diff --git a/.env.example b/.env.example index a4688c5..67d6f77 100644 --- a/.env.example +++ b/.env.example @@ -2,3 +2,8 @@ ETH_NODE_URL='https://eth.llamarpc.com' MANTLE_NODE_URL='https://rpc.mantle.xyz' ARBITRUM_NODE_URL='https://arb1.arbitrum.io/rpc' SCROLL_NODE_URL='https://rpc.scroll.io' +MODE_NODE_URL='https://mainnet.mode.network' +FRAXTAL_NODE_URL='https://rpc.frax.com' +LYRA_NODE_URL='https://rpc.derive.xyz' + +DERIVE_SUBGRAPH_API_KEY='' \ No newline at end of file diff --git a/.github/workflows/main-push-and-pr.yml b/.github/workflows/main-push-and-pr.yml new file mode 100644 index 0000000..0c133e3 --- /dev/null +++ b/.github/workflows/main-push-and-pr.yml @@ -0,0 +1,42 @@ +# This workflow will install Python dependencies, run tests and lint with a single version of Python +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: Python application + +on: + push: + branches: ["main"] + pull_request: + branches: ["main"] + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python 3.10 + uses: actions/setup-python@v3 + with: + python-version: "3.10" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 mypy + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi + + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + + - name: Type check with mypy + run: mypy . --explicit-package-bases --pretty --check-untyped-defs \ No newline at end of file diff --git a/.gitignore b/.gitignore index 82f9275..00b1684 100644 --- a/.gitignore +++ b/.gitignore @@ -61,6 +61,9 @@ local_settings.py db.sqlite3 db.sqlite3-journal +# VSCode +.vscode/ + # Flask stuff: instance/ .webassets-cache diff --git a/README.md b/README.md index 12edebd..2b2e804 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,18 @@ # Overview -This repo offers a self service approach to Ethena Sats Campaign integrations. +This repo offers a self service approach to Ethena Points Campaign integrations. # Instructions -For your protocol to be included and your users to receive sats, you should submit a PR to this repo. Here some guidelines to follow: +For your protocol to be included and your users to receive points, you should submit a PR to this repo. Here some guidelines to follow: 1. Make a copy of `.env.example` and name it `.env`. 2. Run `pip install -r requirements.txt` to install the required packages. -3. Add your integration metadata to `constants/integration_ids.py`. -4. Make a copy of `integrations/template.py`, naming the file `[protocol name].py` and place in the `integrations` directory. -5. Your integration must be a class that inherits from `Integration` and implements the `get_balance` and `get_participants` methods. -6. The `get_balance` method should return the balance of a given user at a given block. -7. The `get_participants` method should return a list of all users that have interacted with the protocol. +3. Add your integration metadata to `integrations/integration_ids.py`. +4. Create a new summary column in `constants/summary_columns.py`. +5. Make a copy of [Template](integrations/template.py), naming the file `[protocol name]_integration.py` and place in the `integrations` directory. +6. Your integration must be a class that inherits from `CachedBalancesIntegration` and implements the `get_block_balances` method. +7. The `get_block_balances` method should return a dict of block numbers to a dict of user addresses to balances at that block. (Note: Not all blocks are queried by this service in production- only a sampling, but your code should be capable of handling any block number.) 8. Write some basic tests at the bottom of the file to ensure your integration is working correctly. 9. Submit a PR to this repo with your integration and ping the Ethena team in Telegram. @@ -20,5 +20,11 @@ For your protocol to be included and your users to receive sats, you should subm - Integrations must follow this architecture and be written in python. - Pendle integrations are included as examples of functioning integrations. Run `python -m integrations.pendle_lpt_integration` to see the output. -- The `get_balance` and `get_participants` methods should be as efficient as possible. -- We prefer that on chain RPC calls are used to get information as much as possible due to reliability and trustlessness. For example one could cycle through events for `get_participants` and read from a smart contract for `get_balance`. Off chain calls to apis or subgraphs are acceptable if necessary. If usage is not reasonable or the external service is not reliable, users may not receive their sats. +- The `get_block_balances` method should be as efficient as possible. So the use of the cached data from previous blocks if possible is highly encouraged. +- We prefer that on chain RPC calls are used to get information as much as possible due to reliability and trustlessness. Off chain calls to apis or subgraphs are acceptable if necessary. If usage is not reasonable or the external service is not reliable, users may not receive their points. + +# Example Integrations +- [ClaimedEnaIntegration](integrations/claimed_ena_example_integration.py): This integration demonstrates how to track ENA token claims using cached balance snapshots for improved performance. It reads from previous balance snapshots to efficiently track user claim history. +- [BeefyCachedBalanceExampleIntegration](integrations/beefy_cached_balance_example_integration.py): This integration is an example of a cached balance integration that is based on API calls. +- [PendleLPTIntegration](integrations/pendle_lpt_integration.py): (Legacy Example) A basic integration showing Pendle LPT staking tracking. Note: This is a non-cached implementation included only for reference - new integrations should use the cached approach for better efficiency. +- [PendleYTIntegration](integrations/pendle_yt_integration.py): (Legacy Example) A basic integration showing Pendle YT staking tracking. Note: This is a non-cached implementation included only for reference - new integrations should use the cached approach for better efficiency. diff --git a/abi/ERC4626_abi.json b/abi/ERC4626_abi.json new file mode 100644 index 0000000..2ad6f97 --- /dev/null +++ b/abi/ERC4626_abi.json @@ -0,0 +1,662 @@ +[ + { + "type": "function", + "name": "allowance", + "inputs": [ + { + "name": "owner", + "type": "address", + "internalType": "address" + }, + { + "name": "spender", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "approve", + "inputs": [ + { + "name": "spender", + "type": "address", + "internalType": "address" + }, + { + "name": "amount", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "asset", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "balanceOf", + "inputs": [ + { + "name": "account", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "convertToAssets", + "inputs": [ + { + "name": "shares", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "convertToShares", + "inputs": [ + { + "name": "assets", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "decimals", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint8", + "internalType": "uint8" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "decreaseAllowance", + "inputs": [ + { + "name": "spender", + "type": "address", + "internalType": "address" + }, + { + "name": "subtractedValue", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "deposit", + "inputs": [ + { + "name": "assets", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "receiver", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "increaseAllowance", + "inputs": [ + { + "name": "spender", + "type": "address", + "internalType": "address" + }, + { + "name": "addedValue", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "maxDeposit", + "inputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "maxMint", + "inputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "maxRedeem", + "inputs": [ + { + "name": "owner", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "maxWithdraw", + "inputs": [ + { + "name": "owner", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "mint", + "inputs": [ + { + "name": "shares", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "receiver", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "name", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "string", + "internalType": "string" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "previewDeposit", + "inputs": [ + { + "name": "assets", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "previewMint", + "inputs": [ + { + "name": "shares", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "previewRedeem", + "inputs": [ + { + "name": "shares", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "previewWithdraw", + "inputs": [ + { + "name": "assets", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "redeem", + "inputs": [ + { + "name": "shares", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "receiver", + "type": "address", + "internalType": "address" + }, + { + "name": "owner", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "symbol", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "string", + "internalType": "string" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "totalAssets", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "totalSupply", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "transfer", + "inputs": [ + { + "name": "to", + "type": "address", + "internalType": "address" + }, + { + "name": "amount", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "transferFrom", + "inputs": [ + { + "name": "from", + "type": "address", + "internalType": "address" + }, + { + "name": "to", + "type": "address", + "internalType": "address" + }, + { + "name": "amount", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "withdraw", + "inputs": [ + { + "name": "assets", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "receiver", + "type": "address", + "internalType": "address" + }, + { + "name": "owner", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "event", + "name": "Approval", + "inputs": [ + { + "name": "owner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "spender", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "value", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Deposit", + "inputs": [ + { + "name": "sender", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "owner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "assets", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "shares", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Transfer", + "inputs": [ + { + "name": "from", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "to", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "value", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Withdraw", + "inputs": [ + { + "name": "sender", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "receiver", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "owner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "assets", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "shares", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + } +] \ No newline at end of file diff --git a/abi/IHyperdriveMorpho.json b/abi/IHyperdriveMorpho.json new file mode 100644 index 0000000..2ef9254 --- /dev/null +++ b/abi/IHyperdriveMorpho.json @@ -0,0 +1,1737 @@ +[ + { + "type": "function", + "name": "PERMIT_TYPEHASH", + "inputs": [], + "outputs": [{ "name": "", "type": "bytes32", "internalType": "bytes32" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "addLiquidity", + "inputs": [ + { + "name": "_contribution", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "_minLpSharePrice", + "type": "uint256", + "internalType": "uint256" + }, + { "name": "_minApr", "type": "uint256", "internalType": "uint256" }, + { "name": "_maxApr", "type": "uint256", "internalType": "uint256" }, + { + "name": "_options", + "type": "tuple", + "internalType": "struct IHyperdrive.Options", + "components": [ + { + "name": "destination", + "type": "address", + "internalType": "address" + }, + { "name": "asBase", "type": "bool", "internalType": "bool" }, + { "name": "extraData", "type": "bytes", "internalType": "bytes" } + ] + } + ], + "outputs": [ + { "name": "lpShares", "type": "uint256", "internalType": "uint256" } + ], + "stateMutability": "payable" + }, + { + "type": "function", + "name": "adminController", + "inputs": [], + "outputs": [{ "name": "", "type": "address", "internalType": "address" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "balanceOf", + "inputs": [ + { "name": "tokenId", "type": "uint256", "internalType": "uint256" }, + { "name": "owner", "type": "address", "internalType": "address" } + ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "baseToken", + "inputs": [], + "outputs": [{ "name": "", "type": "address", "internalType": "address" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "batchTransferFrom", + "inputs": [ + { "name": "from", "type": "address", "internalType": "address" }, + { "name": "to", "type": "address", "internalType": "address" }, + { "name": "ids", "type": "uint256[]", "internalType": "uint256[]" }, + { "name": "values", "type": "uint256[]", "internalType": "uint256[]" } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "checkpoint", + "inputs": [ + { + "name": "_checkpointTime", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "_maxIterations", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "closeLong", + "inputs": [ + { + "name": "_maturityTime", + "type": "uint256", + "internalType": "uint256" + }, + { "name": "_bondAmount", "type": "uint256", "internalType": "uint256" }, + { "name": "_minOutput", "type": "uint256", "internalType": "uint256" }, + { + "name": "_options", + "type": "tuple", + "internalType": "struct IHyperdrive.Options", + "components": [ + { + "name": "destination", + "type": "address", + "internalType": "address" + }, + { "name": "asBase", "type": "bool", "internalType": "bool" }, + { "name": "extraData", "type": "bytes", "internalType": "bytes" } + ] + } + ], + "outputs": [ + { "name": "proceeds", "type": "uint256", "internalType": "uint256" } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "closeShort", + "inputs": [ + { + "name": "_maturityTime", + "type": "uint256", + "internalType": "uint256" + }, + { "name": "_bondAmount", "type": "uint256", "internalType": "uint256" }, + { "name": "_minOutput", "type": "uint256", "internalType": "uint256" }, + { + "name": "_options", + "type": "tuple", + "internalType": "struct IHyperdrive.Options", + "components": [ + { + "name": "destination", + "type": "address", + "internalType": "address" + }, + { "name": "asBase", "type": "bool", "internalType": "bool" }, + { "name": "extraData", "type": "bytes", "internalType": "bytes" } + ] + } + ], + "outputs": [ + { "name": "proceeds", "type": "uint256", "internalType": "uint256" } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "collateralToken", + "inputs": [], + "outputs": [{ "name": "", "type": "address", "internalType": "address" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "collectGovernanceFee", + "inputs": [ + { + "name": "_options", + "type": "tuple", + "internalType": "struct IHyperdrive.Options", + "components": [ + { + "name": "destination", + "type": "address", + "internalType": "address" + }, + { "name": "asBase", "type": "bool", "internalType": "bool" }, + { "name": "extraData", "type": "bytes", "internalType": "bytes" } + ] + } + ], + "outputs": [ + { "name": "proceeds", "type": "uint256", "internalType": "uint256" } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "convertToBase", + "inputs": [ + { "name": "_shareAmount", "type": "uint256", "internalType": "uint256" } + ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "convertToShares", + "inputs": [ + { "name": "_baseAmount", "type": "uint256", "internalType": "uint256" } + ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "decimals", + "inputs": [], + "outputs": [{ "name": "", "type": "uint8", "internalType": "uint8" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "domainSeparator", + "inputs": [], + "outputs": [{ "name": "", "type": "bytes32", "internalType": "bytes32" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getCheckpoint", + "inputs": [ + { + "name": "_checkpointTime", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "tuple", + "internalType": "struct IHyperdrive.Checkpoint", + "components": [ + { + "name": "weightedSpotPrice", + "type": "uint128", + "internalType": "uint128" + }, + { + "name": "lastWeightedSpotPriceUpdateTime", + "type": "uint128", + "internalType": "uint128" + }, + { + "name": "vaultSharePrice", + "type": "uint128", + "internalType": "uint128" + } + ] + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getCheckpointExposure", + "inputs": [ + { + "name": "_checkpointTime", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [{ "name": "", "type": "int256", "internalType": "int256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getMarketState", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "tuple", + "internalType": "struct IHyperdrive.MarketState", + "components": [ + { + "name": "shareReserves", + "type": "uint128", + "internalType": "uint128" + }, + { + "name": "bondReserves", + "type": "uint128", + "internalType": "uint128" + }, + { + "name": "longExposure", + "type": "uint128", + "internalType": "uint128" + }, + { + "name": "longsOutstanding", + "type": "uint128", + "internalType": "uint128" + }, + { + "name": "shareAdjustment", + "type": "int128", + "internalType": "int128" + }, + { + "name": "shortsOutstanding", + "type": "uint128", + "internalType": "uint128" + }, + { + "name": "longAverageMaturityTime", + "type": "uint128", + "internalType": "uint128" + }, + { + "name": "shortAverageMaturityTime", + "type": "uint128", + "internalType": "uint128" + }, + { "name": "isInitialized", "type": "bool", "internalType": "bool" }, + { "name": "isPaused", "type": "bool", "internalType": "bool" }, + { + "name": "zombieBaseProceeds", + "type": "uint112", + "internalType": "uint112" + }, + { + "name": "zombieShareReserves", + "type": "uint128", + "internalType": "uint128" + } + ] + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getPoolConfig", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "tuple", + "internalType": "struct IHyperdrive.PoolConfig", + "components": [ + { + "name": "baseToken", + "type": "address", + "internalType": "contract IERC20" + }, + { + "name": "vaultSharesToken", + "type": "address", + "internalType": "contract IERC20" + }, + { + "name": "linkerFactory", + "type": "address", + "internalType": "address" + }, + { + "name": "linkerCodeHash", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "initialVaultSharePrice", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "minimumShareReserves", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "minimumTransactionAmount", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "circuitBreakerDelta", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "positionDuration", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "checkpointDuration", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "timeStretch", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "governance", + "type": "address", + "internalType": "address" + }, + { + "name": "feeCollector", + "type": "address", + "internalType": "address" + }, + { + "name": "sweepCollector", + "type": "address", + "internalType": "address" + }, + { + "name": "checkpointRewarder", + "type": "address", + "internalType": "address" + }, + { + "name": "fees", + "type": "tuple", + "internalType": "struct IHyperdrive.Fees", + "components": [ + { + "name": "curve", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "flat", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "governanceLP", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "governanceZombie", + "type": "uint256", + "internalType": "uint256" + } + ] + } + ] + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getPoolInfo", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "tuple", + "internalType": "struct IHyperdrive.PoolInfo", + "components": [ + { + "name": "shareReserves", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "shareAdjustment", + "type": "int256", + "internalType": "int256" + }, + { + "name": "zombieBaseProceeds", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "zombieShareReserves", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "bondReserves", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "lpTotalSupply", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "vaultSharePrice", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "longsOutstanding", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "longAverageMaturityTime", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "shortsOutstanding", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "shortAverageMaturityTime", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "withdrawalSharesReadyToWithdraw", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "withdrawalSharesProceeds", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "lpSharePrice", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "longExposure", + "type": "uint256", + "internalType": "uint256" + } + ] + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getUncollectedGovernanceFees", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getWithdrawPool", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "tuple", + "internalType": "struct IHyperdrive.WithdrawPool", + "components": [ + { + "name": "readyToWithdraw", + "type": "uint128", + "internalType": "uint128" + }, + { "name": "proceeds", "type": "uint128", "internalType": "uint128" } + ] + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "id", + "inputs": [], + "outputs": [{ "name": "", "type": "bytes32", "internalType": "Id" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "initialize", + "inputs": [ + { + "name": "_contribution", + "type": "uint256", + "internalType": "uint256" + }, + { "name": "_apr", "type": "uint256", "internalType": "uint256" }, + { + "name": "_options", + "type": "tuple", + "internalType": "struct IHyperdrive.Options", + "components": [ + { + "name": "destination", + "type": "address", + "internalType": "address" + }, + { "name": "asBase", "type": "bool", "internalType": "bool" }, + { "name": "extraData", "type": "bytes", "internalType": "bytes" } + ] + } + ], + "outputs": [ + { "name": "lpShares", "type": "uint256", "internalType": "uint256" } + ], + "stateMutability": "payable" + }, + { + "type": "function", + "name": "irm", + "inputs": [], + "outputs": [{ "name": "", "type": "address", "internalType": "address" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "isApprovedForAll", + "inputs": [ + { "name": "owner", "type": "address", "internalType": "address" }, + { "name": "spender", "type": "address", "internalType": "address" } + ], + "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "isPauser", + "inputs": [ + { "name": "_account", "type": "address", "internalType": "address" } + ], + "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "kind", + "inputs": [], + "outputs": [{ "name": "", "type": "string", "internalType": "string" }], + "stateMutability": "pure" + }, + { + "type": "function", + "name": "lltv", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "load", + "inputs": [ + { "name": "_slots", "type": "uint256[]", "internalType": "uint256[]" } + ], + "outputs": [ + { "name": "", "type": "bytes32[]", "internalType": "bytes32[]" } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "name", + "inputs": [ + { "name": "tokenId", "type": "uint256", "internalType": "uint256" } + ], + "outputs": [{ "name": "", "type": "string", "internalType": "string" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "name", + "inputs": [], + "outputs": [{ "name": "", "type": "string", "internalType": "string" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "nonces", + "inputs": [ + { "name": "owner", "type": "address", "internalType": "address" } + ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "openLong", + "inputs": [ + { "name": "_amount", "type": "uint256", "internalType": "uint256" }, + { "name": "_minOutput", "type": "uint256", "internalType": "uint256" }, + { + "name": "_minVaultSharePrice", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "_options", + "type": "tuple", + "internalType": "struct IHyperdrive.Options", + "components": [ + { + "name": "destination", + "type": "address", + "internalType": "address" + }, + { "name": "asBase", "type": "bool", "internalType": "bool" }, + { "name": "extraData", "type": "bytes", "internalType": "bytes" } + ] + } + ], + "outputs": [ + { + "name": "maturityTime", + "type": "uint256", + "internalType": "uint256" + }, + { "name": "bondProceeds", "type": "uint256", "internalType": "uint256" } + ], + "stateMutability": "payable" + }, + { + "type": "function", + "name": "openShort", + "inputs": [ + { "name": "_bondAmount", "type": "uint256", "internalType": "uint256" }, + { "name": "_maxDeposit", "type": "uint256", "internalType": "uint256" }, + { + "name": "_minVaultSharePrice", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "_options", + "type": "tuple", + "internalType": "struct IHyperdrive.Options", + "components": [ + { + "name": "destination", + "type": "address", + "internalType": "address" + }, + { "name": "asBase", "type": "bool", "internalType": "bool" }, + { "name": "extraData", "type": "bytes", "internalType": "bytes" } + ] + } + ], + "outputs": [ + { + "name": "maturityTime", + "type": "uint256", + "internalType": "uint256" + }, + { "name": "deposit", "type": "uint256", "internalType": "uint256" } + ], + "stateMutability": "payable" + }, + { + "type": "function", + "name": "oracle", + "inputs": [], + "outputs": [{ "name": "", "type": "address", "internalType": "address" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "pause", + "inputs": [{ "name": "_status", "type": "bool", "internalType": "bool" }], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "perTokenApprovals", + "inputs": [ + { "name": "tokenId", "type": "uint256", "internalType": "uint256" }, + { "name": "owner", "type": "address", "internalType": "address" }, + { "name": "spender", "type": "address", "internalType": "address" } + ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "permitForAll", + "inputs": [ + { "name": "owner", "type": "address", "internalType": "address" }, + { "name": "spender", "type": "address", "internalType": "address" }, + { "name": "_approved", "type": "bool", "internalType": "bool" }, + { "name": "deadline", "type": "uint256", "internalType": "uint256" }, + { "name": "v", "type": "uint8", "internalType": "uint8" }, + { "name": "r", "type": "bytes32", "internalType": "bytes32" }, + { "name": "s", "type": "bytes32", "internalType": "bytes32" } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "redeemWithdrawalShares", + "inputs": [ + { + "name": "_withdrawalShares", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "_minOutputPerShare", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "_options", + "type": "tuple", + "internalType": "struct IHyperdrive.Options", + "components": [ + { + "name": "destination", + "type": "address", + "internalType": "address" + }, + { "name": "asBase", "type": "bool", "internalType": "bool" }, + { "name": "extraData", "type": "bytes", "internalType": "bytes" } + ] + } + ], + "outputs": [ + { "name": "proceeds", "type": "uint256", "internalType": "uint256" }, + { + "name": "withdrawalSharesRedeemed", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "removeLiquidity", + "inputs": [ + { "name": "_lpShares", "type": "uint256", "internalType": "uint256" }, + { + "name": "_minOutputPerShare", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "_options", + "type": "tuple", + "internalType": "struct IHyperdrive.Options", + "components": [ + { + "name": "destination", + "type": "address", + "internalType": "address" + }, + { "name": "asBase", "type": "bool", "internalType": "bool" }, + { "name": "extraData", "type": "bytes", "internalType": "bytes" } + ] + } + ], + "outputs": [ + { "name": "proceeds", "type": "uint256", "internalType": "uint256" }, + { + "name": "withdrawalShares", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setApproval", + "inputs": [ + { "name": "tokenID", "type": "uint256", "internalType": "uint256" }, + { "name": "operator", "type": "address", "internalType": "address" }, + { "name": "amount", "type": "uint256", "internalType": "uint256" } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setApprovalBridge", + "inputs": [ + { "name": "tokenID", "type": "uint256", "internalType": "uint256" }, + { "name": "operator", "type": "address", "internalType": "address" }, + { "name": "amount", "type": "uint256", "internalType": "uint256" }, + { "name": "caller", "type": "address", "internalType": "address" } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setApprovalForAll", + "inputs": [ + { "name": "operator", "type": "address", "internalType": "address" }, + { "name": "approved", "type": "bool", "internalType": "bool" } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setGovernance", + "inputs": [ + { "name": "_who", "type": "address", "internalType": "address" } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setPauser", + "inputs": [ + { "name": "", "type": "address", "internalType": "address" }, + { "name": "", "type": "bool", "internalType": "bool" } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "sweep", + "inputs": [ + { + "name": "_target", + "type": "address", + "internalType": "contract IERC20" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "symbol", + "inputs": [ + { "name": "tokenId", "type": "uint256", "internalType": "uint256" } + ], + "outputs": [{ "name": "", "type": "string", "internalType": "string" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "target0", + "inputs": [], + "outputs": [{ "name": "", "type": "address", "internalType": "address" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "target1", + "inputs": [], + "outputs": [{ "name": "", "type": "address", "internalType": "address" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "target2", + "inputs": [], + "outputs": [{ "name": "", "type": "address", "internalType": "address" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "target3", + "inputs": [], + "outputs": [{ "name": "", "type": "address", "internalType": "address" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "target4", + "inputs": [], + "outputs": [{ "name": "", "type": "address", "internalType": "address" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "totalShares", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "totalSupply", + "inputs": [ + { "name": "tokenId", "type": "uint256", "internalType": "uint256" } + ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "transferFrom", + "inputs": [ + { "name": "tokenID", "type": "uint256", "internalType": "uint256" }, + { "name": "from", "type": "address", "internalType": "address" }, + { "name": "to", "type": "address", "internalType": "address" }, + { "name": "amount", "type": "uint256", "internalType": "uint256" } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "transferFromBridge", + "inputs": [ + { "name": "tokenID", "type": "uint256", "internalType": "uint256" }, + { "name": "from", "type": "address", "internalType": "address" }, + { "name": "to", "type": "address", "internalType": "address" }, + { "name": "amount", "type": "uint256", "internalType": "uint256" }, + { "name": "caller", "type": "address", "internalType": "address" } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "vault", + "inputs": [], + "outputs": [{ "name": "", "type": "address", "internalType": "address" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "vaultSharesToken", + "inputs": [], + "outputs": [{ "name": "", "type": "address", "internalType": "address" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "version", + "inputs": [], + "outputs": [{ "name": "", "type": "string", "internalType": "string" }], + "stateMutability": "pure" + }, + { + "type": "event", + "name": "AddLiquidity", + "inputs": [ + { + "name": "provider", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "lpAmount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "amount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "vaultSharePrice", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "asBase", + "type": "bool", + "indexed": false, + "internalType": "bool" + }, + { + "name": "lpSharePrice", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "extraData", + "type": "bytes", + "indexed": false, + "internalType": "bytes" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Approval", + "inputs": [ + { + "name": "owner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "spender", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "value", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ApprovalForAll", + "inputs": [ + { + "name": "account", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "operator", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "approved", + "type": "bool", + "indexed": false, + "internalType": "bool" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "CloseLong", + "inputs": [ + { + "name": "trader", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "destination", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "assetId", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "maturityTime", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "amount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "vaultSharePrice", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "asBase", + "type": "bool", + "indexed": false, + "internalType": "bool" + }, + { + "name": "bondAmount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "extraData", + "type": "bytes", + "indexed": false, + "internalType": "bytes" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "CloseShort", + "inputs": [ + { + "name": "trader", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "destination", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "assetId", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "maturityTime", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "amount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "vaultSharePrice", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "asBase", + "type": "bool", + "indexed": false, + "internalType": "bool" + }, + { + "name": "basePayment", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "bondAmount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "extraData", + "type": "bytes", + "indexed": false, + "internalType": "bytes" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "CollectGovernanceFee", + "inputs": [ + { + "name": "collector", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "amount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "vaultSharePrice", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "asBase", + "type": "bool", + "indexed": false, + "internalType": "bool" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "CreateCheckpoint", + "inputs": [ + { + "name": "checkpointTime", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "checkpointVaultSharePrice", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "vaultSharePrice", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "maturedShorts", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "maturedLongs", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "lpSharePrice", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Initialize", + "inputs": [ + { + "name": "provider", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "lpAmount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "amount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "vaultSharePrice", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "asBase", + "type": "bool", + "indexed": false, + "internalType": "bool" + }, + { + "name": "apr", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "extraData", + "type": "bytes", + "indexed": false, + "internalType": "bytes" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "OpenLong", + "inputs": [ + { + "name": "trader", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "assetId", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "maturityTime", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "amount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "vaultSharePrice", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "asBase", + "type": "bool", + "indexed": false, + "internalType": "bool" + }, + { + "name": "bondAmount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "extraData", + "type": "bytes", + "indexed": false, + "internalType": "bytes" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "OpenShort", + "inputs": [ + { + "name": "trader", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "assetId", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "maturityTime", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "amount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "vaultSharePrice", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "asBase", + "type": "bool", + "indexed": false, + "internalType": "bool" + }, + { + "name": "baseProceeds", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "bondAmount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "extraData", + "type": "bytes", + "indexed": false, + "internalType": "bytes" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "PauseStatusUpdated", + "inputs": [ + { + "name": "isPaused", + "type": "bool", + "indexed": false, + "internalType": "bool" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "RedeemWithdrawalShares", + "inputs": [ + { + "name": "provider", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "destination", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "withdrawalShareAmount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "amount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "vaultSharePrice", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "asBase", + "type": "bool", + "indexed": false, + "internalType": "bool" + }, + { + "name": "extraData", + "type": "bytes", + "indexed": false, + "internalType": "bytes" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "RemoveLiquidity", + "inputs": [ + { + "name": "provider", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "destination", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "lpAmount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "amount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "vaultSharePrice", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "asBase", + "type": "bool", + "indexed": false, + "internalType": "bool" + }, + { + "name": "withdrawalShareAmount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "lpSharePrice", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "extraData", + "type": "bytes", + "indexed": false, + "internalType": "bytes" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Sweep", + "inputs": [ + { + "name": "collector", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "target", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "TransferSingle", + "inputs": [ + { + "name": "operator", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "from", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "to", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "id", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "value", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { "type": "error", "name": "BatchInputLengthMismatch", "inputs": [] }, + { "type": "error", "name": "BelowMinimumContribution", "inputs": [] }, + { "type": "error", "name": "CircuitBreakerTriggered", "inputs": [] }, + { + "type": "error", + "name": "DecreasedPresentValueWhenAddingLiquidity", + "inputs": [] + }, + { "type": "error", "name": "DistributeExcessIdleFailed", "inputs": [] }, + { "type": "error", "name": "ExpInvalidExponent", "inputs": [] }, + { "type": "error", "name": "ExpiredDeadline", "inputs": [] }, + { "type": "error", "name": "InsufficientBalance", "inputs": [] }, + { "type": "error", "name": "InsufficientLiquidity", "inputs": [] }, + { "type": "error", "name": "InvalidApr", "inputs": [] }, + { "type": "error", "name": "InvalidCheckpointTime", "inputs": [] }, + { "type": "error", "name": "InvalidERC20Bridge", "inputs": [] }, + { "type": "error", "name": "InvalidEffectiveShareReserves", "inputs": [] }, + { "type": "error", "name": "InvalidFeeDestination", "inputs": [] }, + { "type": "error", "name": "InvalidInitialVaultSharePrice", "inputs": [] }, + { "type": "error", "name": "InvalidLPSharePrice", "inputs": [] }, + { "type": "error", "name": "InvalidPresentValue", "inputs": [] }, + { "type": "error", "name": "InvalidSignature", "inputs": [] }, + { "type": "error", "name": "InvalidTimestamp", "inputs": [] }, + { "type": "error", "name": "LnInvalidInput", "inputs": [] }, + { "type": "error", "name": "MinimumSharePrice", "inputs": [] }, + { "type": "error", "name": "MinimumTransactionAmount", "inputs": [] }, + { "type": "error", "name": "NotPayable", "inputs": [] }, + { "type": "error", "name": "OutputLimit", "inputs": [] }, + { "type": "error", "name": "PoolAlreadyInitialized", "inputs": [] }, + { "type": "error", "name": "PoolIsPaused", "inputs": [] }, + { "type": "error", "name": "RestrictedZeroAddress", "inputs": [] }, + { + "type": "error", + "name": "ReturnData", + "inputs": [{ "name": "data", "type": "bytes", "internalType": "bytes" }] + }, + { "type": "error", "name": "SweepFailed", "inputs": [] }, + { "type": "error", "name": "TransferFailed", "inputs": [] }, + { "type": "error", "name": "Unauthorized", "inputs": [] }, + { "type": "error", "name": "UnexpectedSuccess", "inputs": [] }, + { "type": "error", "name": "UnsafeCastToInt128", "inputs": [] }, + { "type": "error", "name": "UnsafeCastToInt256", "inputs": [] }, + { "type": "error", "name": "UnsafeCastToUint112", "inputs": [] }, + { "type": "error", "name": "UnsafeCastToUint128", "inputs": [] }, + { "type": "error", "name": "UnsafeCastToUint256", "inputs": [] }, + { "type": "error", "name": "UnsupportedToken", "inputs": [] }, + { "type": "error", "name": "UpdateLiquidityFailed", "inputs": [] } +] \ No newline at end of file diff --git a/abi/IMorpho.json b/abi/IMorpho.json new file mode 100644 index 0000000..493beca --- /dev/null +++ b/abi/IMorpho.json @@ -0,0 +1,630 @@ +[ + { + "type": "function", + "name": "DOMAIN_SEPARATOR", + "inputs": [], + "outputs": [{ "name": "", "type": "bytes32", "internalType": "bytes32" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "accrueInterest", + "inputs": [ + { + "name": "marketParams", + "type": "tuple", + "internalType": "struct MarketParams", + "components": [ + { + "name": "loanToken", + "type": "address", + "internalType": "address" + }, + { + "name": "collateralToken", + "type": "address", + "internalType": "address" + }, + { "name": "oracle", "type": "address", "internalType": "address" }, + { "name": "irm", "type": "address", "internalType": "address" }, + { "name": "lltv", "type": "uint256", "internalType": "uint256" } + ] + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "borrow", + "inputs": [ + { + "name": "marketParams", + "type": "tuple", + "internalType": "struct MarketParams", + "components": [ + { + "name": "loanToken", + "type": "address", + "internalType": "address" + }, + { + "name": "collateralToken", + "type": "address", + "internalType": "address" + }, + { "name": "oracle", "type": "address", "internalType": "address" }, + { "name": "irm", "type": "address", "internalType": "address" }, + { "name": "lltv", "type": "uint256", "internalType": "uint256" } + ] + }, + { "name": "assets", "type": "uint256", "internalType": "uint256" }, + { "name": "shares", "type": "uint256", "internalType": "uint256" }, + { "name": "onBehalf", "type": "address", "internalType": "address" }, + { "name": "receiver", "type": "address", "internalType": "address" } + ], + "outputs": [ + { + "name": "assetsBorrowed", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "sharesBorrowed", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "createMarket", + "inputs": [ + { + "name": "marketParams", + "type": "tuple", + "internalType": "struct MarketParams", + "components": [ + { + "name": "loanToken", + "type": "address", + "internalType": "address" + }, + { + "name": "collateralToken", + "type": "address", + "internalType": "address" + }, + { "name": "oracle", "type": "address", "internalType": "address" }, + { "name": "irm", "type": "address", "internalType": "address" }, + { "name": "lltv", "type": "uint256", "internalType": "uint256" } + ] + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "enableIrm", + "inputs": [ + { "name": "irm", "type": "address", "internalType": "address" } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "enableLltv", + "inputs": [ + { "name": "lltv", "type": "uint256", "internalType": "uint256" } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "extSloads", + "inputs": [ + { "name": "slots", "type": "bytes32[]", "internalType": "bytes32[]" } + ], + "outputs": [ + { "name": "", "type": "bytes32[]", "internalType": "bytes32[]" } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "feeRecipient", + "inputs": [], + "outputs": [{ "name": "", "type": "address", "internalType": "address" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "flashLoan", + "inputs": [ + { "name": "token", "type": "address", "internalType": "address" }, + { "name": "assets", "type": "uint256", "internalType": "uint256" }, + { "name": "data", "type": "bytes", "internalType": "bytes" } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "idToMarketParams", + "inputs": [{ "name": "id", "type": "bytes32", "internalType": "Id" }], + "outputs": [ + { + "name": "", + "type": "tuple", + "internalType": "struct MarketParams", + "components": [ + { + "name": "loanToken", + "type": "address", + "internalType": "address" + }, + { + "name": "collateralToken", + "type": "address", + "internalType": "address" + }, + { "name": "oracle", "type": "address", "internalType": "address" }, + { "name": "irm", "type": "address", "internalType": "address" }, + { "name": "lltv", "type": "uint256", "internalType": "uint256" } + ] + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "isAuthorized", + "inputs": [ + { "name": "authorizer", "type": "address", "internalType": "address" }, + { "name": "authorized", "type": "address", "internalType": "address" } + ], + "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "isIrmEnabled", + "inputs": [ + { "name": "irm", "type": "address", "internalType": "address" } + ], + "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "isLltvEnabled", + "inputs": [ + { "name": "lltv", "type": "uint256", "internalType": "uint256" } + ], + "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "liquidate", + "inputs": [ + { + "name": "marketParams", + "type": "tuple", + "internalType": "struct MarketParams", + "components": [ + { + "name": "loanToken", + "type": "address", + "internalType": "address" + }, + { + "name": "collateralToken", + "type": "address", + "internalType": "address" + }, + { "name": "oracle", "type": "address", "internalType": "address" }, + { "name": "irm", "type": "address", "internalType": "address" }, + { "name": "lltv", "type": "uint256", "internalType": "uint256" } + ] + }, + { "name": "borrower", "type": "address", "internalType": "address" }, + { + "name": "seizedAssets", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "repaidShares", + "type": "uint256", + "internalType": "uint256" + }, + { "name": "data", "type": "bytes", "internalType": "bytes" } + ], + "outputs": [ + { "name": "", "type": "uint256", "internalType": "uint256" }, + { "name": "", "type": "uint256", "internalType": "uint256" } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "market", + "inputs": [{ "name": "id", "type": "bytes32", "internalType": "Id" }], + "outputs": [ + { + "name": "m", + "type": "tuple", + "internalType": "struct Market", + "components": [ + { + "name": "totalSupplyAssets", + "type": "uint128", + "internalType": "uint128" + }, + { + "name": "totalSupplyShares", + "type": "uint128", + "internalType": "uint128" + }, + { + "name": "totalBorrowAssets", + "type": "uint128", + "internalType": "uint128" + }, + { + "name": "totalBorrowShares", + "type": "uint128", + "internalType": "uint128" + }, + { + "name": "lastUpdate", + "type": "uint128", + "internalType": "uint128" + }, + { "name": "fee", "type": "uint128", "internalType": "uint128" } + ] + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "nonce", + "inputs": [ + { "name": "authorizer", "type": "address", "internalType": "address" } + ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "owner", + "inputs": [], + "outputs": [{ "name": "", "type": "address", "internalType": "address" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "position", + "inputs": [ + { "name": "id", "type": "bytes32", "internalType": "Id" }, + { "name": "user", "type": "address", "internalType": "address" } + ], + "outputs": [ + { + "name": "p", + "type": "tuple", + "internalType": "struct Position", + "components": [ + { + "name": "supplyShares", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "borrowShares", + "type": "uint128", + "internalType": "uint128" + }, + { + "name": "collateral", + "type": "uint128", + "internalType": "uint128" + } + ] + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "repay", + "inputs": [ + { + "name": "marketParams", + "type": "tuple", + "internalType": "struct MarketParams", + "components": [ + { + "name": "loanToken", + "type": "address", + "internalType": "address" + }, + { + "name": "collateralToken", + "type": "address", + "internalType": "address" + }, + { "name": "oracle", "type": "address", "internalType": "address" }, + { "name": "irm", "type": "address", "internalType": "address" }, + { "name": "lltv", "type": "uint256", "internalType": "uint256" } + ] + }, + { "name": "assets", "type": "uint256", "internalType": "uint256" }, + { "name": "shares", "type": "uint256", "internalType": "uint256" }, + { "name": "onBehalf", "type": "address", "internalType": "address" }, + { "name": "data", "type": "bytes", "internalType": "bytes" } + ], + "outputs": [ + { + "name": "assetsRepaid", + "type": "uint256", + "internalType": "uint256" + }, + { "name": "sharesRepaid", "type": "uint256", "internalType": "uint256" } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setAuthorization", + "inputs": [ + { "name": "authorized", "type": "address", "internalType": "address" }, + { "name": "newIsAuthorized", "type": "bool", "internalType": "bool" } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setAuthorizationWithSig", + "inputs": [ + { + "name": "authorization", + "type": "tuple", + "internalType": "struct Authorization", + "components": [ + { + "name": "authorizer", + "type": "address", + "internalType": "address" + }, + { + "name": "authorized", + "type": "address", + "internalType": "address" + }, + { "name": "isAuthorized", "type": "bool", "internalType": "bool" }, + { "name": "nonce", "type": "uint256", "internalType": "uint256" }, + { "name": "deadline", "type": "uint256", "internalType": "uint256" } + ] + }, + { + "name": "signature", + "type": "tuple", + "internalType": "struct Signature", + "components": [ + { "name": "v", "type": "uint8", "internalType": "uint8" }, + { "name": "r", "type": "bytes32", "internalType": "bytes32" }, + { "name": "s", "type": "bytes32", "internalType": "bytes32" } + ] + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setFee", + "inputs": [ + { + "name": "marketParams", + "type": "tuple", + "internalType": "struct MarketParams", + "components": [ + { + "name": "loanToken", + "type": "address", + "internalType": "address" + }, + { + "name": "collateralToken", + "type": "address", + "internalType": "address" + }, + { "name": "oracle", "type": "address", "internalType": "address" }, + { "name": "irm", "type": "address", "internalType": "address" }, + { "name": "lltv", "type": "uint256", "internalType": "uint256" } + ] + }, + { "name": "newFee", "type": "uint256", "internalType": "uint256" } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setFeeRecipient", + "inputs": [ + { + "name": "newFeeRecipient", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setOwner", + "inputs": [ + { "name": "newOwner", "type": "address", "internalType": "address" } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "supply", + "inputs": [ + { + "name": "marketParams", + "type": "tuple", + "internalType": "struct MarketParams", + "components": [ + { + "name": "loanToken", + "type": "address", + "internalType": "address" + }, + { + "name": "collateralToken", + "type": "address", + "internalType": "address" + }, + { "name": "oracle", "type": "address", "internalType": "address" }, + { "name": "irm", "type": "address", "internalType": "address" }, + { "name": "lltv", "type": "uint256", "internalType": "uint256" } + ] + }, + { "name": "assets", "type": "uint256", "internalType": "uint256" }, + { "name": "shares", "type": "uint256", "internalType": "uint256" }, + { "name": "onBehalf", "type": "address", "internalType": "address" }, + { "name": "data", "type": "bytes", "internalType": "bytes" } + ], + "outputs": [ + { + "name": "assetsSupplied", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "sharesSupplied", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "supplyCollateral", + "inputs": [ + { + "name": "marketParams", + "type": "tuple", + "internalType": "struct MarketParams", + "components": [ + { + "name": "loanToken", + "type": "address", + "internalType": "address" + }, + { + "name": "collateralToken", + "type": "address", + "internalType": "address" + }, + { "name": "oracle", "type": "address", "internalType": "address" }, + { "name": "irm", "type": "address", "internalType": "address" }, + { "name": "lltv", "type": "uint256", "internalType": "uint256" } + ] + }, + { "name": "assets", "type": "uint256", "internalType": "uint256" }, + { "name": "onBehalf", "type": "address", "internalType": "address" }, + { "name": "data", "type": "bytes", "internalType": "bytes" } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "withdraw", + "inputs": [ + { + "name": "marketParams", + "type": "tuple", + "internalType": "struct MarketParams", + "components": [ + { + "name": "loanToken", + "type": "address", + "internalType": "address" + }, + { + "name": "collateralToken", + "type": "address", + "internalType": "address" + }, + { "name": "oracle", "type": "address", "internalType": "address" }, + { "name": "irm", "type": "address", "internalType": "address" }, + { "name": "lltv", "type": "uint256", "internalType": "uint256" } + ] + }, + { "name": "assets", "type": "uint256", "internalType": "uint256" }, + { "name": "shares", "type": "uint256", "internalType": "uint256" }, + { "name": "onBehalf", "type": "address", "internalType": "address" }, + { "name": "receiver", "type": "address", "internalType": "address" } + ], + "outputs": [ + { + "name": "assetsWithdrawn", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "sharesWithdrawn", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "withdrawCollateral", + "inputs": [ + { + "name": "marketParams", + "type": "tuple", + "internalType": "struct MarketParams", + "components": [ + { + "name": "loanToken", + "type": "address", + "internalType": "address" + }, + { + "name": "collateralToken", + "type": "address", + "internalType": "address" + }, + { "name": "oracle", "type": "address", "internalType": "address" }, + { "name": "irm", "type": "address", "internalType": "address" }, + { "name": "lltv", "type": "uint256", "internalType": "uint256" } + ] + }, + { "name": "assets", "type": "uint256", "internalType": "uint256" }, + { "name": "onBehalf", "type": "address", "internalType": "address" }, + { "name": "receiver", "type": "address", "internalType": "address" } + ], + "outputs": [], + "stateMutability": "nonpayable" + } +] \ No newline at end of file diff --git a/abi/balancer_csp.json b/abi/balancer_csp.json new file mode 100644 index 0000000..49505d2 --- /dev/null +++ b/abi/balancer_csp.json @@ -0,0 +1,886 @@ +[ + { + "inputs": [ + { + "components": [ + { + "internalType": "contract IVault", + "name": "vault", + "type": "address" + }, + { + "internalType": "contract IProtocolFeePercentagesProvider", + "name": "protocolFeeProvider", + "type": "address" + }, + { "internalType": "string", "name": "name", "type": "string" }, + { "internalType": "string", "name": "symbol", "type": "string" }, + { + "internalType": "contract IERC20[]", + "name": "tokens", + "type": "address[]" + }, + { + "internalType": "contract IRateProvider[]", + "name": "rateProviders", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "tokenRateCacheDurations", + "type": "uint256[]" + }, + { + "internalType": "bool", + "name": "exemptFromYieldProtocolFeeFlag", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "amplificationParameter", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "swapFeePercentage", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "pauseWindowDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "bufferPeriodDuration", + "type": "uint256" + }, + { "internalType": "address", "name": "owner", "type": "address" }, + { "internalType": "string", "name": "version", "type": "string" } + ], + "internalType": "struct ComposableStablePool.NewPoolParams", + "name": "params", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "startValue", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "endValue", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "startTime", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "endTime", + "type": "uint256" + } + ], + "name": "AmpUpdateStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "currentValue", + "type": "uint256" + } + ], + "name": "AmpUpdateStopped", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bool", + "name": "paused", + "type": "bool" + } + ], + "name": "PausedStateChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "feeType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "protocolFeePercentage", + "type": "uint256" + } + ], + "name": "ProtocolFeePercentageCacheUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bool", + "name": "enabled", + "type": "bool" + } + ], + "name": "RecoveryModeStateChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "swapFeePercentage", + "type": "uint256" + } + ], + "name": "SwapFeePercentageChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "rate", + "type": "uint256" + } + ], + "name": "TokenRateCacheUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenIndex", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "contract IRateProvider", + "name": "provider", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "cacheDuration", + "type": "uint256" + } + ], + "name": "TokenRateProviderSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [], + "name": "DELEGATE_PROTOCOL_SWAP_FEES_SENTINEL", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" }, + { "internalType": "address", "name": "spender", "type": "address" } + ], + "name": "allowance", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "approve", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "balanceOf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "decreaseAllowance", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "disableRecoveryMode", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "enableRecoveryMode", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes4", "name": "selector", "type": "bytes4" } + ], + "name": "getActionId", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getActualSupply", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAmplificationParameter", + "outputs": [ + { "internalType": "uint256", "name": "value", "type": "uint256" }, + { "internalType": "bool", "name": "isUpdating", "type": "bool" }, + { "internalType": "uint256", "name": "precision", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAuthorizer", + "outputs": [ + { "internalType": "contract IAuthorizer", "name": "", "type": "address" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getBptIndex", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getDomainSeparator", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getLastJoinExitData", + "outputs": [ + { + "internalType": "uint256", + "name": "lastJoinExitAmplification", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastPostJoinExitInvariant", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMinimumBpt", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "getNextNonce", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getOwner", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPausedState", + "outputs": [ + { "internalType": "bool", "name": "paused", "type": "bool" }, + { + "internalType": "uint256", + "name": "pauseWindowEndTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "bufferPeriodEndTime", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPoolId", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "feeType", "type": "uint256" } + ], + "name": "getProtocolFeePercentageCache", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getProtocolFeesCollector", + "outputs": [ + { + "internalType": "contract IProtocolFeesCollector", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getProtocolSwapFeeDelegation", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getRate", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getRateProviders", + "outputs": [ + { + "internalType": "contract IRateProvider[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getScalingFactors", + "outputs": [ + { "internalType": "uint256[]", "name": "", "type": "uint256[]" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getSwapFeePercentage", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "contract IERC20", "name": "token", "type": "address" } + ], + "name": "getTokenRate", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "contract IERC20", "name": "token", "type": "address" } + ], + "name": "getTokenRateCache", + "outputs": [ + { "internalType": "uint256", "name": "rate", "type": "uint256" }, + { "internalType": "uint256", "name": "oldRate", "type": "uint256" }, + { "internalType": "uint256", "name": "duration", "type": "uint256" }, + { "internalType": "uint256", "name": "expires", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getVault", + "outputs": [ + { "internalType": "contract IVault", "name": "", "type": "address" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "inRecoveryMode", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "addedValue", "type": "uint256" } + ], + "name": "increaseAllowance", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "isExemptFromYieldProtocolFee", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "contract IERC20", "name": "token", "type": "address" } + ], + "name": "isTokenExemptFromYieldProtocolFee", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" } + ], + "name": "nonces", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "poolId", "type": "bytes32" }, + { "internalType": "address", "name": "sender", "type": "address" }, + { "internalType": "address", "name": "recipient", "type": "address" }, + { "internalType": "uint256[]", "name": "balances", "type": "uint256[]" }, + { + "internalType": "uint256", + "name": "lastChangeBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "protocolSwapFeePercentage", + "type": "uint256" + }, + { "internalType": "bytes", "name": "userData", "type": "bytes" } + ], + "name": "onExitPool", + "outputs": [ + { "internalType": "uint256[]", "name": "", "type": "uint256[]" }, + { "internalType": "uint256[]", "name": "", "type": "uint256[]" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "poolId", "type": "bytes32" }, + { "internalType": "address", "name": "sender", "type": "address" }, + { "internalType": "address", "name": "recipient", "type": "address" }, + { "internalType": "uint256[]", "name": "balances", "type": "uint256[]" }, + { + "internalType": "uint256", + "name": "lastChangeBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "protocolSwapFeePercentage", + "type": "uint256" + }, + { "internalType": "bytes", "name": "userData", "type": "bytes" } + ], + "name": "onJoinPool", + "outputs": [ + { "internalType": "uint256[]", "name": "", "type": "uint256[]" }, + { "internalType": "uint256[]", "name": "", "type": "uint256[]" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "enum IVault.SwapKind", + "name": "kind", + "type": "uint8" + }, + { + "internalType": "contract IERC20", + "name": "tokenIn", + "type": "address" + }, + { + "internalType": "contract IERC20", + "name": "tokenOut", + "type": "address" + }, + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { "internalType": "bytes32", "name": "poolId", "type": "bytes32" }, + { + "internalType": "uint256", + "name": "lastChangeBlock", + "type": "uint256" + }, + { "internalType": "address", "name": "from", "type": "address" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "bytes", "name": "userData", "type": "bytes" } + ], + "internalType": "struct IPoolSwapStructs.SwapRequest", + "name": "swapRequest", + "type": "tuple" + }, + { "internalType": "uint256[]", "name": "balances", "type": "uint256[]" }, + { "internalType": "uint256", "name": "indexIn", "type": "uint256" }, + { "internalType": "uint256", "name": "indexOut", "type": "uint256" } + ], + "name": "onSwap", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "pause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" }, + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "value", "type": "uint256" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "name": "permit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "poolId", "type": "bytes32" }, + { "internalType": "address", "name": "sender", "type": "address" }, + { "internalType": "address", "name": "recipient", "type": "address" }, + { "internalType": "uint256[]", "name": "balances", "type": "uint256[]" }, + { + "internalType": "uint256", + "name": "lastChangeBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "protocolSwapFeePercentage", + "type": "uint256" + }, + { "internalType": "bytes", "name": "userData", "type": "bytes" } + ], + "name": "queryExit", + "outputs": [ + { "internalType": "uint256", "name": "bptIn", "type": "uint256" }, + { "internalType": "uint256[]", "name": "amountsOut", "type": "uint256[]" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "poolId", "type": "bytes32" }, + { "internalType": "address", "name": "sender", "type": "address" }, + { "internalType": "address", "name": "recipient", "type": "address" }, + { "internalType": "uint256[]", "name": "balances", "type": "uint256[]" }, + { + "internalType": "uint256", + "name": "lastChangeBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "protocolSwapFeePercentage", + "type": "uint256" + }, + { "internalType": "bytes", "name": "userData", "type": "bytes" } + ], + "name": "queryJoin", + "outputs": [ + { "internalType": "uint256", "name": "bptOut", "type": "uint256" }, + { "internalType": "uint256[]", "name": "amountsIn", "type": "uint256[]" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "contract IERC20", "name": "token", "type": "address" }, + { "internalType": "bytes", "name": "poolConfig", "type": "bytes" } + ], + "name": "setAssetManagerPoolConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "swapFeePercentage", + "type": "uint256" + } + ], + "name": "setSwapFeePercentage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "contract IERC20", "name": "token", "type": "address" }, + { "internalType": "uint256", "name": "duration", "type": "uint256" } + ], + "name": "setTokenRateCacheDuration", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "rawEndValue", "type": "uint256" }, + { "internalType": "uint256", "name": "endTime", "type": "uint256" } + ], + "name": "startAmplificationParameterUpdate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "stopAmplificationParameterUpdate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "recipient", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transfer", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "sender", "type": "address" }, + { "internalType": "address", "name": "recipient", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transferFrom", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "unpause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "updateProtocolFeePercentageCache", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "contract IERC20", "name": "token", "type": "address" } + ], + "name": "updateTokenRateCache", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "version", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + } +] diff --git a/abi/balancer_vault.json b/abi/balancer_vault.json new file mode 100644 index 0000000..8a4f2af --- /dev/null +++ b/abi/balancer_vault.json @@ -0,0 +1,1179 @@ +[ + { + "inputs": [ + { + "internalType": "contract IAuthorizer", + "name": "authorizer", + "type": "address" + }, + { + "internalType": "contract IWETH", + "name": "weth", + "type": "address" + }, + { + "internalType": "uint256", + "name": "pauseWindowDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "bufferPeriodDuration", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract IAuthorizer", + "name": "newAuthorizer", + "type": "address" + } + ], + "name": "AuthorizerChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract IERC20", + "name": "token", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "ExternalBalanceTransfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract IFlashLoanRecipient", + "name": "recipient", + "type": "address" + }, + { + "indexed": true, + "internalType": "contract IERC20", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "feeAmount", + "type": "uint256" + } + ], + "name": "FlashLoan", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "contract IERC20", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "int256", + "name": "delta", + "type": "int256" + } + ], + "name": "InternalBalanceChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bool", + "name": "paused", + "type": "bool" + } + ], + "name": "PausedStateChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "poolId", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "liquidityProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract IERC20[]", + "name": "tokens", + "type": "address[]" + }, + { + "indexed": false, + "internalType": "int256[]", + "name": "deltas", + "type": "int256[]" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "protocolFeeAmounts", + "type": "uint256[]" + } + ], + "name": "PoolBalanceChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "poolId", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "assetManager", + "type": "address" + }, + { + "indexed": true, + "internalType": "contract IERC20", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "int256", + "name": "cashDelta", + "type": "int256" + }, + { + "indexed": false, + "internalType": "int256", + "name": "managedDelta", + "type": "int256" + } + ], + "name": "PoolBalanceManaged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "poolId", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "poolAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "enum IVault.PoolSpecialization", + "name": "specialization", + "type": "uint8" + } + ], + "name": "PoolRegistered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "relayer", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "RelayerApprovalChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "poolId", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "contract IERC20", + "name": "tokenIn", + "type": "address" + }, + { + "indexed": true, + "internalType": "contract IERC20", + "name": "tokenOut", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountIn", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountOut", + "type": "uint256" + } + ], + "name": "Swap", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "poolId", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "contract IERC20[]", + "name": "tokens", + "type": "address[]" + } + ], + "name": "TokensDeregistered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "poolId", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "contract IERC20[]", + "name": "tokens", + "type": "address[]" + }, + { + "indexed": false, + "internalType": "address[]", + "name": "assetManagers", + "type": "address[]" + } + ], + "name": "TokensRegistered", + "type": "event" + }, + { + "inputs": [], + "name": "WETH", + "outputs": [ + { + "internalType": "contract IWETH", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum IVault.SwapKind", + "name": "kind", + "type": "uint8" + }, + { + "components": [ + { + "internalType": "bytes32", + "name": "poolId", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "assetInIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "assetOutIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "userData", + "type": "bytes" + } + ], + "internalType": "struct IVault.BatchSwapStep[]", + "name": "swaps", + "type": "tuple[]" + }, + { + "internalType": "contract IAsset[]", + "name": "assets", + "type": "address[]" + }, + { + "components": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "bool", + "name": "fromInternalBalance", + "type": "bool" + }, + { + "internalType": "address payable", + "name": "recipient", + "type": "address" + }, + { + "internalType": "bool", + "name": "toInternalBalance", + "type": "bool" + } + ], + "internalType": "struct IVault.FundManagement", + "name": "funds", + "type": "tuple" + }, + { + "internalType": "int256[]", + "name": "limits", + "type": "int256[]" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + } + ], + "name": "batchSwap", + "outputs": [ + { + "internalType": "int256[]", + "name": "assetDeltas", + "type": "int256[]" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "poolId", + "type": "bytes32" + }, + { + "internalType": "contract IERC20[]", + "name": "tokens", + "type": "address[]" + } + ], + "name": "deregisterTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "poolId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address payable", + "name": "recipient", + "type": "address" + }, + { + "components": [ + { + "internalType": "contract IAsset[]", + "name": "assets", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "minAmountsOut", + "type": "uint256[]" + }, + { + "internalType": "bytes", + "name": "userData", + "type": "bytes" + }, + { + "internalType": "bool", + "name": "toInternalBalance", + "type": "bool" + } + ], + "internalType": "struct IVault.ExitPoolRequest", + "name": "request", + "type": "tuple" + } + ], + "name": "exitPool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IFlashLoanRecipient", + "name": "recipient", + "type": "address" + }, + { + "internalType": "contract IERC20[]", + "name": "tokens", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + }, + { + "internalType": "bytes", + "name": "userData", + "type": "bytes" + } + ], + "name": "flashLoan", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "selector", + "type": "bytes4" + } + ], + "name": "getActionId", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAuthorizer", + "outputs": [ + { + "internalType": "contract IAuthorizer", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getDomainSeparator", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "contract IERC20[]", + "name": "tokens", + "type": "address[]" + } + ], + "name": "getInternalBalance", + "outputs": [ + { + "internalType": "uint256[]", + "name": "balances", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "getNextNonce", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPausedState", + "outputs": [ + { + "internalType": "bool", + "name": "paused", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "pauseWindowEndTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "bufferPeriodEndTime", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "poolId", + "type": "bytes32" + } + ], + "name": "getPool", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "enum IVault.PoolSpecialization", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "poolId", + "type": "bytes32" + }, + { + "internalType": "contract IERC20", + "name": "token", + "type": "address" + } + ], + "name": "getPoolTokenInfo", + "outputs": [ + { + "internalType": "uint256", + "name": "cash", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "managed", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastChangeBlock", + "type": "uint256" + }, + { + "internalType": "address", + "name": "assetManager", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "poolId", + "type": "bytes32" + } + ], + "name": "getPoolTokens", + "outputs": [ + { + "internalType": "contract IERC20[]", + "name": "tokens", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "balances", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "lastChangeBlock", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getProtocolFeesCollector", + "outputs": [ + { + "internalType": "contract ProtocolFeesCollector", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "address", + "name": "relayer", + "type": "address" + } + ], + "name": "hasApprovedRelayer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "poolId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "components": [ + { + "internalType": "contract IAsset[]", + "name": "assets", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "maxAmountsIn", + "type": "uint256[]" + }, + { + "internalType": "bytes", + "name": "userData", + "type": "bytes" + }, + { + "internalType": "bool", + "name": "fromInternalBalance", + "type": "bool" + } + ], + "internalType": "struct IVault.JoinPoolRequest", + "name": "request", + "type": "tuple" + } + ], + "name": "joinPool", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "enum IVault.PoolBalanceOpKind", + "name": "kind", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "poolId", + "type": "bytes32" + }, + { + "internalType": "contract IERC20", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "internalType": "struct IVault.PoolBalanceOp[]", + "name": "ops", + "type": "tuple[]" + } + ], + "name": "managePoolBalance", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "enum IVault.UserBalanceOpKind", + "name": "kind", + "type": "uint8" + }, + { + "internalType": "contract IAsset", + "name": "asset", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address payable", + "name": "recipient", + "type": "address" + } + ], + "internalType": "struct IVault.UserBalanceOp[]", + "name": "ops", + "type": "tuple[]" + } + ], + "name": "manageUserBalance", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum IVault.SwapKind", + "name": "kind", + "type": "uint8" + }, + { + "components": [ + { + "internalType": "bytes32", + "name": "poolId", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "assetInIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "assetOutIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "userData", + "type": "bytes" + } + ], + "internalType": "struct IVault.BatchSwapStep[]", + "name": "swaps", + "type": "tuple[]" + }, + { + "internalType": "contract IAsset[]", + "name": "assets", + "type": "address[]" + }, + { + "components": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "bool", + "name": "fromInternalBalance", + "type": "bool" + }, + { + "internalType": "address payable", + "name": "recipient", + "type": "address" + }, + { + "internalType": "bool", + "name": "toInternalBalance", + "type": "bool" + } + ], + "internalType": "struct IVault.FundManagement", + "name": "funds", + "type": "tuple" + } + ], + "name": "queryBatchSwap", + "outputs": [ + { + "internalType": "int256[]", + "name": "", + "type": "int256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum IVault.PoolSpecialization", + "name": "specialization", + "type": "uint8" + } + ], + "name": "registerPool", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "poolId", + "type": "bytes32" + }, + { + "internalType": "contract IERC20[]", + "name": "tokens", + "type": "address[]" + }, + { + "internalType": "address[]", + "name": "assetManagers", + "type": "address[]" + } + ], + "name": "registerTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IAuthorizer", + "name": "newAuthorizer", + "type": "address" + } + ], + "name": "setAuthorizer", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "paused", + "type": "bool" + } + ], + "name": "setPaused", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "relayer", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setRelayerApproval", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "poolId", + "type": "bytes32" + }, + { + "internalType": "enum IVault.SwapKind", + "name": "kind", + "type": "uint8" + }, + { + "internalType": "contract IAsset", + "name": "assetIn", + "type": "address" + }, + { + "internalType": "contract IAsset", + "name": "assetOut", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "userData", + "type": "bytes" + } + ], + "internalType": "struct IVault.SingleSwap", + "name": "singleSwap", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "bool", + "name": "fromInternalBalance", + "type": "bool" + }, + { + "internalType": "address payable", + "name": "recipient", + "type": "address" + }, + { + "internalType": "bool", + "name": "toInternalBalance", + "type": "bool" + } + ], + "internalType": "struct IVault.FundManagement", + "name": "funds", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "limit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + } + ], + "name": "swap", + "outputs": [ + { + "internalType": "uint256", + "name": "amountCalculated", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } +] diff --git a/abi/curve_llamalend_controller.json b/abi/curve_llamalend_controller.json new file mode 100644 index 0000000..cfc563d --- /dev/null +++ b/abi/curve_llamalend_controller.json @@ -0,0 +1,1269 @@ +[ + { + "name": "UserState", + "inputs": [ + { + "name": "user", + "type": "address", + "indexed": true + }, + { + "name": "collateral", + "type": "uint256", + "indexed": false + }, + { + "name": "debt", + "type": "uint256", + "indexed": false + }, + { + "name": "n1", + "type": "int256", + "indexed": false + }, + { + "name": "n2", + "type": "int256", + "indexed": false + }, + { + "name": "liquidation_discount", + "type": "uint256", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "Borrow", + "inputs": [ + { + "name": "user", + "type": "address", + "indexed": true + }, + { + "name": "collateral_increase", + "type": "uint256", + "indexed": false + }, + { + "name": "loan_increase", + "type": "uint256", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "Repay", + "inputs": [ + { + "name": "user", + "type": "address", + "indexed": true + }, + { + "name": "collateral_decrease", + "type": "uint256", + "indexed": false + }, + { + "name": "loan_decrease", + "type": "uint256", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "RemoveCollateral", + "inputs": [ + { + "name": "user", + "type": "address", + "indexed": true + }, + { + "name": "collateral_decrease", + "type": "uint256", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "Liquidate", + "inputs": [ + { + "name": "liquidator", + "type": "address", + "indexed": true + }, + { + "name": "user", + "type": "address", + "indexed": true + }, + { + "name": "collateral_received", + "type": "uint256", + "indexed": false + }, + { + "name": "stablecoin_received", + "type": "uint256", + "indexed": false + }, + { + "name": "debt", + "type": "uint256", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "SetMonetaryPolicy", + "inputs": [ + { + "name": "monetary_policy", + "type": "address", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "SetBorrowingDiscounts", + "inputs": [ + { + "name": "loan_discount", + "type": "uint256", + "indexed": false + }, + { + "name": "liquidation_discount", + "type": "uint256", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "CollectFees", + "inputs": [ + { + "name": "amount", + "type": "uint256", + "indexed": false + }, + { + "name": "new_supply", + "type": "uint256", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "stateMutability": "nonpayable", + "type": "constructor", + "inputs": [ + { + "name": "collateral_token", + "type": "address" + }, + { + "name": "monetary_policy", + "type": "address" + }, + { + "name": "loan_discount", + "type": "uint256" + }, + { + "name": "liquidation_discount", + "type": "uint256" + }, + { + "name": "amm", + "type": "address" + } + ], + "outputs": [] + }, + { + "stateMutability": "pure", + "type": "function", + "name": "factory", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address" + } + ] + }, + { + "stateMutability": "pure", + "type": "function", + "name": "amm", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address" + } + ] + }, + { + "stateMutability": "pure", + "type": "function", + "name": "collateral_token", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address" + } + ] + }, + { + "stateMutability": "pure", + "type": "function", + "name": "borrowed_token", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "save_rate", + "inputs": [], + "outputs": [] + }, + { + "stateMutability": "view", + "type": "function", + "name": "debt", + "inputs": [ + { + "name": "user", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "loan_exists", + "inputs": [ + { + "name": "user", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "bool" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "total_debt", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "max_borrowable", + "inputs": [ + { + "name": "collateral", + "type": "uint256" + }, + { + "name": "N", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "max_borrowable", + "inputs": [ + { + "name": "collateral", + "type": "uint256" + }, + { + "name": "N", + "type": "uint256" + }, + { + "name": "current_debt", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "min_collateral", + "inputs": [ + { + "name": "debt", + "type": "uint256" + }, + { + "name": "N", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "calculate_debt_n1", + "inputs": [ + { + "name": "collateral", + "type": "uint256" + }, + { + "name": "debt", + "type": "uint256" + }, + { + "name": "N", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "int256" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "create_loan", + "inputs": [ + { + "name": "collateral", + "type": "uint256" + }, + { + "name": "debt", + "type": "uint256" + }, + { + "name": "N", + "type": "uint256" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "create_loan_extended", + "inputs": [ + { + "name": "collateral", + "type": "uint256" + }, + { + "name": "debt", + "type": "uint256" + }, + { + "name": "N", + "type": "uint256" + }, + { + "name": "callbacker", + "type": "address" + }, + { + "name": "callback_args", + "type": "uint256[]" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "create_loan_extended", + "inputs": [ + { + "name": "collateral", + "type": "uint256" + }, + { + "name": "debt", + "type": "uint256" + }, + { + "name": "N", + "type": "uint256" + }, + { + "name": "callbacker", + "type": "address" + }, + { + "name": "callback_args", + "type": "uint256[]" + }, + { + "name": "callback_bytes", + "type": "bytes" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "add_collateral", + "inputs": [ + { + "name": "collateral", + "type": "uint256" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "add_collateral", + "inputs": [ + { + "name": "collateral", + "type": "uint256" + }, + { + "name": "_for", + "type": "address" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "remove_collateral", + "inputs": [ + { + "name": "collateral", + "type": "uint256" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "borrow_more", + "inputs": [ + { + "name": "collateral", + "type": "uint256" + }, + { + "name": "debt", + "type": "uint256" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "borrow_more_extended", + "inputs": [ + { + "name": "collateral", + "type": "uint256" + }, + { + "name": "debt", + "type": "uint256" + }, + { + "name": "callbacker", + "type": "address" + }, + { + "name": "callback_args", + "type": "uint256[]" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "borrow_more_extended", + "inputs": [ + { + "name": "collateral", + "type": "uint256" + }, + { + "name": "debt", + "type": "uint256" + }, + { + "name": "callbacker", + "type": "address" + }, + { + "name": "callback_args", + "type": "uint256[]" + }, + { + "name": "callback_bytes", + "type": "bytes" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "repay", + "inputs": [ + { + "name": "_d_debt", + "type": "uint256" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "repay", + "inputs": [ + { + "name": "_d_debt", + "type": "uint256" + }, + { + "name": "_for", + "type": "address" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "repay", + "inputs": [ + { + "name": "_d_debt", + "type": "uint256" + }, + { + "name": "_for", + "type": "address" + }, + { + "name": "max_active_band", + "type": "int256" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "repay_extended", + "inputs": [ + { + "name": "callbacker", + "type": "address" + }, + { + "name": "callback_args", + "type": "uint256[]" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "repay_extended", + "inputs": [ + { + "name": "callbacker", + "type": "address" + }, + { + "name": "callback_args", + "type": "uint256[]" + }, + { + "name": "callback_bytes", + "type": "bytes" + } + ], + "outputs": [] + }, + { + "stateMutability": "view", + "type": "function", + "name": "health_calculator", + "inputs": [ + { + "name": "user", + "type": "address" + }, + { + "name": "d_collateral", + "type": "int256" + }, + { + "name": "d_debt", + "type": "int256" + }, + { + "name": "full", + "type": "bool" + } + ], + "outputs": [ + { + "name": "", + "type": "int256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "health_calculator", + "inputs": [ + { + "name": "user", + "type": "address" + }, + { + "name": "d_collateral", + "type": "int256" + }, + { + "name": "d_debt", + "type": "int256" + }, + { + "name": "full", + "type": "bool" + }, + { + "name": "N", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "int256" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "liquidate", + "inputs": [ + { + "name": "user", + "type": "address" + }, + { + "name": "min_x", + "type": "uint256" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "liquidate_extended", + "inputs": [ + { + "name": "user", + "type": "address" + }, + { + "name": "min_x", + "type": "uint256" + }, + { + "name": "frac", + "type": "uint256" + }, + { + "name": "callbacker", + "type": "address" + }, + { + "name": "callback_args", + "type": "uint256[]" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "liquidate_extended", + "inputs": [ + { + "name": "user", + "type": "address" + }, + { + "name": "min_x", + "type": "uint256" + }, + { + "name": "frac", + "type": "uint256" + }, + { + "name": "callbacker", + "type": "address" + }, + { + "name": "callback_args", + "type": "uint256[]" + }, + { + "name": "callback_bytes", + "type": "bytes" + } + ], + "outputs": [] + }, + { + "stateMutability": "view", + "type": "function", + "name": "tokens_to_liquidate", + "inputs": [ + { + "name": "user", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "tokens_to_liquidate", + "inputs": [ + { + "name": "user", + "type": "address" + }, + { + "name": "frac", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "health", + "inputs": [ + { + "name": "user", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "int256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "health", + "inputs": [ + { + "name": "user", + "type": "address" + }, + { + "name": "full", + "type": "bool" + } + ], + "outputs": [ + { + "name": "", + "type": "int256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "users_to_liquidate", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "tuple[]", + "components": [ + { + "name": "user", + "type": "address" + }, + { + "name": "x", + "type": "uint256" + }, + { + "name": "y", + "type": "uint256" + }, + { + "name": "debt", + "type": "uint256" + }, + { + "name": "health", + "type": "int256" + } + ] + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "users_to_liquidate", + "inputs": [ + { + "name": "_from", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "tuple[]", + "components": [ + { + "name": "user", + "type": "address" + }, + { + "name": "x", + "type": "uint256" + }, + { + "name": "y", + "type": "uint256" + }, + { + "name": "debt", + "type": "uint256" + }, + { + "name": "health", + "type": "int256" + } + ] + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "users_to_liquidate", + "inputs": [ + { + "name": "_from", + "type": "uint256" + }, + { + "name": "_limit", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "tuple[]", + "components": [ + { + "name": "user", + "type": "address" + }, + { + "name": "x", + "type": "uint256" + }, + { + "name": "y", + "type": "uint256" + }, + { + "name": "debt", + "type": "uint256" + }, + { + "name": "health", + "type": "int256" + } + ] + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "amm_price", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "user_prices", + "inputs": [ + { + "name": "user", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256[2]" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "user_state", + "inputs": [ + { + "name": "user", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256[4]" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "set_amm_fee", + "inputs": [ + { + "name": "fee", + "type": "uint256" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "set_amm_admin_fee", + "inputs": [ + { + "name": "fee", + "type": "uint256" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "set_monetary_policy", + "inputs": [ + { + "name": "monetary_policy", + "type": "address" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "set_borrowing_discounts", + "inputs": [ + { + "name": "loan_discount", + "type": "uint256" + }, + { + "name": "liquidation_discount", + "type": "uint256" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "set_callback", + "inputs": [ + { + "name": "cb", + "type": "address" + } + ], + "outputs": [] + }, + { + "stateMutability": "view", + "type": "function", + "name": "admin_fees", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "collect_fees", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "check_lock", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "bool" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "liquidation_discounts", + "inputs": [ + { + "name": "arg0", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "loans", + "inputs": [ + { + "name": "arg0", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "address" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "loan_ix", + "inputs": [ + { + "name": "arg0", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "n_loans", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "minted", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "redeemed", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "monetary_policy", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "liquidation_discount", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "loan_discount", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + } + ] \ No newline at end of file diff --git a/abi/euler_evault.json b/abi/euler_evault.json new file mode 100644 index 0000000..35ea016 --- /dev/null +++ b/abi/euler_evault.json @@ -0,0 +1,1560 @@ +[ + { + "type": "constructor", + "inputs": [ + { + "name": "integrations", + "type": "tuple", + "internalType": "struct Base.Integrations", + "components": [ + { "name": "evc", "type": "address", "internalType": "address" }, + { + "name": "protocolConfig", + "type": "address", + "internalType": "address" + }, + { + "name": "sequenceRegistry", + "type": "address", + "internalType": "address" + }, + { + "name": "balanceTracker", + "type": "address", + "internalType": "address" + }, + { "name": "permit2", "type": "address", "internalType": "address" } + ] + }, + { + "name": "modules", + "type": "tuple", + "internalType": "struct Dispatch.DeployedModules", + "components": [ + { + "name": "initialize", + "type": "address", + "internalType": "address" + }, + { "name": "token", "type": "address", "internalType": "address" }, + { "name": "vault", "type": "address", "internalType": "address" }, + { + "name": "borrowing", + "type": "address", + "internalType": "address" + }, + { + "name": "liquidation", + "type": "address", + "internalType": "address" + }, + { + "name": "riskManager", + "type": "address", + "internalType": "address" + }, + { + "name": "balanceForwarder", + "type": "address", + "internalType": "address" + }, + { + "name": "governance", + "type": "address", + "internalType": "address" + } + ] + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "EVC", + "inputs": [], + "outputs": [{ "name": "", "type": "address", "internalType": "address" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "LTVBorrow", + "inputs": [ + { "name": "collateral", "type": "address", "internalType": "address" } + ], + "outputs": [{ "name": "", "type": "uint16", "internalType": "uint16" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "LTVFull", + "inputs": [ + { "name": "collateral", "type": "address", "internalType": "address" } + ], + "outputs": [ + { "name": "borrowLTV", "type": "uint16", "internalType": "uint16" }, + { + "name": "liquidationLTV", + "type": "uint16", + "internalType": "uint16" + }, + { + "name": "initialLiquidationLTV", + "type": "uint16", + "internalType": "uint16" + }, + { + "name": "targetTimestamp", + "type": "uint48", + "internalType": "uint48" + }, + { "name": "rampDuration", "type": "uint32", "internalType": "uint32" } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "LTVLiquidation", + "inputs": [ + { "name": "collateral", "type": "address", "internalType": "address" } + ], + "outputs": [{ "name": "", "type": "uint16", "internalType": "uint16" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "LTVList", + "inputs": [], + "outputs": [ + { "name": "", "type": "address[]", "internalType": "address[]" } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "MODULE_BALANCE_FORWARDER", + "inputs": [], + "outputs": [{ "name": "", "type": "address", "internalType": "address" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "MODULE_BORROWING", + "inputs": [], + "outputs": [{ "name": "", "type": "address", "internalType": "address" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "MODULE_GOVERNANCE", + "inputs": [], + "outputs": [{ "name": "", "type": "address", "internalType": "address" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "MODULE_INITIALIZE", + "inputs": [], + "outputs": [{ "name": "", "type": "address", "internalType": "address" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "MODULE_LIQUIDATION", + "inputs": [], + "outputs": [{ "name": "", "type": "address", "internalType": "address" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "MODULE_RISKMANAGER", + "inputs": [], + "outputs": [{ "name": "", "type": "address", "internalType": "address" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "MODULE_TOKEN", + "inputs": [], + "outputs": [{ "name": "", "type": "address", "internalType": "address" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "MODULE_VAULT", + "inputs": [], + "outputs": [{ "name": "", "type": "address", "internalType": "address" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "accountLiquidity", + "inputs": [ + { "name": "account", "type": "address", "internalType": "address" }, + { "name": "liquidation", "type": "bool", "internalType": "bool" } + ], + "outputs": [ + { + "name": "collateralValue", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "liabilityValue", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "accountLiquidityFull", + "inputs": [ + { "name": "account", "type": "address", "internalType": "address" }, + { "name": "liquidation", "type": "bool", "internalType": "bool" } + ], + "outputs": [ + { + "name": "collaterals", + "type": "address[]", + "internalType": "address[]" + }, + { + "name": "collateralValues", + "type": "uint256[]", + "internalType": "uint256[]" + }, + { + "name": "liabilityValue", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "accumulatedFees", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "accumulatedFeesAssets", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "allowance", + "inputs": [ + { "name": "holder", "type": "address", "internalType": "address" }, + { "name": "spender", "type": "address", "internalType": "address" } + ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "approve", + "inputs": [ + { "name": "spender", "type": "address", "internalType": "address" }, + { "name": "amount", "type": "uint256", "internalType": "uint256" } + ], + "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "asset", + "inputs": [], + "outputs": [{ "name": "", "type": "address", "internalType": "address" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "balanceForwarderEnabled", + "inputs": [ + { "name": "account", "type": "address", "internalType": "address" } + ], + "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "balanceOf", + "inputs": [ + { "name": "account", "type": "address", "internalType": "address" } + ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "balanceTrackerAddress", + "inputs": [], + "outputs": [{ "name": "", "type": "address", "internalType": "address" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "borrow", + "inputs": [ + { "name": "amount", "type": "uint256", "internalType": "uint256" }, + { "name": "receiver", "type": "address", "internalType": "address" } + ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "caps", + "inputs": [], + "outputs": [ + { "name": "supplyCap", "type": "uint16", "internalType": "uint16" }, + { "name": "borrowCap", "type": "uint16", "internalType": "uint16" } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "cash", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "checkAccountStatus", + "inputs": [ + { "name": "account", "type": "address", "internalType": "address" }, + { + "name": "collaterals", + "type": "address[]", + "internalType": "address[]" + } + ], + "outputs": [{ "name": "", "type": "bytes4", "internalType": "bytes4" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "checkLiquidation", + "inputs": [ + { "name": "liquidator", "type": "address", "internalType": "address" }, + { "name": "violator", "type": "address", "internalType": "address" }, + { "name": "collateral", "type": "address", "internalType": "address" } + ], + "outputs": [ + { "name": "maxRepay", "type": "uint256", "internalType": "uint256" }, + { "name": "maxYield", "type": "uint256", "internalType": "uint256" } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "checkVaultStatus", + "inputs": [], + "outputs": [{ "name": "", "type": "bytes4", "internalType": "bytes4" }], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "configFlags", + "inputs": [], + "outputs": [{ "name": "", "type": "uint32", "internalType": "uint32" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "convertFees", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "convertToAssets", + "inputs": [ + { "name": "shares", "type": "uint256", "internalType": "uint256" } + ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "convertToShares", + "inputs": [ + { "name": "assets", "type": "uint256", "internalType": "uint256" } + ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "creator", + "inputs": [], + "outputs": [{ "name": "", "type": "address", "internalType": "address" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "dToken", + "inputs": [], + "outputs": [{ "name": "", "type": "address", "internalType": "address" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "debtOf", + "inputs": [ + { "name": "account", "type": "address", "internalType": "address" } + ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "debtOfExact", + "inputs": [ + { "name": "account", "type": "address", "internalType": "address" } + ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "decimals", + "inputs": [], + "outputs": [{ "name": "", "type": "uint8", "internalType": "uint8" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "deposit", + "inputs": [ + { "name": "amount", "type": "uint256", "internalType": "uint256" }, + { "name": "receiver", "type": "address", "internalType": "address" } + ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "disableBalanceForwarder", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "disableController", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "enableBalanceForwarder", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "feeReceiver", + "inputs": [], + "outputs": [{ "name": "", "type": "address", "internalType": "address" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "flashLoan", + "inputs": [ + { "name": "amount", "type": "uint256", "internalType": "uint256" }, + { "name": "data", "type": "bytes", "internalType": "bytes" } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "governorAdmin", + "inputs": [], + "outputs": [{ "name": "", "type": "address", "internalType": "address" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "hookConfig", + "inputs": [], + "outputs": [ + { "name": "", "type": "address", "internalType": "address" }, + { "name": "", "type": "uint32", "internalType": "uint32" } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "initialize", + "inputs": [ + { "name": "proxyCreator", "type": "address", "internalType": "address" } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "interestAccumulator", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "interestFee", + "inputs": [], + "outputs": [{ "name": "", "type": "uint16", "internalType": "uint16" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "interestRate", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "interestRateModel", + "inputs": [], + "outputs": [{ "name": "", "type": "address", "internalType": "address" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "liquidate", + "inputs": [ + { "name": "violator", "type": "address", "internalType": "address" }, + { "name": "collateral", "type": "address", "internalType": "address" }, + { "name": "repayAssets", "type": "uint256", "internalType": "uint256" }, + { + "name": "minYieldBalance", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "liquidationCoolOffTime", + "inputs": [], + "outputs": [{ "name": "", "type": "uint16", "internalType": "uint16" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "maxDeposit", + "inputs": [ + { "name": "account", "type": "address", "internalType": "address" } + ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "maxLiquidationDiscount", + "inputs": [], + "outputs": [{ "name": "", "type": "uint16", "internalType": "uint16" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "maxMint", + "inputs": [ + { "name": "account", "type": "address", "internalType": "address" } + ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "maxRedeem", + "inputs": [ + { "name": "owner", "type": "address", "internalType": "address" } + ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "maxWithdraw", + "inputs": [ + { "name": "owner", "type": "address", "internalType": "address" } + ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "mint", + "inputs": [ + { "name": "amount", "type": "uint256", "internalType": "uint256" }, + { "name": "receiver", "type": "address", "internalType": "address" } + ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "name", + "inputs": [], + "outputs": [{ "name": "", "type": "string", "internalType": "string" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "oracle", + "inputs": [], + "outputs": [{ "name": "", "type": "address", "internalType": "address" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "permit2Address", + "inputs": [], + "outputs": [{ "name": "", "type": "address", "internalType": "address" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "previewDeposit", + "inputs": [ + { "name": "assets", "type": "uint256", "internalType": "uint256" } + ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "previewMint", + "inputs": [ + { "name": "shares", "type": "uint256", "internalType": "uint256" } + ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "previewRedeem", + "inputs": [ + { "name": "shares", "type": "uint256", "internalType": "uint256" } + ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "previewWithdraw", + "inputs": [ + { "name": "assets", "type": "uint256", "internalType": "uint256" } + ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "protocolConfigAddress", + "inputs": [], + "outputs": [{ "name": "", "type": "address", "internalType": "address" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "protocolFeeReceiver", + "inputs": [], + "outputs": [{ "name": "", "type": "address", "internalType": "address" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "protocolFeeShare", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "pullDebt", + "inputs": [ + { "name": "amount", "type": "uint256", "internalType": "uint256" }, + { "name": "from", "type": "address", "internalType": "address" } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "redeem", + "inputs": [ + { "name": "amount", "type": "uint256", "internalType": "uint256" }, + { "name": "receiver", "type": "address", "internalType": "address" }, + { "name": "owner", "type": "address", "internalType": "address" } + ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "repay", + "inputs": [ + { "name": "amount", "type": "uint256", "internalType": "uint256" }, + { "name": "receiver", "type": "address", "internalType": "address" } + ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "repayWithShares", + "inputs": [ + { "name": "amount", "type": "uint256", "internalType": "uint256" }, + { "name": "receiver", "type": "address", "internalType": "address" } + ], + "outputs": [ + { "name": "shares", "type": "uint256", "internalType": "uint256" }, + { "name": "debt", "type": "uint256", "internalType": "uint256" } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setCaps", + "inputs": [ + { "name": "supplyCap", "type": "uint16", "internalType": "uint16" }, + { "name": "borrowCap", "type": "uint16", "internalType": "uint16" } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setConfigFlags", + "inputs": [ + { "name": "newConfigFlags", "type": "uint32", "internalType": "uint32" } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setFeeReceiver", + "inputs": [ + { + "name": "newFeeReceiver", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setGovernorAdmin", + "inputs": [ + { + "name": "newGovernorAdmin", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setHookConfig", + "inputs": [ + { + "name": "newHookTarget", + "type": "address", + "internalType": "address" + }, + { "name": "newHookedOps", "type": "uint32", "internalType": "uint32" } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setInterestFee", + "inputs": [ + { "name": "newFee", "type": "uint16", "internalType": "uint16" } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setInterestRateModel", + "inputs": [ + { "name": "newModel", "type": "address", "internalType": "address" } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setLTV", + "inputs": [ + { "name": "collateral", "type": "address", "internalType": "address" }, + { "name": "borrowLTV", "type": "uint16", "internalType": "uint16" }, + { + "name": "liquidationLTV", + "type": "uint16", + "internalType": "uint16" + }, + { "name": "rampDuration", "type": "uint32", "internalType": "uint32" } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setLiquidationCoolOffTime", + "inputs": [ + { "name": "newCoolOffTime", "type": "uint16", "internalType": "uint16" } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setMaxLiquidationDiscount", + "inputs": [ + { "name": "newDiscount", "type": "uint16", "internalType": "uint16" } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "skim", + "inputs": [ + { "name": "amount", "type": "uint256", "internalType": "uint256" }, + { "name": "receiver", "type": "address", "internalType": "address" } + ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "symbol", + "inputs": [], + "outputs": [{ "name": "", "type": "string", "internalType": "string" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "totalAssets", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "totalBorrows", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "totalBorrowsExact", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "totalSupply", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "touch", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "transfer", + "inputs": [ + { "name": "to", "type": "address", "internalType": "address" }, + { "name": "amount", "type": "uint256", "internalType": "uint256" } + ], + "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "transferFrom", + "inputs": [ + { "name": "from", "type": "address", "internalType": "address" }, + { "name": "to", "type": "address", "internalType": "address" }, + { "name": "amount", "type": "uint256", "internalType": "uint256" } + ], + "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "transferFromMax", + "inputs": [ + { "name": "from", "type": "address", "internalType": "address" }, + { "name": "to", "type": "address", "internalType": "address" } + ], + "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "unitOfAccount", + "inputs": [], + "outputs": [{ "name": "", "type": "address", "internalType": "address" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "viewDelegate", + "inputs": [], + "outputs": [], + "stateMutability": "payable" + }, + { + "type": "function", + "name": "withdraw", + "inputs": [ + { "name": "amount", "type": "uint256", "internalType": "uint256" }, + { "name": "receiver", "type": "address", "internalType": "address" }, + { "name": "owner", "type": "address", "internalType": "address" } + ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "nonpayable" + }, + { + "type": "event", + "name": "Approval", + "inputs": [ + { + "name": "owner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "spender", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "value", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "BalanceForwarderStatus", + "inputs": [ + { + "name": "account", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "status", + "type": "bool", + "indexed": false, + "internalType": "bool" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Borrow", + "inputs": [ + { + "name": "account", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "assets", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ConvertFees", + "inputs": [ + { + "name": "sender", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "protocolReceiver", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "governorReceiver", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "protocolShares", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "governorShares", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "DebtSocialized", + "inputs": [ + { + "name": "account", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "assets", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Deposit", + "inputs": [ + { + "name": "sender", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "owner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "assets", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "shares", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "EVaultCreated", + "inputs": [ + { + "name": "creator", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "asset", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "dToken", + "type": "address", + "indexed": false, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "GovSetCaps", + "inputs": [ + { + "name": "newSupplyCap", + "type": "uint16", + "indexed": false, + "internalType": "uint16" + }, + { + "name": "newBorrowCap", + "type": "uint16", + "indexed": false, + "internalType": "uint16" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "GovSetConfigFlags", + "inputs": [ + { + "name": "newConfigFlags", + "type": "uint32", + "indexed": false, + "internalType": "uint32" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "GovSetFeeReceiver", + "inputs": [ + { + "name": "newFeeReceiver", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "GovSetGovernorAdmin", + "inputs": [ + { + "name": "newGovernorAdmin", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "GovSetHookConfig", + "inputs": [ + { + "name": "newHookTarget", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "newHookedOps", + "type": "uint32", + "indexed": false, + "internalType": "uint32" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "GovSetInterestFee", + "inputs": [ + { + "name": "newFee", + "type": "uint16", + "indexed": false, + "internalType": "uint16" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "GovSetInterestRateModel", + "inputs": [ + { + "name": "newInterestRateModel", + "type": "address", + "indexed": false, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "GovSetLTV", + "inputs": [ + { + "name": "collateral", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "borrowLTV", + "type": "uint16", + "indexed": false, + "internalType": "uint16" + }, + { + "name": "liquidationLTV", + "type": "uint16", + "indexed": false, + "internalType": "uint16" + }, + { + "name": "initialLiquidationLTV", + "type": "uint16", + "indexed": false, + "internalType": "uint16" + }, + { + "name": "targetTimestamp", + "type": "uint48", + "indexed": false, + "internalType": "uint48" + }, + { + "name": "rampDuration", + "type": "uint32", + "indexed": false, + "internalType": "uint32" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "GovSetLiquidationCoolOffTime", + "inputs": [ + { + "name": "newCoolOffTime", + "type": "uint16", + "indexed": false, + "internalType": "uint16" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "GovSetMaxLiquidationDiscount", + "inputs": [ + { + "name": "newDiscount", + "type": "uint16", + "indexed": false, + "internalType": "uint16" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "InterestAccrued", + "inputs": [ + { + "name": "account", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "assets", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Liquidate", + "inputs": [ + { + "name": "liquidator", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "violator", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "collateral", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "repayAssets", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "yieldBalance", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "PullDebt", + "inputs": [ + { + "name": "from", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "to", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "assets", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Repay", + "inputs": [ + { + "name": "account", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "assets", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Transfer", + "inputs": [ + { + "name": "from", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "to", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "value", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "VaultStatus", + "inputs": [ + { + "name": "totalShares", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "totalBorrows", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "accumulatedFees", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "cash", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "interestAccumulator", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "interestRate", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "timestamp", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Withdraw", + "inputs": [ + { + "name": "sender", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "receiver", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "owner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "assets", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "shares", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { "type": "error", "name": "E_AccountLiquidity", "inputs": [] }, + { "type": "error", "name": "E_AmountTooLargeToEncode", "inputs": [] }, + { "type": "error", "name": "E_BadAddress", "inputs": [] }, + { "type": "error", "name": "E_BadAssetReceiver", "inputs": [] }, + { "type": "error", "name": "E_BadBorrowCap", "inputs": [] }, + { "type": "error", "name": "E_BadCollateral", "inputs": [] }, + { "type": "error", "name": "E_BadFee", "inputs": [] }, + { "type": "error", "name": "E_BadMaxLiquidationDiscount", "inputs": [] }, + { "type": "error", "name": "E_BadSharesOwner", "inputs": [] }, + { "type": "error", "name": "E_BadSharesReceiver", "inputs": [] }, + { "type": "error", "name": "E_BadSupplyCap", "inputs": [] }, + { "type": "error", "name": "E_BorrowCapExceeded", "inputs": [] }, + { "type": "error", "name": "E_CheckUnauthorized", "inputs": [] }, + { "type": "error", "name": "E_CollateralDisabled", "inputs": [] }, + { "type": "error", "name": "E_ConfigAmountTooLargeToEncode", "inputs": [] }, + { "type": "error", "name": "E_ControllerDisabled", "inputs": [] }, + { "type": "error", "name": "E_DebtAmountTooLargeToEncode", "inputs": [] }, + { "type": "error", "name": "E_EmptyError", "inputs": [] }, + { "type": "error", "name": "E_ExcessiveRepayAmount", "inputs": [] }, + { "type": "error", "name": "E_FlashLoanNotRepaid", "inputs": [] }, + { "type": "error", "name": "E_Initialized", "inputs": [] }, + { "type": "error", "name": "E_InsufficientAllowance", "inputs": [] }, + { "type": "error", "name": "E_InsufficientAssets", "inputs": [] }, + { "type": "error", "name": "E_InsufficientBalance", "inputs": [] }, + { "type": "error", "name": "E_InsufficientCash", "inputs": [] }, + { "type": "error", "name": "E_InsufficientDebt", "inputs": [] }, + { "type": "error", "name": "E_InvalidLTVAsset", "inputs": [] }, + { "type": "error", "name": "E_LTVBorrow", "inputs": [] }, + { "type": "error", "name": "E_LTVLiquidation", "inputs": [] }, + { "type": "error", "name": "E_LiquidationCoolOff", "inputs": [] }, + { "type": "error", "name": "E_MinYield", "inputs": [] }, + { "type": "error", "name": "E_NoLiability", "inputs": [] }, + { "type": "error", "name": "E_NoPriceOracle", "inputs": [] }, + { "type": "error", "name": "E_NotController", "inputs": [] }, + { "type": "error", "name": "E_NotHookTarget", "inputs": [] }, + { "type": "error", "name": "E_NotSupported", "inputs": [] }, + { "type": "error", "name": "E_OperationDisabled", "inputs": [] }, + { "type": "error", "name": "E_OutstandingDebt", "inputs": [] }, + { "type": "error", "name": "E_ProxyMetadata", "inputs": [] }, + { "type": "error", "name": "E_Reentrancy", "inputs": [] }, + { "type": "error", "name": "E_RepayTooMuch", "inputs": [] }, + { "type": "error", "name": "E_SelfLiquidation", "inputs": [] }, + { "type": "error", "name": "E_SelfTransfer", "inputs": [] }, + { "type": "error", "name": "E_SupplyCapExceeded", "inputs": [] }, + { "type": "error", "name": "E_TransientState", "inputs": [] }, + { "type": "error", "name": "E_Unauthorized", "inputs": [] }, + { "type": "error", "name": "E_ViolatorLiquidityDeferred", "inputs": [] }, + { "type": "error", "name": "E_ZeroAssets", "inputs": [] }, + { "type": "error", "name": "E_ZeroShares", "inputs": [] } +] diff --git a/abi/firm_market.json b/abi/firm_market.json new file mode 100644 index 0000000..f1227b6 --- /dev/null +++ b/abi/firm_market.json @@ -0,0 +1,954 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "_gov", + "type": "address" + }, + { + "internalType": "address", + "name": "_lender", + "type": "address" + }, + { + "internalType": "address", + "name": "_pauseGuardian", + "type": "address" + }, + { + "internalType": "address", + "name": "_escrowImplementation", + "type": "address" + }, + { + "internalType": "contract IDolaBorrowingRights", + "name": "_dbr", + "type": "address" + }, + { + "internalType": "contract IERC20", + "name": "_collateral", + "type": "address" + }, + { + "internalType": "contract IOracle", + "name": "_oracle", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_collateralFactorBps", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_replenishmentIncentiveBps", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_liquidationIncentiveBps", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_callOnDepositCallback", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Borrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "escrow", + "type": "address" + } + ], + "name": "CreateEscrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "liquidator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "repaidDebt", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "liquidatorReward", + "type": "uint256" + } + ], + "name": "Liquidate", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "repayer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Repay", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdraw", + "type": "event" + }, + { + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "borrow", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "borrowController", + "outputs": [ + { + "internalType": "contract IBorrowController", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "borrowOnBehalf", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "borrowPaused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "collateral", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "collateralFactorBps", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "dbr", + "outputs": [ + { + "internalType": "contract IDolaBorrowingRights", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "debts", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amountDeposit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountBorrow", + "type": "uint256" + } + ], + "name": "depositAndBorrow", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "dola", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "escrowImplementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "escrows", + "outputs": [ + { + "internalType": "contract IEscrow", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "forceReplenish", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "forceReplenishAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "getCollateralValue", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "getCreditLimit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "getWithdrawalLimit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "gov", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "invalidateNonce", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "lender", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "uint256", + "name": "repaidDebt", + "type": "uint256" + } + ], + "name": "liquidate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "liquidationFactorBps", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "liquidationFeeBps", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "liquidationIncentiveBps", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "nonces", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "oracle", + "outputs": [ + { + "internalType": "contract IOracle", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "_value", + "type": "bool" + } + ], + "name": "pauseBorrows", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "pauseGuardian", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "predictEscrow", + "outputs": [ + { + "internalType": "contract IEscrow", + "name": "predicted", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "recall", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "repay", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "repayAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawAmount", + "type": "uint256" + } + ], + "name": "repayAndWithdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "replenishmentIncentiveBps", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IBorrowController", + "name": "_borrowController", + "type": "address" + } + ], + "name": "setBorrowController", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_collateralFactorBps", + "type": "uint256" + } + ], + "name": "setCollateralFactorBps", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_gov", + "type": "address" + } + ], + "name": "setGov", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_lender", + "type": "address" + } + ], + "name": "setLender", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_liquidationFactorBps", + "type": "uint256" + } + ], + "name": "setLiquidationFactorBps", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_liquidationFeeBps", + "type": "uint256" + } + ], + "name": "setLiquidationFeeBps", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_liquidationIncentiveBps", + "type": "uint256" + } + ], + "name": "setLiquidationIncentiveBps", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IOracle", + "name": "_oracle", + "type": "address" + } + ], + "name": "setOracle", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_pauseGuardian", + "type": "address" + } + ], + "name": "setPauseGuardian", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_replenishmentIncentiveBps", + "type": "uint256" + } + ], + "name": "setReplenismentIncentiveBps", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "totalDebt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "withdrawOnBehalf", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] \ No newline at end of file diff --git a/abi/firm_simple_escrow.json b/abi/firm_simple_escrow.json new file mode 100644 index 0000000..1d6c925 --- /dev/null +++ b/abi/firm_simple_escrow.json @@ -0,0 +1,84 @@ +[ + { + "inputs": [], + "name": "balance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "market", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "onDeposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "pay", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "token", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } +] \ No newline at end of file diff --git a/abi/fluid_dex_resolver.json b/abi/fluid_dex_resolver.json new file mode 100644 index 0000000..624b0af --- /dev/null +++ b/abi/fluid_dex_resolver.json @@ -0,0 +1,8928 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "factory_", + "type": "address" + }, + { + "internalType": "address", + "name": "liquidity_", + "type": "address" + }, + { + "internalType": "address", + "name": "liquidityResolver_", + "type": "address" + }, + { + "internalType": "address", + "name": "deployer_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "DEPLOYER_CONTRACT", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "FACTORY", + "outputs": [ + { + "internalType": "contract IFluidDexFactory", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "LIQUIDITY", + "outputs": [ + { + "internalType": "contract IFluidLiquidity", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "LIQUIDITY_RESOLVER", + "outputs": [ + { + "internalType": "contract IFluidLiquidityResolver", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dex_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "token0Amt_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token1Amt_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxSharesAmt_", + "type": "uint256" + } + ], + "name": "estimateBorrow", + "outputs": [ + { + "internalType": "uint256", + "name": "shares_", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dex_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "shares_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minToken0Borrow_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minToken1Borrow_", + "type": "uint256" + } + ], + "name": "estimateBorrowPerfect", + "outputs": [ + { + "internalType": "uint256", + "name": "token0Amt_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token1Amt_", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dex_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "token0Amt_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token1Amt_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minSharesAmt_", + "type": "uint256" + } + ], + "name": "estimateDeposit", + "outputs": [ + { + "internalType": "uint256", + "name": "shares_", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dex_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "shares_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxToken0Deposit_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxToken1Deposit_", + "type": "uint256" + } + ], + "name": "estimateDepositPerfect", + "outputs": [ + { + "internalType": "uint256", + "name": "token0Amt_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token1Amt_", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dex_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "token0Amt_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token1Amt_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minSharesAmt_", + "type": "uint256" + } + ], + "name": "estimatePayback", + "outputs": [ + { + "internalType": "uint256", + "name": "shares_", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dex_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "shares_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxToken0Payback_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxToken1Payback_", + "type": "uint256" + } + ], + "name": "estimatePaybackPerfect", + "outputs": [ + { + "internalType": "uint256", + "name": "token0Amt_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token1Amt_", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dex_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "shares_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxToken0_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxToken1_", + "type": "uint256" + } + ], + "name": "estimatePaybackPerfectInOneToken", + "outputs": [ + { + "internalType": "uint256", + "name": "paybackAmt_", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dex_", + "type": "address" + }, + { + "internalType": "bool", + "name": "swap0to1_", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "amountIn_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountOutMin_", + "type": "uint256" + } + ], + "name": "estimateSwapIn", + "outputs": [ + { + "internalType": "uint256", + "name": "amountOut_", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dex_", + "type": "address" + }, + { + "internalType": "bool", + "name": "swap0to1_", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "amountOut_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountInMax_", + "type": "uint256" + } + ], + "name": "estimateSwapOut", + "outputs": [ + { + "internalType": "uint256", + "name": "amountIn_", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dex_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "token0Amt_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token1Amt_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxSharesAmt_", + "type": "uint256" + } + ], + "name": "estimateWithdraw", + "outputs": [ + { + "internalType": "uint256", + "name": "shares_", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dex_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "shares_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minToken0Withdraw_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minToken1Withdraw_", + "type": "uint256" + } + ], + "name": "estimateWithdrawPerfect", + "outputs": [ + { + "internalType": "uint256", + "name": "token0Amt_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token1Amt_", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dex_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "shares_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minToken0_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minToken1_", + "type": "uint256" + } + ], + "name": "estimateWithdrawPerfectInOneToken", + "outputs": [ + { + "internalType": "uint256", + "name": "withdrawAmt_", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getAllDexAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "dexes_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAllDexEntireDatas", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "dex", + "type": "address" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "dexId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "liquidity", + "type": "address" + }, + { + "internalType": "address", + "name": "factory", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "shift", + "type": "address" + }, + { + "internalType": "address", + "name": "admin", + "type": "address" + }, + { + "internalType": "address", + "name": "colOperations", + "type": "address" + }, + { + "internalType": "address", + "name": "debtOperations", + "type": "address" + }, + { + "internalType": "address", + "name": "perfectOperationsAndOracle", + "type": "address" + } + ], + "internalType": "struct IFluidDexT1.Implementations", + "name": "implementations", + "type": "tuple" + }, + { + "internalType": "address", + "name": "deployerContract", + "type": "address" + }, + { + "internalType": "address", + "name": "token0", + "type": "address" + }, + { + "internalType": "address", + "name": "token1", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "supplyToken0Slot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "borrowToken0Slot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "supplyToken1Slot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "borrowToken1Slot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "exchangePriceToken0Slot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "exchangePriceToken1Slot", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "oracleMapping", + "type": "uint256" + } + ], + "internalType": "struct IFluidDexT1.ConstantViews", + "name": "constantViews", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "token0NumeratorPrecision", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token0DenominatorPrecision", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token1NumeratorPrecision", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token1DenominatorPrecision", + "type": "uint256" + } + ], + "internalType": "struct IFluidDexT1.ConstantViews2", + "name": "constantViews2", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bool", + "name": "isSmartCollateralEnabled", + "type": "bool" + }, + { + "internalType": "bool", + "name": "isSmartDebtEnabled", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "fee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "revenueCut", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "upperRange", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lowerRange", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "upperShiftThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lowerShiftThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shiftingTime", + "type": "uint256" + }, + { + "internalType": "address", + "name": "centerPriceAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "hookAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "maxCenterPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minCenterPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "utilizationLimitToken0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "utilizationLimitToken1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxSupplyShares", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxBorrowShares", + "type": "uint256" + } + ], + "internalType": "struct Structs.Configs", + "name": "configs", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "lastStoredPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "centerPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "upperRange", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lowerRange", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "geometricMean", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyToken0ExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowToken0ExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyToken1ExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowToken1ExchangePrice", + "type": "uint256" + } + ], + "internalType": "struct IFluidDexT1.PricesAndExchangePrice", + "name": "pex", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "token0RealReserves", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token1RealReserves", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token0ImaginaryReserves", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token1ImaginaryReserves", + "type": "uint256" + } + ], + "internalType": "struct IFluidDexT1.CollateralReserves", + "name": "colReserves", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "token0Debt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token1Debt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token0RealReserves", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token1RealReserves", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token0ImaginaryReserves", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token1ImaginaryReserves", + "type": "uint256" + } + ], + "internalType": "struct IFluidDexT1.DebtReserves", + "name": "debtReserves", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "lastToLastStoredPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastStoredPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "centerPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastPricesTimeDiff", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "oracleCheckPoint", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "oracleMapping", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalSupplyShares", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBorrowShares", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isSwapAndArbitragePaused", + "type": "bool" + }, + { + "components": [ + { + "internalType": "bool", + "name": "isRangeChangeActive", + "type": "bool" + }, + { + "internalType": "bool", + "name": "isThresholdChangeActive", + "type": "bool" + }, + { + "internalType": "bool", + "name": "isCenterPriceShiftActive", + "type": "bool" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "oldUpper", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "oldLower", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "startTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "oldTime", + "type": "uint256" + } + ], + "internalType": "struct Structs.ShiftData", + "name": "rangeShift", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "oldUpper", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "oldLower", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "startTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "oldTime", + "type": "uint256" + } + ], + "internalType": "struct Structs.ShiftData", + "name": "thresholdShift", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "shiftPercentage", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "startTimestamp", + "type": "uint256" + } + ], + "internalType": "struct Structs.CenterPriceShift", + "name": "centerPriceShift", + "type": "tuple" + } + ], + "internalType": "struct Structs.ShiftChanges", + "name": "shifts", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "token0PerSupplyShare", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token1PerSupplyShare", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token0PerBorrowShare", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token1PerBorrowShare", + "type": "uint256" + } + ], + "internalType": "struct Structs.DexState", + "name": "dexState", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "liquiditySupplyToken0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquiditySupplyToken1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidityBorrowToken0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidityBorrowToken1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidityWithdrawableToken0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidityWithdrawableToken1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidityBorrowableToken0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidityBorrowableToken1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "utilizationLimitToken0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "utilizationLimitToken1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawableUntilUtilizationLimitToken0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawableUntilUtilizationLimitToken1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowableUntilUtilizationLimitToken0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowableUntilUtilizationLimitToken1", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "bool", + "name": "modeWithInterest", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawalLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseWithdrawalLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawable", + "type": "uint256" + } + ], + "internalType": "struct Structs.UserSupplyData", + "name": "liquidityUserSupplyDataToken0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bool", + "name": "modeWithInterest", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawalLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseWithdrawalLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawable", + "type": "uint256" + } + ], + "internalType": "struct Structs.UserSupplyData", + "name": "liquidityUserSupplyDataToken1", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bool", + "name": "modeWithInterest", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "borrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseBorrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxBorrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowable", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimitUtilization", + "type": "uint256" + } + ], + "internalType": "struct Structs.UserBorrowData", + "name": "liquidityUserBorrowDataToken0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bool", + "name": "modeWithInterest", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "borrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseBorrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxBorrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowable", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimitUtilization", + "type": "uint256" + } + ], + "internalType": "struct Structs.UserBorrowData", + "name": "liquidityUserBorrowDataToken1", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "borrowRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "fee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastStoredUtilization", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "storageUpdateThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyRawInterest", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyInterestFree", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowRawInterest", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowInterestFree", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBorrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "revenue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxUtilization", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "version", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "kink", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationZero", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationMax", + "type": "uint256" + } + ], + "internalType": "struct Structs.RateDataV1Params", + "name": "rateDataV1", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "kink1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "kink2", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationZero", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink2", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationMax", + "type": "uint256" + } + ], + "internalType": "struct Structs.RateDataV2Params", + "name": "rateDataV2", + "type": "tuple" + } + ], + "internalType": "struct Structs.RateData", + "name": "rateData", + "type": "tuple" + } + ], + "internalType": "struct Structs.OverallTokenData", + "name": "liquidityTokenData0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "borrowRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "fee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastStoredUtilization", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "storageUpdateThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyRawInterest", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyInterestFree", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowRawInterest", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowInterestFree", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBorrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "revenue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxUtilization", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "version", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "kink", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationZero", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationMax", + "type": "uint256" + } + ], + "internalType": "struct Structs.RateDataV1Params", + "name": "rateDataV1", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "kink1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "kink2", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationZero", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink2", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationMax", + "type": "uint256" + } + ], + "internalType": "struct Structs.RateDataV2Params", + "name": "rateDataV2", + "type": "tuple" + } + ], + "internalType": "struct Structs.RateData", + "name": "rateData", + "type": "tuple" + } + ], + "internalType": "struct Structs.OverallTokenData", + "name": "liquidityTokenData1", + "type": "tuple" + } + ], + "internalType": "struct Structs.SwapLimitsAndAvailability", + "name": "limitsAndAvailability", + "type": "tuple" + } + ], + "internalType": "struct Structs.DexEntireData[]", + "name": "datas_", + "type": "tuple[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dex_", + "type": "address" + } + ], + "name": "getCenterPriceShiftRaw", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "dexId_", + "type": "uint256" + } + ], + "name": "getDexAddress", + "outputs": [ + { + "internalType": "address", + "name": "dex_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dex_", + "type": "address" + } + ], + "name": "getDexCollateralReserves", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "token0RealReserves", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token1RealReserves", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token0ImaginaryReserves", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token1ImaginaryReserves", + "type": "uint256" + } + ], + "internalType": "struct IFluidDexT1.CollateralReserves", + "name": "reserves_", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dex_", + "type": "address" + } + ], + "name": "getDexConfigs", + "outputs": [ + { + "components": [ + { + "internalType": "bool", + "name": "isSmartCollateralEnabled", + "type": "bool" + }, + { + "internalType": "bool", + "name": "isSmartDebtEnabled", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "fee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "revenueCut", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "upperRange", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lowerRange", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "upperShiftThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lowerShiftThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shiftingTime", + "type": "uint256" + }, + { + "internalType": "address", + "name": "centerPriceAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "hookAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "maxCenterPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minCenterPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "utilizationLimitToken0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "utilizationLimitToken1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxSupplyShares", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxBorrowShares", + "type": "uint256" + } + ], + "internalType": "struct Structs.Configs", + "name": "configs_", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dex_", + "type": "address" + } + ], + "name": "getDexConstantsView", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "dexId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "liquidity", + "type": "address" + }, + { + "internalType": "address", + "name": "factory", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "shift", + "type": "address" + }, + { + "internalType": "address", + "name": "admin", + "type": "address" + }, + { + "internalType": "address", + "name": "colOperations", + "type": "address" + }, + { + "internalType": "address", + "name": "debtOperations", + "type": "address" + }, + { + "internalType": "address", + "name": "perfectOperationsAndOracle", + "type": "address" + } + ], + "internalType": "struct IFluidDexT1.Implementations", + "name": "implementations", + "type": "tuple" + }, + { + "internalType": "address", + "name": "deployerContract", + "type": "address" + }, + { + "internalType": "address", + "name": "token0", + "type": "address" + }, + { + "internalType": "address", + "name": "token1", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "supplyToken0Slot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "borrowToken0Slot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "supplyToken1Slot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "borrowToken1Slot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "exchangePriceToken0Slot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "exchangePriceToken1Slot", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "oracleMapping", + "type": "uint256" + } + ], + "internalType": "struct IFluidDexT1.ConstantViews", + "name": "constantsView_", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dex_", + "type": "address" + } + ], + "name": "getDexConstantsView2", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "token0NumeratorPrecision", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token0DenominatorPrecision", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token1NumeratorPrecision", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token1DenominatorPrecision", + "type": "uint256" + } + ], + "internalType": "struct IFluidDexT1.ConstantViews2", + "name": "constantsView2_", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dex_", + "type": "address" + } + ], + "name": "getDexDebtReserves", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "token0Debt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token1Debt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token0RealReserves", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token1RealReserves", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token0ImaginaryReserves", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token1ImaginaryReserves", + "type": "uint256" + } + ], + "internalType": "struct IFluidDexT1.DebtReserves", + "name": "reserves_", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dex_", + "type": "address" + } + ], + "name": "getDexEntireData", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "dex", + "type": "address" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "dexId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "liquidity", + "type": "address" + }, + { + "internalType": "address", + "name": "factory", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "shift", + "type": "address" + }, + { + "internalType": "address", + "name": "admin", + "type": "address" + }, + { + "internalType": "address", + "name": "colOperations", + "type": "address" + }, + { + "internalType": "address", + "name": "debtOperations", + "type": "address" + }, + { + "internalType": "address", + "name": "perfectOperationsAndOracle", + "type": "address" + } + ], + "internalType": "struct IFluidDexT1.Implementations", + "name": "implementations", + "type": "tuple" + }, + { + "internalType": "address", + "name": "deployerContract", + "type": "address" + }, + { + "internalType": "address", + "name": "token0", + "type": "address" + }, + { + "internalType": "address", + "name": "token1", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "supplyToken0Slot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "borrowToken0Slot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "supplyToken1Slot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "borrowToken1Slot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "exchangePriceToken0Slot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "exchangePriceToken1Slot", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "oracleMapping", + "type": "uint256" + } + ], + "internalType": "struct IFluidDexT1.ConstantViews", + "name": "constantViews", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "token0NumeratorPrecision", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token0DenominatorPrecision", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token1NumeratorPrecision", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token1DenominatorPrecision", + "type": "uint256" + } + ], + "internalType": "struct IFluidDexT1.ConstantViews2", + "name": "constantViews2", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bool", + "name": "isSmartCollateralEnabled", + "type": "bool" + }, + { + "internalType": "bool", + "name": "isSmartDebtEnabled", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "fee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "revenueCut", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "upperRange", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lowerRange", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "upperShiftThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lowerShiftThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shiftingTime", + "type": "uint256" + }, + { + "internalType": "address", + "name": "centerPriceAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "hookAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "maxCenterPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minCenterPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "utilizationLimitToken0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "utilizationLimitToken1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxSupplyShares", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxBorrowShares", + "type": "uint256" + } + ], + "internalType": "struct Structs.Configs", + "name": "configs", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "lastStoredPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "centerPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "upperRange", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lowerRange", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "geometricMean", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyToken0ExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowToken0ExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyToken1ExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowToken1ExchangePrice", + "type": "uint256" + } + ], + "internalType": "struct IFluidDexT1.PricesAndExchangePrice", + "name": "pex", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "token0RealReserves", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token1RealReserves", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token0ImaginaryReserves", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token1ImaginaryReserves", + "type": "uint256" + } + ], + "internalType": "struct IFluidDexT1.CollateralReserves", + "name": "colReserves", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "token0Debt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token1Debt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token0RealReserves", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token1RealReserves", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token0ImaginaryReserves", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token1ImaginaryReserves", + "type": "uint256" + } + ], + "internalType": "struct IFluidDexT1.DebtReserves", + "name": "debtReserves", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "lastToLastStoredPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastStoredPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "centerPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastPricesTimeDiff", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "oracleCheckPoint", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "oracleMapping", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalSupplyShares", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBorrowShares", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isSwapAndArbitragePaused", + "type": "bool" + }, + { + "components": [ + { + "internalType": "bool", + "name": "isRangeChangeActive", + "type": "bool" + }, + { + "internalType": "bool", + "name": "isThresholdChangeActive", + "type": "bool" + }, + { + "internalType": "bool", + "name": "isCenterPriceShiftActive", + "type": "bool" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "oldUpper", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "oldLower", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "startTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "oldTime", + "type": "uint256" + } + ], + "internalType": "struct Structs.ShiftData", + "name": "rangeShift", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "oldUpper", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "oldLower", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "startTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "oldTime", + "type": "uint256" + } + ], + "internalType": "struct Structs.ShiftData", + "name": "thresholdShift", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "shiftPercentage", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "startTimestamp", + "type": "uint256" + } + ], + "internalType": "struct Structs.CenterPriceShift", + "name": "centerPriceShift", + "type": "tuple" + } + ], + "internalType": "struct Structs.ShiftChanges", + "name": "shifts", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "token0PerSupplyShare", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token1PerSupplyShare", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token0PerBorrowShare", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token1PerBorrowShare", + "type": "uint256" + } + ], + "internalType": "struct Structs.DexState", + "name": "dexState", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "liquiditySupplyToken0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquiditySupplyToken1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidityBorrowToken0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidityBorrowToken1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidityWithdrawableToken0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidityWithdrawableToken1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidityBorrowableToken0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidityBorrowableToken1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "utilizationLimitToken0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "utilizationLimitToken1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawableUntilUtilizationLimitToken0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawableUntilUtilizationLimitToken1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowableUntilUtilizationLimitToken0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowableUntilUtilizationLimitToken1", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "bool", + "name": "modeWithInterest", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawalLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseWithdrawalLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawable", + "type": "uint256" + } + ], + "internalType": "struct Structs.UserSupplyData", + "name": "liquidityUserSupplyDataToken0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bool", + "name": "modeWithInterest", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawalLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseWithdrawalLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawable", + "type": "uint256" + } + ], + "internalType": "struct Structs.UserSupplyData", + "name": "liquidityUserSupplyDataToken1", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bool", + "name": "modeWithInterest", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "borrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseBorrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxBorrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowable", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimitUtilization", + "type": "uint256" + } + ], + "internalType": "struct Structs.UserBorrowData", + "name": "liquidityUserBorrowDataToken0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bool", + "name": "modeWithInterest", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "borrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseBorrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxBorrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowable", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimitUtilization", + "type": "uint256" + } + ], + "internalType": "struct Structs.UserBorrowData", + "name": "liquidityUserBorrowDataToken1", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "borrowRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "fee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastStoredUtilization", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "storageUpdateThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyRawInterest", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyInterestFree", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowRawInterest", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowInterestFree", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBorrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "revenue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxUtilization", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "version", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "kink", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationZero", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationMax", + "type": "uint256" + } + ], + "internalType": "struct Structs.RateDataV1Params", + "name": "rateDataV1", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "kink1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "kink2", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationZero", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink2", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationMax", + "type": "uint256" + } + ], + "internalType": "struct Structs.RateDataV2Params", + "name": "rateDataV2", + "type": "tuple" + } + ], + "internalType": "struct Structs.RateData", + "name": "rateData", + "type": "tuple" + } + ], + "internalType": "struct Structs.OverallTokenData", + "name": "liquidityTokenData0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "borrowRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "fee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastStoredUtilization", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "storageUpdateThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyRawInterest", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyInterestFree", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowRawInterest", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowInterestFree", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBorrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "revenue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxUtilization", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "version", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "kink", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationZero", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationMax", + "type": "uint256" + } + ], + "internalType": "struct Structs.RateDataV1Params", + "name": "rateDataV1", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "kink1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "kink2", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationZero", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink2", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationMax", + "type": "uint256" + } + ], + "internalType": "struct Structs.RateDataV2Params", + "name": "rateDataV2", + "type": "tuple" + } + ], + "internalType": "struct Structs.RateData", + "name": "rateData", + "type": "tuple" + } + ], + "internalType": "struct Structs.OverallTokenData", + "name": "liquidityTokenData1", + "type": "tuple" + } + ], + "internalType": "struct Structs.SwapLimitsAndAvailability", + "name": "limitsAndAvailability", + "type": "tuple" + } + ], + "internalType": "struct Structs.DexEntireData", + "name": "data_", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "dexes_", + "type": "address[]" + } + ], + "name": "getDexEntireDatas", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "dex", + "type": "address" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "dexId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "liquidity", + "type": "address" + }, + { + "internalType": "address", + "name": "factory", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "shift", + "type": "address" + }, + { + "internalType": "address", + "name": "admin", + "type": "address" + }, + { + "internalType": "address", + "name": "colOperations", + "type": "address" + }, + { + "internalType": "address", + "name": "debtOperations", + "type": "address" + }, + { + "internalType": "address", + "name": "perfectOperationsAndOracle", + "type": "address" + } + ], + "internalType": "struct IFluidDexT1.Implementations", + "name": "implementations", + "type": "tuple" + }, + { + "internalType": "address", + "name": "deployerContract", + "type": "address" + }, + { + "internalType": "address", + "name": "token0", + "type": "address" + }, + { + "internalType": "address", + "name": "token1", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "supplyToken0Slot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "borrowToken0Slot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "supplyToken1Slot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "borrowToken1Slot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "exchangePriceToken0Slot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "exchangePriceToken1Slot", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "oracleMapping", + "type": "uint256" + } + ], + "internalType": "struct IFluidDexT1.ConstantViews", + "name": "constantViews", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "token0NumeratorPrecision", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token0DenominatorPrecision", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token1NumeratorPrecision", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token1DenominatorPrecision", + "type": "uint256" + } + ], + "internalType": "struct IFluidDexT1.ConstantViews2", + "name": "constantViews2", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bool", + "name": "isSmartCollateralEnabled", + "type": "bool" + }, + { + "internalType": "bool", + "name": "isSmartDebtEnabled", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "fee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "revenueCut", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "upperRange", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lowerRange", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "upperShiftThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lowerShiftThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shiftingTime", + "type": "uint256" + }, + { + "internalType": "address", + "name": "centerPriceAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "hookAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "maxCenterPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minCenterPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "utilizationLimitToken0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "utilizationLimitToken1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxSupplyShares", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxBorrowShares", + "type": "uint256" + } + ], + "internalType": "struct Structs.Configs", + "name": "configs", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "lastStoredPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "centerPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "upperRange", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lowerRange", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "geometricMean", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyToken0ExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowToken0ExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyToken1ExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowToken1ExchangePrice", + "type": "uint256" + } + ], + "internalType": "struct IFluidDexT1.PricesAndExchangePrice", + "name": "pex", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "token0RealReserves", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token1RealReserves", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token0ImaginaryReserves", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token1ImaginaryReserves", + "type": "uint256" + } + ], + "internalType": "struct IFluidDexT1.CollateralReserves", + "name": "colReserves", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "token0Debt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token1Debt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token0RealReserves", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token1RealReserves", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token0ImaginaryReserves", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token1ImaginaryReserves", + "type": "uint256" + } + ], + "internalType": "struct IFluidDexT1.DebtReserves", + "name": "debtReserves", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "lastToLastStoredPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastStoredPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "centerPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastPricesTimeDiff", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "oracleCheckPoint", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "oracleMapping", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalSupplyShares", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBorrowShares", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isSwapAndArbitragePaused", + "type": "bool" + }, + { + "components": [ + { + "internalType": "bool", + "name": "isRangeChangeActive", + "type": "bool" + }, + { + "internalType": "bool", + "name": "isThresholdChangeActive", + "type": "bool" + }, + { + "internalType": "bool", + "name": "isCenterPriceShiftActive", + "type": "bool" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "oldUpper", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "oldLower", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "startTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "oldTime", + "type": "uint256" + } + ], + "internalType": "struct Structs.ShiftData", + "name": "rangeShift", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "oldUpper", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "oldLower", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "startTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "oldTime", + "type": "uint256" + } + ], + "internalType": "struct Structs.ShiftData", + "name": "thresholdShift", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "shiftPercentage", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "startTimestamp", + "type": "uint256" + } + ], + "internalType": "struct Structs.CenterPriceShift", + "name": "centerPriceShift", + "type": "tuple" + } + ], + "internalType": "struct Structs.ShiftChanges", + "name": "shifts", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "token0PerSupplyShare", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token1PerSupplyShare", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token0PerBorrowShare", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token1PerBorrowShare", + "type": "uint256" + } + ], + "internalType": "struct Structs.DexState", + "name": "dexState", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "liquiditySupplyToken0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquiditySupplyToken1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidityBorrowToken0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidityBorrowToken1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidityWithdrawableToken0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidityWithdrawableToken1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidityBorrowableToken0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidityBorrowableToken1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "utilizationLimitToken0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "utilizationLimitToken1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawableUntilUtilizationLimitToken0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawableUntilUtilizationLimitToken1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowableUntilUtilizationLimitToken0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowableUntilUtilizationLimitToken1", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "bool", + "name": "modeWithInterest", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawalLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseWithdrawalLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawable", + "type": "uint256" + } + ], + "internalType": "struct Structs.UserSupplyData", + "name": "liquidityUserSupplyDataToken0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bool", + "name": "modeWithInterest", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawalLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseWithdrawalLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawable", + "type": "uint256" + } + ], + "internalType": "struct Structs.UserSupplyData", + "name": "liquidityUserSupplyDataToken1", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bool", + "name": "modeWithInterest", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "borrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseBorrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxBorrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowable", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimitUtilization", + "type": "uint256" + } + ], + "internalType": "struct Structs.UserBorrowData", + "name": "liquidityUserBorrowDataToken0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bool", + "name": "modeWithInterest", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "borrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseBorrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxBorrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowable", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimitUtilization", + "type": "uint256" + } + ], + "internalType": "struct Structs.UserBorrowData", + "name": "liquidityUserBorrowDataToken1", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "borrowRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "fee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastStoredUtilization", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "storageUpdateThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyRawInterest", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyInterestFree", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowRawInterest", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowInterestFree", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBorrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "revenue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxUtilization", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "version", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "kink", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationZero", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationMax", + "type": "uint256" + } + ], + "internalType": "struct Structs.RateDataV1Params", + "name": "rateDataV1", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "kink1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "kink2", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationZero", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink2", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationMax", + "type": "uint256" + } + ], + "internalType": "struct Structs.RateDataV2Params", + "name": "rateDataV2", + "type": "tuple" + } + ], + "internalType": "struct Structs.RateData", + "name": "rateData", + "type": "tuple" + } + ], + "internalType": "struct Structs.OverallTokenData", + "name": "liquidityTokenData0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "borrowRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "fee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastStoredUtilization", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "storageUpdateThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyRawInterest", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyInterestFree", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowRawInterest", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowInterestFree", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBorrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "revenue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxUtilization", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "version", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "kink", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationZero", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationMax", + "type": "uint256" + } + ], + "internalType": "struct Structs.RateDataV1Params", + "name": "rateDataV1", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "kink1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "kink2", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationZero", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink2", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationMax", + "type": "uint256" + } + ], + "internalType": "struct Structs.RateDataV2Params", + "name": "rateDataV2", + "type": "tuple" + } + ], + "internalType": "struct Structs.RateData", + "name": "rateData", + "type": "tuple" + } + ], + "internalType": "struct Structs.OverallTokenData", + "name": "liquidityTokenData1", + "type": "tuple" + } + ], + "internalType": "struct Structs.SwapLimitsAndAvailability", + "name": "limitsAndAvailability", + "type": "tuple" + } + ], + "internalType": "struct Structs.DexEntireData[]", + "name": "datas_", + "type": "tuple[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dex_", + "type": "address" + } + ], + "name": "getDexId", + "outputs": [ + { + "internalType": "uint256", + "name": "id_", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dex_", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "secondsAgos_", + "type": "uint256[]" + } + ], + "name": "getDexOraclePrice", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "twap1by0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lowestPrice1by0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "highestPrice1by0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "twap0by1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lowestPrice0by1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "highestPrice0by1", + "type": "uint256" + } + ], + "internalType": "struct IFluidDexT1.Oracle[]", + "name": "twaps_", + "type": "tuple[]" + }, + { + "internalType": "uint256", + "name": "currentPrice_", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dex_", + "type": "address" + } + ], + "name": "getDexPricesAndExchangePrices", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "lastStoredPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "centerPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "upperRange", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lowerRange", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "geometricMean", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyToken0ExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowToken0ExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyToken1ExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowToken1ExchangePrice", + "type": "uint256" + } + ], + "internalType": "struct IFluidDexT1.PricesAndExchangePrice", + "name": "pex_", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dex_", + "type": "address" + } + ], + "name": "getDexState", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "lastToLastStoredPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastStoredPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "centerPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastPricesTimeDiff", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "oracleCheckPoint", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "oracleMapping", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalSupplyShares", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBorrowShares", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isSwapAndArbitragePaused", + "type": "bool" + }, + { + "components": [ + { + "internalType": "bool", + "name": "isRangeChangeActive", + "type": "bool" + }, + { + "internalType": "bool", + "name": "isThresholdChangeActive", + "type": "bool" + }, + { + "internalType": "bool", + "name": "isCenterPriceShiftActive", + "type": "bool" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "oldUpper", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "oldLower", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "startTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "oldTime", + "type": "uint256" + } + ], + "internalType": "struct Structs.ShiftData", + "name": "rangeShift", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "oldUpper", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "oldLower", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "startTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "oldTime", + "type": "uint256" + } + ], + "internalType": "struct Structs.ShiftData", + "name": "thresholdShift", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "shiftPercentage", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "startTimestamp", + "type": "uint256" + } + ], + "internalType": "struct Structs.CenterPriceShift", + "name": "centerPriceShift", + "type": "tuple" + } + ], + "internalType": "struct Structs.ShiftChanges", + "name": "shifts", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "token0PerSupplyShare", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token1PerSupplyShare", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token0PerBorrowShare", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token1PerBorrowShare", + "type": "uint256" + } + ], + "internalType": "struct Structs.DexState", + "name": "state_", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dex_", + "type": "address" + } + ], + "name": "getDexSwapLimitsAndAvailability", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "liquiditySupplyToken0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquiditySupplyToken1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidityBorrowToken0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidityBorrowToken1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidityWithdrawableToken0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidityWithdrawableToken1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidityBorrowableToken0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidityBorrowableToken1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "utilizationLimitToken0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "utilizationLimitToken1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawableUntilUtilizationLimitToken0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawableUntilUtilizationLimitToken1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowableUntilUtilizationLimitToken0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowableUntilUtilizationLimitToken1", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "bool", + "name": "modeWithInterest", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawalLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseWithdrawalLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawable", + "type": "uint256" + } + ], + "internalType": "struct Structs.UserSupplyData", + "name": "liquidityUserSupplyDataToken0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bool", + "name": "modeWithInterest", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawalLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseWithdrawalLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawable", + "type": "uint256" + } + ], + "internalType": "struct Structs.UserSupplyData", + "name": "liquidityUserSupplyDataToken1", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bool", + "name": "modeWithInterest", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "borrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseBorrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxBorrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowable", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimitUtilization", + "type": "uint256" + } + ], + "internalType": "struct Structs.UserBorrowData", + "name": "liquidityUserBorrowDataToken0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bool", + "name": "modeWithInterest", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "borrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseBorrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxBorrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowable", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimitUtilization", + "type": "uint256" + } + ], + "internalType": "struct Structs.UserBorrowData", + "name": "liquidityUserBorrowDataToken1", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "borrowRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "fee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastStoredUtilization", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "storageUpdateThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyRawInterest", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyInterestFree", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowRawInterest", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowInterestFree", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBorrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "revenue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxUtilization", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "version", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "kink", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationZero", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationMax", + "type": "uint256" + } + ], + "internalType": "struct Structs.RateDataV1Params", + "name": "rateDataV1", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "kink1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "kink2", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationZero", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink2", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationMax", + "type": "uint256" + } + ], + "internalType": "struct Structs.RateDataV2Params", + "name": "rateDataV2", + "type": "tuple" + } + ], + "internalType": "struct Structs.RateData", + "name": "rateData", + "type": "tuple" + } + ], + "internalType": "struct Structs.OverallTokenData", + "name": "liquidityTokenData0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "borrowRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "fee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastStoredUtilization", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "storageUpdateThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyRawInterest", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyInterestFree", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowRawInterest", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowInterestFree", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBorrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "revenue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxUtilization", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "version", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "kink", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationZero", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationMax", + "type": "uint256" + } + ], + "internalType": "struct Structs.RateDataV1Params", + "name": "rateDataV1", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "kink1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "kink2", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationZero", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink2", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationMax", + "type": "uint256" + } + ], + "internalType": "struct Structs.RateDataV2Params", + "name": "rateDataV2", + "type": "tuple" + } + ], + "internalType": "struct Structs.RateData", + "name": "rateData", + "type": "tuple" + } + ], + "internalType": "struct Structs.OverallTokenData", + "name": "liquidityTokenData1", + "type": "tuple" + } + ], + "internalType": "struct Structs.SwapLimitsAndAvailability", + "name": "limitsAndAvailability_", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dex_", + "type": "address" + } + ], + "name": "getDexTokens", + "outputs": [ + { + "internalType": "address", + "name": "token0_", + "type": "address" + }, + { + "internalType": "address", + "name": "token1_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dex_", + "type": "address" + } + ], + "name": "getDexVariables2Raw", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dex_", + "type": "address" + } + ], + "name": "getDexVariablesRaw", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dex_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index_", + "type": "uint256" + } + ], + "name": "getOracleRaw", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dex_", + "type": "address" + } + ], + "name": "getRangeShiftRaw", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dex_", + "type": "address" + } + ], + "name": "getThresholdShiftRaw", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dex_", + "type": "address" + } + ], + "name": "getTotalBorrowSharesRaw", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTotalDexes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dex_", + "type": "address" + } + ], + "name": "getTotalSupplySharesRaw", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dex_", + "type": "address" + }, + { + "internalType": "address", + "name": "user_", + "type": "address" + } + ], + "name": "getUserBorrowData", + "outputs": [ + { + "components": [ + { + "internalType": "bool", + "name": "isAllowed", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "borrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseBorrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxBorrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowable", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "bool", + "name": "modeWithInterest", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "borrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseBorrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxBorrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowable", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimitUtilization", + "type": "uint256" + } + ], + "internalType": "struct Structs.UserBorrowData", + "name": "liquidityUserBorrowDataToken0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bool", + "name": "modeWithInterest", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "borrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseBorrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxBorrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowable", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimitUtilization", + "type": "uint256" + } + ], + "internalType": "struct Structs.UserBorrowData", + "name": "liquidityUserBorrowDataToken1", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "borrowRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "fee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastStoredUtilization", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "storageUpdateThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyRawInterest", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyInterestFree", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowRawInterest", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowInterestFree", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBorrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "revenue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxUtilization", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "version", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "kink", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationZero", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationMax", + "type": "uint256" + } + ], + "internalType": "struct Structs.RateDataV1Params", + "name": "rateDataV1", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "kink1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "kink2", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationZero", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink2", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationMax", + "type": "uint256" + } + ], + "internalType": "struct Structs.RateDataV2Params", + "name": "rateDataV2", + "type": "tuple" + } + ], + "internalType": "struct Structs.RateData", + "name": "rateData", + "type": "tuple" + } + ], + "internalType": "struct Structs.OverallTokenData", + "name": "liquidityTokenData0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "borrowRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "fee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastStoredUtilization", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "storageUpdateThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyRawInterest", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyInterestFree", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowRawInterest", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowInterestFree", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBorrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "revenue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxUtilization", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "version", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "kink", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationZero", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationMax", + "type": "uint256" + } + ], + "internalType": "struct Structs.RateDataV1Params", + "name": "rateDataV1", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "kink1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "kink2", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationZero", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink2", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationMax", + "type": "uint256" + } + ], + "internalType": "struct Structs.RateDataV2Params", + "name": "rateDataV2", + "type": "tuple" + } + ], + "internalType": "struct Structs.RateData", + "name": "rateData", + "type": "tuple" + } + ], + "internalType": "struct Structs.OverallTokenData", + "name": "liquidityTokenData1", + "type": "tuple" + } + ], + "internalType": "struct Structs.UserBorrowData", + "name": "userBorrowData_", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dex_", + "type": "address" + }, + { + "internalType": "address", + "name": "user_", + "type": "address" + } + ], + "name": "getUserBorrowDataRaw", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dex_", + "type": "address" + }, + { + "internalType": "address[]", + "name": "users_", + "type": "address[]" + } + ], + "name": "getUserBorrowDatas", + "outputs": [ + { + "components": [ + { + "internalType": "bool", + "name": "isAllowed", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "borrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseBorrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxBorrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowable", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "bool", + "name": "modeWithInterest", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "borrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseBorrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxBorrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowable", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimitUtilization", + "type": "uint256" + } + ], + "internalType": "struct Structs.UserBorrowData", + "name": "liquidityUserBorrowDataToken0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bool", + "name": "modeWithInterest", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "borrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseBorrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxBorrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowable", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimitUtilization", + "type": "uint256" + } + ], + "internalType": "struct Structs.UserBorrowData", + "name": "liquidityUserBorrowDataToken1", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "borrowRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "fee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastStoredUtilization", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "storageUpdateThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyRawInterest", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyInterestFree", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowRawInterest", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowInterestFree", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBorrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "revenue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxUtilization", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "version", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "kink", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationZero", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationMax", + "type": "uint256" + } + ], + "internalType": "struct Structs.RateDataV1Params", + "name": "rateDataV1", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "kink1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "kink2", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationZero", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink2", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationMax", + "type": "uint256" + } + ], + "internalType": "struct Structs.RateDataV2Params", + "name": "rateDataV2", + "type": "tuple" + } + ], + "internalType": "struct Structs.RateData", + "name": "rateData", + "type": "tuple" + } + ], + "internalType": "struct Structs.OverallTokenData", + "name": "liquidityTokenData0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "borrowRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "fee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastStoredUtilization", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "storageUpdateThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyRawInterest", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyInterestFree", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowRawInterest", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowInterestFree", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBorrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "revenue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxUtilization", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "version", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "kink", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationZero", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationMax", + "type": "uint256" + } + ], + "internalType": "struct Structs.RateDataV1Params", + "name": "rateDataV1", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "kink1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "kink2", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationZero", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink2", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationMax", + "type": "uint256" + } + ], + "internalType": "struct Structs.RateDataV2Params", + "name": "rateDataV2", + "type": "tuple" + } + ], + "internalType": "struct Structs.RateData", + "name": "rateData", + "type": "tuple" + } + ], + "internalType": "struct Structs.OverallTokenData", + "name": "liquidityTokenData1", + "type": "tuple" + } + ], + "internalType": "struct Structs.UserBorrowData[]", + "name": "userBorrowingsData_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dex_", + "type": "address" + }, + { + "internalType": "address[]", + "name": "users_", + "type": "address[]" + } + ], + "name": "getUserBorrowSupplyDatas", + "outputs": [ + { + "components": [ + { + "internalType": "bool", + "name": "isAllowed", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawalLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseWithdrawalLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawable", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "bool", + "name": "modeWithInterest", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawalLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseWithdrawalLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawable", + "type": "uint256" + } + ], + "internalType": "struct Structs.UserSupplyData", + "name": "liquidityUserSupplyDataToken0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bool", + "name": "modeWithInterest", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawalLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseWithdrawalLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawable", + "type": "uint256" + } + ], + "internalType": "struct Structs.UserSupplyData", + "name": "liquidityUserSupplyDataToken1", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "borrowRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "fee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastStoredUtilization", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "storageUpdateThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyRawInterest", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyInterestFree", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowRawInterest", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowInterestFree", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBorrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "revenue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxUtilization", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "version", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "kink", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationZero", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationMax", + "type": "uint256" + } + ], + "internalType": "struct Structs.RateDataV1Params", + "name": "rateDataV1", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "kink1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "kink2", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationZero", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink2", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationMax", + "type": "uint256" + } + ], + "internalType": "struct Structs.RateDataV2Params", + "name": "rateDataV2", + "type": "tuple" + } + ], + "internalType": "struct Structs.RateData", + "name": "rateData", + "type": "tuple" + } + ], + "internalType": "struct Structs.OverallTokenData", + "name": "liquidityTokenData0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "borrowRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "fee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastStoredUtilization", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "storageUpdateThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyRawInterest", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyInterestFree", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowRawInterest", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowInterestFree", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBorrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "revenue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxUtilization", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "version", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "kink", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationZero", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationMax", + "type": "uint256" + } + ], + "internalType": "struct Structs.RateDataV1Params", + "name": "rateDataV1", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "kink1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "kink2", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationZero", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink2", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationMax", + "type": "uint256" + } + ], + "internalType": "struct Structs.RateDataV2Params", + "name": "rateDataV2", + "type": "tuple" + } + ], + "internalType": "struct Structs.RateData", + "name": "rateData", + "type": "tuple" + } + ], + "internalType": "struct Structs.OverallTokenData", + "name": "liquidityTokenData1", + "type": "tuple" + } + ], + "internalType": "struct Structs.UserSupplyData[]", + "name": "userSuppliesData_", + "type": "tuple[]" + }, + { + "components": [ + { + "internalType": "bool", + "name": "isAllowed", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "borrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseBorrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxBorrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowable", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "bool", + "name": "modeWithInterest", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "borrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseBorrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxBorrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowable", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimitUtilization", + "type": "uint256" + } + ], + "internalType": "struct Structs.UserBorrowData", + "name": "liquidityUserBorrowDataToken0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bool", + "name": "modeWithInterest", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "borrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseBorrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxBorrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowable", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimitUtilization", + "type": "uint256" + } + ], + "internalType": "struct Structs.UserBorrowData", + "name": "liquidityUserBorrowDataToken1", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "borrowRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "fee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastStoredUtilization", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "storageUpdateThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyRawInterest", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyInterestFree", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowRawInterest", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowInterestFree", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBorrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "revenue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxUtilization", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "version", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "kink", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationZero", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationMax", + "type": "uint256" + } + ], + "internalType": "struct Structs.RateDataV1Params", + "name": "rateDataV1", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "kink1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "kink2", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationZero", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink2", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationMax", + "type": "uint256" + } + ], + "internalType": "struct Structs.RateDataV2Params", + "name": "rateDataV2", + "type": "tuple" + } + ], + "internalType": "struct Structs.RateData", + "name": "rateData", + "type": "tuple" + } + ], + "internalType": "struct Structs.OverallTokenData", + "name": "liquidityTokenData0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "borrowRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "fee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastStoredUtilization", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "storageUpdateThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyRawInterest", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyInterestFree", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowRawInterest", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowInterestFree", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBorrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "revenue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxUtilization", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "version", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "kink", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationZero", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationMax", + "type": "uint256" + } + ], + "internalType": "struct Structs.RateDataV1Params", + "name": "rateDataV1", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "kink1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "kink2", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationZero", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink2", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationMax", + "type": "uint256" + } + ], + "internalType": "struct Structs.RateDataV2Params", + "name": "rateDataV2", + "type": "tuple" + } + ], + "internalType": "struct Structs.RateData", + "name": "rateData", + "type": "tuple" + } + ], + "internalType": "struct Structs.OverallTokenData", + "name": "liquidityTokenData1", + "type": "tuple" + } + ], + "internalType": "struct Structs.UserBorrowData[]", + "name": "userBorrowingsData_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dex_", + "type": "address" + }, + { + "internalType": "address", + "name": "user_", + "type": "address" + } + ], + "name": "getUserSupplyData", + "outputs": [ + { + "components": [ + { + "internalType": "bool", + "name": "isAllowed", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawalLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseWithdrawalLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawable", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "bool", + "name": "modeWithInterest", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawalLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseWithdrawalLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawable", + "type": "uint256" + } + ], + "internalType": "struct Structs.UserSupplyData", + "name": "liquidityUserSupplyDataToken0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bool", + "name": "modeWithInterest", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawalLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseWithdrawalLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawable", + "type": "uint256" + } + ], + "internalType": "struct Structs.UserSupplyData", + "name": "liquidityUserSupplyDataToken1", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "borrowRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "fee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastStoredUtilization", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "storageUpdateThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyRawInterest", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyInterestFree", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowRawInterest", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowInterestFree", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBorrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "revenue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxUtilization", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "version", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "kink", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationZero", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationMax", + "type": "uint256" + } + ], + "internalType": "struct Structs.RateDataV1Params", + "name": "rateDataV1", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "kink1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "kink2", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationZero", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink2", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationMax", + "type": "uint256" + } + ], + "internalType": "struct Structs.RateDataV2Params", + "name": "rateDataV2", + "type": "tuple" + } + ], + "internalType": "struct Structs.RateData", + "name": "rateData", + "type": "tuple" + } + ], + "internalType": "struct Structs.OverallTokenData", + "name": "liquidityTokenData0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "borrowRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "fee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastStoredUtilization", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "storageUpdateThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyRawInterest", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyInterestFree", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowRawInterest", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowInterestFree", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBorrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "revenue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxUtilization", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "version", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "kink", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationZero", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationMax", + "type": "uint256" + } + ], + "internalType": "struct Structs.RateDataV1Params", + "name": "rateDataV1", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "kink1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "kink2", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationZero", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink2", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationMax", + "type": "uint256" + } + ], + "internalType": "struct Structs.RateDataV2Params", + "name": "rateDataV2", + "type": "tuple" + } + ], + "internalType": "struct Structs.RateData", + "name": "rateData", + "type": "tuple" + } + ], + "internalType": "struct Structs.OverallTokenData", + "name": "liquidityTokenData1", + "type": "tuple" + } + ], + "internalType": "struct Structs.UserSupplyData", + "name": "userSupplyData_", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dex_", + "type": "address" + }, + { + "internalType": "address", + "name": "user_", + "type": "address" + } + ], + "name": "getUserSupplyDataRaw", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dex_", + "type": "address" + }, + { + "internalType": "address[]", + "name": "users_", + "type": "address[]" + } + ], + "name": "getUserSupplyDatas", + "outputs": [ + { + "components": [ + { + "internalType": "bool", + "name": "isAllowed", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawalLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseWithdrawalLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawable", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "bool", + "name": "modeWithInterest", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawalLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseWithdrawalLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawable", + "type": "uint256" + } + ], + "internalType": "struct Structs.UserSupplyData", + "name": "liquidityUserSupplyDataToken0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bool", + "name": "modeWithInterest", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawalLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseWithdrawalLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawable", + "type": "uint256" + } + ], + "internalType": "struct Structs.UserSupplyData", + "name": "liquidityUserSupplyDataToken1", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "borrowRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "fee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastStoredUtilization", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "storageUpdateThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyRawInterest", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyInterestFree", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowRawInterest", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowInterestFree", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBorrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "revenue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxUtilization", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "version", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "kink", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationZero", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationMax", + "type": "uint256" + } + ], + "internalType": "struct Structs.RateDataV1Params", + "name": "rateDataV1", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "kink1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "kink2", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationZero", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink2", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationMax", + "type": "uint256" + } + ], + "internalType": "struct Structs.RateDataV2Params", + "name": "rateDataV2", + "type": "tuple" + } + ], + "internalType": "struct Structs.RateData", + "name": "rateData", + "type": "tuple" + } + ], + "internalType": "struct Structs.OverallTokenData", + "name": "liquidityTokenData0", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "borrowRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "fee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastStoredUtilization", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "storageUpdateThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyRawInterest", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyInterestFree", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowRawInterest", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowInterestFree", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBorrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "revenue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxUtilization", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "version", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "kink", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationZero", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationMax", + "type": "uint256" + } + ], + "internalType": "struct Structs.RateDataV1Params", + "name": "rateDataV1", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "kink1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "kink2", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationZero", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationKink2", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rateAtUtilizationMax", + "type": "uint256" + } + ], + "internalType": "struct Structs.RateDataV2Params", + "name": "rateDataV2", + "type": "tuple" + } + ], + "internalType": "struct Structs.RateData", + "name": "rateData", + "type": "tuple" + } + ], + "internalType": "struct Structs.OverallTokenData", + "name": "liquidityTokenData1", + "type": "tuple" + } + ], + "internalType": "struct Structs.UserSupplyData[]", + "name": "userSuppliesData_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + } +] \ No newline at end of file diff --git a/abi/fluid_vault_position_resolver.json b/abi/fluid_vault_position_resolver.json new file mode 100644 index 0000000..e160513 --- /dev/null +++ b/abi/fluid_vault_position_resolver.json @@ -0,0 +1,150 @@ +[ + { + "inputs": [ + { + "internalType": "contract IFluidVaultResolver", + "name": "vaultResolver_", + "type": "address" + }, + { + "internalType": "contract IFluidVaultFactory", + "name": "vaultFactory_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "FluidVaultPositionsResolver__AddressZero", + "type": "error" + }, + { + "inputs": [], + "name": "FACTORY", + "outputs": [ + { + "internalType": "contract IFluidVaultFactory", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "VAULT_RESOLVER", + "outputs": [ + { + "internalType": "contract IFluidVaultResolver", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vault_", + "type": "address" + } + ], + "name": "getAllVaultNftIds", + "outputs": [ + { + "internalType": "uint256[]", + "name": "nftIds_", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vault_", + "type": "address" + } + ], + "name": "getAllVaultPositions", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "nftId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrow", + "type": "uint256" + } + ], + "internalType": "struct Structs.UserPosition[]", + "name": "positions_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "nftIds_", + "type": "uint256[]" + } + ], + "name": "getPositionsForNftIds", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "nftId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrow", + "type": "uint256" + } + ], + "internalType": "struct Structs.UserPosition[]", + "name": "positions_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + } +] \ No newline at end of file diff --git a/abi/fluid_vault_resolver.json b/abi/fluid_vault_resolver.json new file mode 100644 index 0000000..b1be3fe --- /dev/null +++ b/abi/fluid_vault_resolver.json @@ -0,0 +1,3984 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "factory_", + "type": "address" + }, + { + "internalType": "address", + "name": "liquidityResolver_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "FACTORY", + "outputs": [ + { + "internalType": "contract IFluidVaultFactory", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "LIQUIDITY_RESOLVER", + "outputs": [ + { + "internalType": "contract IFluidLiquidityResolver", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "slot_", + "type": "uint256" + }, + { + "internalType": "int256", + "name": "key1_", + "type": "int256" + }, + { + "internalType": "uint256", + "name": "key2_", + "type": "uint256" + } + ], + "name": "calculateDoubleIntUintMapping", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "slot_", + "type": "uint256" + }, + { + "internalType": "int256", + "name": "key_", + "type": "int256" + } + ], + "name": "calculateStorageSlotIntMapping", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "slot_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "key_", + "type": "uint256" + } + ], + "name": "calculateStorageSlotUintMapping", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vault_", + "type": "address" + } + ], + "name": "getAbsorbedDustDebt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vault_", + "type": "address" + } + ], + "name": "getAbsorbedLiquidityRaw", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAllVaultsAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "vaults_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAllVaultsLiquidation", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "vault", + "type": "address" + }, + { + "internalType": "address", + "name": "token0In", + "type": "address" + }, + { + "internalType": "address", + "name": "token0Out", + "type": "address" + }, + { + "internalType": "address", + "name": "token1In", + "type": "address" + }, + { + "internalType": "address", + "name": "token1Out", + "type": "address" + }, + { + "internalType": "uint256", + "name": "inAmt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "outAmt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "inAmtWithAbsorb", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "outAmtWithAbsorb", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "absorbAvailable", + "type": "bool" + } + ], + "internalType": "struct Structs.LiquidationStruct[]", + "name": "liquidationsData_", + "type": "tuple[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vault_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "branch_", + "type": "uint256" + } + ], + "name": "getBranchDataRaw", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vault_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index_", + "type": "uint256" + } + ], + "name": "getContractForDeployerIndex", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vault_", + "type": "address" + } + ], + "name": "getDexFromAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "vaults_", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "tokensInAmt_", + "type": "uint256[]" + } + ], + "name": "getMultipleVaultsLiquidation", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "vault", + "type": "address" + }, + { + "internalType": "address", + "name": "token0In", + "type": "address" + }, + { + "internalType": "address", + "name": "token0Out", + "type": "address" + }, + { + "internalType": "address", + "name": "token1In", + "type": "address" + }, + { + "internalType": "address", + "name": "token1Out", + "type": "address" + }, + { + "internalType": "uint256", + "name": "inAmt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "outAmt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "inAmtWithAbsorb", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "outAmtWithAbsorb", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "absorbAvailable", + "type": "bool" + } + ], + "internalType": "struct Structs.LiquidationStruct[]", + "name": "liquidationsData_", + "type": "tuple[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vault_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "positionId_", + "type": "uint256" + } + ], + "name": "getPositionDataRaw", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vault_", + "type": "address" + } + ], + "name": "getRateRaw", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vault_", + "type": "address" + } + ], + "name": "getRebalancer", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vault_", + "type": "address" + }, + { + "internalType": "int256", + "name": "tick_", + "type": "int256" + } + ], + "name": "getTickDataRaw", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vault_", + "type": "address" + }, + { + "internalType": "int256", + "name": "key_", + "type": "int256" + } + ], + "name": "getTickHasDebtRaw", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vault_", + "type": "address" + }, + { + "internalType": "int256", + "name": "tick_", + "type": "int256" + }, + { + "internalType": "uint256", + "name": "id_", + "type": "uint256" + } + ], + "name": "getTickIdDataRaw", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "nftId_", + "type": "uint256" + } + ], + "name": "getTokenConfig", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTotalVaults", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vault_", + "type": "address" + } + ], + "name": "getVaultAbsorb", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "vault", + "type": "address" + }, + { + "internalType": "bool", + "name": "absorbAvailable", + "type": "bool" + } + ], + "internalType": "struct Structs.AbsorbStruct", + "name": "absorbData_", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "vaultId_", + "type": "uint256" + } + ], + "name": "getVaultAddress", + "outputs": [ + { + "internalType": "address", + "name": "vault_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vault_", + "type": "address" + } + ], + "name": "getVaultEntireData", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "vault", + "type": "address" + }, + { + "internalType": "bool", + "name": "isSmartCol", + "type": "bool" + }, + { + "internalType": "bool", + "name": "isSmartDebt", + "type": "bool" + }, + { + "components": [ + { + "internalType": "address", + "name": "liquidity", + "type": "address" + }, + { + "internalType": "address", + "name": "factory", + "type": "address" + }, + { + "internalType": "address", + "name": "operateImplementation", + "type": "address" + }, + { + "internalType": "address", + "name": "adminImplementation", + "type": "address" + }, + { + "internalType": "address", + "name": "secondaryImplementation", + "type": "address" + }, + { + "internalType": "address", + "name": "deployer", + "type": "address" + }, + { + "internalType": "address", + "name": "supply", + "type": "address" + }, + { + "internalType": "address", + "name": "borrow", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "token0", + "type": "address" + }, + { + "internalType": "address", + "name": "token1", + "type": "address" + } + ], + "internalType": "struct IFluidVault.Tokens", + "name": "supplyToken", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "token0", + "type": "address" + }, + { + "internalType": "address", + "name": "token1", + "type": "address" + } + ], + "internalType": "struct IFluidVault.Tokens", + "name": "borrowToken", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "vaultId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "vaultType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "supplyExchangePriceSlot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "borrowExchangePriceSlot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "userSupplySlot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "userBorrowSlot", + "type": "bytes32" + } + ], + "internalType": "struct IFluidVault.ConstantViews", + "name": "constantVariables", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint16", + "name": "supplyRateMagnifier", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "borrowRateMagnifier", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "collateralFactor", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "liquidationThreshold", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "liquidationMaxLimit", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "withdrawalGap", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "liquidationPenalty", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "borrowFee", + "type": "uint16" + }, + { + "internalType": "address", + "name": "oracle", + "type": "address" + }, + { + "internalType": "uint256", + "name": "oraclePriceOperate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "oraclePriceLiquidate", + "type": "uint256" + }, + { + "internalType": "address", + "name": "rebalancer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + } + ], + "internalType": "struct Structs.Configs", + "name": "configs", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "lastStoredLiquiditySupplyExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastStoredLiquidityBorrowExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastStoredVaultSupplyExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastStoredVaultBorrowExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquiditySupplyExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidityBorrowExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "vaultSupplyExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "vaultBorrowExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyRateLiquidity", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowRateLiquidity", + "type": "uint256" + }, + { + "internalType": "int256", + "name": "supplyRateVault", + "type": "int256" + }, + { + "internalType": "int256", + "name": "borrowRateVault", + "type": "int256" + }, + { + "internalType": "int256", + "name": "rewardsOrFeeRateSupply", + "type": "int256" + }, + { + "internalType": "int256", + "name": "rewardsOrFeeRateBorrow", + "type": "int256" + } + ], + "internalType": "struct Structs.ExchangePricesAndRates", + "name": "exchangePricesAndRates", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "totalSupplyVault", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBorrowVault", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalSupplyLiquidityOrDex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBorrowLiquidityOrDex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "absorbedSupply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "absorbedBorrow", + "type": "uint256" + } + ], + "internalType": "struct Structs.TotalSupplyAndBorrow", + "name": "totalSupplyAndBorrow", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "withdrawLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawable", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowable", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimitUtilization", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minimumBorrowing", + "type": "uint256" + } + ], + "internalType": "struct Structs.LimitsAndAvailability", + "name": "limitsAndAvailability", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "totalPositions", + "type": "uint256" + }, + { + "internalType": "int256", + "name": "topTick", + "type": "int256" + }, + { + "internalType": "uint256", + "name": "currentBranch", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBranch", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBorrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "status", + "type": "uint256" + }, + { + "internalType": "int256", + "name": "minimaTick", + "type": "int256" + }, + { + "internalType": "uint256", + "name": "debtFactor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "partials", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "debtLiquidity", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseBranchId", + "type": "uint256" + }, + { + "internalType": "int256", + "name": "baseBranchMinima", + "type": "int256" + } + ], + "internalType": "struct Structs.CurrentBranchState", + "name": "currentBranchState", + "type": "tuple" + } + ], + "internalType": "struct Structs.VaultState", + "name": "vaultState", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bool", + "name": "modeWithInterest", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawalLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseWithdrawalLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawable", + "type": "uint256" + } + ], + "internalType": "struct Structs.UserSupplyData", + "name": "liquidityUserSupplyData", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bool", + "name": "modeWithInterest", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "borrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseBorrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxBorrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowable", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimitUtilization", + "type": "uint256" + } + ], + "internalType": "struct Structs.UserBorrowData", + "name": "liquidityUserBorrowData", + "type": "tuple" + } + ], + "internalType": "struct Structs.VaultEntireData", + "name": "vaultData_", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vault_", + "type": "address" + } + ], + "name": "getVaultId", + "outputs": [ + { + "internalType": "uint256", + "name": "id_", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vault_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenInAmt_", + "type": "uint256" + } + ], + "name": "getVaultLiquidation", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "vault", + "type": "address" + }, + { + "internalType": "address", + "name": "token0In", + "type": "address" + }, + { + "internalType": "address", + "name": "token0Out", + "type": "address" + }, + { + "internalType": "address", + "name": "token1In", + "type": "address" + }, + { + "internalType": "address", + "name": "token1Out", + "type": "address" + }, + { + "internalType": "uint256", + "name": "inAmt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "outAmt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "inAmtWithAbsorb", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "outAmtWithAbsorb", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "absorbAvailable", + "type": "bool" + } + ], + "internalType": "struct Structs.LiquidationStruct", + "name": "liquidationData_", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vault_", + "type": "address" + } + ], + "name": "getVaultState", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "totalPositions", + "type": "uint256" + }, + { + "internalType": "int256", + "name": "topTick", + "type": "int256" + }, + { + "internalType": "uint256", + "name": "currentBranch", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBranch", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBorrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "status", + "type": "uint256" + }, + { + "internalType": "int256", + "name": "minimaTick", + "type": "int256" + }, + { + "internalType": "uint256", + "name": "debtFactor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "partials", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "debtLiquidity", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseBranchId", + "type": "uint256" + }, + { + "internalType": "int256", + "name": "baseBranchMinima", + "type": "int256" + } + ], + "internalType": "struct Structs.CurrentBranchState", + "name": "currentBranchState", + "type": "tuple" + } + ], + "internalType": "struct Structs.VaultState", + "name": "vaultState_", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vault_", + "type": "address" + } + ], + "name": "getVaultType", + "outputs": [ + { + "internalType": "uint256", + "name": "vaultType_", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vault_", + "type": "address" + } + ], + "name": "getVaultVariables2Raw", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vault_", + "type": "address" + } + ], + "name": "getVaultVariablesRaw", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getVaultsAbsorb", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "vault", + "type": "address" + }, + { + "internalType": "bool", + "name": "absorbAvailable", + "type": "bool" + } + ], + "internalType": "struct Structs.AbsorbStruct[]", + "name": "absorbData_", + "type": "tuple[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "vaults_", + "type": "address[]" + } + ], + "name": "getVaultsAbsorb", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "vault", + "type": "address" + }, + { + "internalType": "bool", + "name": "absorbAvailable", + "type": "bool" + } + ], + "internalType": "struct Structs.AbsorbStruct[]", + "name": "absorbData_", + "type": "tuple[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "vaults_", + "type": "address[]" + } + ], + "name": "getVaultsEntireData", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "vault", + "type": "address" + }, + { + "internalType": "bool", + "name": "isSmartCol", + "type": "bool" + }, + { + "internalType": "bool", + "name": "isSmartDebt", + "type": "bool" + }, + { + "components": [ + { + "internalType": "address", + "name": "liquidity", + "type": "address" + }, + { + "internalType": "address", + "name": "factory", + "type": "address" + }, + { + "internalType": "address", + "name": "operateImplementation", + "type": "address" + }, + { + "internalType": "address", + "name": "adminImplementation", + "type": "address" + }, + { + "internalType": "address", + "name": "secondaryImplementation", + "type": "address" + }, + { + "internalType": "address", + "name": "deployer", + "type": "address" + }, + { + "internalType": "address", + "name": "supply", + "type": "address" + }, + { + "internalType": "address", + "name": "borrow", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "token0", + "type": "address" + }, + { + "internalType": "address", + "name": "token1", + "type": "address" + } + ], + "internalType": "struct IFluidVault.Tokens", + "name": "supplyToken", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "token0", + "type": "address" + }, + { + "internalType": "address", + "name": "token1", + "type": "address" + } + ], + "internalType": "struct IFluidVault.Tokens", + "name": "borrowToken", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "vaultId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "vaultType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "supplyExchangePriceSlot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "borrowExchangePriceSlot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "userSupplySlot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "userBorrowSlot", + "type": "bytes32" + } + ], + "internalType": "struct IFluidVault.ConstantViews", + "name": "constantVariables", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint16", + "name": "supplyRateMagnifier", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "borrowRateMagnifier", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "collateralFactor", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "liquidationThreshold", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "liquidationMaxLimit", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "withdrawalGap", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "liquidationPenalty", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "borrowFee", + "type": "uint16" + }, + { + "internalType": "address", + "name": "oracle", + "type": "address" + }, + { + "internalType": "uint256", + "name": "oraclePriceOperate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "oraclePriceLiquidate", + "type": "uint256" + }, + { + "internalType": "address", + "name": "rebalancer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + } + ], + "internalType": "struct Structs.Configs", + "name": "configs", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "lastStoredLiquiditySupplyExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastStoredLiquidityBorrowExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastStoredVaultSupplyExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastStoredVaultBorrowExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquiditySupplyExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidityBorrowExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "vaultSupplyExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "vaultBorrowExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyRateLiquidity", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowRateLiquidity", + "type": "uint256" + }, + { + "internalType": "int256", + "name": "supplyRateVault", + "type": "int256" + }, + { + "internalType": "int256", + "name": "borrowRateVault", + "type": "int256" + }, + { + "internalType": "int256", + "name": "rewardsOrFeeRateSupply", + "type": "int256" + }, + { + "internalType": "int256", + "name": "rewardsOrFeeRateBorrow", + "type": "int256" + } + ], + "internalType": "struct Structs.ExchangePricesAndRates", + "name": "exchangePricesAndRates", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "totalSupplyVault", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBorrowVault", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalSupplyLiquidityOrDex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBorrowLiquidityOrDex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "absorbedSupply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "absorbedBorrow", + "type": "uint256" + } + ], + "internalType": "struct Structs.TotalSupplyAndBorrow", + "name": "totalSupplyAndBorrow", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "withdrawLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawable", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowable", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimitUtilization", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minimumBorrowing", + "type": "uint256" + } + ], + "internalType": "struct Structs.LimitsAndAvailability", + "name": "limitsAndAvailability", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "totalPositions", + "type": "uint256" + }, + { + "internalType": "int256", + "name": "topTick", + "type": "int256" + }, + { + "internalType": "uint256", + "name": "currentBranch", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBranch", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBorrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "status", + "type": "uint256" + }, + { + "internalType": "int256", + "name": "minimaTick", + "type": "int256" + }, + { + "internalType": "uint256", + "name": "debtFactor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "partials", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "debtLiquidity", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseBranchId", + "type": "uint256" + }, + { + "internalType": "int256", + "name": "baseBranchMinima", + "type": "int256" + } + ], + "internalType": "struct Structs.CurrentBranchState", + "name": "currentBranchState", + "type": "tuple" + } + ], + "internalType": "struct Structs.VaultState", + "name": "vaultState", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bool", + "name": "modeWithInterest", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawalLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseWithdrawalLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawable", + "type": "uint256" + } + ], + "internalType": "struct Structs.UserSupplyData", + "name": "liquidityUserSupplyData", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bool", + "name": "modeWithInterest", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "borrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseBorrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxBorrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowable", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimitUtilization", + "type": "uint256" + } + ], + "internalType": "struct Structs.UserBorrowData", + "name": "liquidityUserBorrowData", + "type": "tuple" + } + ], + "internalType": "struct Structs.VaultEntireData[]", + "name": "vaultsData_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getVaultsEntireData", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "vault", + "type": "address" + }, + { + "internalType": "bool", + "name": "isSmartCol", + "type": "bool" + }, + { + "internalType": "bool", + "name": "isSmartDebt", + "type": "bool" + }, + { + "components": [ + { + "internalType": "address", + "name": "liquidity", + "type": "address" + }, + { + "internalType": "address", + "name": "factory", + "type": "address" + }, + { + "internalType": "address", + "name": "operateImplementation", + "type": "address" + }, + { + "internalType": "address", + "name": "adminImplementation", + "type": "address" + }, + { + "internalType": "address", + "name": "secondaryImplementation", + "type": "address" + }, + { + "internalType": "address", + "name": "deployer", + "type": "address" + }, + { + "internalType": "address", + "name": "supply", + "type": "address" + }, + { + "internalType": "address", + "name": "borrow", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "token0", + "type": "address" + }, + { + "internalType": "address", + "name": "token1", + "type": "address" + } + ], + "internalType": "struct IFluidVault.Tokens", + "name": "supplyToken", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "token0", + "type": "address" + }, + { + "internalType": "address", + "name": "token1", + "type": "address" + } + ], + "internalType": "struct IFluidVault.Tokens", + "name": "borrowToken", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "vaultId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "vaultType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "supplyExchangePriceSlot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "borrowExchangePriceSlot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "userSupplySlot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "userBorrowSlot", + "type": "bytes32" + } + ], + "internalType": "struct IFluidVault.ConstantViews", + "name": "constantVariables", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint16", + "name": "supplyRateMagnifier", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "borrowRateMagnifier", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "collateralFactor", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "liquidationThreshold", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "liquidationMaxLimit", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "withdrawalGap", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "liquidationPenalty", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "borrowFee", + "type": "uint16" + }, + { + "internalType": "address", + "name": "oracle", + "type": "address" + }, + { + "internalType": "uint256", + "name": "oraclePriceOperate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "oraclePriceLiquidate", + "type": "uint256" + }, + { + "internalType": "address", + "name": "rebalancer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + } + ], + "internalType": "struct Structs.Configs", + "name": "configs", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "lastStoredLiquiditySupplyExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastStoredLiquidityBorrowExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastStoredVaultSupplyExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastStoredVaultBorrowExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquiditySupplyExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidityBorrowExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "vaultSupplyExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "vaultBorrowExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyRateLiquidity", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowRateLiquidity", + "type": "uint256" + }, + { + "internalType": "int256", + "name": "supplyRateVault", + "type": "int256" + }, + { + "internalType": "int256", + "name": "borrowRateVault", + "type": "int256" + }, + { + "internalType": "int256", + "name": "rewardsOrFeeRateSupply", + "type": "int256" + }, + { + "internalType": "int256", + "name": "rewardsOrFeeRateBorrow", + "type": "int256" + } + ], + "internalType": "struct Structs.ExchangePricesAndRates", + "name": "exchangePricesAndRates", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "totalSupplyVault", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBorrowVault", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalSupplyLiquidityOrDex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBorrowLiquidityOrDex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "absorbedSupply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "absorbedBorrow", + "type": "uint256" + } + ], + "internalType": "struct Structs.TotalSupplyAndBorrow", + "name": "totalSupplyAndBorrow", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "withdrawLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawable", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowable", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimitUtilization", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minimumBorrowing", + "type": "uint256" + } + ], + "internalType": "struct Structs.LimitsAndAvailability", + "name": "limitsAndAvailability", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "totalPositions", + "type": "uint256" + }, + { + "internalType": "int256", + "name": "topTick", + "type": "int256" + }, + { + "internalType": "uint256", + "name": "currentBranch", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBranch", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBorrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "status", + "type": "uint256" + }, + { + "internalType": "int256", + "name": "minimaTick", + "type": "int256" + }, + { + "internalType": "uint256", + "name": "debtFactor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "partials", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "debtLiquidity", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseBranchId", + "type": "uint256" + }, + { + "internalType": "int256", + "name": "baseBranchMinima", + "type": "int256" + } + ], + "internalType": "struct Structs.CurrentBranchState", + "name": "currentBranchState", + "type": "tuple" + } + ], + "internalType": "struct Structs.VaultState", + "name": "vaultState", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bool", + "name": "modeWithInterest", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawalLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseWithdrawalLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawable", + "type": "uint256" + } + ], + "internalType": "struct Structs.UserSupplyData", + "name": "liquidityUserSupplyData", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bool", + "name": "modeWithInterest", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "borrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseBorrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxBorrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowable", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimitUtilization", + "type": "uint256" + } + ], + "internalType": "struct Structs.UserBorrowData", + "name": "liquidityUserBorrowData", + "type": "tuple" + } + ], + "internalType": "struct Structs.VaultEntireData[]", + "name": "vaultsData_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "slot_", + "type": "uint256" + } + ], + "name": "normalSlot", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "nftId_", + "type": "uint256" + } + ], + "name": "positionByNftId", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "nftId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "bool", + "name": "isLiquidated", + "type": "bool" + }, + { + "internalType": "bool", + "name": "isSupplyPosition", + "type": "bool" + }, + { + "internalType": "int256", + "name": "tick", + "type": "int256" + }, + { + "internalType": "uint256", + "name": "tickId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "beforeSupply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "beforeBorrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "beforeDustBorrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "dustBorrow", + "type": "uint256" + } + ], + "internalType": "struct Structs.UserPosition", + "name": "userPosition_", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "vault", + "type": "address" + }, + { + "internalType": "bool", + "name": "isSmartCol", + "type": "bool" + }, + { + "internalType": "bool", + "name": "isSmartDebt", + "type": "bool" + }, + { + "components": [ + { + "internalType": "address", + "name": "liquidity", + "type": "address" + }, + { + "internalType": "address", + "name": "factory", + "type": "address" + }, + { + "internalType": "address", + "name": "operateImplementation", + "type": "address" + }, + { + "internalType": "address", + "name": "adminImplementation", + "type": "address" + }, + { + "internalType": "address", + "name": "secondaryImplementation", + "type": "address" + }, + { + "internalType": "address", + "name": "deployer", + "type": "address" + }, + { + "internalType": "address", + "name": "supply", + "type": "address" + }, + { + "internalType": "address", + "name": "borrow", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "token0", + "type": "address" + }, + { + "internalType": "address", + "name": "token1", + "type": "address" + } + ], + "internalType": "struct IFluidVault.Tokens", + "name": "supplyToken", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "token0", + "type": "address" + }, + { + "internalType": "address", + "name": "token1", + "type": "address" + } + ], + "internalType": "struct IFluidVault.Tokens", + "name": "borrowToken", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "vaultId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "vaultType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "supplyExchangePriceSlot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "borrowExchangePriceSlot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "userSupplySlot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "userBorrowSlot", + "type": "bytes32" + } + ], + "internalType": "struct IFluidVault.ConstantViews", + "name": "constantVariables", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint16", + "name": "supplyRateMagnifier", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "borrowRateMagnifier", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "collateralFactor", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "liquidationThreshold", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "liquidationMaxLimit", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "withdrawalGap", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "liquidationPenalty", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "borrowFee", + "type": "uint16" + }, + { + "internalType": "address", + "name": "oracle", + "type": "address" + }, + { + "internalType": "uint256", + "name": "oraclePriceOperate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "oraclePriceLiquidate", + "type": "uint256" + }, + { + "internalType": "address", + "name": "rebalancer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + } + ], + "internalType": "struct Structs.Configs", + "name": "configs", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "lastStoredLiquiditySupplyExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastStoredLiquidityBorrowExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastStoredVaultSupplyExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastStoredVaultBorrowExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquiditySupplyExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidityBorrowExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "vaultSupplyExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "vaultBorrowExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyRateLiquidity", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowRateLiquidity", + "type": "uint256" + }, + { + "internalType": "int256", + "name": "supplyRateVault", + "type": "int256" + }, + { + "internalType": "int256", + "name": "borrowRateVault", + "type": "int256" + }, + { + "internalType": "int256", + "name": "rewardsOrFeeRateSupply", + "type": "int256" + }, + { + "internalType": "int256", + "name": "rewardsOrFeeRateBorrow", + "type": "int256" + } + ], + "internalType": "struct Structs.ExchangePricesAndRates", + "name": "exchangePricesAndRates", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "totalSupplyVault", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBorrowVault", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalSupplyLiquidityOrDex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBorrowLiquidityOrDex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "absorbedSupply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "absorbedBorrow", + "type": "uint256" + } + ], + "internalType": "struct Structs.TotalSupplyAndBorrow", + "name": "totalSupplyAndBorrow", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "withdrawLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawable", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowable", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimitUtilization", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minimumBorrowing", + "type": "uint256" + } + ], + "internalType": "struct Structs.LimitsAndAvailability", + "name": "limitsAndAvailability", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "totalPositions", + "type": "uint256" + }, + { + "internalType": "int256", + "name": "topTick", + "type": "int256" + }, + { + "internalType": "uint256", + "name": "currentBranch", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBranch", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBorrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "status", + "type": "uint256" + }, + { + "internalType": "int256", + "name": "minimaTick", + "type": "int256" + }, + { + "internalType": "uint256", + "name": "debtFactor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "partials", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "debtLiquidity", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseBranchId", + "type": "uint256" + }, + { + "internalType": "int256", + "name": "baseBranchMinima", + "type": "int256" + } + ], + "internalType": "struct Structs.CurrentBranchState", + "name": "currentBranchState", + "type": "tuple" + } + ], + "internalType": "struct Structs.VaultState", + "name": "vaultState", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bool", + "name": "modeWithInterest", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawalLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseWithdrawalLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawable", + "type": "uint256" + } + ], + "internalType": "struct Structs.UserSupplyData", + "name": "liquidityUserSupplyData", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bool", + "name": "modeWithInterest", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "borrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseBorrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxBorrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowable", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimitUtilization", + "type": "uint256" + } + ], + "internalType": "struct Structs.UserBorrowData", + "name": "liquidityUserBorrowData", + "type": "tuple" + } + ], + "internalType": "struct Structs.VaultEntireData", + "name": "vaultData_", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user_", + "type": "address" + } + ], + "name": "positionsByUser", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "nftId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "bool", + "name": "isLiquidated", + "type": "bool" + }, + { + "internalType": "bool", + "name": "isSupplyPosition", + "type": "bool" + }, + { + "internalType": "int256", + "name": "tick", + "type": "int256" + }, + { + "internalType": "uint256", + "name": "tickId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "beforeSupply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "beforeBorrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "beforeDustBorrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "dustBorrow", + "type": "uint256" + } + ], + "internalType": "struct Structs.UserPosition[]", + "name": "userPositions_", + "type": "tuple[]" + }, + { + "components": [ + { + "internalType": "address", + "name": "vault", + "type": "address" + }, + { + "internalType": "bool", + "name": "isSmartCol", + "type": "bool" + }, + { + "internalType": "bool", + "name": "isSmartDebt", + "type": "bool" + }, + { + "components": [ + { + "internalType": "address", + "name": "liquidity", + "type": "address" + }, + { + "internalType": "address", + "name": "factory", + "type": "address" + }, + { + "internalType": "address", + "name": "operateImplementation", + "type": "address" + }, + { + "internalType": "address", + "name": "adminImplementation", + "type": "address" + }, + { + "internalType": "address", + "name": "secondaryImplementation", + "type": "address" + }, + { + "internalType": "address", + "name": "deployer", + "type": "address" + }, + { + "internalType": "address", + "name": "supply", + "type": "address" + }, + { + "internalType": "address", + "name": "borrow", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "token0", + "type": "address" + }, + { + "internalType": "address", + "name": "token1", + "type": "address" + } + ], + "internalType": "struct IFluidVault.Tokens", + "name": "supplyToken", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "token0", + "type": "address" + }, + { + "internalType": "address", + "name": "token1", + "type": "address" + } + ], + "internalType": "struct IFluidVault.Tokens", + "name": "borrowToken", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "vaultId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "vaultType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "supplyExchangePriceSlot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "borrowExchangePriceSlot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "userSupplySlot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "userBorrowSlot", + "type": "bytes32" + } + ], + "internalType": "struct IFluidVault.ConstantViews", + "name": "constantVariables", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint16", + "name": "supplyRateMagnifier", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "borrowRateMagnifier", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "collateralFactor", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "liquidationThreshold", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "liquidationMaxLimit", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "withdrawalGap", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "liquidationPenalty", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "borrowFee", + "type": "uint16" + }, + { + "internalType": "address", + "name": "oracle", + "type": "address" + }, + { + "internalType": "uint256", + "name": "oraclePriceOperate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "oraclePriceLiquidate", + "type": "uint256" + }, + { + "internalType": "address", + "name": "rebalancer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + } + ], + "internalType": "struct Structs.Configs", + "name": "configs", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "lastStoredLiquiditySupplyExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastStoredLiquidityBorrowExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastStoredVaultSupplyExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastStoredVaultBorrowExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquiditySupplyExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidityBorrowExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "vaultSupplyExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "vaultBorrowExchangePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "supplyRateLiquidity", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowRateLiquidity", + "type": "uint256" + }, + { + "internalType": "int256", + "name": "supplyRateVault", + "type": "int256" + }, + { + "internalType": "int256", + "name": "borrowRateVault", + "type": "int256" + }, + { + "internalType": "int256", + "name": "rewardsOrFeeRateSupply", + "type": "int256" + }, + { + "internalType": "int256", + "name": "rewardsOrFeeRateBorrow", + "type": "int256" + } + ], + "internalType": "struct Structs.ExchangePricesAndRates", + "name": "exchangePricesAndRates", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "totalSupplyVault", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBorrowVault", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalSupplyLiquidityOrDex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBorrowLiquidityOrDex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "absorbedSupply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "absorbedBorrow", + "type": "uint256" + } + ], + "internalType": "struct Structs.TotalSupplyAndBorrow", + "name": "totalSupplyAndBorrow", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "withdrawLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawable", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowable", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimitUtilization", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minimumBorrowing", + "type": "uint256" + } + ], + "internalType": "struct Structs.LimitsAndAvailability", + "name": "limitsAndAvailability", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "totalPositions", + "type": "uint256" + }, + { + "internalType": "int256", + "name": "topTick", + "type": "int256" + }, + { + "internalType": "uint256", + "name": "currentBranch", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBranch", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBorrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "status", + "type": "uint256" + }, + { + "internalType": "int256", + "name": "minimaTick", + "type": "int256" + }, + { + "internalType": "uint256", + "name": "debtFactor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "partials", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "debtLiquidity", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseBranchId", + "type": "uint256" + }, + { + "internalType": "int256", + "name": "baseBranchMinima", + "type": "int256" + } + ], + "internalType": "struct Structs.CurrentBranchState", + "name": "currentBranchState", + "type": "tuple" + } + ], + "internalType": "struct Structs.VaultState", + "name": "vaultState", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bool", + "name": "modeWithInterest", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "supply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawalLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseWithdrawalLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawable", + "type": "uint256" + } + ], + "internalType": "struct Structs.UserSupplyData", + "name": "liquidityUserSupplyData", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bool", + "name": "modeWithInterest", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "borrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandPercent", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expandDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseBorrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxBorrowLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowableUntilLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowable", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowLimitUtilization", + "type": "uint256" + } + ], + "internalType": "struct Structs.UserBorrowData", + "name": "liquidityUserBorrowData", + "type": "tuple" + } + ], + "internalType": "struct Structs.VaultEntireData[]", + "name": "vaultsData_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user_", + "type": "address" + } + ], + "name": "positionsNftIdOfUser", + "outputs": [ + { + "internalType": "uint256[]", + "name": "nftIds_", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tickRaw_", + "type": "uint256" + } + ], + "name": "tickHelper", + "outputs": [ + { + "internalType": "int256", + "name": "tick", + "type": "int256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "totalPositions", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "nftId_", + "type": "uint256" + } + ], + "name": "vaultByNftId", + "outputs": [ + { + "internalType": "address", + "name": "vault_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } +] \ No newline at end of file diff --git a/abi/gmx_gm_token.json b/abi/gmx_gm_token.json new file mode 100644 index 0000000..962e7dc --- /dev/null +++ b/abi/gmx_gm_token.json @@ -0,0 +1,503 @@ +[ + { + "inputs": [ + { + "internalType": "contract RoleStore", + "name": "_roleStore", + "type": "address" + }, + { + "internalType": "contract DataStore", + "name": "_dataStore", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "EmptyHoldingAddress", + "type": "error" + }, + { + "inputs": [], + "name": "EmptyReceiver", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "EmptyTokenTranferGasLimit", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "msgSender", + "type": "address" + } + ], + "name": "InvalidNativeTokenSender", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + } + ], + "name": "SelfTransferNotSupported", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "TokenTransferError", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "msgSender", + "type": "address" + }, + { + "internalType": "string", + "name": "role", + "type": "string" + } + ], + "name": "Unauthorized", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "dataStore", + "outputs": [ + { + "internalType": "contract DataStore", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "roleStore", + "outputs": [ + { + "internalType": "contract RoleStore", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferOut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "shouldUnwrapNativeToken", + "type": "bool" + } + ], + "name": "transferOut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferOutNativeToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } +] \ No newline at end of file diff --git a/abi/gmx_synthetics_reader_contract.json b/abi/gmx_synthetics_reader_contract.json new file mode 100644 index 0000000..57e655d --- /dev/null +++ b/abi/gmx_synthetics_reader_contract.json @@ -0,0 +1,3943 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "market", + "type": "address" + } + ], + "name": "DisabledMarket", + "type": "error" + }, + { + "inputs": [], + "name": "EmptyMarket", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "contract DataStore", + "name": "dataStore", + "type": "address" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "start", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "end", + "type": "uint256" + } + ], + "name": "getAccountOrders", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "address", + "name": "cancellationReceiver", + "type": "address" + }, + { + "internalType": "address", + "name": "callbackContract", + "type": "address" + }, + { + "internalType": "address", + "name": "uiFeeReceiver", + "type": "address" + }, + { + "internalType": "address", + "name": "market", + "type": "address" + }, + { + "internalType": "address", + "name": "initialCollateralToken", + "type": "address" + }, + { + "internalType": "address[]", + "name": "swapPath", + "type": "address[]" + } + ], + "internalType": "struct Order.Addresses", + "name": "addresses", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "enum Order.OrderType", + "name": "orderType", + "type": "uint8" + }, + { + "internalType": "enum Order.DecreasePositionSwapType", + "name": "decreasePositionSwapType", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "sizeDeltaUsd", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "initialCollateralDeltaAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "triggerPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "acceptablePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "executionFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "callbackGasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minOutputAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "updatedAtBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "updatedAtTime", + "type": "uint256" + } + ], + "internalType": "struct Order.Numbers", + "name": "numbers", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bool", + "name": "isLong", + "type": "bool" + }, + { + "internalType": "bool", + "name": "shouldUnwrapNativeToken", + "type": "bool" + }, + { + "internalType": "bool", + "name": "isFrozen", + "type": "bool" + }, + { + "internalType": "bool", + "name": "autoCancel", + "type": "bool" + } + ], + "internalType": "struct Order.Flags", + "name": "flags", + "type": "tuple" + } + ], + "internalType": "struct Order.Props[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract DataStore", + "name": "dataStore", + "type": "address" + }, + { + "internalType": "contract IReferralStorage", + "name": "referralStorage", + "type": "address" + }, + { + "internalType": "bytes32[]", + "name": "positionKeys", + "type": "bytes32[]" + }, + { + "components": [ + { + "components": [ + { + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "internalType": "struct Price.Props", + "name": "indexTokenPrice", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "internalType": "struct Price.Props", + "name": "longTokenPrice", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "internalType": "struct Price.Props", + "name": "shortTokenPrice", + "type": "tuple" + } + ], + "internalType": "struct MarketUtils.MarketPrices[]", + "name": "prices", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "uiFeeReceiver", + "type": "address" + } + ], + "name": "getAccountPositionInfoList", + "outputs": [ + { + "components": [ + { + "components": [ + { + "components": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "market", + "type": "address" + }, + { + "internalType": "address", + "name": "collateralToken", + "type": "address" + } + ], + "internalType": "struct Position.Addresses", + "name": "addresses", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "sizeInUsd", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "sizeInTokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "collateralAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowingFactor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "fundingFeeAmountPerSize", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "longTokenClaimableFundingAmountPerSize", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shortTokenClaimableFundingAmountPerSize", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "increasedAtBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "decreasedAtBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "increasedAtTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "decreasedAtTime", + "type": "uint256" + } + ], + "internalType": "struct Position.Numbers", + "name": "numbers", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bool", + "name": "isLong", + "type": "bool" + } + ], + "internalType": "struct Position.Flags", + "name": "flags", + "type": "tuple" + } + ], + "internalType": "struct Position.Props", + "name": "position", + "type": "tuple" + }, + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "referralCode", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "affiliate", + "type": "address" + }, + { + "internalType": "address", + "name": "trader", + "type": "address" + }, + { + "internalType": "uint256", + "name": "totalRebateFactor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "traderDiscountFactor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalRebateAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "traderDiscountAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "affiliateRewardAmount", + "type": "uint256" + } + ], + "internalType": "struct PositionPricingUtils.PositionReferralFees", + "name": "referral", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "fundingFeeAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "claimableLongTokenAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "claimableShortTokenAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "latestFundingFeeAmountPerSize", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "latestLongTokenClaimableFundingAmountPerSize", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "latestShortTokenClaimableFundingAmountPerSize", + "type": "uint256" + } + ], + "internalType": "struct PositionPricingUtils.PositionFundingFees", + "name": "funding", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "borrowingFeeUsd", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowingFeeAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowingFeeReceiverFactor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowingFeeAmountForFeeReceiver", + "type": "uint256" + } + ], + "internalType": "struct PositionPricingUtils.PositionBorrowingFees", + "name": "borrowing", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "uiFeeReceiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "uiFeeReceiverFactor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "uiFeeAmount", + "type": "uint256" + } + ], + "internalType": "struct PositionPricingUtils.PositionUiFees", + "name": "ui", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "internalType": "struct Price.Props", + "name": "collateralTokenPrice", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "positionFeeFactor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "protocolFeeAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "positionFeeReceiverFactor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "feeReceiverAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "feeAmountForPool", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "positionFeeAmountForPool", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "positionFeeAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalCostAmountExcludingFunding", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalCostAmount", + "type": "uint256" + } + ], + "internalType": "struct PositionPricingUtils.PositionFees", + "name": "fees", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "int256", + "name": "priceImpactUsd", + "type": "int256" + }, + { + "internalType": "uint256", + "name": "priceImpactDiffUsd", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "executionPrice", + "type": "uint256" + } + ], + "internalType": "struct ReaderPricingUtils.ExecutionPriceResult", + "name": "executionPriceResult", + "type": "tuple" + }, + { + "internalType": "int256", + "name": "basePnlUsd", + "type": "int256" + }, + { + "internalType": "int256", + "name": "uncappedBasePnlUsd", + "type": "int256" + }, + { + "internalType": "int256", + "name": "pnlAfterPriceImpactUsd", + "type": "int256" + } + ], + "internalType": "struct ReaderUtils.PositionInfo[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract DataStore", + "name": "dataStore", + "type": "address" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "start", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "end", + "type": "uint256" + } + ], + "name": "getAccountPositions", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "market", + "type": "address" + }, + { + "internalType": "address", + "name": "collateralToken", + "type": "address" + } + ], + "internalType": "struct Position.Addresses", + "name": "addresses", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "sizeInUsd", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "sizeInTokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "collateralAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowingFactor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "fundingFeeAmountPerSize", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "longTokenClaimableFundingAmountPerSize", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shortTokenClaimableFundingAmountPerSize", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "increasedAtBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "decreasedAtBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "increasedAtTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "decreasedAtTime", + "type": "uint256" + } + ], + "internalType": "struct Position.Numbers", + "name": "numbers", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bool", + "name": "isLong", + "type": "bool" + } + ], + "internalType": "struct Position.Flags", + "name": "flags", + "type": "tuple" + } + ], + "internalType": "struct Position.Props[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract DataStore", + "name": "dataStore", + "type": "address" + }, + { + "internalType": "address", + "name": "market", + "type": "address" + }, + { + "internalType": "bool", + "name": "isLong", + "type": "bool" + }, + { + "components": [ + { + "components": [ + { + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "internalType": "struct Price.Props", + "name": "indexTokenPrice", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "internalType": "struct Price.Props", + "name": "longTokenPrice", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "internalType": "struct Price.Props", + "name": "shortTokenPrice", + "type": "tuple" + } + ], + "internalType": "struct MarketUtils.MarketPrices", + "name": "prices", + "type": "tuple" + } + ], + "name": "getAdlState", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "", + "type": "bool" + }, + { + "internalType": "int256", + "name": "", + "type": "int256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract DataStore", + "name": "dataStore", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + } + ], + "name": "getDeposit", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "address", + "name": "callbackContract", + "type": "address" + }, + { + "internalType": "address", + "name": "uiFeeReceiver", + "type": "address" + }, + { + "internalType": "address", + "name": "market", + "type": "address" + }, + { + "internalType": "address", + "name": "initialLongToken", + "type": "address" + }, + { + "internalType": "address", + "name": "initialShortToken", + "type": "address" + }, + { + "internalType": "address[]", + "name": "longTokenSwapPath", + "type": "address[]" + }, + { + "internalType": "address[]", + "name": "shortTokenSwapPath", + "type": "address[]" + } + ], + "internalType": "struct Deposit.Addresses", + "name": "addresses", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "initialLongTokenAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "initialShortTokenAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minMarketTokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "updatedAtBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "updatedAtTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "executionFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "callbackGasLimit", + "type": "uint256" + } + ], + "internalType": "struct Deposit.Numbers", + "name": "numbers", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bool", + "name": "shouldUnwrapNativeToken", + "type": "bool" + } + ], + "internalType": "struct Deposit.Flags", + "name": "flags", + "type": "tuple" + } + ], + "internalType": "struct Deposit.Props", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract DataStore", + "name": "dataStore", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "marketToken", + "type": "address" + }, + { + "internalType": "address", + "name": "indexToken", + "type": "address" + }, + { + "internalType": "address", + "name": "longToken", + "type": "address" + }, + { + "internalType": "address", + "name": "shortToken", + "type": "address" + } + ], + "internalType": "struct Market.Props", + "name": "market", + "type": "tuple" + }, + { + "components": [ + { + "components": [ + { + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "internalType": "struct Price.Props", + "name": "indexTokenPrice", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "internalType": "struct Price.Props", + "name": "longTokenPrice", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "internalType": "struct Price.Props", + "name": "shortTokenPrice", + "type": "tuple" + } + ], + "internalType": "struct MarketUtils.MarketPrices", + "name": "prices", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "longTokenAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shortTokenAmount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "uiFeeReceiver", + "type": "address" + }, + { + "internalType": "enum ISwapPricingUtils.SwapPricingType", + "name": "swapPricingType", + "type": "uint8" + }, + { + "internalType": "bool", + "name": "includeVirtualInventoryImpact", + "type": "bool" + } + ], + "name": "getDepositAmountOut", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract DataStore", + "name": "dataStore", + "type": "address" + }, + { + "internalType": "address", + "name": "marketKey", + "type": "address" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "internalType": "struct Price.Props", + "name": "indexTokenPrice", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "positionSizeInUsd", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "positionSizeInTokens", + "type": "uint256" + }, + { + "internalType": "int256", + "name": "sizeDeltaUsd", + "type": "int256" + }, + { + "internalType": "bool", + "name": "isLong", + "type": "bool" + } + ], + "name": "getExecutionPrice", + "outputs": [ + { + "components": [ + { + "internalType": "int256", + "name": "priceImpactUsd", + "type": "int256" + }, + { + "internalType": "uint256", + "name": "priceImpactDiffUsd", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "executionPrice", + "type": "uint256" + } + ], + "internalType": "struct ReaderPricingUtils.ExecutionPriceResult", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract DataStore", + "name": "dataStore", + "type": "address" + }, + { + "internalType": "address", + "name": "key", + "type": "address" + } + ], + "name": "getMarket", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "marketToken", + "type": "address" + }, + { + "internalType": "address", + "name": "indexToken", + "type": "address" + }, + { + "internalType": "address", + "name": "longToken", + "type": "address" + }, + { + "internalType": "address", + "name": "shortToken", + "type": "address" + } + ], + "internalType": "struct Market.Props", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract DataStore", + "name": "dataStore", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" + } + ], + "name": "getMarketBySalt", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "marketToken", + "type": "address" + }, + { + "internalType": "address", + "name": "indexToken", + "type": "address" + }, + { + "internalType": "address", + "name": "longToken", + "type": "address" + }, + { + "internalType": "address", + "name": "shortToken", + "type": "address" + } + ], + "internalType": "struct Market.Props", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract DataStore", + "name": "dataStore", + "type": "address" + }, + { + "components": [ + { + "components": [ + { + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "internalType": "struct Price.Props", + "name": "indexTokenPrice", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "internalType": "struct Price.Props", + "name": "longTokenPrice", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "internalType": "struct Price.Props", + "name": "shortTokenPrice", + "type": "tuple" + } + ], + "internalType": "struct MarketUtils.MarketPrices", + "name": "prices", + "type": "tuple" + }, + { + "internalType": "address", + "name": "marketKey", + "type": "address" + } + ], + "name": "getMarketInfo", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "address", + "name": "marketToken", + "type": "address" + }, + { + "internalType": "address", + "name": "indexToken", + "type": "address" + }, + { + "internalType": "address", + "name": "longToken", + "type": "address" + }, + { + "internalType": "address", + "name": "shortToken", + "type": "address" + } + ], + "internalType": "struct Market.Props", + "name": "market", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "borrowingFactorPerSecondForLongs", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowingFactorPerSecondForShorts", + "type": "uint256" + }, + { + "components": [ + { + "components": [ + { + "components": [ + { + "internalType": "uint256", + "name": "longToken", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shortToken", + "type": "uint256" + } + ], + "internalType": "struct MarketUtils.CollateralType", + "name": "long", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "longToken", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shortToken", + "type": "uint256" + } + ], + "internalType": "struct MarketUtils.CollateralType", + "name": "short", + "type": "tuple" + } + ], + "internalType": "struct MarketUtils.PositionType", + "name": "fundingFeeAmountPerSize", + "type": "tuple" + }, + { + "components": [ + { + "components": [ + { + "internalType": "uint256", + "name": "longToken", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shortToken", + "type": "uint256" + } + ], + "internalType": "struct MarketUtils.CollateralType", + "name": "long", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "longToken", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shortToken", + "type": "uint256" + } + ], + "internalType": "struct MarketUtils.CollateralType", + "name": "short", + "type": "tuple" + } + ], + "internalType": "struct MarketUtils.PositionType", + "name": "claimableFundingAmountPerSize", + "type": "tuple" + } + ], + "internalType": "struct ReaderUtils.BaseFundingValues", + "name": "baseFunding", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bool", + "name": "longsPayShorts", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "fundingFactorPerSecond", + "type": "uint256" + }, + { + "internalType": "int256", + "name": "nextSavedFundingFactorPerSecond", + "type": "int256" + }, + { + "components": [ + { + "components": [ + { + "internalType": "uint256", + "name": "longToken", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shortToken", + "type": "uint256" + } + ], + "internalType": "struct MarketUtils.CollateralType", + "name": "long", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "longToken", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shortToken", + "type": "uint256" + } + ], + "internalType": "struct MarketUtils.CollateralType", + "name": "short", + "type": "tuple" + } + ], + "internalType": "struct MarketUtils.PositionType", + "name": "fundingFeeAmountPerSizeDelta", + "type": "tuple" + }, + { + "components": [ + { + "components": [ + { + "internalType": "uint256", + "name": "longToken", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shortToken", + "type": "uint256" + } + ], + "internalType": "struct MarketUtils.CollateralType", + "name": "long", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "longToken", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shortToken", + "type": "uint256" + } + ], + "internalType": "struct MarketUtils.CollateralType", + "name": "short", + "type": "tuple" + } + ], + "internalType": "struct MarketUtils.PositionType", + "name": "claimableFundingAmountPerSizeDelta", + "type": "tuple" + } + ], + "internalType": "struct MarketUtils.GetNextFundingAmountPerSizeResult", + "name": "nextFunding", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "virtualPoolAmountForLongToken", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "virtualPoolAmountForShortToken", + "type": "uint256" + }, + { + "internalType": "int256", + "name": "virtualInventoryForPositions", + "type": "int256" + } + ], + "internalType": "struct ReaderUtils.VirtualInventory", + "name": "virtualInventory", + "type": "tuple" + }, + { + "internalType": "bool", + "name": "isDisabled", + "type": "bool" + } + ], + "internalType": "struct ReaderUtils.MarketInfo", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract DataStore", + "name": "dataStore", + "type": "address" + }, + { + "components": [ + { + "components": [ + { + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "internalType": "struct Price.Props", + "name": "indexTokenPrice", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "internalType": "struct Price.Props", + "name": "longTokenPrice", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "internalType": "struct Price.Props", + "name": "shortTokenPrice", + "type": "tuple" + } + ], + "internalType": "struct MarketUtils.MarketPrices[]", + "name": "marketPricesList", + "type": "tuple[]" + }, + { + "internalType": "uint256", + "name": "start", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "end", + "type": "uint256" + } + ], + "name": "getMarketInfoList", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "address", + "name": "marketToken", + "type": "address" + }, + { + "internalType": "address", + "name": "indexToken", + "type": "address" + }, + { + "internalType": "address", + "name": "longToken", + "type": "address" + }, + { + "internalType": "address", + "name": "shortToken", + "type": "address" + } + ], + "internalType": "struct Market.Props", + "name": "market", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "borrowingFactorPerSecondForLongs", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowingFactorPerSecondForShorts", + "type": "uint256" + }, + { + "components": [ + { + "components": [ + { + "components": [ + { + "internalType": "uint256", + "name": "longToken", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shortToken", + "type": "uint256" + } + ], + "internalType": "struct MarketUtils.CollateralType", + "name": "long", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "longToken", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shortToken", + "type": "uint256" + } + ], + "internalType": "struct MarketUtils.CollateralType", + "name": "short", + "type": "tuple" + } + ], + "internalType": "struct MarketUtils.PositionType", + "name": "fundingFeeAmountPerSize", + "type": "tuple" + }, + { + "components": [ + { + "components": [ + { + "internalType": "uint256", + "name": "longToken", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shortToken", + "type": "uint256" + } + ], + "internalType": "struct MarketUtils.CollateralType", + "name": "long", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "longToken", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shortToken", + "type": "uint256" + } + ], + "internalType": "struct MarketUtils.CollateralType", + "name": "short", + "type": "tuple" + } + ], + "internalType": "struct MarketUtils.PositionType", + "name": "claimableFundingAmountPerSize", + "type": "tuple" + } + ], + "internalType": "struct ReaderUtils.BaseFundingValues", + "name": "baseFunding", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bool", + "name": "longsPayShorts", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "fundingFactorPerSecond", + "type": "uint256" + }, + { + "internalType": "int256", + "name": "nextSavedFundingFactorPerSecond", + "type": "int256" + }, + { + "components": [ + { + "components": [ + { + "internalType": "uint256", + "name": "longToken", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shortToken", + "type": "uint256" + } + ], + "internalType": "struct MarketUtils.CollateralType", + "name": "long", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "longToken", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shortToken", + "type": "uint256" + } + ], + "internalType": "struct MarketUtils.CollateralType", + "name": "short", + "type": "tuple" + } + ], + "internalType": "struct MarketUtils.PositionType", + "name": "fundingFeeAmountPerSizeDelta", + "type": "tuple" + }, + { + "components": [ + { + "components": [ + { + "internalType": "uint256", + "name": "longToken", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shortToken", + "type": "uint256" + } + ], + "internalType": "struct MarketUtils.CollateralType", + "name": "long", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "longToken", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shortToken", + "type": "uint256" + } + ], + "internalType": "struct MarketUtils.CollateralType", + "name": "short", + "type": "tuple" + } + ], + "internalType": "struct MarketUtils.PositionType", + "name": "claimableFundingAmountPerSizeDelta", + "type": "tuple" + } + ], + "internalType": "struct MarketUtils.GetNextFundingAmountPerSizeResult", + "name": "nextFunding", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "virtualPoolAmountForLongToken", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "virtualPoolAmountForShortToken", + "type": "uint256" + }, + { + "internalType": "int256", + "name": "virtualInventoryForPositions", + "type": "int256" + } + ], + "internalType": "struct ReaderUtils.VirtualInventory", + "name": "virtualInventory", + "type": "tuple" + }, + { + "internalType": "bool", + "name": "isDisabled", + "type": "bool" + } + ], + "internalType": "struct ReaderUtils.MarketInfo[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract DataStore", + "name": "dataStore", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "marketToken", + "type": "address" + }, + { + "internalType": "address", + "name": "indexToken", + "type": "address" + }, + { + "internalType": "address", + "name": "longToken", + "type": "address" + }, + { + "internalType": "address", + "name": "shortToken", + "type": "address" + } + ], + "internalType": "struct Market.Props", + "name": "market", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "internalType": "struct Price.Props", + "name": "indexTokenPrice", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "internalType": "struct Price.Props", + "name": "longTokenPrice", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "internalType": "struct Price.Props", + "name": "shortTokenPrice", + "type": "tuple" + }, + { + "internalType": "bytes32", + "name": "pnlFactorType", + "type": "bytes32" + }, + { + "internalType": "bool", + "name": "maximize", + "type": "bool" + } + ], + "name": "getMarketTokenPrice", + "outputs": [ + { + "internalType": "int256", + "name": "", + "type": "int256" + }, + { + "components": [ + { + "internalType": "int256", + "name": "poolValue", + "type": "int256" + }, + { + "internalType": "int256", + "name": "longPnl", + "type": "int256" + }, + { + "internalType": "int256", + "name": "shortPnl", + "type": "int256" + }, + { + "internalType": "int256", + "name": "netPnl", + "type": "int256" + }, + { + "internalType": "uint256", + "name": "longTokenAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shortTokenAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "longTokenUsd", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shortTokenUsd", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBorrowingFees", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowingFeePoolFactor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "impactPoolAmount", + "type": "uint256" + } + ], + "internalType": "struct MarketPoolValueInfo.Props", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract DataStore", + "name": "dataStore", + "type": "address" + }, + { + "internalType": "uint256", + "name": "start", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "end", + "type": "uint256" + } + ], + "name": "getMarkets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "marketToken", + "type": "address" + }, + { + "internalType": "address", + "name": "indexToken", + "type": "address" + }, + { + "internalType": "address", + "name": "longToken", + "type": "address" + }, + { + "internalType": "address", + "name": "shortToken", + "type": "address" + } + ], + "internalType": "struct Market.Props[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract DataStore", + "name": "dataStore", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "marketToken", + "type": "address" + }, + { + "internalType": "address", + "name": "indexToken", + "type": "address" + }, + { + "internalType": "address", + "name": "longToken", + "type": "address" + }, + { + "internalType": "address", + "name": "shortToken", + "type": "address" + } + ], + "internalType": "struct Market.Props", + "name": "market", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "internalType": "struct Price.Props", + "name": "indexTokenPrice", + "type": "tuple" + }, + { + "internalType": "bool", + "name": "maximize", + "type": "bool" + } + ], + "name": "getNetPnl", + "outputs": [ + { + "internalType": "int256", + "name": "", + "type": "int256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract DataStore", + "name": "dataStore", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "marketToken", + "type": "address" + }, + { + "internalType": "address", + "name": "indexToken", + "type": "address" + }, + { + "internalType": "address", + "name": "longToken", + "type": "address" + }, + { + "internalType": "address", + "name": "shortToken", + "type": "address" + } + ], + "internalType": "struct Market.Props", + "name": "market", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "internalType": "struct Price.Props", + "name": "indexTokenPrice", + "type": "tuple" + }, + { + "internalType": "bool", + "name": "isLong", + "type": "bool" + }, + { + "internalType": "bool", + "name": "maximize", + "type": "bool" + } + ], + "name": "getOpenInterestWithPnl", + "outputs": [ + { + "internalType": "int256", + "name": "", + "type": "int256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract DataStore", + "name": "dataStore", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + } + ], + "name": "getOrder", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "address", + "name": "cancellationReceiver", + "type": "address" + }, + { + "internalType": "address", + "name": "callbackContract", + "type": "address" + }, + { + "internalType": "address", + "name": "uiFeeReceiver", + "type": "address" + }, + { + "internalType": "address", + "name": "market", + "type": "address" + }, + { + "internalType": "address", + "name": "initialCollateralToken", + "type": "address" + }, + { + "internalType": "address[]", + "name": "swapPath", + "type": "address[]" + } + ], + "internalType": "struct Order.Addresses", + "name": "addresses", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "enum Order.OrderType", + "name": "orderType", + "type": "uint8" + }, + { + "internalType": "enum Order.DecreasePositionSwapType", + "name": "decreasePositionSwapType", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "sizeDeltaUsd", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "initialCollateralDeltaAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "triggerPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "acceptablePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "executionFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "callbackGasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minOutputAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "updatedAtBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "updatedAtTime", + "type": "uint256" + } + ], + "internalType": "struct Order.Numbers", + "name": "numbers", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bool", + "name": "isLong", + "type": "bool" + }, + { + "internalType": "bool", + "name": "shouldUnwrapNativeToken", + "type": "bool" + }, + { + "internalType": "bool", + "name": "isFrozen", + "type": "bool" + }, + { + "internalType": "bool", + "name": "autoCancel", + "type": "bool" + } + ], + "internalType": "struct Order.Flags", + "name": "flags", + "type": "tuple" + } + ], + "internalType": "struct Order.Props", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract DataStore", + "name": "dataStore", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "marketToken", + "type": "address" + }, + { + "internalType": "address", + "name": "indexToken", + "type": "address" + }, + { + "internalType": "address", + "name": "longToken", + "type": "address" + }, + { + "internalType": "address", + "name": "shortToken", + "type": "address" + } + ], + "internalType": "struct Market.Props", + "name": "market", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "internalType": "struct Price.Props", + "name": "indexTokenPrice", + "type": "tuple" + }, + { + "internalType": "bool", + "name": "isLong", + "type": "bool" + }, + { + "internalType": "bool", + "name": "maximize", + "type": "bool" + } + ], + "name": "getPnl", + "outputs": [ + { + "internalType": "int256", + "name": "", + "type": "int256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract DataStore", + "name": "dataStore", + "type": "address" + }, + { + "internalType": "address", + "name": "marketAddress", + "type": "address" + }, + { + "components": [ + { + "components": [ + { + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "internalType": "struct Price.Props", + "name": "indexTokenPrice", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "internalType": "struct Price.Props", + "name": "longTokenPrice", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "internalType": "struct Price.Props", + "name": "shortTokenPrice", + "type": "tuple" + } + ], + "internalType": "struct MarketUtils.MarketPrices", + "name": "prices", + "type": "tuple" + }, + { + "internalType": "bool", + "name": "isLong", + "type": "bool" + }, + { + "internalType": "bool", + "name": "maximize", + "type": "bool" + } + ], + "name": "getPnlToPoolFactor", + "outputs": [ + { + "internalType": "int256", + "name": "", + "type": "int256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract DataStore", + "name": "dataStore", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + } + ], + "name": "getPosition", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "market", + "type": "address" + }, + { + "internalType": "address", + "name": "collateralToken", + "type": "address" + } + ], + "internalType": "struct Position.Addresses", + "name": "addresses", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "sizeInUsd", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "sizeInTokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "collateralAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowingFactor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "fundingFeeAmountPerSize", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "longTokenClaimableFundingAmountPerSize", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shortTokenClaimableFundingAmountPerSize", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "increasedAtBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "decreasedAtBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "increasedAtTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "decreasedAtTime", + "type": "uint256" + } + ], + "internalType": "struct Position.Numbers", + "name": "numbers", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bool", + "name": "isLong", + "type": "bool" + } + ], + "internalType": "struct Position.Flags", + "name": "flags", + "type": "tuple" + } + ], + "internalType": "struct Position.Props", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract DataStore", + "name": "dataStore", + "type": "address" + }, + { + "internalType": "contract IReferralStorage", + "name": "referralStorage", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "positionKey", + "type": "bytes32" + }, + { + "components": [ + { + "components": [ + { + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "internalType": "struct Price.Props", + "name": "indexTokenPrice", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "internalType": "struct Price.Props", + "name": "longTokenPrice", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "internalType": "struct Price.Props", + "name": "shortTokenPrice", + "type": "tuple" + } + ], + "internalType": "struct MarketUtils.MarketPrices", + "name": "prices", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "sizeDeltaUsd", + "type": "uint256" + }, + { + "internalType": "address", + "name": "uiFeeReceiver", + "type": "address" + }, + { + "internalType": "bool", + "name": "usePositionSizeAsSizeDeltaUsd", + "type": "bool" + } + ], + "name": "getPositionInfo", + "outputs": [ + { + "components": [ + { + "components": [ + { + "components": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "market", + "type": "address" + }, + { + "internalType": "address", + "name": "collateralToken", + "type": "address" + } + ], + "internalType": "struct Position.Addresses", + "name": "addresses", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "sizeInUsd", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "sizeInTokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "collateralAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowingFactor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "fundingFeeAmountPerSize", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "longTokenClaimableFundingAmountPerSize", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shortTokenClaimableFundingAmountPerSize", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "increasedAtBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "decreasedAtBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "increasedAtTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "decreasedAtTime", + "type": "uint256" + } + ], + "internalType": "struct Position.Numbers", + "name": "numbers", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bool", + "name": "isLong", + "type": "bool" + } + ], + "internalType": "struct Position.Flags", + "name": "flags", + "type": "tuple" + } + ], + "internalType": "struct Position.Props", + "name": "position", + "type": "tuple" + }, + { + "components": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "referralCode", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "affiliate", + "type": "address" + }, + { + "internalType": "address", + "name": "trader", + "type": "address" + }, + { + "internalType": "uint256", + "name": "totalRebateFactor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "traderDiscountFactor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalRebateAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "traderDiscountAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "affiliateRewardAmount", + "type": "uint256" + } + ], + "internalType": "struct PositionPricingUtils.PositionReferralFees", + "name": "referral", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "fundingFeeAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "claimableLongTokenAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "claimableShortTokenAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "latestFundingFeeAmountPerSize", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "latestLongTokenClaimableFundingAmountPerSize", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "latestShortTokenClaimableFundingAmountPerSize", + "type": "uint256" + } + ], + "internalType": "struct PositionPricingUtils.PositionFundingFees", + "name": "funding", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "borrowingFeeUsd", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowingFeeAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowingFeeReceiverFactor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "borrowingFeeAmountForFeeReceiver", + "type": "uint256" + } + ], + "internalType": "struct PositionPricingUtils.PositionBorrowingFees", + "name": "borrowing", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "uiFeeReceiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "uiFeeReceiverFactor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "uiFeeAmount", + "type": "uint256" + } + ], + "internalType": "struct PositionPricingUtils.PositionUiFees", + "name": "ui", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "internalType": "struct Price.Props", + "name": "collateralTokenPrice", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "positionFeeFactor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "protocolFeeAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "positionFeeReceiverFactor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "feeReceiverAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "feeAmountForPool", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "positionFeeAmountForPool", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "positionFeeAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalCostAmountExcludingFunding", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalCostAmount", + "type": "uint256" + } + ], + "internalType": "struct PositionPricingUtils.PositionFees", + "name": "fees", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "int256", + "name": "priceImpactUsd", + "type": "int256" + }, + { + "internalType": "uint256", + "name": "priceImpactDiffUsd", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "executionPrice", + "type": "uint256" + } + ], + "internalType": "struct ReaderPricingUtils.ExecutionPriceResult", + "name": "executionPriceResult", + "type": "tuple" + }, + { + "internalType": "int256", + "name": "basePnlUsd", + "type": "int256" + }, + { + "internalType": "int256", + "name": "uncappedBasePnlUsd", + "type": "int256" + }, + { + "internalType": "int256", + "name": "pnlAfterPriceImpactUsd", + "type": "int256" + } + ], + "internalType": "struct ReaderUtils.PositionInfo", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract DataStore", + "name": "dataStore", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "marketToken", + "type": "address" + }, + { + "internalType": "address", + "name": "indexToken", + "type": "address" + }, + { + "internalType": "address", + "name": "longToken", + "type": "address" + }, + { + "internalType": "address", + "name": "shortToken", + "type": "address" + } + ], + "internalType": "struct Market.Props", + "name": "market", + "type": "tuple" + }, + { + "components": [ + { + "components": [ + { + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "internalType": "struct Price.Props", + "name": "indexTokenPrice", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "internalType": "struct Price.Props", + "name": "longTokenPrice", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "internalType": "struct Price.Props", + "name": "shortTokenPrice", + "type": "tuple" + } + ], + "internalType": "struct MarketUtils.MarketPrices", + "name": "prices", + "type": "tuple" + }, + { + "internalType": "bytes32", + "name": "positionKey", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "sizeDeltaUsd", + "type": "uint256" + } + ], + "name": "getPositionPnlUsd", + "outputs": [ + { + "internalType": "int256", + "name": "", + "type": "int256" + }, + { + "internalType": "int256", + "name": "", + "type": "int256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract DataStore", + "name": "dataStore", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + } + ], + "name": "getShift", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "address", + "name": "callbackContract", + "type": "address" + }, + { + "internalType": "address", + "name": "uiFeeReceiver", + "type": "address" + }, + { + "internalType": "address", + "name": "fromMarket", + "type": "address" + }, + { + "internalType": "address", + "name": "toMarket", + "type": "address" + } + ], + "internalType": "struct Shift.Addresses", + "name": "addresses", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "marketTokenAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minMarketTokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "updatedAtTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "executionFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "callbackGasLimit", + "type": "uint256" + } + ], + "internalType": "struct Shift.Numbers", + "name": "numbers", + "type": "tuple" + } + ], + "internalType": "struct Shift.Props", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract DataStore", + "name": "dataStore", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "marketToken", + "type": "address" + }, + { + "internalType": "address", + "name": "indexToken", + "type": "address" + }, + { + "internalType": "address", + "name": "longToken", + "type": "address" + }, + { + "internalType": "address", + "name": "shortToken", + "type": "address" + } + ], + "internalType": "struct Market.Props", + "name": "market", + "type": "tuple" + }, + { + "components": [ + { + "components": [ + { + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "internalType": "struct Price.Props", + "name": "indexTokenPrice", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "internalType": "struct Price.Props", + "name": "longTokenPrice", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "internalType": "struct Price.Props", + "name": "shortTokenPrice", + "type": "tuple" + } + ], + "internalType": "struct MarketUtils.MarketPrices", + "name": "prices", + "type": "tuple" + }, + { + "internalType": "address", + "name": "tokenIn", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amountIn", + "type": "uint256" + }, + { + "internalType": "address", + "name": "uiFeeReceiver", + "type": "address" + } + ], + "name": "getSwapAmountOut", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "int256", + "name": "", + "type": "int256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "feeReceiverAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "feeAmountForPool", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountAfterFees", + "type": "uint256" + }, + { + "internalType": "address", + "name": "uiFeeReceiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "uiFeeReceiverFactor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "uiFeeAmount", + "type": "uint256" + } + ], + "internalType": "struct SwapPricingUtils.SwapFees", + "name": "fees", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract DataStore", + "name": "dataStore", + "type": "address" + }, + { + "internalType": "address", + "name": "marketKey", + "type": "address" + }, + { + "internalType": "address", + "name": "tokenIn", + "type": "address" + }, + { + "internalType": "address", + "name": "tokenOut", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amountIn", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "internalType": "struct Price.Props", + "name": "tokenInPrice", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "internalType": "struct Price.Props", + "name": "tokenOutPrice", + "type": "tuple" + } + ], + "name": "getSwapPriceImpact", + "outputs": [ + { + "internalType": "int256", + "name": "", + "type": "int256" + }, + { + "internalType": "int256", + "name": "", + "type": "int256" + }, + { + "internalType": "int256", + "name": "", + "type": "int256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract DataStore", + "name": "dataStore", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + } + ], + "name": "getWithdrawal", + "outputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "address", + "name": "callbackContract", + "type": "address" + }, + { + "internalType": "address", + "name": "uiFeeReceiver", + "type": "address" + }, + { + "internalType": "address", + "name": "market", + "type": "address" + }, + { + "internalType": "address[]", + "name": "longTokenSwapPath", + "type": "address[]" + }, + { + "internalType": "address[]", + "name": "shortTokenSwapPath", + "type": "address[]" + } + ], + "internalType": "struct Withdrawal.Addresses", + "name": "addresses", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "marketTokenAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minLongTokenAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minShortTokenAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "updatedAtBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "updatedAtTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "executionFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "callbackGasLimit", + "type": "uint256" + } + ], + "internalType": "struct Withdrawal.Numbers", + "name": "numbers", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bool", + "name": "shouldUnwrapNativeToken", + "type": "bool" + } + ], + "internalType": "struct Withdrawal.Flags", + "name": "flags", + "type": "tuple" + } + ], + "internalType": "struct Withdrawal.Props", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract DataStore", + "name": "dataStore", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "marketToken", + "type": "address" + }, + { + "internalType": "address", + "name": "indexToken", + "type": "address" + }, + { + "internalType": "address", + "name": "longToken", + "type": "address" + }, + { + "internalType": "address", + "name": "shortToken", + "type": "address" + } + ], + "internalType": "struct Market.Props", + "name": "market", + "type": "tuple" + }, + { + "components": [ + { + "components": [ + { + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "internalType": "struct Price.Props", + "name": "indexTokenPrice", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "internalType": "struct Price.Props", + "name": "longTokenPrice", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "internalType": "struct Price.Props", + "name": "shortTokenPrice", + "type": "tuple" + } + ], + "internalType": "struct MarketUtils.MarketPrices", + "name": "prices", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "marketTokenAmount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "uiFeeReceiver", + "type": "address" + }, + { + "internalType": "enum ISwapPricingUtils.SwapPricingType", + "name": "swapPricingType", + "type": "uint8" + } + ], + "name": "getWithdrawalAmountOut", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } +] \ No newline at end of file diff --git a/abi/hyperdrive_registry.json b/abi/hyperdrive_registry.json new file mode 100644 index 0000000..c1ea11b --- /dev/null +++ b/abi/hyperdrive_registry.json @@ -0,0 +1,555 @@ +[ + { + "inputs": [ + { + "internalType": "string", + "name": "_name", + "type": "string" + }], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "EndIndexTooLarge", + "type": "error" + }, + { + "inputs": [], + "name": "InputLengthMismatch", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidFactory", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidIndexes", + "type": "error" + }, + { + "inputs": [], + "name": "Unauthorized", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "admin", + "type": "address" + }], + "name": "AdminUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "factory", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "data", + "type": "uint256" + }], + "name": "FactoryInfoUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "instance", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "data", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "factory", + "type": "address" + }], + "name": "InstanceInfoUpdated", + "type": "event" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_startIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_endIndex", + "type": "uint256" + }], + "name": "getFactoriesInRange", + "outputs": [ + { + "internalType": "address[]", + "name": "factories", + "type": "address[]" + }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_index", + "type": "uint256" + }], + "name": "getFactoryAtIndex", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_factory", + "type": "address" + }], + "name": "getFactoryInfo", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "data", + "type": "uint256" + }], + "internalType": "struct IHyperdriveRegistry.FactoryInfo", + "name": "info", + "type": "tuple" + }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_factory", + "type": "address" + }], + "name": "getFactoryInfoWithMetadata", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "data", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "kind", + "type": "string" + }, + { + "internalType": "string", + "name": "version", + "type": "string" + }], + "internalType": "struct IHyperdriveRegistry.FactoryInfoWithMetadata", + "name": "info", + "type": "tuple" + }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "__factories", + "type": "address[]" + }], + "name": "getFactoryInfos", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "data", + "type": "uint256" + }], + "internalType": "struct IHyperdriveRegistry.FactoryInfo[]", + "name": "info", + "type": "tuple[]" + }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "__factories", + "type": "address[]" + }], + "name": "getFactoryInfosWithMetadata", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "data", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "kind", + "type": "string" + }, + { + "internalType": "string", + "name": "version", + "type": "string" + }], + "internalType": "struct IHyperdriveRegistry.FactoryInfoWithMetadata[]", + "name": "info", + "type": "tuple[]" + }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_index", + "type": "uint256" + }], + "name": "getInstanceAtIndex", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_instance", + "type": "address" + }], + "name": "getInstanceInfo", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "data", + "type": "uint256" + }, + { + "internalType": "address", + "name": "factory", + "type": "address" + }], + "internalType": "struct IHyperdriveRegistry.InstanceInfo", + "name": "info", + "type": "tuple" + }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_instance", + "type": "address" + }], + "name": "getInstanceInfoWithMetadata", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "data", + "type": "uint256" + }, + { + "internalType": "address", + "name": "factory", + "type": "address" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "kind", + "type": "string" + }, + { + "internalType": "string", + "name": "version", + "type": "string" + }], + "internalType": "struct IHyperdriveRegistry.InstanceInfoWithMetadata", + "name": "info", + "type": "tuple" + }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "__instances", + "type": "address[]" + }], + "name": "getInstanceInfos", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "data", + "type": "uint256" + }, + { + "internalType": "address", + "name": "factory", + "type": "address" + }], + "internalType": "struct IHyperdriveRegistry.InstanceInfo[]", + "name": "info", + "type": "tuple[]" + }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "__instances", + "type": "address[]" + }], + "name": "getInstanceInfosWithMetadata", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "data", + "type": "uint256" + }, + { + "internalType": "address", + "name": "factory", + "type": "address" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "kind", + "type": "string" + }, + { + "internalType": "string", + "name": "version", + "type": "string" + }], + "internalType": "struct IHyperdriveRegistry.InstanceInfoWithMetadata[]", + "name": "info", + "type": "tuple[]" + }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_startIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_endIndex", + "type": "uint256" + }], + "name": "getInstancesInRange", + "outputs": [ + { + "internalType": "address[]", + "name": "instances", + "type": "address[]" + }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getNumberOfFactories", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getNumberOfInstances", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "kind", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "__factories", + "type": "address[]" + }, + { + "internalType": "uint128[]", + "name": "_data", + "type": "uint128[]" + }], + "name": "setFactoryInfo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "__instances", + "type": "address[]" + }, + { + "internalType": "uint128[]", + "name": "_data", + "type": "uint128[]" + }, + { + "internalType": "address[]", + "name": "__factories", + "type": "address[]" + }], + "name": "setInstanceInfo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_admin", + "type": "address" + }], + "name": "updateAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "version", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + }], + "stateMutability": "view", + "type": "function" + }] \ No newline at end of file diff --git a/abi/merchant_moe_lb_pair.json b/abi/merchant_moe_lb_pair.json new file mode 100644 index 0000000..a7c6d6c --- /dev/null +++ b/abi/merchant_moe_lb_pair.json @@ -0,0 +1,949 @@ +[ + { + "inputs": [ + { + "internalType": "contract ILBFactory", + "name": "factory_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { "inputs": [], "name": "AddressHelper__CallFailed", "type": "error" }, + { "inputs": [], "name": "AddressHelper__NonContract", "type": "error" }, + { + "inputs": [{ "internalType": "uint24", "name": "id", "type": "uint24" }], + "name": "BinHelper__CompositionFactorFlawed", + "type": "error" + }, + { "inputs": [], "name": "BinHelper__LiquidityOverflow", "type": "error" }, + { "inputs": [], "name": "FeeHelper__FeeOverflow", "type": "error" }, + { "inputs": [], "name": "LBPair__AddressZero", "type": "error" }, + { "inputs": [], "name": "LBPair__AlreadyInitialized", "type": "error" }, + { "inputs": [], "name": "LBPair__EmptyMarketConfigs", "type": "error" }, + { "inputs": [], "name": "LBPair__FlashLoanCallbackFailed", "type": "error" }, + { + "inputs": [], + "name": "LBPair__FlashLoanInsufficientAmount", + "type": "error" + }, + { "inputs": [], "name": "LBPair__InsufficientAmountIn", "type": "error" }, + { "inputs": [], "name": "LBPair__InsufficientAmountOut", "type": "error" }, + { "inputs": [], "name": "LBPair__InvalidInput", "type": "error" }, + { + "inputs": [], + "name": "LBPair__InvalidStaticFeeParameters", + "type": "error" + }, + { "inputs": [], "name": "LBPair__MaxTotalFeeExceeded", "type": "error" }, + { "inputs": [], "name": "LBPair__OnlyFactory", "type": "error" }, + { "inputs": [], "name": "LBPair__OnlyProtocolFeeRecipient", "type": "error" }, + { "inputs": [], "name": "LBPair__OutOfLiquidity", "type": "error" }, + { "inputs": [], "name": "LBPair__TokenNotSupported", "type": "error" }, + { + "inputs": [{ "internalType": "uint24", "name": "id", "type": "uint24" }], + "name": "LBPair__ZeroAmount", + "type": "error" + }, + { + "inputs": [{ "internalType": "uint24", "name": "id", "type": "uint24" }], + "name": "LBPair__ZeroAmountsOut", + "type": "error" + }, + { "inputs": [], "name": "LBPair__ZeroBorrowAmount", "type": "error" }, + { + "inputs": [{ "internalType": "uint24", "name": "id", "type": "uint24" }], + "name": "LBPair__ZeroShares", + "type": "error" + }, + { "inputs": [], "name": "LBToken__AddressThisOrZero", "type": "error" }, + { + "inputs": [ + { "internalType": "address", "name": "from", "type": "address" }, + { "internalType": "uint256", "name": "id", "type": "uint256" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "LBToken__BurnExceedsBalance", + "type": "error" + }, + { "inputs": [], "name": "LBToken__InvalidLength", "type": "error" }, + { + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" } + ], + "name": "LBToken__SelfApproval", + "type": "error" + }, + { + "inputs": [ + { "internalType": "address", "name": "from", "type": "address" }, + { "internalType": "address", "name": "spender", "type": "address" } + ], + "name": "LBToken__SpenderNotApproved", + "type": "error" + }, + { + "inputs": [ + { "internalType": "address", "name": "from", "type": "address" }, + { "internalType": "uint256", "name": "id", "type": "uint256" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "LBToken__TransferExceedsBalance", + "type": "error" + }, + { + "inputs": [], + "name": "LiquidityConfigurations__InvalidConfig", + "type": "error" + }, + { "inputs": [], "name": "OracleHelper__InvalidOracleId", "type": "error" }, + { + "inputs": [], + "name": "OracleHelper__LookUpTimestampTooOld", + "type": "error" + }, + { "inputs": [], "name": "OracleHelper__NewLengthTooSmall", "type": "error" }, + { "inputs": [], "name": "PackedUint128Math__AddOverflow", "type": "error" }, + { + "inputs": [], + "name": "PackedUint128Math__MultiplierTooLarge", + "type": "error" + }, + { "inputs": [], "name": "PackedUint128Math__SubUnderflow", "type": "error" }, + { + "inputs": [], + "name": "PairParametersHelper__InvalidParameter", + "type": "error" + }, + { "inputs": [], "name": "ReentrancyGuard__ReentrantCall", "type": "error" }, + { "inputs": [], "name": "SafeCast__Exceeds128Bits", "type": "error" }, + { "inputs": [], "name": "SafeCast__Exceeds24Bits", "type": "error" }, + { "inputs": [], "name": "SafeCast__Exceeds40Bits", "type": "error" }, + { "inputs": [], "name": "TokenHelper__TransferFailed", "type": "error" }, + { "inputs": [], "name": "Uint128x128Math__LogUnderflow", "type": "error" }, + { + "inputs": [ + { "internalType": "uint256", "name": "x", "type": "uint256" }, + { "internalType": "int256", "name": "y", "type": "int256" } + ], + "name": "Uint128x128Math__PowUnderflow", + "type": "error" + }, + { "inputs": [], "name": "Uint256x256Math__MulDivOverflow", "type": "error" }, + { + "inputs": [], + "name": "Uint256x256Math__MulShiftOverflow", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "feeRecipient", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "protocolFees", + "type": "bytes32" + } + ], + "name": "CollectedProtocolFees", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint24", + "name": "id", + "type": "uint24" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "totalFees", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "protocolFees", + "type": "bytes32" + } + ], + "name": "CompositionFees", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "bytes32[]", + "name": "amounts", + "type": "bytes32[]" + } + ], + "name": "DepositedToBins", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "contract ILBFlashLoanCallback", + "name": "receiver", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint24", + "name": "activeId", + "type": "uint24" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "amounts", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "totalFees", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "protocolFees", + "type": "bytes32" + } + ], + "name": "FlashLoan", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint24", + "name": "idReference", + "type": "uint24" + }, + { + "indexed": false, + "internalType": "uint24", + "name": "volatilityReference", + "type": "uint24" + } + ], + "name": "ForcedDecay", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "oracleLength", + "type": "uint16" + } + ], + "name": "OracleLengthIncreased", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "baseFactor", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "filterPeriod", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "decayPeriod", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "reductionFactor", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "uint24", + "name": "variableFeeControl", + "type": "uint24" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "protocolShare", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "uint24", + "name": "maxVolatilityAccumulator", + "type": "uint24" + } + ], + "name": "StaticFeeParametersSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint24", + "name": "id", + "type": "uint24" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "amountsIn", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "amountsOut", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint24", + "name": "volatilityAccumulator", + "type": "uint24" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "totalFees", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "protocolFees", + "type": "bytes32" + } + ], + "name": "Swap", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + } + ], + "name": "TransferBatch", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "bytes32[]", + "name": "amounts", + "type": "bytes32[]" + } + ], + "name": "WithdrawnFromBins", + "type": "event" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "bool", "name": "approved", "type": "bool" } + ], + "name": "approveForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" }, + { "internalType": "uint256", "name": "id", "type": "uint256" } + ], + "name": "balanceOf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address[]", "name": "accounts", "type": "address[]" }, + { "internalType": "uint256[]", "name": "ids", "type": "uint256[]" } + ], + "name": "balanceOfBatch", + "outputs": [ + { + "internalType": "uint256[]", + "name": "batchBalances", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "from", "type": "address" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256[]", "name": "ids", "type": "uint256[]" }, + { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" } + ], + "name": "batchTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "from", "type": "address" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256[]", "name": "ids", "type": "uint256[]" }, + { + "internalType": "uint256[]", + "name": "amountsToBurn", + "type": "uint256[]" + } + ], + "name": "burn", + "outputs": [ + { "internalType": "bytes32[]", "name": "amounts", "type": "bytes32[]" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "collectProtocolFees", + "outputs": [ + { + "internalType": "bytes32", + "name": "collectedProtocolFees", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ILBFlashLoanCallback", + "name": "receiver", + "type": "address" + }, + { "internalType": "bytes32", "name": "amounts", "type": "bytes32" }, + { "internalType": "bytes", "name": "data", "type": "bytes" } + ], + "name": "flashLoan", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "forceDecay", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getActiveId", + "outputs": [ + { "internalType": "uint24", "name": "activeId", "type": "uint24" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint24", "name": "id", "type": "uint24" }], + "name": "getBin", + "outputs": [ + { "internalType": "uint128", "name": "binReserveX", "type": "uint128" }, + { "internalType": "uint128", "name": "binReserveY", "type": "uint128" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getBinStep", + "outputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "getFactory", + "outputs": [ + { + "internalType": "contract ILBFactory", + "name": "factory", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "price", "type": "uint256" } + ], + "name": "getIdFromPrice", + "outputs": [{ "internalType": "uint24", "name": "id", "type": "uint24" }], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bool", "name": "swapForY", "type": "bool" }, + { "internalType": "uint24", "name": "id", "type": "uint24" } + ], + "name": "getNextNonEmptyBin", + "outputs": [ + { "internalType": "uint24", "name": "nextId", "type": "uint24" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getOracleParameters", + "outputs": [ + { "internalType": "uint8", "name": "sampleLifetime", "type": "uint8" }, + { "internalType": "uint16", "name": "size", "type": "uint16" }, + { "internalType": "uint16", "name": "activeSize", "type": "uint16" }, + { "internalType": "uint40", "name": "lastUpdated", "type": "uint40" }, + { "internalType": "uint40", "name": "firstTimestamp", "type": "uint40" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint40", "name": "lookupTimestamp", "type": "uint40" } + ], + "name": "getOracleSampleAt", + "outputs": [ + { "internalType": "uint64", "name": "cumulativeId", "type": "uint64" }, + { + "internalType": "uint64", + "name": "cumulativeVolatility", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "cumulativeBinCrossed", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint24", "name": "id", "type": "uint24" }], + "name": "getPriceFromId", + "outputs": [ + { "internalType": "uint256", "name": "price", "type": "uint256" } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "getProtocolFees", + "outputs": [ + { "internalType": "uint128", "name": "protocolFeeX", "type": "uint128" }, + { "internalType": "uint128", "name": "protocolFeeY", "type": "uint128" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getReserves", + "outputs": [ + { "internalType": "uint128", "name": "reserveX", "type": "uint128" }, + { "internalType": "uint128", "name": "reserveY", "type": "uint128" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getStaticFeeParameters", + "outputs": [ + { "internalType": "uint16", "name": "baseFactor", "type": "uint16" }, + { "internalType": "uint16", "name": "filterPeriod", "type": "uint16" }, + { "internalType": "uint16", "name": "decayPeriod", "type": "uint16" }, + { "internalType": "uint16", "name": "reductionFactor", "type": "uint16" }, + { + "internalType": "uint24", + "name": "variableFeeControl", + "type": "uint24" + }, + { "internalType": "uint16", "name": "protocolShare", "type": "uint16" }, + { + "internalType": "uint24", + "name": "maxVolatilityAccumulator", + "type": "uint24" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint128", "name": "amountOut", "type": "uint128" }, + { "internalType": "bool", "name": "swapForY", "type": "bool" } + ], + "name": "getSwapIn", + "outputs": [ + { "internalType": "uint128", "name": "amountIn", "type": "uint128" }, + { "internalType": "uint128", "name": "amountOutLeft", "type": "uint128" }, + { "internalType": "uint128", "name": "fee", "type": "uint128" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint128", "name": "amountIn", "type": "uint128" }, + { "internalType": "bool", "name": "swapForY", "type": "bool" } + ], + "name": "getSwapOut", + "outputs": [ + { "internalType": "uint128", "name": "amountInLeft", "type": "uint128" }, + { "internalType": "uint128", "name": "amountOut", "type": "uint128" }, + { "internalType": "uint128", "name": "fee", "type": "uint128" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTokenX", + "outputs": [ + { "internalType": "contract IERC20", "name": "tokenX", "type": "address" } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "getTokenY", + "outputs": [ + { "internalType": "contract IERC20", "name": "tokenY", "type": "address" } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "getVariableFeeParameters", + "outputs": [ + { + "internalType": "uint24", + "name": "volatilityAccumulator", + "type": "uint24" + }, + { + "internalType": "uint24", + "name": "volatilityReference", + "type": "uint24" + }, + { "internalType": "uint24", "name": "idReference", "type": "uint24" }, + { "internalType": "uint40", "name": "timeOfLastUpdate", "type": "uint40" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "newLength", "type": "uint16" } + ], + "name": "increaseOracleLength", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "baseFactor", "type": "uint16" }, + { "internalType": "uint16", "name": "filterPeriod", "type": "uint16" }, + { "internalType": "uint16", "name": "decayPeriod", "type": "uint16" }, + { "internalType": "uint16", "name": "reductionFactor", "type": "uint16" }, + { + "internalType": "uint24", + "name": "variableFeeControl", + "type": "uint24" + }, + { "internalType": "uint16", "name": "protocolShare", "type": "uint16" }, + { + "internalType": "uint24", + "name": "maxVolatilityAccumulator", + "type": "uint24" + }, + { "internalType": "uint24", "name": "activeId", "type": "uint24" } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" }, + { "internalType": "address", "name": "spender", "type": "address" } + ], + "name": "isApprovedForAll", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "to", "type": "address" }, + { + "internalType": "bytes32[]", + "name": "liquidityConfigs", + "type": "bytes32[]" + }, + { "internalType": "address", "name": "refundTo", "type": "address" } + ], + "name": "mint", + "outputs": [ + { + "internalType": "bytes32", + "name": "amountsReceived", + "type": "bytes32" + }, + { "internalType": "bytes32", "name": "amountsLeft", "type": "bytes32" }, + { + "internalType": "uint256[]", + "name": "liquidityMinted", + "type": "uint256[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "baseFactor", "type": "uint16" }, + { "internalType": "uint16", "name": "filterPeriod", "type": "uint16" }, + { "internalType": "uint16", "name": "decayPeriod", "type": "uint16" }, + { "internalType": "uint16", "name": "reductionFactor", "type": "uint16" }, + { + "internalType": "uint24", + "name": "variableFeeControl", + "type": "uint24" + }, + { "internalType": "uint16", "name": "protocolShare", "type": "uint16" }, + { + "internalType": "uint24", + "name": "maxVolatilityAccumulator", + "type": "uint24" + } + ], + "name": "setStaticFeeParameters", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bool", "name": "swapForY", "type": "bool" }, + { "internalType": "address", "name": "to", "type": "address" } + ], + "name": "swap", + "outputs": [ + { "internalType": "bytes32", "name": "amountsOut", "type": "bytes32" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "id", "type": "uint256" }], + "name": "totalSupply", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + } + ] \ No newline at end of file diff --git a/abi/merchant_moe_liquidity_helper.json b/abi/merchant_moe_liquidity_helper.json new file mode 100644 index 0000000..0561652 --- /dev/null +++ b/abi/merchant_moe_liquidity_helper.json @@ -0,0 +1,578 @@ +[ + { + "inputs": [], + "name": "BinHelper__LiquidityOverflow", + "type": "error" + }, + { + "inputs": [], + "name": "FeesAmounts__LengthMismatch", + "type": "error" + }, + { + "inputs": [], + "name": "SafeCast__Exceeds24Bits", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "x", + "type": "uint256" + }, + { + "internalType": "int256", + "name": "y", + "type": "int256" + } + ], + "name": "Uint128x128Math__PowUnderflow", + "type": "error" + }, + { + "inputs": [], + "name": "Uint256x256Math__MulDivOverflow", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "contract ILBPair", + "name": "lbPair", + "type": "address" + }, + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "previousX", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "previousY", + "type": "uint256[]" + } + ], + "name": "getAmountsAndFeesEarnedOf", + "outputs": [ + { + "internalType": "uint256[]", + "name": "amountsX", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "amountsY", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "feesX", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "feesY", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ILBPair", + "name": "lbPair", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "liquidities", + "type": "uint256[]" + } + ], + "name": "getAmountsForLiquidities", + "outputs": [ + { + "internalType": "uint256[]", + "name": "amountsX", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "amountsY", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ILBPair", + "name": "lbPair", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "shares", + "type": "uint256[]" + } + ], + "name": "getAmountsForShares", + "outputs": [ + { + "internalType": "uint256[]", + "name": "amountsX", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "amountsY", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ILBPair", + "name": "lbPair", + "type": "address" + }, + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + } + ], + "name": "getAmountsOf", + "outputs": [ + { + "internalType": "uint256[]", + "name": "amountsX", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "amountsY", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ILBPair", + "name": "pair", + "type": "address" + }, + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "uint24", + "name": "id", + "type": "uint24" + }, + { + "internalType": "uint24", + "name": "lengthLeft", + "type": "uint24" + }, + { + "internalType": "uint24", + "name": "lengthRight", + "type": "uint24" + } + ], + "name": "getBinsReserveOf", + "outputs": [ + { + "internalType": "uint24", + "name": "", + "type": "uint24" + }, + { + "components": [ + { + "internalType": "uint24", + "name": "id", + "type": "uint24" + }, + { + "internalType": "uint128", + "name": "reserveX", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "reserveY", + "type": "uint128" + }, + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalShares", + "type": "uint256" + } + ], + "internalType": "struct NonEmptyBinHelper.PopulatedBinUser[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ILBPair", + "name": "lbPair", + "type": "address" + }, + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "previousLiquidities", + "type": "uint256[]" + } + ], + "name": "getFeeSharesAndFeesEarnedOf", + "outputs": [ + { + "internalType": "uint256[]", + "name": "feeShares", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "feesX", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "feesY", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ILBPair", + "name": "lbPair", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "amountsX", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "amountsY", + "type": "uint256[]" + } + ], + "name": "getLiquiditiesForAmounts", + "outputs": [ + { + "internalType": "uint256[]", + "name": "liquidities", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ILBPair", + "name": "lbPair", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "shares", + "type": "uint256[]" + } + ], + "name": "getLiquiditiesForShares", + "outputs": [ + { + "internalType": "uint256[]", + "name": "liquidities", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ILBPair", + "name": "lbPair", + "type": "address" + }, + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + } + ], + "name": "getLiquiditiesOf", + "outputs": [ + { + "internalType": "uint256[]", + "name": "liquidities", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ILBPair", + "name": "pair", + "type": "address" + }, + { + "internalType": "uint24", + "name": "start", + "type": "uint24" + }, + { + "internalType": "uint24", + "name": "end", + "type": "uint24" + }, + { + "internalType": "uint24", + "name": "length", + "type": "uint24" + } + ], + "name": "getPopulatedBinsId", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ILBPair", + "name": "pair", + "type": "address" + }, + { + "internalType": "uint24", + "name": "start", + "type": "uint24" + }, + { + "internalType": "uint24", + "name": "end", + "type": "uint24" + }, + { + "internalType": "uint24", + "name": "length", + "type": "uint24" + } + ], + "name": "getPopulatedBinsReserves", + "outputs": [ + { + "components": [ + { + "internalType": "uint24", + "name": "id", + "type": "uint24" + }, + { + "internalType": "uint128", + "name": "reserveX", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "reserveY", + "type": "uint128" + } + ], + "internalType": "struct NonEmptyBinHelper.PopulatedBin[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ILBPair", + "name": "lbPair", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "amountsX", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "amountsY", + "type": "uint256[]" + } + ], + "name": "getSharesForAmounts", + "outputs": [ + { + "internalType": "uint256[]", + "name": "shares", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ILBPair", + "name": "lbPair", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "liquidities", + "type": "uint256[]" + } + ], + "name": "getSharesForLiquidities", + "outputs": [ + { + "internalType": "uint256[]", + "name": "shares", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ILBPair", + "name": "lbPair", + "type": "address" + }, + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + } + ], + "name": "getSharesOf", + "outputs": [ + { + "internalType": "uint256[]", + "name": "balances", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + } +] \ No newline at end of file diff --git a/abi/r_token.json b/abi/r_token.json new file mode 100644 index 0000000..c6e3b7f --- /dev/null +++ b/abi/r_token.json @@ -0,0 +1,845 @@ +[ + { + "type": "function", + "name": "_acceptAdmin", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "_reduceReserves", + "inputs": [ + { "name": "reduceAmount", "type": "uint256", "internalType": "uint256" } + ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "_setComptroller", + "inputs": [ + { + "name": "newComptroller", + "type": "address", + "internalType": "contract ComptrollerInterface" + } + ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "_setInterestRateModel", + "inputs": [ + { + "name": "newInterestRateModel", + "type": "address", + "internalType": "contract InterestRateModel" + } + ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "_setPendingAdmin", + "inputs": [ + { + "name": "newPendingAdmin", + "type": "address", + "internalType": "address payable" + } + ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "_setProtocolSeizeShare", + "inputs": [ + { + "name": "newProtocolSeizeShareMantissa", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "_setRedemptionReserveFactorFresh", + "inputs": [ + { + "name": "newRedemptionReserveFactorMantissa", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "_setReserveFactor", + "inputs": [ + { + "name": "newReserveFactorMantissa", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "accrualBlockNumber", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "accrueInterest", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "admin", + "inputs": [], + "outputs": [ + { "name": "", "type": "address", "internalType": "address payable" } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "allowance", + "inputs": [ + { "name": "owner", "type": "address", "internalType": "address" }, + { "name": "spender", "type": "address", "internalType": "address" } + ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "approve", + "inputs": [ + { "name": "spender", "type": "address", "internalType": "address" }, + { "name": "amount", "type": "uint256", "internalType": "uint256" } + ], + "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "balanceOf", + "inputs": [ + { "name": "owner", "type": "address", "internalType": "address" } + ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "balanceOfUnderlying", + "inputs": [ + { "name": "owner", "type": "address", "internalType": "address" } + ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "borrowBalanceCurrent", + "inputs": [ + { "name": "account", "type": "address", "internalType": "address" } + ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "borrowBalanceStored", + "inputs": [ + { "name": "account", "type": "address", "internalType": "address" } + ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "borrowIndex", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "borrowRatePerBlock", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "comptroller", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "contract ComptrollerInterface" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "decimals", + "inputs": [], + "outputs": [{ "name": "", "type": "uint8", "internalType": "uint8" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "exchangeRateCurrent", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "exchangeRateStored", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getAccountSnapshot", + "inputs": [ + { "name": "account", "type": "address", "internalType": "address" } + ], + "outputs": [ + { "name": "", "type": "uint256", "internalType": "uint256" }, + { "name": "", "type": "uint256", "internalType": "uint256" }, + { "name": "", "type": "uint256", "internalType": "uint256" }, + { "name": "", "type": "uint256", "internalType": "uint256" } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getCash", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "initialize", + "inputs": [ + { + "name": "comptroller_", + "type": "address", + "internalType": "contract ComptrollerInterface" + }, + { + "name": "interestRateModel_", + "type": "address", + "internalType": "contract InterestRateModel" + }, + { + "name": "initialExchangeRateMantissa_", + "type": "uint256", + "internalType": "uint256" + }, + { "name": "name_", "type": "string", "internalType": "string" }, + { "name": "symbol_", "type": "string", "internalType": "string" }, + { "name": "decimals_", "type": "uint8", "internalType": "uint8" } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "interestRateModel", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "contract InterestRateModel" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "isEthDerivative", + "inputs": [], + "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "isRToken", + "inputs": [], + "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "name", + "inputs": [], + "outputs": [{ "name": "", "type": "string", "internalType": "string" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "pendingAdmin", + "inputs": [], + "outputs": [ + { "name": "", "type": "address", "internalType": "address payable" } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "protocolSeizeShareMantissa", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "reserveFactorMantissa", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "seize", + "inputs": [ + { "name": "liquidator", "type": "address", "internalType": "address" }, + { "name": "borrower", "type": "address", "internalType": "address" }, + { "name": "seizeTokens", "type": "uint256", "internalType": "uint256" } + ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "supplyRatePerBlock", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "symbol", + "inputs": [], + "outputs": [{ "name": "", "type": "string", "internalType": "string" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "totalBorrows", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "totalBorrowsCurrent", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "totalReserves", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "totalSupply", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "transfer", + "inputs": [ + { "name": "dst", "type": "address", "internalType": "address" }, + { "name": "amount", "type": "uint256", "internalType": "uint256" } + ], + "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "transferFrom", + "inputs": [ + { "name": "src", "type": "address", "internalType": "address" }, + { "name": "dst", "type": "address", "internalType": "address" }, + { "name": "amount", "type": "uint256", "internalType": "uint256" } + ], + "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], + "stateMutability": "nonpayable" + }, + { + "type": "event", + "name": "AccrueInterest", + "inputs": [ + { + "name": "cashPrior", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "interestAccumulated", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "borrowIndex", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "totalBorrows", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Approval", + "inputs": [ + { + "name": "owner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "spender", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "amount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Borrow", + "inputs": [ + { + "name": "borrower", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "borrowAmount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "accountBorrows", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "totalBorrows", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Failure", + "inputs": [ + { + "name": "error", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "info", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "detail", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "LiquidateBorrow", + "inputs": [ + { + "name": "liquidator", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "borrower", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "repayAmount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "rTokenCollateral", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "seizeTokens", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Mint", + "inputs": [ + { + "name": "minter", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "mintAmount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "mintTokens", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "NewAdmin", + "inputs": [ + { + "name": "oldAdmin", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "newAdmin", + "type": "address", + "indexed": false, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "NewComptroller", + "inputs": [ + { + "name": "oldComptroller", + "type": "address", + "indexed": false, + "internalType": "contract ComptrollerInterface" + }, + { + "name": "newComptroller", + "type": "address", + "indexed": false, + "internalType": "contract ComptrollerInterface" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "NewMarketInterestRateModel", + "inputs": [ + { + "name": "oldInterestRateModel", + "type": "address", + "indexed": false, + "internalType": "contract InterestRateModel" + }, + { + "name": "newInterestRateModel", + "type": "address", + "indexed": false, + "internalType": "contract InterestRateModel" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "NewPendingAdmin", + "inputs": [ + { + "name": "oldPendingAdmin", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "newPendingAdmin", + "type": "address", + "indexed": false, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "NewProtocolSeizeShare", + "inputs": [ + { + "name": "oldProtocolSeizeShareMantissa", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "newProtocolSeizeShareMantissa", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "NewRedemptionReserveFactor", + "inputs": [ + { + "name": "oldRedemptionReserveFactor", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "newRedemptionReserveFactor", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "NewReserveFactor", + "inputs": [ + { + "name": "oldReserveFactorMantissa", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "newReserveFactorMantissa", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Redeem", + "inputs": [ + { + "name": "redeemer", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "redeemAmount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "redeemTokens", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "RepayBorrow", + "inputs": [ + { + "name": "payer", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "borrower", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "repayAmount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "accountBorrows", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "totalBorrows", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ReservesAdded", + "inputs": [ + { + "name": "benefactor", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "addAmount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "newTotalReserves", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ReservesReduced", + "inputs": [ + { + "name": "admin", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "reduceAmount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "newTotalReserves", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Transfer", + "inputs": [ + { + "name": "from", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "to", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "amount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + } +] diff --git a/abi/radiant_lending_pool.json b/abi/radiant_lending_pool.json new file mode 100644 index 0000000..a2a9e96 --- /dev/null +++ b/abi/radiant_lending_pool.json @@ -0,0 +1,799 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "reserve", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "onBehalfOf", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "borrowRateMode", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "borrowRate", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint16", + "name": "referral", + "type": "uint16" + } + ], + "name": "Borrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "reserve", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "onBehalfOf", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint16", + "name": "referral", + "type": "uint16" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "initiator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "premium", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "referralCode", + "type": "uint16" + } + ], + "name": "FlashLoan", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "collateralAsset", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "debtAsset", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "debtToCover", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "liquidatedCollateralAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "liquidator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "receiveAToken", + "type": "bool" + }, + { + "indexed": false, + "internalType": "address", + "name": "liquidationFeeTo", + "type": "address" + } + ], + "name": "LiquidationCall", + "type": "event" + }, + { "anonymous": false, "inputs": [], "name": "Paused", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "reserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "RebalanceStableBorrowRate", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "reserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "repayer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Repay", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "reserve", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "liquidityRate", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "stableBorrowRate", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "variableBorrowRate", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "liquidityIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "variableBorrowIndex", + "type": "uint256" + } + ], + "name": "ReserveDataUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "reserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "ReserveUsedAsCollateralDisabled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "reserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "ReserveUsedAsCollateralEnabled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "reserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "rateMode", + "type": "uint256" + } + ], + "name": "Swap", + "type": "event" + }, + { "anonymous": false, "inputs": [], "name": "Unpaused", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "reserve", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdraw", + "type": "event" + }, + { + "inputs": [], + "name": "FLASHLOAN_PREMIUM_TOTAL", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "LENDINGPOOL_REVISION", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MAX_NUMBER_RESERVES", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MAX_STABLE_RATE_BORROW_SIZE_PERCENT", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { + "internalType": "uint256", + "name": "interestRateMode", + "type": "uint256" + }, + { "internalType": "uint16", "name": "referralCode", "type": "uint16" }, + { "internalType": "address", "name": "onBehalfOf", "type": "address" } + ], + "name": "borrow", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { "internalType": "address", "name": "onBehalfOf", "type": "address" }, + { "internalType": "uint16", "name": "referralCode", "type": "uint16" } + ], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" }, + { "internalType": "address", "name": "from", "type": "address" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { + "internalType": "uint256", + "name": "balanceFromBefore", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceToBefore", + "type": "uint256" + } + ], + "name": "finalizeTransfer", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "receiverAddress", + "type": "address" + }, + { "internalType": "address[]", "name": "assets", "type": "address[]" }, + { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" }, + { "internalType": "uint256[]", "name": "modes", "type": "uint256[]" }, + { "internalType": "address", "name": "onBehalfOf", "type": "address" }, + { "internalType": "bytes", "name": "params", "type": "bytes" }, + { "internalType": "uint16", "name": "referralCode", "type": "uint16" } + ], + "name": "flashLoan", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getAddressesProvider", + "outputs": [ + { + "internalType": "contract ILendingPoolAddressesProvider", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" } + ], + "name": "getConfiguration", + "outputs": [ + { + "components": [ + { "internalType": "uint256", "name": "data", "type": "uint256" } + ], + "internalType": "struct DataTypes.ReserveConfigurationMap", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" } + ], + "name": "getReserveData", + "outputs": [ + { + "components": [ + { + "components": [ + { "internalType": "uint256", "name": "data", "type": "uint256" } + ], + "internalType": "struct DataTypes.ReserveConfigurationMap", + "name": "configuration", + "type": "tuple" + }, + { + "internalType": "uint128", + "name": "liquidityIndex", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "variableBorrowIndex", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "currentLiquidityRate", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "currentVariableBorrowRate", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "currentStableBorrowRate", + "type": "uint128" + }, + { + "internalType": "uint40", + "name": "lastUpdateTimestamp", + "type": "uint40" + }, + { + "internalType": "address", + "name": "aTokenAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "stableDebtTokenAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "variableDebtTokenAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "interestRateStrategyAddress", + "type": "address" + }, + { "internalType": "uint8", "name": "id", "type": "uint8" } + ], + "internalType": "struct DataTypes.ReserveData", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" } + ], + "name": "getReserveNormalizedIncome", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" } + ], + "name": "getReserveNormalizedVariableDebt", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getReservesList", + "outputs": [ + { "internalType": "address[]", "name": "", "type": "address[]" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "user", "type": "address" } + ], + "name": "getUserAccountData", + "outputs": [ + { + "internalType": "uint256", + "name": "totalCollateralETH", + "type": "uint256" + }, + { "internalType": "uint256", "name": "totalDebtETH", "type": "uint256" }, + { + "internalType": "uint256", + "name": "availableBorrowsETH", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "currentLiquidationThreshold", + "type": "uint256" + }, + { "internalType": "uint256", "name": "ltv", "type": "uint256" }, + { "internalType": "uint256", "name": "healthFactor", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "user", "type": "address" } + ], + "name": "getUserConfiguration", + "outputs": [ + { + "components": [ + { "internalType": "uint256", "name": "data", "type": "uint256" } + ], + "internalType": "struct DataTypes.UserConfigurationMap", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" }, + { "internalType": "address", "name": "aTokenAddress", "type": "address" }, + { + "internalType": "address", + "name": "stableDebtAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "variableDebtAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "interestRateStrategyAddress", + "type": "address" + } + ], + "name": "initReserve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ILendingPoolAddressesProvider", + "name": "provider", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "collateralAsset", + "type": "address" + }, + { "internalType": "address", "name": "debtAsset", "type": "address" }, + { "internalType": "address", "name": "user", "type": "address" }, + { "internalType": "uint256", "name": "debtToCover", "type": "uint256" }, + { "internalType": "bool", "name": "receiveAToken", "type": "bool" } + ], + "name": "liquidationCall", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" }, + { "internalType": "address", "name": "user", "type": "address" } + ], + "name": "rebalanceStableBorrowRate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { "internalType": "uint256", "name": "rateMode", "type": "uint256" }, + { "internalType": "address", "name": "onBehalfOf", "type": "address" } + ], + "name": "repay", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" }, + { "internalType": "uint256", "name": "configuration", "type": "uint256" } + ], + "name": "setConfiguration", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "bool", "name": "val", "type": "bool" }], + "name": "setPause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" }, + { + "internalType": "address", + "name": "rateStrategyAddress", + "type": "address" + } + ], + "name": "setReserveInterestRateStrategyAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" }, + { "internalType": "bool", "name": "useAsCollateral", "type": "bool" } + ], + "name": "setUserUseReserveAsCollateral", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" }, + { "internalType": "uint256", "name": "rateMode", "type": "uint256" } + ], + "name": "swapBorrowRateMode", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { "internalType": "address", "name": "to", "type": "address" } + ], + "name": "withdraw", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/abi/radiant_r_token.json b/abi/radiant_r_token.json new file mode 100644 index 0000000..5149a1d --- /dev/null +++ b/abi/radiant_r_token.json @@ -0,0 +1,837 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "BalanceTransfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "Burn", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "underlyingAsset", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "pool", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "treasury", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "incentivesController", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "aTokenDecimals", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "string", + "name": "aTokenName", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "aTokenSymbol", + "type": "string" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "params", + "type": "bytes" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "Mint", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [], + "name": "ATOKEN_REVISION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "EIP712_REVISION", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PERMIT_TYPEHASH", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "POOL", + "outputs": [ + { + "internalType": "contract ILendingPool", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "RESERVE_TREASURY_ADDRESS", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "UNDERLYING_ASSET_ADDRESS", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "_nonces", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "address", + "name": "receiverOfUnderlying", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getAssetPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getIncentivesController", + "outputs": [ + { + "internalType": "contract IAaveIncentivesController", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "getScaledUserBalanceAndSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "handleRepayment", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ILendingPool", + "name": "pool", + "type": "address" + }, + { + "internalType": "address", + "name": "treasury", + "type": "address" + }, + { + "internalType": "address", + "name": "underlyingAsset", + "type": "address" + }, + { + "internalType": "contract IAaveIncentivesController", + "name": "incentivesController", + "type": "address" + }, + { + "internalType": "uint8", + "name": "aTokenDecimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "aTokenName", + "type": "string" + }, + { + "internalType": "string", + "name": "aTokenSymbol", + "type": "string" + }, + { + "internalType": "bytes", + "name": "params", + "type": "bytes" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "mintToTreasury", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "permit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "scaledBalanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "scaledTotalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "transferOnLiquidation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferUnderlyingTo", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/abi/ramses_gauge.json b/abi/ramses_gauge.json new file mode 100644 index 0000000..76c44f0 --- /dev/null +++ b/abi/ramses_gauge.json @@ -0,0 +1 @@ +[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"claimed0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"claimed1","type":"uint256"}],"name":"ClaimFees","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"reward","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ClaimRewards","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"reward","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"NotifyReward","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"reward","type":"address"}],"name":"RewardInitialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"_ve","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimFees","outputs":[{"internalType":"uint256","name":"claimed0","type":"uint256"},{"internalType":"uint256","name":"claimed1","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"depositAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"derivedBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"derivedBalances","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"derivedSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"account","type":"address"}],"name":"earned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeDistributor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address[]","name":"tokens","type":"address[]"}],"name":"getReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getRewardTokenIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_stake","type":"address"},{"internalType":"address","name":"_bribe","type":"address"},{"internalType":"address","name":"__ve","type":"address"},{"internalType":"address","name":"_voter","type":"address"},{"internalType":"bool","name":"_forPair","type":"bool"},{"internalType":"address[]","name":"_allowedRewardTokens","type":"address[]"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isForPair","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isReward","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isStarted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"lastTimeRewardApplicable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"lastUpdateTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"left","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"notifyRewardAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"pendingRewardRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"periodFinish","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"poke","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"uint256","name":"duplicateIndex","type":"uint256"}],"name":"removeExtraRewardToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"removeRewardWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"rescueTrappedFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"rewardPerToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewardPerTokenStored","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewardRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rewards","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardsListLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stake","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"storedRewardsPerUser","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"tokenIds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"userRewardPerTokenStored","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"voter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"whitelistNotifiedRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"withdrawToken","outputs":[],"stateMutability":"nonpayable","type":"function"}] \ No newline at end of file diff --git a/abi/ramses_legacy_pool.json b/abi/ramses_legacy_pool.json new file mode 100644 index 0000000..1817b69 --- /dev/null +++ b/abi/ramses_legacy_pool.json @@ -0,0 +1 @@ +[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"Claim","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"Fees","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"toFeesOld","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"toTreasuryOld","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"toFeesNew","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"toTreasuryNew","type":"uint8"}],"name":"SetFeeSplit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount0In","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1In","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount0Out","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1Out","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"Swap","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"reserve0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"reserve1","type":"uint256"}],"name":"Sync","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"blockTimestampLast","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"burn","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"}],"name":"current","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentCumulativePrices","outputs":[{"internalType":"uint256","name":"reserve0Cumulative","type":"uint256"},{"internalType":"uint256","name":"reserve1Cumulative","type":"uint256"},{"internalType":"uint256","name":"blockTimestamp","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeSplit","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fees","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"address","name":"tokenIn","type":"address"}],"name":"getAmountOut","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getReserves","outputs":[{"internalType":"uint256","name":"_reserve0","type":"uint256"},{"internalType":"uint256","name":"_reserve1","type":"uint256"},{"internalType":"uint256","name":"_blockTimestampLast","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token0","type":"address"},{"internalType":"address","name":"_token1","type":"address"},{"internalType":"bool","name":"_stable","type":"bool"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"initializeVoter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lastObservation","outputs":[{"components":[{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"uint256","name":"reserve0Cumulative","type":"uint256"},{"internalType":"uint256","name":"reserve1Cumulative","type":"uint256"}],"internalType":"struct Pair.Observation","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"metadata","outputs":[{"internalType":"uint256","name":"dec0","type":"uint256"},{"internalType":"uint256","name":"dec1","type":"uint256"},{"internalType":"uint256","name":"r0","type":"uint256"},{"internalType":"uint256","name":"r1","type":"uint256"},{"internalType":"bool","name":"st","type":"bool"},{"internalType":"address","name":"t0","type":"address"},{"internalType":"address","name":"t1","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"mint","outputs":[{"internalType":"uint256","name":"liquidity","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"observationLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"observations","outputs":[{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"uint256","name":"reserve0Cumulative","type":"uint256"},{"internalType":"uint256","name":"reserve1Cumulative","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"points","type":"uint256"}],"name":"prices","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"granularity","type":"uint256"}],"name":"quote","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"reserve0","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"reserve0CumulativeLast","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"reserve1","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"reserve1CumulativeLast","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"points","type":"uint256"},{"internalType":"uint256","name":"window","type":"uint256"}],"name":"sample","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"isActive","type":"bool"}],"name":"setActiveGauge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"setFeeSplit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"skim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount0Out","type":"uint256"},{"internalType":"uint256","name":"amount1Out","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"swap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sync","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"token0","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token1","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokens","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"dst","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"src","type":"address"},{"internalType":"address","name":"dst","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"voter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}] \ No newline at end of file diff --git a/abi/ramses_nfp_manager.json b/abi/ramses_nfp_manager.json new file mode 100644 index 0000000..5c10671 --- /dev/null +++ b/abi/ramses_nfp_manager.json @@ -0,0 +1 @@ +[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"Collect","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint128","name":"liquidity","type":"uint128"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"DecreaseLiquidity","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint128","name":"liquidity","type":"uint128"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"IncreaseLiquidity","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"oldVeRamTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newVeRamTokenId","type":"uint256"}],"name":"SwitchAttachment","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PERMIT_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WETH9","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"internalType":"uint256","name":"veRamTokenId","type":"uint256"}],"name":"batchSwitchAttachment","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint128","name":"amount0Max","type":"uint128"},{"internalType":"uint128","name":"amount1Max","type":"uint128"}],"internalType":"struct INonfungiblePositionManager.CollectParams","name":"params","type":"tuple"}],"name":"collect","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"uint160","name":"sqrtPriceX96","type":"uint160"}],"name":"createAndInitializePoolIfNecessary","outputs":[{"internalType":"address","name":"pool","type":"address"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint128","name":"liquidity","type":"uint128"},{"internalType":"uint256","name":"amount0Min","type":"uint256"},{"internalType":"uint256","name":"amount1Min","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct INonfungiblePositionManager.DecreaseLiquidityParams","name":"params","type":"tuple"}],"name":"decreaseLiquidity","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address[]","name":"tokens","type":"address[]"}],"name":"getReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount0Desired","type":"uint256"},{"internalType":"uint256","name":"amount1Desired","type":"uint256"},{"internalType":"uint256","name":"amount0Min","type":"uint256"},{"internalType":"uint256","name":"amount1Min","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct INonfungiblePositionManager.IncreaseLiquidityParams","name":"params","type":"tuple"}],"name":"increaseLiquidity","outputs":[{"internalType":"uint128","name":"liquidity","type":"uint128"},{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint256","name":"amount0Desired","type":"uint256"},{"internalType":"uint256","name":"amount1Desired","type":"uint256"},{"internalType":"uint256","name":"amount0Min","type":"uint256"},{"internalType":"uint256","name":"amount1Min","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"veRamTokenId","type":"uint256"}],"internalType":"struct INonfungiblePositionManager.MintParams","name":"params","type":"tuple"}],"name":"mint","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint128","name":"liquidity","type":"uint128"},{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"positions","outputs":[{"internalType":"uint96","name":"nonce","type":"uint96"},{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint128","name":"liquidity","type":"uint128"},{"internalType":"uint256","name":"feeGrowthInside0LastX128","type":"uint256"},{"internalType":"uint256","name":"feeGrowthInside1LastX128","type":"uint256"},{"internalType":"uint128","name":"tokensOwed0","type":"uint128"},{"internalType":"uint128","name":"tokensOwed1","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount0Owed","type":"uint256"},{"internalType":"uint256","name":"amount1Owed","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"ramsesV2MintCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"refundETH","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"selfPermit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"selfPermitAllowed","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"selfPermitAllowedIfNecessary","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"selfPermitIfNecessary","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amountMinimum","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"sweepToken","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"veRamTokenId","type":"uint256"}],"name":"switchAttachment","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"timelock","outputs":[{"internalType":"address","name":"_timelock","type":"address"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountMinimum","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"unwrapWETH9","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"veRam","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"voter","outputs":[{"internalType":"address","name":"_voter","type":"address"}],"stateMutability":"pure","type":"function"},{"stateMutability":"payable","type":"receive"}] \ No newline at end of file diff --git a/abi/ramses_pool.json b/abi/ramses_pool.json new file mode 100644 index 0000000..eb28557 --- /dev/null +++ b/abi/ramses_pool.json @@ -0,0 +1 @@ +[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"int24","name":"tickLower","type":"int24"},{"indexed":true,"internalType":"int24","name":"tickUpper","type":"int24"},{"indexed":false,"internalType":"uint128","name":"amount","type":"uint128"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":true,"internalType":"int24","name":"tickLower","type":"int24"},{"indexed":true,"internalType":"int24","name":"tickUpper","type":"int24"},{"indexed":false,"internalType":"uint128","name":"amount0","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"amount1","type":"uint128"}],"name":"Collect","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint128","name":"amount0","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"amount1","type":"uint128"}],"name":"CollectProtocol","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"paid0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"paid1","type":"uint256"}],"name":"Flash","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"observationCardinalityNextOld","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"observationCardinalityNextNew","type":"uint16"}],"name":"IncreaseObservationCardinalityNext","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint160","name":"sqrtPriceX96","type":"uint160"},{"indexed":false,"internalType":"int24","name":"tick","type":"int24"}],"name":"Initialize","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"int24","name":"tickLower","type":"int24"},{"indexed":true,"internalType":"int24","name":"tickUpper","type":"int24"},{"indexed":false,"internalType":"uint128","name":"amount","type":"uint128"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"feeProtocol0Old","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"feeProtocol1Old","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"feeProtocol0New","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"feeProtocol1New","type":"uint8"}],"name":"SetFeeProtocol","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"int256","name":"amount0","type":"int256"},{"indexed":false,"internalType":"int256","name":"amount1","type":"int256"},{"indexed":false,"internalType":"uint160","name":"sqrtPriceX96","type":"uint160"},{"indexed":false,"internalType":"uint128","name":"liquidity","type":"uint128"},{"indexed":false,"internalType":"int24","name":"tick","type":"int24"}],"name":"Swap","type":"event"},{"inputs":[],"name":"_advancePeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"period","type":"uint256"}],"name":"boostInfos","outputs":[{"internalType":"uint128","name":"totalBoostAmount","type":"uint128"},{"internalType":"int128","name":"totalVeRamAmount","type":"int128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"period","type":"uint256"},{"internalType":"bytes32","name":"key","type":"bytes32"}],"name":"boostInfos","outputs":[{"internalType":"uint128","name":"boostAmount","type":"uint128"},{"internalType":"int128","name":"veRamAmount","type":"int128"},{"internalType":"int256","name":"secondsDebtX96","type":"int256"},{"internalType":"int256","name":"boostedSecondsDebtX96","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"boostedLiquidity","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint128","name":"amount","type":"uint128"}],"name":"burn","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint128","name":"amount","type":"uint128"}],"name":"burn","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint128","name":"amount","type":"uint128"},{"internalType":"uint256","name":"veRamTokenId","type":"uint256"}],"name":"burn","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint128","name":"amount0Requested","type":"uint128"},{"internalType":"uint128","name":"amount1Requested","type":"uint128"}],"name":"collect","outputs":[{"internalType":"uint128","name":"amount0","type":"uint128"},{"internalType":"uint128","name":"amount1","type":"uint128"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint128","name":"amount0Requested","type":"uint128"},{"internalType":"uint128","name":"amount1Requested","type":"uint128"}],"name":"collect","outputs":[{"internalType":"uint128","name":"amount0","type":"uint128"},{"internalType":"uint128","name":"amount1","type":"uint128"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint128","name":"amount0Requested","type":"uint128"},{"internalType":"uint128","name":"amount1Requested","type":"uint128"}],"name":"collectProtocol","outputs":[{"internalType":"uint128","name":"amount0","type":"uint128"},{"internalType":"uint128","name":"amount1","type":"uint128"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentFee","outputs":[{"internalType":"uint24","name":"","type":"uint24"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fee","outputs":[{"internalType":"uint24","name":"","type":"uint24"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeGrowthGlobal0X128","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeGrowthGlobal1X128","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"flash","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"observationCardinalityNext","type":"uint16"}],"name":"increaseObservationCardinalityNext","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_factory","type":"address"},{"internalType":"address","name":"_nfpManager","type":"address"},{"internalType":"address","name":"_veRam","type":"address"},{"internalType":"address","name":"_voter","type":"address"},{"internalType":"address","name":"_token0","type":"address"},{"internalType":"address","name":"_token1","type":"address"},{"internalType":"uint24","name":"_fee","type":"uint24"},{"internalType":"int24","name":"_tickSpacing","type":"int24"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint160","name":"sqrtPriceX96","type":"uint160"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lastPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"liquidity","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxLiquidityPerTick","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint128","name":"amount","type":"uint128"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"mint","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint128","name":"amount","type":"uint128"},{"internalType":"uint256","name":"veRamTokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"mint","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"nfpManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"observations","outputs":[{"internalType":"uint32","name":"blockTimestamp","type":"uint32"},{"internalType":"int56","name":"tickCumulative","type":"int56"},{"internalType":"uint160","name":"secondsPerLiquidityCumulativeX128","type":"uint160"},{"internalType":"bool","name":"initialized","type":"bool"},{"internalType":"uint160","name":"secondsPerBoostedLiquidityPeriodX128","type":"uint160"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32[]","name":"secondsAgos","type":"uint32[]"}],"name":"observe","outputs":[{"internalType":"int56[]","name":"tickCumulatives","type":"int56[]"},{"internalType":"uint160[]","name":"secondsPerLiquidityCumulativeX128s","type":"uint160[]"},{"internalType":"uint160[]","name":"secondsPerBoostedLiquidityPeriodX128s","type":"uint160[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"period","type":"uint32"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"}],"name":"periodCumulativesInside","outputs":[{"internalType":"uint160","name":"secondsPerLiquidityInsideX128","type":"uint160"},{"internalType":"uint160","name":"secondsPerBoostedLiquidityInsideX128","type":"uint160"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"period","type":"uint256"}],"name":"periods","outputs":[{"internalType":"uint32","name":"previousPeriod","type":"uint32"},{"internalType":"int24","name":"startTick","type":"int24"},{"internalType":"int24","name":"lastTick","type":"int24"},{"internalType":"uint160","name":"endSecondsPerLiquidityPeriodX128","type":"uint160"},{"internalType":"uint160","name":"endSecondsPerBoostedLiquidityPeriodX128","type":"uint160"},{"internalType":"uint32","name":"boostedInRange","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"period","type":"uint256"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"}],"name":"positionPeriodDebt","outputs":[{"internalType":"int256","name":"secondsDebtX96","type":"int256"},{"internalType":"int256","name":"boostedSecondsDebtX96","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"period","type":"uint256"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"}],"name":"positionPeriodSecondsInRange","outputs":[{"internalType":"uint256","name":"periodSecondsInsideX96","type":"uint256"},{"internalType":"uint256","name":"periodBoostedSecondsInsideX96","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"key","type":"bytes32"}],"name":"positions","outputs":[{"internalType":"uint128","name":"liquidity","type":"uint128"},{"internalType":"uint256","name":"feeGrowthInside0LastX128","type":"uint256"},{"internalType":"uint256","name":"feeGrowthInside1LastX128","type":"uint256"},{"internalType":"uint128","name":"tokensOwed0","type":"uint128"},{"internalType":"uint128","name":"tokensOwed1","type":"uint128"},{"internalType":"uint256","name":"attachedVeRamId","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"protocolFees","outputs":[{"internalType":"uint128","name":"token0","type":"uint128"},{"internalType":"uint128","name":"token1","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"slots","type":"bytes32[]"}],"name":"readStorage","outputs":[{"internalType":"bytes32[]","name":"returnData","type":"bytes32[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint24","name":"_fee","type":"uint24"}],"name":"setFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"setFeeProtocol","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"slot0","outputs":[{"internalType":"uint160","name":"sqrtPriceX96","type":"uint160"},{"internalType":"int24","name":"tick","type":"int24"},{"internalType":"uint16","name":"observationIndex","type":"uint16"},{"internalType":"uint16","name":"observationCardinality","type":"uint16"},{"internalType":"uint16","name":"observationCardinalityNext","type":"uint16"},{"internalType":"uint8","name":"feeProtocol","type":"uint8"},{"internalType":"bool","name":"unlocked","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"}],"name":"snapshotCumulativesInside","outputs":[{"internalType":"int56","name":"tickCumulativeInside","type":"int56"},{"internalType":"uint160","name":"secondsPerLiquidityInsideX128","type":"uint160"},{"internalType":"uint160","name":"secondsPerBoostedLiquidityInsideX128","type":"uint160"},{"internalType":"uint32","name":"secondsInside","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"bool","name":"zeroForOne","type":"bool"},{"internalType":"int256","name":"amountSpecified","type":"int256"},{"internalType":"uint160","name":"sqrtPriceLimitX96","type":"uint160"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"swap","outputs":[{"internalType":"int256","name":"amount0","type":"int256"},{"internalType":"int256","name":"amount1","type":"int256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int16","name":"tick","type":"int16"}],"name":"tickBitmap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tickSpacing","outputs":[{"internalType":"int24","name":"","type":"int24"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int24","name":"tick","type":"int24"}],"name":"ticks","outputs":[{"internalType":"uint128","name":"liquidityGross","type":"uint128"},{"internalType":"int128","name":"liquidityNet","type":"int128"},{"internalType":"uint128","name":"boostedLiquidityGross","type":"uint128"},{"internalType":"int128","name":"boostedLiquidityNet","type":"int128"},{"internalType":"uint256","name":"feeGrowthOutside0X128","type":"uint256"},{"internalType":"uint256","name":"feeGrowthOutside1X128","type":"uint256"},{"internalType":"int56","name":"tickCumulativeOutside","type":"int56"},{"internalType":"uint160","name":"secondsPerLiquidityOutsideX128","type":"uint160"},{"internalType":"uint32","name":"secondsOutside","type":"uint32"},{"internalType":"bool","name":"initialized","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token0","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token1","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"veRam","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"voter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}] \ No newline at end of file diff --git a/abi/velodrome_pool.json b/abi/velodrome_pool.json new file mode 100644 index 0000000..07c5ff3 --- /dev/null +++ b/abi/velodrome_pool.json @@ -0,0 +1,33 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + } + ], + "name": "Mint", + "type": "event" + } +] \ No newline at end of file diff --git a/abi/velodrome_sugar.json b/abi/velodrome_sugar.json new file mode 100644 index 0000000..7a90c66 --- /dev/null +++ b/abi/velodrome_sugar.json @@ -0,0 +1,752 @@ +[ + { + "inputs": [ + { + "name": "_voter", + "type": "address" + }, + { + "name": "_registry", + "type": "address" + }, + { + "name": "_convertor", + "type": "address" + }, + { + "name": "_nfpm", + "type": "address" + }, + { + "name": "_slipstream_helper", + "type": "address" + }, + { + "name": "_token_registry", + "type": "address" + }, + { + "name": "_pool_factory", + "type": "address" + }, + { + "name": "_gauge_factory", + "type": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "name": "_limit", + "type": "uint256" + }, + { + "name": "_offset", + "type": "uint256" + } + ], + "name": "forSwaps", + "outputs": [ + { + "components": [ + { + "name": "lp", + "type": "address" + }, + { + "name": "type", + "type": "int24" + }, + { + "name": "token0", + "type": "address" + }, + { + "name": "token1", + "type": "address" + }, + { + "name": "factory", + "type": "address" + }, + { + "name": "pool_fee", + "type": "uint256" + } + ], + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "name": "_limit", + "type": "uint256" + }, + { + "name": "_offset", + "type": "uint256" + }, + { + "name": "_account", + "type": "address" + }, + { + "name": "_addresses", + "type": "address[]" + } + ], + "name": "tokens", + "outputs": [ + { + "components": [ + { + "name": "token_address", + "type": "address" + }, + { + "name": "symbol", + "type": "string" + }, + { + "name": "decimals", + "type": "uint8" + }, + { + "name": "account_balance", + "type": "uint256" + }, + { + "name": "listed", + "type": "bool" + } + ], + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "name": "_limit", + "type": "uint256" + }, + { + "name": "_offset", + "type": "uint256" + } + ], + "name": "all", + "outputs": [ + { + "components": [ + { + "name": "lp", + "type": "address" + }, + { + "name": "symbol", + "type": "string" + }, + { + "name": "decimals", + "type": "uint8" + }, + { + "name": "liquidity", + "type": "uint256" + }, + { + "name": "type", + "type": "int24" + }, + { + "name": "tick", + "type": "int24" + }, + { + "name": "sqrt_ratio", + "type": "uint160" + }, + { + "name": "token0", + "type": "address" + }, + { + "name": "reserve0", + "type": "uint256" + }, + { + "name": "staked0", + "type": "uint256" + }, + { + "name": "token1", + "type": "address" + }, + { + "name": "reserve1", + "type": "uint256" + }, + { + "name": "staked1", + "type": "uint256" + }, + { + "name": "gauge", + "type": "address" + }, + { + "name": "gauge_liquidity", + "type": "uint256" + }, + { + "name": "gauge_alive", + "type": "bool" + }, + { + "name": "fee", + "type": "address" + }, + { + "name": "bribe", + "type": "address" + }, + { + "name": "factory", + "type": "address" + }, + { + "name": "emissions", + "type": "uint256" + }, + { + "name": "emissions_token", + "type": "address" + }, + { + "name": "pool_fee", + "type": "uint256" + }, + { + "name": "unstaked_fee", + "type": "uint256" + }, + { + "name": "token0_fees", + "type": "uint256" + }, + { + "name": "token1_fees", + "type": "uint256" + } + ], + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "name": "_index", + "type": "uint256" + } + ], + "name": "byIndex", + "outputs": [ + { + "components": [ + { + "name": "lp", + "type": "address" + }, + { + "name": "symbol", + "type": "string" + }, + { + "name": "decimals", + "type": "uint8" + }, + { + "name": "liquidity", + "type": "uint256" + }, + { + "name": "type", + "type": "int24" + }, + { + "name": "tick", + "type": "int24" + }, + { + "name": "sqrt_ratio", + "type": "uint160" + }, + { + "name": "token0", + "type": "address" + }, + { + "name": "reserve0", + "type": "uint256" + }, + { + "name": "staked0", + "type": "uint256" + }, + { + "name": "token1", + "type": "address" + }, + { + "name": "reserve1", + "type": "uint256" + }, + { + "name": "staked1", + "type": "uint256" + }, + { + "name": "gauge", + "type": "address" + }, + { + "name": "gauge_liquidity", + "type": "uint256" + }, + { + "name": "gauge_alive", + "type": "bool" + }, + { + "name": "fee", + "type": "address" + }, + { + "name": "bribe", + "type": "address" + }, + { + "name": "factory", + "type": "address" + }, + { + "name": "emissions", + "type": "uint256" + }, + { + "name": "emissions_token", + "type": "address" + }, + { + "name": "pool_fee", + "type": "uint256" + }, + { + "name": "unstaked_fee", + "type": "uint256" + }, + { + "name": "token0_fees", + "type": "uint256" + }, + { + "name": "token1_fees", + "type": "uint256" + } + ], + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "name": "_limit", + "type": "uint256" + }, + { + "name": "_offset", + "type": "uint256" + }, + { + "name": "_account", + "type": "address" + } + ], + "name": "positions", + "outputs": [ + { + "components": [ + { + "name": "id", + "type": "uint256" + }, + { + "name": "lp", + "type": "address" + }, + { + "name": "liquidity", + "type": "uint256" + }, + { + "name": "staked", + "type": "uint256" + }, + { + "name": "amount0", + "type": "uint256" + }, + { + "name": "amount1", + "type": "uint256" + }, + { + "name": "staked0", + "type": "uint256" + }, + { + "name": "staked1", + "type": "uint256" + }, + { + "name": "unstaked_earned0", + "type": "uint256" + }, + { + "name": "unstaked_earned1", + "type": "uint256" + }, + { + "name": "emissions_earned", + "type": "uint256" + }, + { + "name": "tick_lower", + "type": "int24" + }, + { + "name": "tick_upper", + "type": "int24" + }, + { + "name": "sqrt_ratio_lower", + "type": "uint160" + }, + { + "name": "sqrt_ratio_upper", + "type": "uint160" + } + ], + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "name": "_limit", + "type": "uint256" + }, + { + "name": "_offset", + "type": "uint256" + } + ], + "name": "epochsLatest", + "outputs": [ + { + "components": [ + { + "name": "ts", + "type": "uint256" + }, + { + "name": "lp", + "type": "address" + }, + { + "name": "votes", + "type": "uint256" + }, + { + "name": "emissions", + "type": "uint256" + }, + { + "components": [ + { + "name": "token", + "type": "address" + }, + { + "name": "amount", + "type": "uint256" + } + ], + "name": "bribes", + "type": "tuple[]" + }, + { + "components": [ + { + "name": "token", + "type": "address" + }, + { + "name": "amount", + "type": "uint256" + } + ], + "name": "fees", + "type": "tuple[]" + } + ], + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "name": "_limit", + "type": "uint256" + }, + { + "name": "_offset", + "type": "uint256" + }, + { + "name": "_address", + "type": "address" + } + ], + "name": "epochsByAddress", + "outputs": [ + { + "components": [ + { + "name": "ts", + "type": "uint256" + }, + { + "name": "lp", + "type": "address" + }, + { + "name": "votes", + "type": "uint256" + }, + { + "name": "emissions", + "type": "uint256" + }, + { + "components": [ + { + "name": "token", + "type": "address" + }, + { + "name": "amount", + "type": "uint256" + } + ], + "name": "bribes", + "type": "tuple[]" + }, + { + "components": [ + { + "name": "token", + "type": "address" + }, + { + "name": "amount", + "type": "uint256" + } + ], + "name": "fees", + "type": "tuple[]" + } + ], + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "name": "_limit", + "type": "uint256" + }, + { + "name": "_offset", + "type": "uint256" + }, + { + "name": "_venft_id", + "type": "uint256" + } + ], + "name": "rewards", + "outputs": [ + { + "components": [ + { + "name": "venft_id", + "type": "uint256" + }, + { + "name": "lp", + "type": "address" + }, + { + "name": "amount", + "type": "uint256" + }, + { + "name": "token", + "type": "address" + }, + { + "name": "fee", + "type": "address" + }, + { + "name": "bribe", + "type": "address" + } + ], + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "name": "_venft_id", + "type": "uint256" + }, + { + "name": "_pool", + "type": "address" + } + ], + "name": "rewardsByAddress", + "outputs": [ + { + "components": [ + { + "name": "venft_id", + "type": "uint256" + }, + { + "name": "lp", + "type": "address" + }, + { + "name": "amount", + "type": "uint256" + }, + { + "name": "token", + "type": "address" + }, + { + "name": "fee", + "type": "address" + }, + { + "name": "bribe", + "type": "address" + } + ], + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "registry", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "token_registry", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pool_factory", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "gauge_factory", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } +] \ No newline at end of file diff --git a/campaign/campaign.py b/campaign/campaign.py new file mode 100644 index 0000000..bfd4092 --- /dev/null +++ b/campaign/campaign.py @@ -0,0 +1,92 @@ +from typing import List +from constants.example_integrations import ( + ACTIVE_ENA_START_BLOCK_EXAMPLE, + BEEFY_ARBITRUM_START_BLOCK_EXAMPLE, +) +from integrations.beefy_cached_balance_example_integration import ( + BeefyCachedBalanceIntegration, +) +from integrations.claimed_ena_example_integration import ClaimedEnaIntegration +from utils import pendle +from web3 import Web3 + +from constants.chains import Chain +from constants.pendle import PENDLE_USDE_JULY_DEPLOYMENT_BLOCK +from constants.summary_columns import SummaryColumn +from integrations.integration import Integration +from integrations.integration_ids import IntegrationID +from integrations.pendle_lpt_integration import PendleLPTIntegration +from integrations.pendle_yt_integration import PendleYTIntegration +from integrations.template import ProtocolNameIntegration + +# TODO: Add your integration here +INTEGRATIONS: List[Integration] = [ + # Template integration + ProtocolNameIntegration( + integration_id=IntegrationID.EXAMPLE, + start_block=20000000, + summary_cols=[SummaryColumn.TEMPLATE_PTS], + chain=Chain.ETHEREUM, + reward_multiplier=20, + excluded_addresses={ + Web3.to_checksum_address("0x0000000000000000000000000000000000000000") + }, + end_block=40000000, + ), + # Example integration using cached user balances for improved performance, + # reads from previous balance snapshots + ClaimedEnaIntegration( + integration_id=IntegrationID.CLAIMED_ENA_EXAMPLE, + start_block=ACTIVE_ENA_START_BLOCK_EXAMPLE, + summary_cols=[SummaryColumn.CLAIMED_ENA_PTS_EXAMPLE], + reward_multiplier=1, + ), + # Cached balances integration example, based on API calls + BeefyCachedBalanceIntegration( + integration_id=IntegrationID.BEEFY_CACHED_BALANCE_EXAMPLE, + start_block=BEEFY_ARBITRUM_START_BLOCK_EXAMPLE, + summary_cols=[SummaryColumn.BEEFY_CACHED_BALANCE_EXAMPLE], + chain=Chain.ARBITRUM, + reward_multiplier=1, + ), + # Simple Integration class examples (outdated), + # don't use these anymore + PendleLPTIntegration( + integration_id=IntegrationID.PENDLE_USDE_LPT, + start_block=PENDLE_USDE_JULY_DEPLOYMENT_BLOCK, + sy_contract=pendle.sy_contract, + lp_contract=pendle.lpt_contract, + summary_cols=[SummaryColumn.PENDLE_SHARDS], + chain=Chain.ETHEREUM, + reward_multiplier=20, + ), + PendleLPTIntegration( + integration_id=IntegrationID.PENDLE_ARBITRUM_USDE_LPT, + start_block=PENDLE_USDE_JULY_DEPLOYMENT_BLOCK, + sy_contract=pendle.usde_arb_SY_contract, + lp_contract=pendle.usde_arb_LPT_contract, + summary_cols=[SummaryColumn.PENDLE_ARBITRUM_SHARDS], + chain=Chain.ARBITRUM, + reward_multiplier=20, + ), + PendleYTIntegration( + integration_id=IntegrationID.PENDLE_USDE_YT, + start_block=PENDLE_USDE_JULY_DEPLOYMENT_BLOCK, + summary_cols=[SummaryColumn.PENDLE_SHARDS], + yt_contract=pendle.yt_contract, + chain=Chain.ETHEREUM, + reward_multiplier=20, + ), + PendleYTIntegration( + integration_id=IntegrationID.PENDLE_ARBITRUM_USDE_YT, + start_block=PENDLE_USDE_JULY_DEPLOYMENT_BLOCK, + summary_cols=[SummaryColumn.PENDLE_ARBITRUM_SHARDS], + yt_contract=pendle.usde_arb_YT_contract, + chain=Chain.ARBITRUM, + reward_multiplier=20, + ), +] + + +def get_integrations() -> List[Integration]: + return INTEGRATIONS diff --git a/constants/allstake.py b/constants/allstake.py new file mode 100644 index 0000000..841ecfe --- /dev/null +++ b/constants/allstake.py @@ -0,0 +1,58 @@ +import json +from typing import TypedDict, Dict +from utils.web3_utils import W3_BY_CHAIN +from web3.contract.contract import Contract +from web3 import Web3 +from constants.chains import Chain +from integrations.integration_ids import IntegrationID + +with open("abi/ERC20_abi.json") as f: + erc20_abi = json.load(f) + + +class StrategyConfig(TypedDict): + start: int + chain: Chain + underlying: Contract + strategy: Contract + page_size: int + + +contract = W3_BY_CHAIN[Chain.ETHEREUM]["w3"].eth.contract + +ALLSTAKE_STRATEGIES: Dict[IntegrationID, StrategyConfig] = { + IntegrationID.ALLSTAKE_USDE: StrategyConfig( + start=20810640, + chain=Chain.ETHEREUM, + underlying=contract( + address=Web3.to_checksum_address( + "0x4c9edd5852cd905f086c759e8383e09bff1e68b3" + ), + abi=erc20_abi, + ), + strategy=contract( + address=Web3.to_checksum_address( + "0x8B6bF38B812BE4749577303FB8D222576957ff44" + ), + abi=erc20_abi, + ), + page_size=5000, + ), + IntegrationID.ALLSTAKE_SUSDE: StrategyConfig( + start=20811020, + chain=Chain.ETHEREUM, + underlying=contract( + address=Web3.to_checksum_address( + "0x9d39a5de30e57443bff2a8307a4256c8797a3497" + ), + abi=erc20_abi, + ), + strategy=contract( + address=Web3.to_checksum_address( + "0x5d083d71F7A531F543070b78740880F5A346B53a" + ), + abi=erc20_abi, + ), + page_size=5000, + ), +} diff --git a/constants/balancer.py b/constants/balancer.py new file mode 100644 index 0000000..d3e9c61 --- /dev/null +++ b/constants/balancer.py @@ -0,0 +1,163 @@ +from enum import Enum +from dataclasses import dataclass +from typing import Dict, Optional + +from constants.chains import Chain +from integrations.integration_ids import IntegrationID + +## If you want to integrate another Balancer Pool, first add it to the IntegrationID enum in integration_ids.py +## Then, add a new entry to the INTEGRATION_CONFIGS dictionary below. Aura integration is optional. +## If the chain is not yet supported, add it to the Chain enum in chains.py and add RPCs to web3_utils.py. + + +# Addresses for Ethena tokens are the same across L2 chains (except ZKsync) +class Token(Enum): + USDE = "0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34" + SUSDE = "0x211Cc4DD073734dA055fbF44a2b4667d5E5fE5d2" + ENA = "0x58538e6A46E07434d7E7375Bc268D3cb839C0133" + + +@dataclass +class IntegrationConfig: + chain: Chain + start_block: int + incentivized_token: str + incentivized_token_decimals: int + pool_id: str + gauge_address: str + aura_address: str + has_preminted_bpts: bool = ( + False # CSPs have a different function for getting the BPT supply + ) + + +INTEGRATION_CONFIGS: Dict[IntegrationID, IntegrationConfig] = { + IntegrationID.BALANCER_FRAXTAL_FRAX_USDE: IntegrationConfig( + chain=Chain.FRAXTAL, + start_block=5931687, + incentivized_token=Token.USDE.value, + incentivized_token_decimals=18, + pool_id="0xa0af0b88796c1aa67e93db89fead2ab7aa3d6747000000000000000000000007", + gauge_address="0xf99d875Dd868277cf3780f51D69c6E1F8522a1e9", + aura_address="0x56bA1E88340fD53968f686490519Fb0fBB692a39", + has_preminted_bpts=True, + ), + IntegrationID.BALANCER_ARBITRUM_GHO_USDE: IntegrationConfig( + chain=Chain.ARBITRUM, + start_block=225688025, + incentivized_token=Token.USDE.value, + incentivized_token_decimals=18, + pool_id="0x2b783cd37774bb77d387d35683e8388937712f0a00020000000000000000056b", + gauge_address="0xf2d151c40C18d8097AAa5157eE8f447CBe217269", + aura_address="0x106398c0a78AE85F501FEE16d53A81401469b9B8", + ), + IntegrationID.BALANCER_ARBITRUM_WAGHO_USDE: IntegrationConfig( + chain=Chain.ARBITRUM, + start_block=245277323, + incentivized_token=Token.USDE.value, + incentivized_token_decimals=18, + pool_id="0x38161e9efb8de52d00a1eb0f773223fd28fdd7c20002000000000000000005a0", + gauge_address="0xcfab2efef3affdd158568dc896115eac26b3c498", + aura_address="0x8f2c4c4ad0b45a3c740e7f7fbc5a106659adeee7", + ), + IntegrationID.BALANCER_ARBITRUM_GYD_SUSDE: IntegrationConfig( + chain=Chain.ARBITRUM, + start_block=240466292, + incentivized_token=Token.SUSDE.value, + incentivized_token_decimals=18, + pool_id="0xdeeaf8b0a8cf26217261b813e085418c7dd8f1ee00020000000000000000058f", + gauge_address="0xdEC026525FE4FEF54857bCF551aEA97aBc24A673", + aura_address="0x2d7cFe43BcDf10137924a20445B763Fb40E5871c", + ), + IntegrationID.BALANCER_ARBITRUM_SUSDE_SFRAX: IntegrationConfig( + chain=Chain.ARBITRUM, + start_block=197330091, + incentivized_token=Token.SUSDE.value, + incentivized_token_decimals=18, + pool_id="0x59743f1812bb85db83e9e4ee061d124aaa64290000000000000000000000052b", + gauge_address="0x4b8858a8E42f406B4dC2eCB8D48B5cf0021035c8", + aura_address="0x0a6a427867a3274909A04276cB5589AE8Cc2dfc7", + has_preminted_bpts=True, + ), + IntegrationID.BALANCER_ARBITRUM_SUSDE_USDC: IntegrationConfig( + chain=Chain.ARBITRUM, + start_block=197316005, + incentivized_token=Token.SUSDE.value, + incentivized_token_decimals=18, + pool_id="0x2f0cdf8596be980ef24924ca7bf54e630ca526b2000000000000000000000529", + gauge_address="0xe9801a0fa08acf9140ba3a347a8c6048ff9eab7c", + aura_address="0x043A59D13884DddCa18b99C3C184C29aAd973b35", + has_preminted_bpts=True, + ), + IntegrationID.BALANCER_ETHEREUM_WSTETH_SUSDE: IntegrationConfig( + chain=Chain.ETHEREUM, + start_block=20005052, + incentivized_token=Token.SUSDE.value, + incentivized_token_decimals=18, + pool_id="0xa8210885430aaa333c9f0d66ab5d0c312bed5e43000200000000000000000692", + gauge_address="0xbd00c7cbe59dddbd784c899ac173b7ba514b9997", + aura_address="0x99d9e4d3078f7c9c5b792999749290a54fb87257", + ), + IntegrationID.BALANCER_ETHEREUM_BAOUSD_SUSDE: IntegrationConfig( + chain=Chain.ETHEREUM, + start_block=20169334, + incentivized_token=Token.SUSDE.value, + incentivized_token_decimals=18, + pool_id="0x79af734562f741946566d5126bbded4cb699e35500000000000000000000069f", + gauge_address="0xf91ba601c53f831869da4aceaaec11c479413972", + aura_address="0xd34793bf42d922b04e7e53253f7195725a4a7e9d", + has_preminted_bpts=True, + ), + IntegrationID.BALANCER_ETHEREUM_SUSDE_USDC: IntegrationConfig( + chain=Chain.ETHEREUM, + start_block=19663564, + incentivized_token=Token.SUSDE.value, + incentivized_token_decimals=18, + pool_id="0xb819feef8f0fcdc268afe14162983a69f6bf179e000000000000000000000689", + gauge_address="0x84f7f5cd2218f31b750e7009bb6fd34e0b945dac", + aura_address="0x4b87dcff2f45535775a9564229119dca5e697a10", + has_preminted_bpts=True, + ), + IntegrationID.BALANCER_ETHEREUM_SUSDE_GYD: IntegrationConfig( + chain=Chain.ETHEREUM, + start_block=20569775, + incentivized_token=Token.SUSDE.value, + incentivized_token_decimals=18, + pool_id="0x8d93b853849b9884e2bb413444ec23eb5366ee910002000000000000000006b3", + gauge_address="0x146b6030E6d6a6398B918E9854652a71C9537180", + aura_address="0x1f2b312c30b08c1957bd3ada616e77bc7bff51ff", + ), + IntegrationID.BALANCER_FRAXTAL_SFRAX_SDAI_SUSDE: IntegrationConfig( + chain=Chain.FRAXTAL, + start_block=5931675, + incentivized_token=Token.SUSDE.value, + incentivized_token_decimals=18, + pool_id="0x33251abecb0364df98a27a8d5d7b5ccddc774c42000000000000000000000008", + gauge_address="0x275e8514b83479f526673327b279753abc666a05", + aura_address="0x8bb2303ab3ff8bcb1833b71ca14fde75cb88d0b8", + has_preminted_bpts=True, + ), + IntegrationID.BALANCER_FRAXTAL_FRAX_USDE_DAI_USDT_USDC: IntegrationConfig( + chain=Chain.FRAXTAL, + start_block=6859850, + incentivized_token=Token.USDE.value, + incentivized_token_decimals=18, + pool_id="0x760b30eb4be3ccd840e91183e33e2953c6a31253000000000000000000000005", + gauge_address="0x982653b874b059871a46f66120c69503fe391979", + aura_address="0x5a1e521e700d684323886346a2c782febcc0ea4b", + has_preminted_bpts=True, + ), +} + + +def get_integration_config( + integration_id: IntegrationID, +) -> Optional[IntegrationConfig]: + return INTEGRATION_CONFIGS.get(integration_id) + + +AURA_VOTER_PROXY = { + Chain.FRAXTAL: "0xC181Edc719480bd089b94647c2Dc504e2700a2B0", +} + +BALANCER_VAULT = "0xBA12222222228d8Ba445958a75a0704d566BF2C8" diff --git a/constants/beefy.py b/constants/beefy.py new file mode 100644 index 0000000..a478e02 --- /dev/null +++ b/constants/beefy.py @@ -0,0 +1 @@ +BEEFY_LRT_API_URL = "https://lrt.beefy.finance/api/v2" diff --git a/constants/chains.py b/constants/chains.py index a77c887..7b0c8d3 100644 --- a/constants/chains.py +++ b/constants/chains.py @@ -4,6 +4,10 @@ class Chain(Enum): ETHEREUM = "Ethereum" ARBITRUM = "Arbitrum" + FRAXTAL = "Fraxtal" MANTLE = "Mantle" BLAST = "Blast" SCROLL = "Scroll" + MODE = "Mode" + OPTIMISM = "Optimism" + Lyra = "Lyra" diff --git a/constants/curve.py b/constants/curve.py new file mode 100644 index 0000000..19b3768 --- /dev/null +++ b/constants/curve.py @@ -0,0 +1,47 @@ +from constants.summary_columns import SummaryColumn +from dataclasses import dataclass +from constants.chains import Chain +from integrations.integration_ids import IntegrationID + + +@dataclass +class RewardContractConfig: + abi_filename: str + address: str + chain: Chain + genesis_block: int + reward_multiplier: int + balance_multiplier: int + integration_id: IntegrationID + state_arg_no: int + event_arg_name: str + + +CURVE_LLAMALEND = [ + RewardContractConfig( + abi_filename="abi/curve_llamalend_controller.json", + address="0x74f88Baa966407b50c10B393bBD789639EFfE78B", + chain=Chain.ETHEREUM, + genesis_block=20148558, + reward_multiplier=20, + balance_multiplier=1, + integration_id=IntegrationID.CURVE_ETHEREUM_USDE_BORROWERS, + state_arg_no=0, + event_arg_name="user", + ), + RewardContractConfig( + abi_filename="abi/curve_llamalend_controller.json", + address="0xB536FEa3a01c95Dd09932440eC802A75410139D6", + chain=Chain.ETHEREUM, + genesis_block=19999153, + reward_multiplier=5, + balance_multiplier=1, + integration_id=IntegrationID.CURVE_ETHEREUM_SUSDE_BORROWERS, + state_arg_no=0, + event_arg_name="user", + ), +] + +SUMMARY_COLS = { + "llamalend": SummaryColumn.CURVE_LLAMALEND_SHARDS, +} diff --git a/constants/equilibria.py b/constants/equilibria.py index 0896a21..1f8fa11 100644 --- a/constants/equilibria.py +++ b/constants/equilibria.py @@ -1,30 +1,42 @@ -PENDLE_LOCKER_ETHEREUM = "0x64627901dAdb46eD7f275fD4FC87d086cfF1e6E3" -equilibria_deposit_ethereum = "0x4D32C8Ff2fACC771eC7Efc70d6A8468bC30C26bF" +from web3 import Web3 -SUSDE_SEPT = "0x198Ddb596a080215F0e15caeABca7eAB6b2d7A8f" +PENDLE_LOCKER_ETHEREUM = Web3.to_checksum_address( + "0x64627901dAdb46eD7f275fD4FC87d086cfF1e6E3" +) +equilibria_deposit_ethereum = Web3.to_checksum_address( + "0x4D32C8Ff2fACC771eC7Efc70d6A8468bC30C26bF" +) + +SUSDE_SEPT = Web3.to_checksum_address("0x198Ddb596a080215F0e15caeABca7eAB6b2d7A8f") SUSDE_SEPT_ID = 51 SUSDE_SEPT_DEPLOYMENT_BLOCK = 19931018 -Karak_sUSDe_SEPT = "0xcB7212d19D52b53e44625Dc1A9d4B1f1d4833575" +Karak_sUSDe_SEPT = Web3.to_checksum_address( + "0xcB7212d19D52b53e44625Dc1A9d4B1f1d4833575" +) Karak_sUSDe_SEPT_ID = 57 Karak_sUSDe_SEPT_DEPLOYMENT_BLOCK = 19975464 -Karak_USDE_SEPT = "0x6fDF80071499b46Bb53AfBA7bAFf9D91A21133AB" +Karak_USDE_SEPT = Web3.to_checksum_address("0x6fDF80071499b46Bb53AfBA7bAFf9D91A21133AB") Karak_USDE_SEPT_ID = 56 Karak_USDE_SEPT_DEPLOYMENT_BLOCK = 19975462 -Zircuit_USDe_AUG = "0x0CaCF4ACdAAB8664857C29755Bd710B8bafDBeC3" +Zircuit_USDe_AUG = Web3.to_checksum_address( + "0x0CaCF4ACdAAB8664857C29755Bd710B8bafDBeC3" +) Zircuit_USDe_AUG_ID = 69 Zircuit_USDe_AUG_DEPLOYMENT_BLOCK = 20181693 -rUSDE_SEPT = "0x2F35DF137b64D1b62AE440b0D6A7b1cf9af4aB62" +rUSDE_SEPT = Web3.to_checksum_address("0x2F35DF137b64D1b62AE440b0D6A7b1cf9af4aB62") rUSDE_SEPT_ID = 70 rUSDE_SEPT_DEPLOYMENT_BLOCK = 20230561 -USDE_EXPIRY = "0x8c9590Fa87d5083668f1Ba0C6696688A0d2E8EC0" +USDE_EXPIRY = Web3.to_checksum_address("0x8c9590Fa87d5083668f1Ba0C6696688A0d2E8EC0") USDE_EXPIRY_ID = 33 USDE_EXPIRY_DEPLOYMENT_BLOCK = 19330240 -SUSDE_APR_EXPIRY = "0xDC947a371D46356859860451198cB3450086c88C" +SUSDE_APR_EXPIRY = Web3.to_checksum_address( + "0xDC947a371D46356859860451198cB3450086c88C" +) SUSDE_APR_EXPIRY_ID = 35 SUSDE_APR_EXPIRY_DEPLOYMENT_BLOCK = 19382154 diff --git a/constants/euler.py b/constants/euler.py new file mode 100644 index 0000000..5f7e9d1 --- /dev/null +++ b/constants/euler.py @@ -0,0 +1,9 @@ +from web3 import Web3 + +EVC_ADDRESS = Web3.to_checksum_address("0x0C9a3dd6b8F28529d72d7f9cE918D493519EE383") +USDE_VAULT_ADDRESS = Web3.to_checksum_address( + "0xac73efa7696dc1c1617bbc20aec64422c8b70eda" +) +SUSDE_VAULT_ADDRESS = Web3.to_checksum_address( + "0x8dde384022d4de1d6c67891a8865f551c444dc4c" +) diff --git a/constants/example_integrations.py b/constants/example_integrations.py new file mode 100644 index 0000000..2b1ca8b --- /dev/null +++ b/constants/example_integrations.py @@ -0,0 +1,16 @@ +import json +from web3 import Web3 +from utils.web3_utils import w3 + +PAGINATION_SIZE = 2000 +ACTIVE_ENA_START_BLOCK_EXAMPLE = 21202656 +ENA_ADDRESS = Web3.to_checksum_address("0x57e114B691Db790C35207b2e685D4A43181e6061") +with open("abi/ERC20_abi.json") as f: + ERC20_ABI = json.load(f) + +ENA_CONTRACT = w3.eth.contract( + address=ENA_ADDRESS, + abi=ERC20_ABI, +) + +BEEFY_ARBITRUM_START_BLOCK_EXAMPLE = 219870802 diff --git a/constants/firm.py b/constants/firm.py new file mode 100644 index 0000000..e8e86f7 --- /dev/null +++ b/constants/firm.py @@ -0,0 +1,7 @@ +from web3 import Web3 + +FIRM_SUSDE_DEPLOYMENT_BLOCK = 20441987 + +SUSDE_MARKET_ADDRESS = Web3.to_checksum_address( + "0x79eF6d28C41e47A588E2F2ffB4140Eb6d952AEc4" +) diff --git a/constants/fluid.py b/constants/fluid.py new file mode 100644 index 0000000..45e6f57 --- /dev/null +++ b/constants/fluid.py @@ -0,0 +1,10 @@ +from web3 import Web3 + +vaultResolver = Web3.to_checksum_address("0x49290f778faAD125f2FBCDE6F09600e73bf4bBd9") +vaultPositionResolver = Web3.to_checksum_address( + "0x3E3dae4F30347782089d398D462546eb5276801C" +) +vaultFactory = Web3.to_checksum_address("0x324c5Dc1fC42c7a4D43d92df1eBA58a54d13Bf2d") +sUSDe = Web3.to_checksum_address("0x9D39A5DE30e57443BfF2A8307A4256c8797A3497") +USDe = Web3.to_checksum_address("0x4c9EDD5852cd905f086C759E8383e09bff1E68B3") +dexResolver = Web3.to_checksum_address("0x7af0C11F5c787632e567e6418D74e5832d8FFd4c") diff --git a/constants/gmx.py b/constants/gmx.py new file mode 100644 index 0000000..fea81f2 --- /dev/null +++ b/constants/gmx.py @@ -0,0 +1,43 @@ +from web3 import Web3 + +GMX_USDE_USDC_MARKET_ADDRESS = Web3.to_checksum_address( + "0x45aD16Aaa28fb66Ef74d5ca0Ab9751F2817c81a4" +) +GMX_USDE_USDC_MARKET_BLOCK = 237528674 + +GMX_WSTETH_USDE_MARKET_ADDRESS = Web3.to_checksum_address( + "0x0Cf1fb4d1FF67A3D8Ca92c9d6643F8F9be8e03E5" +) +GMX_WSTETH_USDE_MARKET_BLOCK = 237523986 + + +GMX_SYNTHETICS_READER_CONTRACT_ADDRESS = Web3.to_checksum_address( + "0x5Ca84c34a381434786738735265b9f3FD814b824" +) +GMX_DATA_STORE_CONTRACT_ADDRESS = Web3.to_checksum_address( + "0xFD70de6b91282D8017aA4E741e9Ae325CAb992d8" +) + + +ETH_TOKEN_ADDRESS = Web3.to_checksum_address( + "0x0000000000000000000000000000000000000000" +) +WETH_TOKEN_ADDRESS = Web3.to_checksum_address( + "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1" +) +WSTETH_TOKEN_ADDRESS = Web3.to_checksum_address( + "0x5979D7b546E38E414F7E9822514be443A4800529" +) +USDE_TOKEN_ADDRESS = Web3.to_checksum_address( + "0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34" +) +USDC_TOKEN_ADDRESS = Web3.to_checksum_address( + "0xaf88d065e77c8cC2239327C5EDb3A432268e5831" +) + +GMX_MAX_PNL_FACTOR_FOR_TRADERS_KEY = ( + "0xab15365d3aa743e766355e2557c230d8f943e195dc84d9b2b05928a07b635ee1" +) + +GMX_PRICES_ENDPOINT = "https://arbitrum-v2-1-api.gmxinfra.io/prices/tickers" +GMX_SUBSQUID_ENDPOINT = "https://gmx.squids.live/gmx-synthetics-arbitrum/graphql" diff --git a/constants/hyperdrive.py b/constants/hyperdrive.py new file mode 100644 index 0000000..efa1f4e --- /dev/null +++ b/constants/hyperdrive.py @@ -0,0 +1,21 @@ +import json +from enum import IntEnum + +HYPERDRIVE_SUSDE_POOL_ADDRESS = "0x05b65FA90AD702e6Fd0C3Bd7c4c9C47BAB2BEa6b" +HYPERDRIVE_SUSDE_POOL_DEPLOYMENT_BLOCK = 20931644 + +HYPERDRIVE_MORPHO_ABI = None +with open("abi/IHyperdriveMorpho.json") as f: + HYPERDRIVE_MORPHO_ABI = json.load(f) + +ERC20_ABI = None +with open("abi/ERC20_abi.json") as f: + ERC20_ABI = json.load(f) + +class HyperdrivePrefix(IntEnum): + r"""The asset ID is used to encode the trade type in a transaction receipt""" + + LP = 0 + LONG = 1 + SHORT = 2 + WITHDRAWAL_SHARE = 3 diff --git a/constants/integration_ids.py b/constants/integration_ids.py deleted file mode 100644 index 0131ada..0000000 --- a/constants/integration_ids.py +++ /dev/null @@ -1,82 +0,0 @@ -from enum import Enum - -from constants.integration_token import Token - - -class IntegrationID(Enum): - EXAMPLE = ('example', 'Example', Token.USDE) - PENDLE_USDE_LPT = ('pendle_effective_lpt_held', 'Pendle USDe LPT') - PENDLE_USDE_YT = ('pendle_yt_held', 'Pendle USDe YT') - PENDLE_SUSDE_LPT_APRIL_EXPIRY = ('pendle_effective_susde_apr_lpt_held', 'Pendle sUSDe LPT (April expiry)', Token.SUSDE) - PENDLE_SUSDE_YT_APRIL_EXPIRY = ('pendle_susde_apr_yt_held', 'Pendle sUSDe YT (April expiry)', Token.SUSDE) - PENDLE_SUSDE_LPT_JULY_EXPIRY = ('pendle_effective_susde_jul_lpt_held', 'Pendle sUSDe LPT (July expiry)', Token.SUSDE) - PENDLE_SUSDE_YT_JULY_EXPIRY = ('pendle_susde_jul_yt_held', 'Pendle sUSDe YT (July expiry)', Token.SUSDE) - PENDLE_SUSDE_LPT_SEPT_EXPIRY = ('pendle_effective_susde_sep_lpt_held', 'Pendle sUSDe LPT (Sept expiry)', Token.SUSDE) - PENDLE_SUSDE_YT_SEPT_EXPIRY = ('pendle_susde_sep_yt_held', 'Pendle sUSDe YT (Sept expiry)', Token.SUSDE) - PENDLE_ENA_LPT = ('pendle_effective_ena_lpt_held', 'Pendle ENA LPT', Token.ENA) - PENDLE_ENA_YT = ('pendle_ena_yt_held', 'Pendle ENA YT', Token.ENA) - PENDLE_ARBITRUM_USDE_LPT = ('pendle_arbtrium_effective_lpt_bal', 'Pendle Arbitrum USDe LPT') - PENDLE_ARBITRUM_USDE_YT = ('pendle_arbtrium_yt_bal', 'Pendle Arbitrum USDe YT') - PENDLE_KARAK_USDE_LPT = ('pendle_karak_usde_lpt_held', 'Pendle Karak USDe LPT') - PENDLE_KARAK_USDE_YT = ('pendle_karak_usde_yt_held', 'Pendle Karak USDe YT') - PENDLE_KARAK_SUSDE_LPT = ('pendle_karak_susde_lpt_held', 'Pendle Karak sUSDe LPT', Token.SUSDE) - PENDLE_KARAK_SUSDE_YT = ('pendle_karak_susde_yt_held', 'Pendle Karak sUSDe YT', Token.SUSDE) - PENDLE_MANTLE_USDE_LPT = ('pendle_mantle_effective_lpt_bal', 'Pendle Mantle USDe LPT') - PENDLE_MANTLE_USDE_YT = ('pendle_mantle_yt_bal', 'Pendle Mantle USDe YT') - PENDLE_ZIRCUIT_USDE_LPT = ('pendle_effective_zircuit_usde_lpt_held', 'Pendle Zircuit USDe LPT') - PENDLE_ZIRCUIT_USDE_YT = ('pendle_zircuit_usde_yt_held', 'Pendle Zircuit USDe YT') - - # Stake DAO - STAKEDAO_SUSDE_JULY_LPT = ('stakedao_susde_july_effective_lpt_held', 'Stake DAO sUSDe July LPT', Token.SUSDE) - STAKEDAO_SUSDE_SEPT_LPT = ('stakedao_susde_sept_effective_lpt_held', 'Stake DAO sUSDe Sept LPT', Token.SUSDE) - STAKEDAO_USDE_JULY_LPT = ('stakedao_usde_july_effective_lpt_held', 'Stake DAO USDe July LPT', Token.USDE) - - #PENPIE - PENPIE_SUSDE_JULY_LPT=('penpie_susde_july_effective_lpt_held', 'PENPIE sUSDe July LPT', Token.SUSDE) - PENPIE_Karak_sUSDe_26SEP2024_LPT= ('PENPIE_Karak_sUSDe_26SEP2024_effective_lpt_held', 'Karak_sUSDe_26SEP2024', Token.SUSDE) - PENPIE_Karak_USDE_26SEP2024_LPT= ('PENPIE_Karak_USDE_26SEP2024_effective_lpt_held', 'Karak_USDE_26SEP2024', Token.USDE) - PENPIE_sUSDe25APR2024_LPT= ('PENPIE_sUSDe25APR2024_effective_lpt_held', 'sUSDe25APR2024', Token.SUSDE) - PENPIE_sUSDe26SEP2024_LPT= ('PENPIE_sUSDe26SEP2024_effective_lpt_held', 'sUSDe26SEP2024', Token.SUSDE) - PENPIE_USDe25JUL2024_LPT= ('PENPIE_USDe25JUL2024_effective_lpt_held', 'USDe25JUL2024', Token.USDE) - PENPIE_Zircuit_USDe27JUN2024_LPT= ('PENPIE_Zircuit_USDe27JUN2024_effective_lpt_held', 'Zircuit_USDe27JUN2024', Token.USDE) - PENPIE_ENA29AUG2024_LPT= ('PENPIE_ENA29AUG2024_effective_lpt_held', 'ENA29AUG2024', Token.ENA) - PENPIE_USDE_ARB_AUG2024_LPT= ('PENPIE_USDE_ARB_AUG2024_effective_lpt_held', 'USDE_ARB_AUG2024', Token.USDE) - - - # EQUILIBRIA - EQUILIBRIA_SUSDE_SEPT_LPT = ('equilibria_susde_sept_effective_lpt_held', 'Equilibria sUSDe Sept LPT', Token.SUSDE) - EQUILIBRIA_Karak_SUSDE_SEPT_SEPT = ('equilibria_karak_susde_sept_effective_lpt_held', 'Equilibria Karak sUSDe Sept LPT', Token.SUSDE) - EQUILIBRIA_Karak_USDE_SEPT_LPT = ('equilibria_karak_usde_sept_effective_lpt_held', 'Equilibria Karak USDe Sept LPT', Token.USDE) - EQUILIBRIA_Zircuit_USDE_AUG_LPT = ('equilibria_zircuit_usde_aug_effective_lpt_held', 'Equilibria Zircuit USDe Aug LPT', Token.USDE) - EQUILIBRIA_rUSDE_SEPT_LPT = ('equilibria_rusde_sept_effective_lpt_held', 'Equilibria rUSDe Sept LPT') - EQUILIBRIA_USDE_LPT_EXPIRY = ('equilibria_usde_lpt_expiry_effective_lpt_held', 'Equilibria USDe LPT Expiry', Token.USDE) - EQUILIBRIA_SUSDE_APR_EXPIRY = ('equilibria_susde_apr_expiry_effective_lpt_held', 'Equilibria sUSDe Apr Expiry', Token.SUSDE) - - # Term Finance - TERM_SUSDE = ('term_susde_held', 'Term Finance sUSDe', Token.SUSDE) - - # Synthetix - SYNTHETIX_USDE_LP = ('synthetix_usde_arb_lp_bal', 'Synthetix V3 Arbitrum USDe LP', Token.USDE) - - # Lendle - LENDLE_USDE_LPT = ('lendle_usde_lpt_bal', 'Lendle Mantle USDe LPT', Token.USDE) - - # Ambient - AMBIENT_SCROLL_LP = ('ambient_usde_scroll_lp_bal', 'Ambient Scroll LP', Token.USDE) - - # Nuri - NURI_USDE_LP = ('nuri_usde_lp_bal', 'Nuri USDe LP', Token.USDE) - - def __init__(self, column_name: str, description: str, token: Token = Token.USDE): - self.column_name = column_name - self.description = description - self.token = token - - def get_column_name(self) -> str: - return self.column_name - - def get_description(self) -> str: - return self.description - - def get_token(self) -> Token: - return self.token diff --git a/constants/lyra.py b/constants/lyra.py new file mode 100644 index 0000000..5e1716f --- /dev/null +++ b/constants/lyra.py @@ -0,0 +1,85 @@ +import json +from typing import TypedDict, Dict +from utils.web3_utils import W3_BY_CHAIN +from web3.contract.contract import Contract +from web3 import Web3 +from constants.chains import Chain +from integrations.integration_ids import IntegrationID +from enum import Enum + +with open("abi/ERC20_abi.json") as f: + erc20_abi = json.load(f) + + +class DetailType(Enum): + Vault = "Vault" + Exchange = "Exchange" + + +class LyraVaultDetails(TypedDict): + detail_type: DetailType + start: int + chain: Chain + page_size: int + integration_token: Contract | None + bridge: Contract | None + vault_token: Contract | None + + +# NOTE: does not handle cross-chain transfers of vault tokens +LYRA_CONTRACTS_AND_START_BY_TOKEN: Dict[IntegrationID, LyraVaultDetails] = { + IntegrationID.LYRA_SUSDE_BULL_MAINNET: LyraVaultDetails( + detail_type=DetailType.Vault, + start=20211445, + chain=Chain.ETHEREUM, + integration_token=W3_BY_CHAIN[Chain.ETHEREUM]["w3"].eth.contract( + address=Web3.to_checksum_address( + "0x9d39a5de30e57443bff2a8307a4256c8797a3497" + ), + abi=erc20_abi, + ), # sUSDe + bridge=W3_BY_CHAIN[Chain.ETHEREUM]["w3"].eth.contract( + address=Web3.to_checksum_address( + "0xE3E96892D30E0ee1a8131BAf87c891201F7137bf" + ), + abi=erc20_abi, + ), + vault_token=W3_BY_CHAIN[Chain.ETHEREUM]["w3"].eth.contract( + address=Web3.to_checksum_address( + "0x1d080C689B930f9dEa69CB3B4Bc6b8c213DFC2ad" + ), + abi=erc20_abi, + ), + page_size=5000, + ), + IntegrationID.LYRA_SUSDE_BULL_ARBITRUM: LyraVaultDetails( + detail_type=DetailType.Vault, + start=227626020, + chain=Chain.ARBITRUM, + integration_token=W3_BY_CHAIN[Chain.ARBITRUM]["w3"].eth.contract( + address=Web3.to_checksum_address( + "0x211cc4dd073734da055fbf44a2b4667d5e5fe5d2" + ), + abi=erc20_abi, + ), # sUSDe + bridge=W3_BY_CHAIN[Chain.ARBITRUM]["w3"].eth.contract( + address=Web3.to_checksum_address( + "0x3c143EA5eBaB50ad6D2B2d14FA719234d1d38F1b" + ), + abi=erc20_abi, + ), + vault_token=W3_BY_CHAIN[Chain.ARBITRUM]["w3"].eth.contract( + address=Web3.to_checksum_address( + "0x81494d722DDceDbA31ac40F28daFa66b207f232B" + ), + abi=erc20_abi, + ), + page_size=20000, + ), + IntegrationID.LYRA_SUSDE_EXCHANGE_DEPOSIT: LyraVaultDetails( # type: ignore + detail_type=DetailType.Exchange, + start=11481048, + chain=Chain.Lyra, + page_size=20000, + ), +} diff --git a/constants/merchantmoe.py b/constants/merchantmoe.py new file mode 100644 index 0000000..4084fa7 --- /dev/null +++ b/constants/merchantmoe.py @@ -0,0 +1,5 @@ +ZERO_ADDRESS = "0x0000000000000000000000000000000000000000" +DEAD_ADDRESS = "0x000000000000000000000000000000000000dead" +MERCHANT_MOE_LIQUIDITY_HELPER_CONTRACT = "0xA5c68C9E55Dde3505e60c4B5eAe411e2977dfB35" +METH_USDE_MERCHANT_MOE_LBT_CONTRACT = "0x74Db2EB31D4B5a0522d3c2eB6dBd87aAc21745f9" +METH_USDE_MERCHANT_MOE_LBT_DEPLOYMENT_BLOCK = 65983600 \ No newline at end of file diff --git a/constants/nuri.py b/constants/nuri.py index 2bf4f14..fa2187a 100644 --- a/constants/nuri.py +++ b/constants/nuri.py @@ -1,5 +1,13 @@ -NURI_NFP_MANAGER_ADDRESS = "0xAAA78E8C4241990B4ce159E105dA08129345946A" -NURI_POOL_ADDRESS = "0x93b77EABf65921477EE1FbC1B3833D7071DB1797" +from web3 import Web3 + +NURI_NFP_MANAGER_ADDRESS = Web3.to_checksum_address( + "0xAAA78E8C4241990B4ce159E105dA08129345946A" +) +NURI_POOL_ADDRESS = Web3.to_checksum_address( + "0x93b77EABf65921477EE1FbC1B3833D7071DB1797" +) NURI_DEPLOYMENT_BLOCK = 7055711 -SCROLL_USDE_TOKEN_ADDRESS = "0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34" \ No newline at end of file +SCROLL_USDE_TOKEN_ADDRESS = Web3.to_checksum_address( + "0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34" +) diff --git a/constants/pendle.py b/constants/pendle.py index 047500f..06ccb6a 100644 --- a/constants/pendle.py +++ b/constants/pendle.py @@ -1,49 +1,73 @@ -PENDLE_ETH_MULTISIG = "0x8270400d528c34e1596EF367eeDEc99080A1b592" -PENDLE_MANTLE_MULTISIG = "0x5C30d3578A4D07a340650a76B9Ae5dF20D5bdF55" -PENDLE_ARBITRUM_MULTISIG = "0xCbcb48e22622a3778b6F14C2f5d258Ba026b05e6" -KARAK_VAULT_SUPERVISOR = "0x54e44DbB92dBA848ACe27F44c0CB4268981eF1CC" +from web3 import Web3 + +PENDLE_ETH_MULTISIG = Web3.to_checksum_address( + "0x8270400d528c34e1596ef367eedec99080a1b592" +) +PENDLE_MANTLE_MULTISIG = Web3.to_checksum_address( + "0x5c30d3578a4d07a340650a76b9ae5df20d5bdf55" +) +PENDLE_ARBITRUM_MULTISIG = Web3.to_checksum_address( + "0xcbcb48e22622a3778b6f14c2f5d258ba026b05e6" +) +KARAK_VAULT_SUPERVISOR = Web3.to_checksum_address( + "0x54e44dbb92dba848ace27f44c0cb4268981ef1cc" +) PENDLE_DEDUCTION = 0.97 -SY = "0x42862F48eAdE25661558AFE0A630b132038553D0" -YT = "0x1e3d13932C31d7355fCb3FEc680b0cD159dC1A07" -LPT = "0x19588F29f9402Bb508007FeADd415c875Ee3f19F" +SY = Web3.to_checksum_address("0x42862f48eade25661558afe0a630b132038553d0") +YT = Web3.to_checksum_address("0x1e3d13932c31d7355fcb3fec680b0cd159dc1a07") +LPT = Web3.to_checksum_address("0x19588f29f9402bb508007feadd415c875ee3f19f") PENDLE_USDE_JULY_DEPLOYMENT_BLOCK = 19564654 -pendle_router = "0x00000000005BBB0EF59571E58418F9a4357b68A0" +pendle_router = Web3.to_checksum_address("0x00000000005bbb0ef59571e58418f9a4357b68a0") susde_new_pool_block = 19728566 -sUSDe_SY = "0xC4ed348c56223C5953939e932E315F9d72Cd83fF" -sUSDe_YT = "0xf65CD2460F4F199C5AC09c74Ac05c40559C29e4F" -sUSDe_LPT = "0x107a2e3cD2BB9a32B9eE2E4d51143149F8367eBa" +sUSDe_SY = Web3.to_checksum_address("0xc4ed348c56223c5953939e932e315f9d72cd83ff") +sUSDe_YT = Web3.to_checksum_address("0xf65cd2460f4f199c5ac09c74ac05c40559c29e4f") +sUSDe_LPT = Web3.to_checksum_address("0x107a2e3cd2bb9a32b9ee2e4d51143149f8367eba") PENDLE_SUSDE_JULY_DEPLOYMENT_BLOCK = 19717752 -SUSDE_SY_SEPT = "0x4139cDC6345aFFbaC0692b43bed4D059Df3e6d65" -SUSDE_YT_SEPT = "0xdc02b77a3986da62C7A78FED73949C9767850809" -SUSDE_LPT_SEPT = "0xd1D7D99764f8a52Aff007b7831cc02748b2013b5" +SUSDE_SY_SEPT = Web3.to_checksum_address("0x4139cdc6345affbac0692b43bed4d059df3e6d65") +SUSDE_YT_SEPT = Web3.to_checksum_address("0xdc02b77a3986da62c7a78fed73949c9767850809") +SUSDE_LPT_SEPT = Web3.to_checksum_address("0xd1d7d99764f8a52aff007b7831cc02748b2013b5") PENDLE_SUSDE_SEPT_DEPLOYMENT_BLOCK = 19909022 -sUSDe_SY_old = "0x215a61deaD7e1303b8571Bb429491aeAc5f2061e" -sUSDe_YT_old = "0x20c8Cf9714339fd018898cB5De84c089e48d1c87" -sUSDe_LPT_old = "0x8f7627bD46B30E296Aa3AAbe1dF9Bfac10920B6E" +sUSDe_SY_old = Web3.to_checksum_address("0x215a61dead7e1303b8571bb429491aeac5f2061e") +sUSDe_YT_old = Web3.to_checksum_address("0x20c8cf9714339fd018898cb5de84c089e48d1c87") +sUSDe_LPT_old = Web3.to_checksum_address("0x8f7627bd46b30e296aa3aabe1df9bfac10920b6e") PENDLE_SUSDE_APRIL_DEPLOYMENT_BLOCK = 19367010 -mantle_YT = "0xb3c0f96c4208185cC22Afd1b7CF21F1dabd9648A" -mantle_LPT = "0x7dc07C575A0c512422dCab82CE9Ed74dB58Be30C" -mantle_SY = "0x5B9e411c9E50164133DE07FE1cAC05A094000105" +mantle_YT = Web3.to_checksum_address("0xb3c0f96c4208185cc22afd1b7cf21f1dabd9648a") +mantle_LPT = Web3.to_checksum_address("0x7dc07c575a0c512422dcab82ce9ed74db58be30c") +mantle_SY = Web3.to_checksum_address("0x5b9e411c9e50164133de07fe1cac05a094000105") PENDLE_MANTLE_DEPLOYMENT_BLOCK = 59995414 -USDe_zircuit_LPT = "0x90c98ab215498B72Abfec04c651e2e496bA364C0" -USDe_zircuit_SY = "0x293C6937D8D82e05B01335F7B33FBA0c8e256E30" -USDe_zircuit_YT = "0x40357b9f22B4DfF0Bf56A90661b8eC106C259d29" +USDe_zircuit_LPT = Web3.to_checksum_address( + "0x90c98ab215498b72abfec04c651e2e496ba364c0" +) +USDe_zircuit_SY = Web3.to_checksum_address("0x293c6937d8d82e05b01335f7b33fba0c8e256e30") +USDe_zircuit_YT = Web3.to_checksum_address("0x40357b9f22b4dff0bf56a90661b8ec106c259d29") PENDLE_USDE_ZIRCUIT_DEPLOYMENT_BLOCK = 19588125 zircuit_USDe_start_block = 19589650 -ENA_LP = "0x9C73879F795CefA1D5239dE08d1B6Aba2D2d1434" -ENA_SY = "0x66C68a7bcC4CBcAb43A2947A529765d86D4ef14f" -ENA_YT = "0x87be82bBd3e6f1c0871001f8EB4C12b60462c835" +ENA_LP = Web3.to_checksum_address("0x9c73879f795cefa1d5239de08d1b6aba2d2d1434") +ENA_SY = Web3.to_checksum_address("0x66c68a7bcc4cbcab43a2947a529765d86d4ef14f") +ENA_YT = Web3.to_checksum_address("0x87be82bbd3e6f1c0871001f8eb4c12b60462c835") PENDLE_ENA_DEPLOYMENT_BLOCK = 19644726 -usde_arb_LP = "0x2Dfaf9a5E4F293BceedE49f2dBa29aACDD88E0C4" -usde_arb_SY = "0xb3C24D9dcCC2Ec5f778742389ffe448E295B84e0" -usde_arb_PT = "0xad853EB4fB3Fe4a66CdFCD7b75922a0494955292" -usde_arb_YT = "0xF478f7FeaeAB0DFdC91E02cDd6C63c66E30a7335" +usde_arb_LP = Web3.to_checksum_address("0x2dfaf9a5e4f293bceede49f2dba29aacdd88e0c4") +usde_arb_SY = Web3.to_checksum_address("0xb3c24d9dccc2ec5f778742389ffe448e295b84e0") +usde_arb_PT = Web3.to_checksum_address("0xad853eb4fb3fe4a66cdfcd7b75922a0494955292") +usde_arb_YT = Web3.to_checksum_address("0xf478f7feaeab0dfdc91e02cdd6c63c66e30a7335") PENDLE_USDE_ARB_DEPLOYMENT_BLOCK = 197776131 -PENDLE_USDE_KARAK_LP = "0x1BCBDB8c8652345A5ACF04e6E74f70086c68FEfC" -PENDLE_USDE_KARAK_SY = "0xfe2d379117895Fa6144B209C13894A17aB18C86c" -PENDLE_USDE_KARAK_YT = "0x2e40D7Cfee1e7D31d1F4875e6F33B2c9a17038fF" +PENDLE_USDE_KARAK_LP = Web3.to_checksum_address( + "0x1bcbdb8c8652345a5acf04e6e74f70086c68fefc" +) +PENDLE_USDE_KARAK_SY = Web3.to_checksum_address( + "0xfe2d379117895fa6144b209c13894a17ab18c86c" +) +PENDLE_USDE_KARAK_YT = Web3.to_checksum_address( + "0x2e40d7cfee1e7d31d1f4875e6f33b2c9a17038ff" +) PENDLE_USDE_KARAK_DEPLOYMENT_BLOCK = 19967899 -PENDLE_SUSDE_KARAK_LP = "0xB1f587B354a4a363f5332e88effbbC2E4961250A" -PENDLE_SUSDE_KARAK_SY = "0x1b641894e66aec7Bf5ab86517e8D81763Cc8e19E" -PENDLE_SUSDE_KARAK_YT = "0xdd68f5D26Bf1182d6b241108bfC01f95C030502b" +PENDLE_SUSDE_KARAK_LP = Web3.to_checksum_address( + "0xb1f587b354a4a363f5332e88effbbc2e4961250a" +) +PENDLE_SUSDE_KARAK_SY = Web3.to_checksum_address( + "0x1b641894e66aec7bf5ab86517e8d81763cc8e19e" +) +PENDLE_SUSDE_KARAK_YT = Web3.to_checksum_address( + "0xdd68f5d26bf1182d6b241108bfc01f95c030502b" +) PENDLE_SUSDE_KARAK_DEPLOYMENT_BLOCK = 19967918 diff --git a/constants/penpie.py b/constants/penpie.py index ef866f9..8f08a9d 100644 --- a/constants/penpie.py +++ b/constants/penpie.py @@ -1,38 +1,94 @@ -PENDLE_LOCKER_ETHEREUM = "0x6E799758CEE75DAe3d84e09D40dc416eCf713652" -PENDLE_LOCKER_ARBITRUM = "0x6DB96BBEB081d2a85E0954C252f2c1dC108b3f81" -master_penpie_ethereum="0x16296859C15289731521F199F0a5f762dF6347d0" -master_penpie_arbitrum="0x0776C06907CE6Ff3d9Dbf84bA9B3422d7225942D" +from web3 import Web3 + +PENDLE_LOCKER_ETHEREUM = Web3.to_checksum_address( + "0x6E799758CEE75DAe3d84e09D40dc416eCf713652" +) +PENDLE_LOCKER_ARBITRUM = Web3.to_checksum_address( + "0x6DB96BBEB081d2a85E0954C252f2c1dC108b3f81" +) +master_penpie_ethereum = Web3.to_checksum_address( + "0x16296859C15289731521F199F0a5f762dF6347d0" +) +master_penpie_arbitrum = Web3.to_checksum_address( + "0x0776C06907CE6Ff3d9Dbf84bA9B3422d7225942D" +) + + +SUSDE_JULY = Web3.to_checksum_address("0xae52ec79F2444D642B7E855DfF67bA4849D365eB") +SUSDE_JULY_DEPLOYMENT_BLOCK = 19717752 +Karak_sUSDe_26SEP2024_PRT = Web3.to_checksum_address( + "0x1c055D8081CA3B2bE0DD00ABe784b142C608219E" +) +Karak_sUSDe_26SEP2024_PRT_DEPLOYMENT_BLOCK = 19967918 -SUSDE_JULY = "0xae52ec79F2444D642B7E855DfF67bA4849D365eB" -SUSDE_JULY_DEPLOYMENT_BLOCK = 19717752 -Karak_sUSDe_26SEP2024_PRT="0x1c055D8081CA3B2bE0DD00ABe784b142C608219E" -Karak_sUSDe_26SEP2024_PRT_DEPLOYMENT_BLOCK=19967918 +Karak_USDE_26SEP2024_PRT = Web3.to_checksum_address( + "0x0980Be7cC405ae7C31CC39E1dd1ee77483C1a430" +) +Karak_USDE_26SEP2024_PRT_DEPLOYMENT_BLOCK = 19967899 + + +sUSDe25APR2024_PRT = Web3.to_checksum_address( + "0xD35B5F85aeec81ba3A9BFa26478b2C43B8889C91" +) +sUSDe25APR2024_PRT_DEPLOYMENT_BLOCK = 19367010 + + +sUSDe26SEP2024_PRT = Web3.to_checksum_address( + "0xA60f87Eac3877dFCE688Df40AeBba20030E0eb75" +) +sUSDe26SEP2024_PRT_DEPLOYMENT_BLOCK = 19909022 + +USDe25JUL2024_PRT = Web3.to_checksum_address( + "0x3984E25AF3EbcfB4ca8925e9fA8855e17DC1D240" +) +USDe25JUL2024_PRT_DEPLOYMENT_BLOCK = 19564654 + + +Zircuit_USDe27JUN2024_PRT = Web3.to_checksum_address( + "0x15254c0CD69cD5c92D6A8D66De487370E146b17d" +) +Zircuit_USDe27JUN2024_PRT_DEPLOYMENT_BLOCK = 19588125 + +ENA29AUG2024_PRT = Web3.to_checksum_address( + "0xF65d42E30C15E861bc410a94e01f0CbADC0356C2" +) +ENA29AUG2024_PRT_DEPLOYMENT_BLOCK = 19644726 +USDE_ARB_AUG2024 = Web3.to_checksum_address( + "0x51FF42a579EBfC18EF9e92050494028B4aF34FA5" +) +USDE_ARB_AUG2024_DEPLOYMENT_BLOCK = 197776131 -Karak_USDE_26SEP2024_PRT="0x0980Be7cC405ae7C31CC39E1dd1ee77483C1a430" -Karak_USDE_26SEP2024_PRT_DEPLOYMENT_BLOCK=19967899 +USDe_24OCT2024 = Web3.to_checksum_address("0x39dAF77ad5514a9d3008313c2B8a37520C1F86D2") +USDe_24OCT2024_DEPLOYMENT_BLOCK = 20326930 +ENA_31OCT2024 = Web3.to_checksum_address("0x0328C188287EaDA3E2E2151544d0226f800Eb9b5") +ENA_31OCT2024_DEPLOYMENT_BLOCK = 20395113 -sUSDe25APR2024_PRT="0xD35B5F85aeec81ba3A9BFa26478b2C43B8889C91" -sUSDe25APR2024_PRT_DEPLOYMENT_BLOCK=19367010 +rsUSDe_26SEP2024 = Web3.to_checksum_address( + "0x7F5955E5E36ABD98914c11E8c3Eff318CCc4eAF5" +) +rsUSDe_26SEP2024_DEPLOYMENT_BLOCK = 20208513 -sUSDe26SEP2024_PRT="0xA60f87Eac3877dFCE688Df40AeBba20030E0eb75" -sUSDe26SEP2024_PRT_DEPLOYMENT_BLOCK=19909022 +USDe_26DEC2024 = Web3.to_checksum_address("0x6065c7870fF455fb9a78DD304579BdE2D7735703") +USDe_26DEC2024_DEPLOYMENT_BLOCK = 20323985 -USDe25JUL2024_PRT="0x3984E25AF3EbcfB4ca8925e9fA8855e17DC1D240" -USDe25JUL2024_PRT_DEPLOYMENT_BLOCK=19564654 +sUSDE_26DEC2024 = Web3.to_checksum_address("0x590F0AB4c70686985D2C5a38859E0550445ACC20") +sUSDE_26DEC2024_DEPLOYMENT_BLOCK = 20323930 -Zircuit_USDe27JUN2024_PRT="0x15254c0CD69cD5c92D6A8D66De487370E146b17d" -Zircuit_USDe27JUN2024_PRT_DEPLOYMENT_BLOCK=19588125 +sUSDE_24OCT2024 = Web3.to_checksum_address("0xaf09EE734B9B7157F371Ce984F67b1E87f8f2b2c") +sUSDE_24OCT2024_DEPLOYMENT_BLOCK = 20326872 -ENA29AUG2024_PRT="0xF65d42E30C15E861bc410a94e01f0CbADC0356C2" -ENA29AUG2024_PRT_DEPLOYMENT_BLOCK=19644726 +rsENA_26SEP2024 = Web3.to_checksum_address("0x618e5ee4DD5BbD995883425B8AaC87dDCfb48Cf7") +rsENA_26SEP2024_DEPLOYMENT_BLOCK = 20208485 -USDE_ARB_AUG2024="0x51FF42a579EBfC18EF9e92050494028B4aF34FA5" -USDE_ARB_AUG2024_DEPLOYMENT_BLOCK=197776131 +USDE_ARB_NOV2024 = Web3.to_checksum_address( + "0x706f7F4cc144d6621E0c8798381575a8Cd1E0572" +) +USDE_ARB_NOV2024_DEPLOYMENT_BLOCK = 242775302 diff --git a/constants/radiant.py b/constants/radiant.py new file mode 100644 index 0000000..4c5e676 --- /dev/null +++ b/constants/radiant.py @@ -0,0 +1,45 @@ +import json +from typing import TypedDict, Dict +from utils.web3_utils import W3_BY_CHAIN +from web3.contract.contract import Contract +from web3 import Web3 +from constants.chains import Chain +from integrations.integration_ids import IntegrationID + +with open("abi/radiant_r_token.json") as f: + r_token_abi = json.load(f) +with open("abi/radiant_lending_pool.json") as f: + lending_pool_abi = json.load(f) + + +class RadiantLendingDetails(TypedDict): + start: int + chain: Chain + collateral_address: str + r_token_contract: Contract + lending_pool: Contract + graph_url: str + + +RADIANT_CONTRACTS_AND_START_BY_TOKEN: Dict[IntegrationID, RadiantLendingDetails] = { + IntegrationID.RADIANT_USDE_CORE_ARBITRUM: RadiantLendingDetails( + start=247318247, + chain=Chain.ARBITRUM, + collateral_address=Web3.to_checksum_address( + "0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34" + ), + r_token_contract=W3_BY_CHAIN[Chain.ARBITRUM]["w3"].eth.contract( + address=Web3.to_checksum_address( + "0x19f0bE6a603967c72bE32a30915a38d52cA31Ae2" + ), + abi=r_token_abi, + ), + lending_pool=W3_BY_CHAIN[Chain.ARBITRUM]["w3"].eth.contract( + address=Web3.to_checksum_address( + "0xF4B1486DD74D07706052A33d31d7c0AAFD0659E1" + ), + abi=lending_pool_abi, + ), + graph_url="https://gateway-arbitrum.network.thegraph.com/api/8d1d947ce53cce677d86d075396ad13b/subgraphs/id/E1UTUGaNbTb4XbEYoupJZ5hU62hW9CnadKTXLRSP2hM", + ), +} diff --git a/constants/ramses.py b/constants/ramses.py new file mode 100644 index 0000000..bdd4828 --- /dev/null +++ b/constants/ramses.py @@ -0,0 +1,5 @@ +RAMSES_NFP_MANAGER_ADDRESS = "0xAA277CB7914b7e5514946Da92cb9De332Ce610EF" +RAMSES_POOL_ADDRESS = "0x09b5007f51Fb6DD0340008D8042d3b30A92E0D3f" +RAMSES_DEPLOYMENT_BLOCK = 237805839 + +ARBITRUM_USDE_TOKEN_ADDRESS = "0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34" diff --git a/constants/rho_markets.py b/constants/rho_markets.py new file mode 100644 index 0000000..8f723a5 --- /dev/null +++ b/constants/rho_markets.py @@ -0,0 +1,4 @@ +from utils.web3_utils import w3_scroll + +RHO_MARKETS_SCROLL_RUSDE_ADDRESS = w3_scroll.to_checksum_address("0x5fF1926507f6e71bFbd5f9897fBaeF021E2F77CA") +RHO_MARKETS_SCROLL_DEPLOYMENT_BLOCK = 7154508 diff --git a/constants/splice.py b/constants/splice.py new file mode 100644 index 0000000..30f0048 --- /dev/null +++ b/constants/splice.py @@ -0,0 +1,11 @@ +from web3 import Web3 + +USDE_SY = Web3.to_checksum_address("0x86A30BE69D839d7E95948f5ba9d45B1F1f1749d6") +USDE_YT = Web3.to_checksum_address("0xeB0D929e92A29D7Ee3cc83F334dB5Da5C28D0216") +USDE_LPT = Web3.to_checksum_address("0x6bcbDF29Ccd99E8b76798336bA800946CAFa415d") +USDE_DEPLOYMENT_BLOCK = 11148972 + +SUSDE_SY = Web3.to_checksum_address("0x0E63b9d6138F363ecf7Db74dD05e3bA81C3c17eC") +SUSDE_YT = Web3.to_checksum_address("0x0cC48a4616A636006A3C121AD5eF7D52155fAaFF") +SUSDE_LPT = Web3.to_checksum_address("0xe138a963403037DB36349eD2b747aA05F4E171cc") +SUSDE_DEPLOYMENT_BLOCK = 11148921 diff --git a/constants/summary_columns.py b/constants/summary_columns.py index fdae722..e0c35b4 100644 --- a/constants/summary_columns.py +++ b/constants/summary_columns.py @@ -1,16 +1,50 @@ from enum import Enum +class SummaryColumnType(Enum): + ETHENA_PTS = "ethena_pts" + ETHEREAL_PTS = "ethereal_pts" + + class SummaryColumn(Enum): - PENDLE_SHARDS = "pendle_shards" - PENDLE_ARBITRUM_SHARDS = "pendle_arbtrium_shards" - PENDLE_MANTLE_SHARDS = "pendle_mantle_shards" - SYNTHETIX_ARBITRUM_SHARDS = "synthetix_arbitrum_shards" + TEMPLATE_PTS = ("template_pts", SummaryColumnType.ETHENA_PTS) + PENDLE_SHARDS = ("pendle_shards", SummaryColumnType.ETHENA_PTS) + PENDLE_ARBITRUM_SHARDS = ("pendle_arbtrium_shards", SummaryColumnType.ETHENA_PTS) + PENDLE_MANTLE_SHARDS = ("pendle_mantle_shards", SummaryColumnType.ETHENA_PTS) + SYNTHETIX_ARBITRUM_SHARDS = ( + "synthetix_arbitrum_shards", + SummaryColumnType.ETHENA_PTS, + ) + + AMBIENT_SCROLL_SHARDS = ("ambient_scroll_shards", SummaryColumnType.ETHENA_PTS) + + NURI_SHARDS = ("nuri_shards", SummaryColumnType.ETHENA_PTS) + LENDLE_MANTLE_SHARDS = ("lendle_mantle_shards", SummaryColumnType.ETHENA_PTS) + + RHO_MARKETS_SCROLL_SHARDS = ( + "rho_markets_scroll_shards", + SummaryColumnType.ETHENA_PTS, + ) + + RAMSES_SHARDS = ("ramses_shards", SummaryColumnType.ETHENA_PTS) + + GMX_ARBITRUM_SHARDS = ("gmx_arbitrum_shards", SummaryColumnType.ETHENA_PTS) + + CURVE_LLAMALEND_SHARDS = ("curve_llamalend_shards", SummaryColumnType.ETHENA_PTS) + + CLAIMED_ENA_PTS_EXAMPLE = ("claimed_ena_example", SummaryColumnType.ETHENA_PTS) - AMBIENT_SCROLL_SHARDS = "ambient_scroll_shards" - - NURI_SHARDS = "nuri_shards" - LENDLE_MANTLE_SHARDS = "lendle_mantle_shards" + BEEFY_CACHED_BALANCE_EXAMPLE = ( + "beefy_cached_balance_example", + SummaryColumnType.ETHENA_PTS, + ) + def __init__(self, column_name: str, col_type: SummaryColumnType): + self.column_name = column_name + self.col_type = col_type + def get_col_name(self) -> str: + return self.column_name + def get_col_type(self) -> SummaryColumnType: + return self.col_type diff --git a/constants/synthetix.py b/constants/synthetix.py index 212b617..e9cd15f 100644 --- a/constants/synthetix.py +++ b/constants/synthetix.py @@ -1,5 +1,13 @@ -SYNTHETIX_ARB_CORE_PROXY_ADDRESS = "0xffffffaEff0B96Ea8e4f94b2253f31abdD875847" -SYNTHETIX_ARB_CORE_ACCOUNT_PROXY_ADDRESS = "0x0E429603D3Cb1DFae4E6F52Add5fE82d96d77Dac" +from web3 import Web3 + +SYNTHETIX_ARB_CORE_PROXY_ADDRESS = Web3.to_checksum_address( + "0xffffffaEff0B96Ea8e4f94b2253f31abdD875847" +) +SYNTHETIX_ARB_CORE_ACCOUNT_PROXY_ADDRESS = Web3.to_checksum_address( + "0x0E429603D3Cb1DFae4E6F52Add5fE82d96d77Dac" +) SYNTHETIX_ARB_DEPLOYMENT_BLOCK = 218272801 -ARB_USDE_TOKEN_ADDRESS = "0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34" \ No newline at end of file +ARB_USDE_TOKEN_ADDRESS = Web3.to_checksum_address( + "0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34" +) diff --git a/constants/velodrome.py b/constants/velodrome.py new file mode 100644 index 0000000..e8f0375 --- /dev/null +++ b/constants/velodrome.py @@ -0,0 +1,7 @@ +VELODROME_MODE_START_BLOCK = 7798059 +PAGE_SIZE = 100 +VELODROME_MODE_SUGAR_ADDRESS = "0x207DfB36A449fd10d9c3bA7d75e76290a0c06731" + +ENA_MODE_TOKEN = "0x58538e6A46E07434d7E7375Bc268D3cb839C0133" +USDE_MODE_TOKEN = "0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34" +SUSDE_MODE_TOKEN = "0x211Cc4DD073734dA055fbF44a2b4667d5E5fE5d2" \ No newline at end of file diff --git a/integrations/allstake_susde.py b/integrations/allstake_susde.py new file mode 100644 index 0000000..a6aff73 --- /dev/null +++ b/integrations/allstake_susde.py @@ -0,0 +1,15 @@ +from utils.web3_utils import W3_BY_CHAIN +from integrations.integration_ids import IntegrationID +from utils.allstake import AllstakeIntegration + + +if __name__ == "__main__": + integration = AllstakeIntegration(IntegrationID.ALLSTAKE_SUSDE) + current_block = W3_BY_CHAIN[integration.chain]["w3"].eth.get_block_number() + + participants = integration.get_participants(None) + print("Get Participants:") + print(participants) + print("Get Balances of All Participants:") + for participant in participants: + print(participant, integration.get_balance(participant, current_block)) diff --git a/integrations/allstake_usde.py b/integrations/allstake_usde.py new file mode 100644 index 0000000..309cea0 --- /dev/null +++ b/integrations/allstake_usde.py @@ -0,0 +1,15 @@ +from utils.web3_utils import W3_BY_CHAIN +from integrations.integration_ids import IntegrationID +from utils.allstake import AllstakeIntegration + + +if __name__ == "__main__": + integration = AllstakeIntegration(IntegrationID.ALLSTAKE_USDE) + current_block = W3_BY_CHAIN[integration.chain]["w3"].eth.get_block_number() + + participants = integration.get_participants(None) + print("Get Participants:") + print(participants) + print("Get Balances of All Participants:") + for participant in participants: + print(participant, integration.get_balance(participant, current_block)) diff --git a/integrations/ambient_scroll.py b/integrations/ambient_scroll.py index 007117f..f83972f 100644 --- a/integrations/ambient_scroll.py +++ b/integrations/ambient_scroll.py @@ -1,7 +1,7 @@ import requests from constants.chains import Chain -from constants.integration_ids import IntegrationID -from models.integration import Integration +from integrations.integration_ids import IntegrationID +from integrations.integration import Integration from constants.summary_columns import SummaryColumn from constants.ambient import AMBIENT_SCROLL_DEPLOYMENT_BLOCK, AMBIENT_SCROLL_API_URL @@ -22,12 +22,12 @@ def get_balance(self, user: str, block: int) -> float: Get the balance of a user at a given block """ url = f"{AMBIENT_SCROLL_API_URL}/sats/scroll/balance" - params = {"user": user, "block": block} - response = requests.get(url, params=params) + params = {"user": str(user), "block": str(block)} + response = requests.get(url, params=params) # type: ignore data = response.json() return data["data"] - def get_participants(self) -> list: + def get_participants(self, blocks: list[int] | None) -> set[str]: """ Get all participants of the protocol, ever. This function should only be called once and should cache the results by setting self.participants @@ -41,5 +41,5 @@ def get_participants(self) -> list: if __name__ == "__main__": # Simple tests for the integration ambient = Ambient() - print(ambient.get_participants()) - print(ambient.get_balance(list(ambient.get_participants())[2], 7372500)) + print(ambient.get_participants(None)) + print(ambient.get_balance(list(ambient.get_participants(None))[2], 7372500)) diff --git a/integrations/balancer_integration.py b/integrations/balancer_integration.py new file mode 100644 index 0000000..24a0404 --- /dev/null +++ b/integrations/balancer_integration.py @@ -0,0 +1,143 @@ +from typing import List, Optional, Set +from integrations.integration_ids import IntegrationID +from integrations.integration import Integration +from utils.balancer import ( + get_vault_pool_token_balance, + get_potential_token_holders, + get_user_balance, + get_bpt_supply, +) +from constants.balancer import INTEGRATION_CONFIGS + + +class BalancerIntegration(Integration): + def __init__(self, integration_id: IntegrationID): + config = INTEGRATION_CONFIGS.get(integration_id) + if not config: + raise ValueError( + f"No configuration found for integration ID: {integration_id}" + ) + + super().__init__( + integration_id, + config.start_block, + config.chain, + [], + 20, + 1, + None, + None, + ) + + self.pool_id = config.pool_id + self.has_preminted_bpts = config.has_preminted_bpts + self.gauge_address = config.gauge_address + self.aura_address = config.aura_address + self.incentivized_token = config.incentivized_token + self.incentivized_token_decimals = config.incentivized_token_decimals + + def get_balance(self, user: str, block: int | str = "latest") -> float: + """ + Retrieve the balance of the user in the incentivized Ethena token. + + This method calculates the user's token balance based on the share of Balancer Pool Tokens (BPTs) + staked either directly in Balancer gauges or via Aura Finance. + """ + gauge_balance = get_user_balance(self.chain, user, self.gauge_address, block) + aura_balance = get_user_balance(self.chain, user, self.aura_address, block) + + bpt_address = self.pool_id[:42] + bpt_supply = get_bpt_supply( + self.chain, bpt_address, self.has_preminted_bpts, block + ) + + user_balance = gauge_balance + aura_balance + + incentivized_token_balance = get_vault_pool_token_balance( + self.chain, self.pool_id, self.incentivized_token, block + ) + + user_share = user_balance / bpt_supply + + return ( + user_share + * incentivized_token_balance + / pow(10, self.incentivized_token_decimals) + ) + + def get_participants( + self, + blocks: Optional[List[int]], + ) -> Set[str]: + """ + Retrieve the set of all unique participants who might have staked Balancer Pool Tokens (BPTs). + + This method identifies all addresses that have staked their BPT either directly + in Balancer gauges or via Aura Finance. Non-staked BPT holders are not included. + """ + gauge_holders = get_potential_token_holders( + self.chain, self.gauge_address, self.start_block + ) + aura_holders = get_potential_token_holders( + self.chain, self.aura_address, self.start_block + ) + + return set(aura_holders + gauge_holders) + + +if __name__ == "__main__": + balancer = BalancerIntegration(IntegrationID.BALANCER_FRAXTAL_FRAX_USDE) + participants = { + "0x58d70BFa5B7dEf2B44c2B6c6e1F50bed4950B4D6", + "0x5836130b9f34deeb78C7642f37E921F913E4C3d6", + "0xDE609fb3ef5875bE6cD5F881F17aF17E5FAE16cd", + "0xFe077981C40B01E0f2CD28633799C87F951Fa954", + "0xBcA4D68BE543dCEFb1a8bcCb519503f9ba3f2026", + "0x2E2aFAFbeEaA08d6883dCdEBEe84A2d623a9CEee", + "0xB439b0844D0D9aF237FF37dc2379f07B6CD06171", + "0x16E1bc23C2210Ed6C8410e3c6Ec0FD8C0B5662Da", + "0x60b1708e496f33EFb9198Fe5219656f31665d16c", + "0x7caec00E024BbDe0dCdaEED9c9407bAf88FDC65c", + "0x9C1DF238A1b1B1F5E3bC5C046201B253D8Bf9E3c", + "0x1CaadD7BbAD2eEDb593bb808Db4Af1a678AF560b", + "0xb541765F540447646A9545E0A4800A0Bacf9E13D", + "0x97a1CA841B4792068932D4224681f6F6fa22C549", + "0x69344717556C64DC49A2Ba36267A04efAcF34d27", + "0x584358236b7bcd791077843B8a7E5c8419b51c86", + "0x650036B83283656BCa3a4D11671E3DD4229B5720", + "0x8e5D2f8A445dD6812e907BCB0fB4633656BcB8cd", + "0x5452E6ABbC7bCB9e0907A3f8f24434CbaF438bA4", + "0x72292f8183dAD15DAe55377321d29F1053d1603F", + "0x18D62A25e399CEF8F8FBf36C1a3055657f6E5775", + "0x73E4a6BD123aBf43Ef1da93C214BE8DA0dF3b20a", + "0x576159e8003e74cbDb5b2274CfC4418BB60cD0d8", + "0xDcc5b9BA5aB98DC38477831Ff359d81f911423eb", + "0x35341d0F2eAe4aE3782c4F7a08C86f7717fD0839", + "0x75C108dF63381E5b2FAe62d610D79A8915911AA8", + "0x653181142dC87D1bc4a1b7849604D4ba510a4A3d", + "0xd476c2dB017a1e8be6D2ccbF6E00BEE544aaa316", + "0xF4E7e39411E60C2B9AECd6C92482e1980bbB3A4D", + "0xeeDb07ae31191e8E803685887Bf653754f2f6F52", + "0x1e892233459C4F96B9bafD13947f75EbF96410Ae", + "0x2cFb075E8FC0D99837653629B0A3d527f0769a1A", + "0x90e06d2d9705c181Bad2A4e7c3DcA13631a6f479", + "0x09Fa38EBa245bb68354B8950FA2fe71f02863393", + "0xE059A37d87C49503B283a2F7A3A5d4B652ff7351", + "0x05747fc55e8156F2337a5e525f5c5818BD8f195F", + "0x61EF43A10d4bc127c961D89e122595d85e87e2C8", + "0x4A380643690dc94e0182826Dc97bAAD4E6686646", + "0x4B298f807E0449C6Eb0320773dc4d3fb1BDf7B25", + "0xc87e3788764823CEDdD132CA2E697767de5ed4de", + "0x4CB01b6672bc750821af952ec5A2447fC90195b1", + "0x4b08d2f583C119902ef5599BC30396F83865Fec8", + "0x854B004700885A61107B458f11eCC169A019b764", + "0x4334703B0B74E2045926f82F4158A103fCE1Df4f", + "0xf0f74277C46eBec6B6C9678C9B3b8637B893918D", + "0xe3Be0Baae3d4928D3e2E7724d4bf188003C56EBF", + "0x82495AFEa7a975F637e68eb5f9afF15071d35BB0", + "0xc018C33B4Db79144e6B6D3220AB6c53565BA1931", + "0x5EB476bFD8C1a9Ba7A9663543a6686193b42600c", + "0xC0fC2fA4629A1a23Ded78193ac16dfe6FFc05269", + } + for participant in participants: + print(participant, balancer.get_balance(participant)) diff --git a/integrations/beefy_arbitrum_usde.py b/integrations/beefy_arbitrum_usde.py new file mode 100644 index 0000000..1c885e0 --- /dev/null +++ b/integrations/beefy_arbitrum_usde.py @@ -0,0 +1,14 @@ +from constants.chains import Chain +from integrations.integration_ids import IntegrationID +from utils.beefy import BeefyIntegration + +if __name__ == "__main__": + beefy_integration = BeefyIntegration( + IntegrationID.BEEFY_ARBITRUM_USDE, 179921508, Chain.ARBITRUM + ) + print(beefy_integration.get_participants(None)) + print( + beefy_integration.get_balance( + list(beefy_integration.get_participants(None))[0], 20000001 + ) + ) diff --git a/integrations/beefy_cached_balance_example_integration.py b/integrations/beefy_cached_balance_example_integration.py new file mode 100644 index 0000000..eded118 --- /dev/null +++ b/integrations/beefy_cached_balance_example_integration.py @@ -0,0 +1,112 @@ +import logging + +from constants.example_integrations import ( + BEEFY_ARBITRUM_START_BLOCK_EXAMPLE, +) +from integrations.cached_balances_integration import CachedBalancesIntegration +from web3 import Web3 +from constants.chains import Chain +from typing import Dict, List, Set, cast +from eth_typing import ChecksumAddress + +from constants.beefy import BEEFY_LRT_API_URL +from constants.summary_columns import SummaryColumn +from integrations.integration_ids import IntegrationID +from utils.request_utils import requests_retry_session +from utils.slack import slack_message + +CHAIN_TO_API_URL_PREFIX = { + Chain.ARBITRUM: f"{BEEFY_LRT_API_URL}/partner/ethena/arbitrum", + Chain.FRAXTAL: f"{BEEFY_LRT_API_URL}/partner/ethena/fraxtal", + Chain.MANTLE: f"{BEEFY_LRT_API_URL}/partner/ethena/mantle", + Chain.OPTIMISM: f"{BEEFY_LRT_API_URL}/partner/ethena/optimism", +} + + +class BeefyCachedBalanceIntegration(CachedBalancesIntegration): + def __init__( + self, + integration_id: IntegrationID, + start_block: int, + chain: Chain, + summary_cols: List[SummaryColumn], + reward_multiplier: int = 1, + ): + super().__init__( + integration_id=integration_id, + start_block=start_block, + chain=chain, + summary_cols=summary_cols, + reward_multiplier=reward_multiplier, + balance_multiplier=1, + excluded_addresses=None, + end_block=None, + ) + + def get_beefy_users(self) -> Set[ChecksumAddress]: + """ + Get all participants of the protocol, ever. + """ + logging.info("[Beefy integration] Getting participants...") + try: + base_url = CHAIN_TO_API_URL_PREFIX[self.chain] + url = f"{base_url}/users" + + response = requests_retry_session().get(url) + data = cast(List[str], response.json()) + return set(Web3.to_checksum_address(user) for user in data) + except Exception as e: + msg = f"Error getting participants for beefy: {e}" + logging.error(msg) + slack_message(msg) + return set() + + def get_data_for_block( + self, block: int, users: Set[ChecksumAddress] + ) -> Dict[ChecksumAddress, float]: + logging.info(f"Getting data for beefy at block {block}...") + + if block < self.start_block: + return {} + data: Dict[ChecksumAddress, float] = {} + # Just get the first 10 users as a quick example + for user in list(users)[:10]: + try: + base_url = CHAIN_TO_API_URL_PREFIX[self.chain] + url = f"{base_url}/user/{user}/balance/{block}" + response = requests_retry_session(retries=1, backoff_factor=0).get(url) + user_data = response.json() + + if user_data is None or "effective_balance" not in user_data: + data[user] = 0.0 + data[user] = round(float(user_data["effective_balance"]), 4) + except Exception as e: + msg = f"Error getting beefy data for {user} at block {block}: {e}" + logging.error(msg) + slack_message(msg) + data[user] = 0.0 + return data + + def get_block_balances( + self, cached_data: Dict[int, Dict[ChecksumAddress, float]], blocks: List[int] + ) -> Dict[int, Dict[ChecksumAddress, float]]: + logging.info("Getting block data for beefy...") + block_data: Dict[int, Dict[ChecksumAddress, float]] = {} + beefy_users = self.get_beefy_users() + for block in blocks: + if block < self.start_block: + block_data[block] = {} + continue + block_data[block] = self.get_data_for_block(block, beefy_users) + return block_data + + +if __name__ == "__main__": + example_integration = BeefyCachedBalanceIntegration( + integration_id=IntegrationID.BEEFY_CACHED_BALANCE_EXAMPLE, + start_block=BEEFY_ARBITRUM_START_BLOCK_EXAMPLE, + chain=Chain.ARBITRUM, + summary_cols=[SummaryColumn.BEEFY_CACHED_BALANCE_EXAMPLE], + ) + # Since this integration is based on API calls, we don't need to use the cached data + print(example_integration.get_block_balances(cached_data={}, blocks=[276231389])) diff --git a/integrations/beefy_fraxtal_usde.py b/integrations/beefy_fraxtal_usde.py new file mode 100644 index 0000000..a7bf160 --- /dev/null +++ b/integrations/beefy_fraxtal_usde.py @@ -0,0 +1,14 @@ +from constants.chains import Chain +from integrations.integration_ids import IntegrationID +from utils.beefy import BeefyIntegration + +if __name__ == "__main__": + beefy_integration = BeefyIntegration( + IntegrationID.BEEFY_FRAXTAL_USDE, 2366784, Chain.FRAXTAL + ) + print(beefy_integration.get_participants(None)) + print( + beefy_integration.get_balance( + list(beefy_integration.get_participants(None))[0], 2466784 + ) + ) diff --git a/integrations/beefy_mantle_usde.py b/integrations/beefy_mantle_usde.py new file mode 100644 index 0000000..980b9be --- /dev/null +++ b/integrations/beefy_mantle_usde.py @@ -0,0 +1,14 @@ +from constants.chains import Chain +from integrations.integration_ids import IntegrationID +from utils.beefy import BeefyIntegration + +if __name__ == "__main__": + beefy_integration = BeefyIntegration( + IntegrationID.BEEFY_MANTLE_USDE, 66470986, Chain.MANTLE + ) + print(beefy_integration.get_participants(None)) + print( + beefy_integration.get_balance( + list(beefy_integration.get_participants(None))[0], 66480986 + ) + ) diff --git a/integrations/beefy_optimism_usde.py b/integrations/beefy_optimism_usde.py new file mode 100644 index 0000000..c5b1c48 --- /dev/null +++ b/integrations/beefy_optimism_usde.py @@ -0,0 +1,14 @@ +from constants.chains import Chain +from integrations.integration_ids import IntegrationID +from utils.beefy import BeefyIntegration + +if __name__ == "__main__": + beefy_integration = BeefyIntegration( + IntegrationID.BEEFY_OPTIMISM_USDE, 38082415, Chain.OPTIMISM + ) + print(beefy_integration.get_participants(None)) + print( + beefy_integration.get_balance( + list(beefy_integration.get_participants(None))[0], 106819558 + ) + ) diff --git a/integrations/cached_balances_integration.py b/integrations/cached_balances_integration.py new file mode 100644 index 0000000..f935736 --- /dev/null +++ b/integrations/cached_balances_integration.py @@ -0,0 +1,39 @@ +from typing import Callable, Dict, List, Optional, Set +from eth_typing import ChecksumAddress +from constants.summary_columns import SummaryColumn +from constants.chains import Chain +from integrations.integration import Integration +from integrations.integration_ids import IntegrationID as IntID + + +class CachedBalancesIntegration(Integration): + def __init__( + self, + integration_id: IntID, + start_block: int, + chain: Chain = Chain.ETHEREUM, + summary_cols: Optional[List[SummaryColumn]] = None, + reward_multiplier: int = 1, + balance_multiplier: int = 1, + excluded_addresses: Optional[Set[ChecksumAddress]] = None, + end_block: Optional[int] = None, + ethereal_multiplier: int = 0, + ethereal_multiplier_func: Optional[Callable[[int, str], int]] = None, + ): + super().__init__( + integration_id=integration_id, + start_block=start_block, + chain=chain, + summary_cols=summary_cols, + reward_multiplier=reward_multiplier, + balance_multiplier=balance_multiplier, + excluded_addresses=excluded_addresses, + end_block=end_block, + ethereal_multiplier=ethereal_multiplier, + ethereal_multiplier_func=ethereal_multiplier_func, + ) + + def get_block_balances( + self, cached_data: Dict[int, Dict[ChecksumAddress, float]], blocks: List[int] + ) -> Dict[int, Dict[ChecksumAddress, float]]: + raise NotImplementedError diff --git a/integrations/claimed_ena_example_integration.py b/integrations/claimed_ena_example_integration.py new file mode 100644 index 0000000..8e39851 --- /dev/null +++ b/integrations/claimed_ena_example_integration.py @@ -0,0 +1,109 @@ +from copy import deepcopy +import logging + +from typing import Dict, List, Optional + +from constants.summary_columns import SummaryColumn +from eth_typing import ChecksumAddress + +from constants.example_integrations import ( + ACTIVE_ENA_START_BLOCK_EXAMPLE, + ENA_CONTRACT, + PAGINATION_SIZE, +) + +from constants.chains import Chain +from integrations.integration_ids import IntegrationID +from integrations.cached_balances_integration import CachedBalancesIntegration +from utils.web3_utils import fetch_events_logs_with_retry + + +class ClaimedEnaIntegration(CachedBalancesIntegration): + def __init__( + self, + integration_id: IntegrationID, + start_block: int, + chain: Chain = Chain.ETHEREUM, + summary_cols: Optional[List[SummaryColumn]] = None, + reward_multiplier: int = 1, + ): + super().__init__( + integration_id, + start_block, + chain, + summary_cols, + reward_multiplier, + ) + + def get_block_balances( + self, cached_data: Dict[int, Dict[ChecksumAddress, float]], blocks: List[int] + ) -> Dict[int, Dict[ChecksumAddress, float]]: + logging.info("Getting block data for claimed ENA") + new_block_data: Dict[int, Dict[ChecksumAddress, float]] = {} + if not blocks: + logging.error("No blocks provided to claimed ENA get_block_balances") + return new_block_data + sorted_blocks = sorted(blocks) + cache_copy: Dict[int, Dict[ChecksumAddress, float]] = deepcopy(cached_data) + for block in sorted_blocks: + # find the closest prev block in the data + # list keys parsed as ints and in descending order + sorted_existing_blocks = sorted( + cache_copy, + reverse=True, + ) + # loop through the sorted blocks and find the closest previous block + prev_block = self.start_block + start = prev_block + bals = {} + for existing_block in sorted_existing_blocks: + if existing_block < block: + prev_block = existing_block + start = existing_block + 1 + bals = deepcopy(cache_copy[prev_block]) + break + # parse transfer events since and update bals + while start <= block: + to_block = min(start + PAGINATION_SIZE, block) + # print(f"Fetching transfers from {start} to {to_block}") + transfers = fetch_events_logs_with_retry( + "Token transfers claimed ENA", + ENA_CONTRACT.events.Transfer(), + start, + to_block, + ) + for transfer in transfers: + recipient = transfer["args"]["to"] + if recipient not in bals: + bals[recipient] = 0 + bals[recipient] += round(transfer["args"]["value"] / 10**18, 4) + start = to_block + 1 + new_block_data[block] = bals + cache_copy[block] = bals + return new_block_data + + +if __name__ == "__main__": + example_integration = ClaimedEnaIntegration( + integration_id=IntegrationID.CLAIMED_ENA_EXAMPLE, + start_block=ACTIVE_ENA_START_BLOCK_EXAMPLE, + summary_cols=[SummaryColumn.CLAIMED_ENA_PTS_EXAMPLE], + reward_multiplier=20, + ) + + # Without cached data + without_cached_data_output = example_integration.get_block_balances( + cached_data={}, blocks=[21209856, 21217056] + ) + + print("=" * 120) + print("Run without cached data", without_cached_data_output) + print("=" * 120, "\n" * 5) + + # With cached data, using the previous output so there is no need + # to fetch the previous blocks again + with_cached_data_output = example_integration.get_block_balances( + cached_data=without_cached_data_output, blocks=[21224256] + ) + print("Run with cached data", with_cached_data_output) + print("=" * 120) diff --git a/integrations/curve.py b/integrations/curve.py new file mode 100644 index 0000000..a8801b3 --- /dev/null +++ b/integrations/curve.py @@ -0,0 +1,53 @@ +import sys +sys.path.append("./") + +from rich.console import Console +from rich.table import Table +from rich.panel import Panel + +if __name__ == "__main__": + from utils.curve import Curve + from constants.curve import CURVE_LLAMALEND + + console = Console() + + LENDING_CONTRACTS = [Curve(config) for config in CURVE_LLAMALEND] + console.print(f"Number of contracts: {len(LENDING_CONTRACTS)}", style="bold green") + + for id, contract in enumerate(LENDING_CONTRACTS, start=1): + + # Create a panel with the same width as the table + panel = Panel( + f"[bold cyan]{id}. {contract.integration_id.get_description()} on {contract.chain.name}[/bold cyan]", + expand=False + ) + console.print(panel) + console.print(f"Current block in chain {contract.chain.name}: {contract.get_current_block()}") + console.print(f"Token: {contract.reward_config.integration_id.get_token()}") + + # Cache participants + contract.get_participants() + + start_state = contract.start_state + last_indexed_block = contract.last_indexed_block + + console.print(f"Total participants: {len(start_state)}. Balances at latest indexed block {last_indexed_block}:") + + latest_state = contract.get_user_states(last_indexed_block) + + console.print("\n") + table = Table(title="Participant Details") + table.add_column("Address", style="cyan", no_wrap=True) + table.add_column("Start Block", justify="right", style="magenta") + table.add_column("Start Balance", justify="right", style="green") + table.add_column("Current Balance", justify="right", style="yellow") + + for user_info_start, current_user_info in zip(start_state, latest_state): + table.add_row( + user_info_start.address, + str(user_info_start.block), + f"{user_info_start.state[0]/1e18:.2f}", + f"{current_user_info.state[0]/1e18:.2f}", + ) + + console.print(table) diff --git a/integrations/equilibria_karak_susde_sept.py b/integrations/equilibria_karak_susde_sept.py index 6768070..de55cfa 100644 --- a/integrations/equilibria_karak_susde_sept.py +++ b/integrations/equilibria_karak_susde_sept.py @@ -1,6 +1,10 @@ -from constants.integration_ids import IntegrationID +from integrations.integration_ids import IntegrationID from utils.equilibria import EquilibriaIntegration -from constants.equilibria import Karak_sUSDe_SEPT, Karak_sUSDe_SEPT_ID, Karak_sUSDe_SEPT_DEPLOYMENT_BLOCK +from constants.equilibria import ( + Karak_sUSDe_SEPT, + Karak_sUSDe_SEPT_ID, + Karak_sUSDe_SEPT_DEPLOYMENT_BLOCK, +) from constants.chains import Chain from constants.equilibria import PENDLE_LOCKER_ETHEREUM @@ -13,9 +17,12 @@ Chain.ETHEREUM, 20, 1, - [PENDLE_LOCKER_ETHEREUM] - + {PENDLE_LOCKER_ETHEREUM}, ) - print(equilibria_integration.get_participants()) - print(equilibria_integration.get_balance(list(equilibria_integration.get_participants())[0], "latest")) + print(equilibria_integration.get_participants(None)) + print( + equilibria_integration.get_balance( + list(equilibria_integration.get_participants(None))[0] + ) + ) diff --git a/integrations/equilibria_karak_usde_sept.py b/integrations/equilibria_karak_usde_sept.py index 8f66067..67473df 100644 --- a/integrations/equilibria_karak_usde_sept.py +++ b/integrations/equilibria_karak_usde_sept.py @@ -1,6 +1,10 @@ -from constants.integration_ids import IntegrationID +from integrations.integration_ids import IntegrationID from utils.equilibria import EquilibriaIntegration -from constants.equilibria import Karak_USDE_SEPT, Karak_USDE_SEPT_ID, Karak_USDE_SEPT_DEPLOYMENT_BLOCK +from constants.equilibria import ( + Karak_USDE_SEPT, + Karak_USDE_SEPT_ID, + Karak_USDE_SEPT_DEPLOYMENT_BLOCK, +) from constants.chains import Chain from constants.equilibria import PENDLE_LOCKER_ETHEREUM @@ -13,9 +17,12 @@ Chain.ETHEREUM, 20, 1, - [PENDLE_LOCKER_ETHEREUM] - + {PENDLE_LOCKER_ETHEREUM}, ) - print(equilibria_integration.get_participants()) - print(equilibria_integration.get_balance(list(equilibria_integration.get_participants())[0], "latest")) + print(equilibria_integration.get_participants(None)) + print( + equilibria_integration.get_balance( + list(equilibria_integration.get_participants(None))[0] + ) + ) diff --git a/integrations/equilibria_rusde_sept.py b/integrations/equilibria_rusde_sept.py index cfc480a..a289b64 100644 --- a/integrations/equilibria_rusde_sept.py +++ b/integrations/equilibria_rusde_sept.py @@ -1,4 +1,4 @@ -from constants.integration_ids import IntegrationID +from integrations.integration_ids import IntegrationID from utils.equilibria import EquilibriaIntegration from constants.equilibria import rUSDE_SEPT, rUSDE_SEPT_ID, rUSDE_SEPT_DEPLOYMENT_BLOCK from constants.chains import Chain @@ -13,9 +13,12 @@ Chain.ETHEREUM, 20, 1, - [PENDLE_LOCKER_ETHEREUM] - + {PENDLE_LOCKER_ETHEREUM}, ) - print(equilibria_integration.get_participants()) - print(equilibria_integration.get_balance(list(equilibria_integration.get_participants())[0], "latest")) + print(equilibria_integration.get_participants(None)) + print( + equilibria_integration.get_balance( + list(equilibria_integration.get_participants(None))[0] + ) + ) diff --git a/integrations/equilibria_susde_apr_expiry.py b/integrations/equilibria_susde_apr_expiry.py index e16e941..11ee7af 100644 --- a/integrations/equilibria_susde_apr_expiry.py +++ b/integrations/equilibria_susde_apr_expiry.py @@ -1,6 +1,10 @@ -from constants.integration_ids import IntegrationID +from integrations.integration_ids import IntegrationID from utils.equilibria import EquilibriaIntegration -from constants.equilibria import SUSDE_APR_EXPIRY, SUSDE_APR_EXPIRY_ID, SUSDE_APR_EXPIRY_DEPLOYMENT_BLOCK +from constants.equilibria import ( + SUSDE_APR_EXPIRY, + SUSDE_APR_EXPIRY_ID, + SUSDE_APR_EXPIRY_DEPLOYMENT_BLOCK, +) from constants.chains import Chain from constants.equilibria import PENDLE_LOCKER_ETHEREUM @@ -13,9 +17,12 @@ Chain.ETHEREUM, 20, 1, - [PENDLE_LOCKER_ETHEREUM] - + {PENDLE_LOCKER_ETHEREUM}, ) - print(equilibria_integration.get_participants()) - print(equilibria_integration.get_balance(list(equilibria_integration.get_participants())[0], "latest")) + print(equilibria_integration.get_participants(None)) + print( + equilibria_integration.get_balance( + list(equilibria_integration.get_participants(None))[0] + ) + ) diff --git a/integrations/equilibria_susde_sept.py b/integrations/equilibria_susde_sept.py index 02c68b3..e4b47c7 100644 --- a/integrations/equilibria_susde_sept.py +++ b/integrations/equilibria_susde_sept.py @@ -1,4 +1,4 @@ -from constants.integration_ids import IntegrationID +from integrations.integration_ids import IntegrationID from utils.equilibria import EquilibriaIntegration from constants.equilibria import SUSDE_SEPT, SUSDE_SEPT_ID, SUSDE_SEPT_DEPLOYMENT_BLOCK from constants.chains import Chain @@ -13,9 +13,12 @@ Chain.ETHEREUM, 20, 1, - [PENDLE_LOCKER_ETHEREUM] - + {PENDLE_LOCKER_ETHEREUM}, ) - print(equilibria_integration.get_participants()) - print(equilibria_integration.get_balance(list(equilibria_integration.get_participants())[0], "latest")) + print(equilibria_integration.get_participants(None)) + print( + equilibria_integration.get_balance( + list(equilibria_integration.get_participants(None))[0] + ) + ) diff --git a/integrations/equilibria_usde_expiry.py b/integrations/equilibria_usde_expiry.py index 147abfd..4797ec5 100644 --- a/integrations/equilibria_usde_expiry.py +++ b/integrations/equilibria_usde_expiry.py @@ -1,6 +1,10 @@ -from constants.integration_ids import IntegrationID +from integrations.integration_ids import IntegrationID from utils.equilibria import EquilibriaIntegration -from constants.equilibria import USDE_EXPIRY, USDE_EXPIRY_ID, USDE_EXPIRY_DEPLOYMENT_BLOCK +from constants.equilibria import ( + USDE_EXPIRY, + USDE_EXPIRY_ID, + USDE_EXPIRY_DEPLOYMENT_BLOCK, +) from constants.chains import Chain from constants.equilibria import PENDLE_LOCKER_ETHEREUM @@ -13,8 +17,12 @@ Chain.ETHEREUM, 20, 1, - [PENDLE_LOCKER_ETHEREUM] + {PENDLE_LOCKER_ETHEREUM}, ) - print(equilibria_integration.get_participants()) - print(equilibria_integration.get_balance(list(equilibria_integration.get_participants())[0], "latest")) + print(equilibria_integration.get_participants(None)) + print( + equilibria_integration.get_balance( + list(equilibria_integration.get_participants(None))[0] + ) + ) diff --git a/integrations/equilibria_zircuit_usde_aug.py b/integrations/equilibria_zircuit_usde_aug.py index 8e5b8d8..be01e27 100644 --- a/integrations/equilibria_zircuit_usde_aug.py +++ b/integrations/equilibria_zircuit_usde_aug.py @@ -1,6 +1,10 @@ -from constants.integration_ids import IntegrationID +from integrations.integration_ids import IntegrationID from utils.equilibria import EquilibriaIntegration -from constants.equilibria import Zircuit_USDe_AUG, Zircuit_USDe_AUG_ID, Zircuit_USDe_AUG_DEPLOYMENT_BLOCK +from constants.equilibria import ( + Zircuit_USDe_AUG, + Zircuit_USDe_AUG_ID, + Zircuit_USDe_AUG_DEPLOYMENT_BLOCK, +) from constants.chains import Chain from constants.equilibria import PENDLE_LOCKER_ETHEREUM @@ -13,9 +17,12 @@ Chain.ETHEREUM, 20, 1, - [PENDLE_LOCKER_ETHEREUM] - + {PENDLE_LOCKER_ETHEREUM}, ) - print(equilibria_integration.get_participants()) - print(equilibria_integration.get_balance(list(equilibria_integration.get_participants())[0], "latest")) + print(equilibria_integration.get_participants(None)) + print( + equilibria_integration.get_balance( + list(equilibria_integration.get_participants(None))[0] + ) + ) diff --git a/integrations/euler_susde.py b/integrations/euler_susde.py new file mode 100644 index 0000000..ff41513 --- /dev/null +++ b/integrations/euler_susde.py @@ -0,0 +1,86 @@ +import json +from constants.chains import Chain +from integrations.integration_ids import IntegrationID +from constants.euler import SUSDE_VAULT_ADDRESS +from constants.merchantmoe import DEAD_ADDRESS, ZERO_ADDRESS +from integrations.integration import Integration +from utils.web3_utils import ( + fetch_events_logs_with_retry, + call_with_retry, + w3, +) +from web3 import Web3 + +with open("abi/euler_evault.json") as f: + evault_abi = json.load(f) + + +class EulerIntegration(Integration): + def __init__(self): + super().__init__( + IntegrationID.EULER_SUSDE, + 20529207, + Chain.ETHEREUM, + None, + 5, + 1, + None, + None, + ) + self.vault_contract = w3.eth.contract( + address=SUSDE_VAULT_ADDRESS, abi=evault_abi + ) + + def get_balance(self, user: str, block: int) -> float: + try: + etoken_balance = call_with_retry( + self.vault_contract.functions.balanceOf(user), block + ) + if etoken_balance == 0: + return 0 + asset_balance = call_with_retry( + self.vault_contract.functions.convertToAssets(etoken_balance), block + ) + except Exception as ex: + print("Error getting balance for user %s: %s", user, ex) + return 0 + + return round(asset_balance / 1e18, 4) + + def get_participants(self, blocks: list[int] | None) -> set[str]: + if self.participants is not None: + return self.participants + + all_users: set[str] = set() + start = self.start_block + end = w3.eth.get_block_number() + + batch_size = 10000 + + while start < end: + current_batch_end = min(start + batch_size, end) + transfers = fetch_events_logs_with_retry( + f"Euler Vault {self.vault_contract}", + self.vault_contract.events.Transfer(), + start, + current_batch_end, + ) + + for transfer in transfers: + from_address = transfer["args"]["from"] + to_address = transfer["args"]["to"] + if from_address != ZERO_ADDRESS and from_address != DEAD_ADDRESS: + all_users.add(Web3.to_checksum_address(from_address)) + if to_address != ZERO_ADDRESS and to_address != DEAD_ADDRESS: + all_users.add(Web3.to_checksum_address(to_address)) + + start += batch_size + + return all_users + + +if __name__ == "__main__": + example_integration = EulerIntegration() + participants = example_integration.get_participants(None) + print(participants) + print(example_integration.get_balance(list(participants)[0], 20677865)) diff --git a/integrations/euler_usde.py b/integrations/euler_usde.py new file mode 100644 index 0000000..c6e791f --- /dev/null +++ b/integrations/euler_usde.py @@ -0,0 +1,82 @@ +import json +from constants.chains import Chain +from integrations.integration_ids import IntegrationID +from constants.euler import USDE_VAULT_ADDRESS +from integrations.integration import Integration +from utils.web3_utils import ( + fetch_events_logs_with_retry, + call_with_retry, + w3, +) + +with open("abi/euler_evault.json") as f: + evault_abi = json.load(f) + + +class EulerIntegration(Integration): + def __init__(self): + super().__init__( + IntegrationID.EULER_USDE, + 20529207, + Chain.ETHEREUM, + None, + 20, + 1, + None, + None, + ) + + self.vault_contract = w3.eth.contract( + address=USDE_VAULT_ADDRESS, abi=evault_abi + ) + + def get_balance(self, user: str, block: int) -> float: + try: + etoken_balance = call_with_retry( + self.vault_contract.functions.balanceOf(user), block + ) + asset_balance = call_with_retry( + self.vault_contract.functions.convertToAssets(etoken_balance), block + ) + except Exception as ex: + print("Error getting balance for user %s: %s", user, ex) + + return asset_balance + + def get_participants(self, blocks: list[int] | None) -> set[str]: + if self.participants is not None: + return self.participants + + all_users = set() + start = self.start_block + end = w3.eth.get_block_number() + + batch_size = 10000 + + while start < end: + current_batch_end = min(start + batch_size, end) + transfers = fetch_events_logs_with_retry( + f"Euler Vault {self.vault_contract}", + self.vault_contract.events.Transfer(), + start, + current_batch_end, + ) + + for transfer in transfers: + from_address = transfer["args"]["from"] + to_address = transfer["args"]["to"] + if from_address != "0x0000000000000000000000000000000000000000": + all_users.add(from_address) + if to_address != "0x0000000000000000000000000000000000000000": + all_users.add(to_address) + + start += batch_size + + return all_users + + +if __name__ == "__main__": + example_integration = EulerIntegration() + participants = example_integration.get_participants(None) + print(participants) + print(example_integration.get_balance(list(participants)[0], 20677865)) diff --git a/integrations/firm_susde.py b/integrations/firm_susde.py new file mode 100644 index 0000000..cde8083 --- /dev/null +++ b/integrations/firm_susde.py @@ -0,0 +1,62 @@ +from typing import List, Optional, Set +from constants.chains import Chain +from integrations.integration_ids import IntegrationID +from integrations.integration import Integration +from constants.firm import FIRM_SUSDE_DEPLOYMENT_BLOCK +from utils.firm import get_escrow_contract, firm_susde_market_contract +from utils.web3_utils import w3, fetch_events_logs_with_retry, call_with_retry + + +class Firm(Integration): + def __init__(self): + super().__init__( + IntegrationID.FIRM_SUSDE, + FIRM_SUSDE_DEPLOYMENT_BLOCK, + Chain.ETHEREUM, + [], + 20, + 1, + None, + None, + ) + + def get_balance(self, user: str, block: int) -> float: + # get user escrow + escrow_contract = get_escrow_contract(user) + # get the balance from the escrow + balance = call_with_retry( + escrow_contract.functions.balance(), + block, + ) + return balance / 1e18 + + def get_participants( + self, + blocks: Optional[List[int]], + ) -> Set[str]: + page_size = 1900 + start_block = FIRM_SUSDE_DEPLOYMENT_BLOCK + target_block = w3.eth.get_block_number() + + all_users = set() + while start_block < target_block: + to_block = min(start_block + page_size, target_block) + escrow_creations = fetch_events_logs_with_retry( + f"Inverse Finance FiRM users from {start_block} to {to_block}", + firm_susde_market_contract.events.CreateEscrow(), + start_block, + to_block, + ) + for escrow_creation in escrow_creations: + all_users.add(escrow_creation["args"]["user"]) + start_block += page_size + return all_users + + +if __name__ == "__main__": + firm = Firm() + participants = firm.get_participants(None) + print("participants", participants) + currentBlock = w3.eth.get_block_number() + if len(participants) > 0: + print(firm.get_balance(list(participants)[len(participants) - 1], currentBlock)) diff --git a/integrations/fluid_susde.py b/integrations/fluid_susde.py new file mode 100644 index 0000000..96c5ca5 --- /dev/null +++ b/integrations/fluid_susde.py @@ -0,0 +1,108 @@ +from constants.chains import Chain +from integrations.integration_ids import IntegrationID +from integrations.integration import Integration +from utils.web3_utils import call_with_retry, W3_BY_CHAIN +from utils.fluid import vaultResolver_contract, vaultPositionResolver_contract +from constants.fluid import sUSDe + + +class FluidIntegration(Integration): + + def __init__(self): + super().__init__( + IntegrationID.FLUID, + 21016131, + Chain.ETHEREUM, + [], + 5, + 1, + None, + None, + ) + self.blocknumber_to_susdeVaults = {} + + def get_balance(self, user: str, block: int) -> float: + balance = 0 + try: + userPositions, vaultEntireDatas = call_with_retry( + vaultResolver_contract.functions.positionsByUser(user), block + ) + for i in range(len(userPositions)): + if vaultEntireDatas[i][3][8][0] == sUSDe: + balance += userPositions[i][9] + return balance / 1e18 + except Exception as e: + return 0 + + def get_participants(self, blocks: list[int] | None) -> set[str]: + participants = [] + current_block = W3_BY_CHAIN[self.chain]["w3"].eth.get_block_number() + + relevant_vaults = self.get_relevant_vaults(current_block) + relavantUserPositions = [] + + try: + for vault in relevant_vaults: + relavantUserPositions += call_with_retry( + vaultPositionResolver_contract.functions.getAllVaultPositions( + vault + ), + current_block, + ) + for userPosition in relavantUserPositions: + owner = userPosition[1] + if owner not in participants: + participants.append(owner) + except Exception as e: + print(f"Error: {str(e)}") + return set(participants) + + def get_relevant_vaults(self, block: int) -> list: + if block in self.blocknumber_to_susdeVaults: + return self.blocknumber_to_susdeVaults[block] + + if self.blocknumber_to_susdeVaults != {}: + totalVaults = call_with_retry( + vaultResolver_contract.functions.getTotalVaults(), block + ) + for block_number in self.blocknumber_to_susdeVaults: + totalVaults_at_block = call_with_retry( + vaultResolver_contract.functions.getTotalVaults(), block_number + ) + if totalVaults == totalVaults_at_block: + self.blocknumber_to_susdeVaults[block] = ( + self.blocknumber_to_susdeVaults[block_number] + ) + return self.blocknumber_to_susdeVaults[block_number] + + vaults = call_with_retry( + vaultResolver_contract.functions.getAllVaultsAddresses(), block + ) + relevantVaults = [] + for vaultAddress in vaults: + supplyTokenOfVault = ( + call_with_retry( + vaultResolver_contract.functions.getVaultEntireData(vaultAddress), + block, + ) + )[3][8][0] + if supplyTokenOfVault == sUSDe: + relevantVaults.append(vaultAddress) + self.blocknumber_to_susdeVaults[block] = relevantVaults + return relevantVaults + + +if __name__ == "__main__": + example_integration = FluidIntegration() + print("getting relevant vaults") + print(example_integration.get_relevant_vaults(21088189)) + + print("\n\n\ngetting participants") + print(example_integration.get_participants(None)) + + print("\n\n\n getting balance") + print( + example_integration.get_balance( + "0xEb54fC872F70A4B7addb34C331DeC3fDf9a329de", 21079685 + ) + ) diff --git a/integrations/fluid_usde.py b/integrations/fluid_usde.py new file mode 100644 index 0000000..9ce5b8b --- /dev/null +++ b/integrations/fluid_usde.py @@ -0,0 +1,104 @@ +from constants.chains import Chain +from integrations.integration_ids import IntegrationID +from integrations.integration import Integration +from utils.web3_utils import call_with_retry, W3_BY_CHAIN +from utils.fluid import vaultResolver_contract, vaultPositionResolver_contract +from constants.fluid import USDe + + +class FluidIntegration(Integration): + + def __init__(self): + super().__init__( + IntegrationID.FLUID, + 21016131, + Chain.ETHEREUM, + [], + 20, + 1, + None, + None, + ) + self.blocknumber_to_usdeVaults = {} + + def get_balance(self, user: str, block: int) -> float: + balance = 0 + try: + userPositions, vaultEntireDatas = call_with_retry( + vaultResolver_contract.functions.positionsByUser(user), block + ) + for i in range(len(userPositions)): + if ( + vaultEntireDatas[i][3][8][0] == USDe + or vaultEntireDatas[i][3][8][1] == USDe + ) and userPositions[i][10] != 40000: + balance += userPositions[i][9] + return balance / 1e18 + except Exception as e: + return 0 + + def get_participants(self, blocks: list[int] | None) -> set[str]: + participants = [] + current_block = W3_BY_CHAIN[self.chain]["w3"].eth.get_block_number() + + relevant_vaults = self.get_relevant_vaults(current_block) + relavantUserPositions = [] + + try: + for vault in relevant_vaults: + relavantUserPositions += call_with_retry( + vaultPositionResolver_contract.functions.getAllVaultPositions( + vault + ), + current_block, + ) + for userPosition in relavantUserPositions: + owner = userPosition[1] + if owner not in participants: + participants.append(owner) + except Exception as e: + print(f"Error: {str(e)}") + return set(participants) + + def get_relevant_vaults(self, block: int) -> list: + if block in self.blocknumber_to_usdeVaults: + return self.blocknumber_to_usdeVaults[block] + + if self.blocknumber_to_usdeVaults != {}: + totalVaults = call_with_retry( + vaultResolver_contract.functions.getTotalVaults(), block + ) + for block_number in self.blocknumber_to_usdeVaults: + totalVaults_at_block = call_with_retry( + vaultResolver_contract.functions.getTotalVaults(), block_number + ) + if totalVaults == totalVaults_at_block: + self.blocknumber_to_usdeVaults[block] = ( + self.blocknumber_to_usdeVaults[block_number] + ) + return self.blocknumber_to_usdeVaults[block_number] + + vaults = call_with_retry( + vaultResolver_contract.functions.getAllVaultsAddresses(), block + ) + relevantVaults = [] + for vaultAddress in vaults: + vaultData = call_with_retry( + vaultResolver_contract.functions.getVaultEntireData(vaultAddress), block + ) + if (vaultData[3][8][0] == USDe or vaultData[3][8][1] == USDe) and not ( + vaultData[1] and vaultData[2] + ): + relevantVaults.append(vaultAddress) + self.blocknumber_to_usdeVaults[block] = relevantVaults + return relevantVaults + + +if __name__ == "__main__": + example_integration = FluidIntegration() + current_block = W3_BY_CHAIN[example_integration.chain]["w3"].eth.get_block_number() + print("getting relevant vaults") + print(example_integration.get_relevant_vaults(current_block)) + + print("\n\n\ngetting participants") + print(example_integration.get_participants(None)) diff --git a/integrations/fluid_usde_t4.py b/integrations/fluid_usde_t4.py new file mode 100644 index 0000000..07c67fa --- /dev/null +++ b/integrations/fluid_usde_t4.py @@ -0,0 +1,82 @@ +from constants.chains import Chain +from integrations.integration_ids import IntegrationID +from integrations.integration import Integration +from utils.web3_utils import call_with_retry, W3_BY_CHAIN +from utils.fluid import ( + vaultResolver_contract, + vaultPositionResolver_contract, + dexResolver_contract, +) +from constants.fluid import USDe +import json + + +class FluidIntegration(Integration): + + def __init__(self): + super().__init__( + IntegrationID.FLUID, + 21016131, + Chain.ETHEREUM, + [], + 30, + 1, + None, + None, + ) + self.relevant_vaults = ["0x1B4EC865915872AEc7A30423fdA2584C9fa894C5"] + + def get_balance(self, user: str, block: int) -> float: + balance = 0 + try: + userPositions, vaultEntireDatas = call_with_retry( + vaultResolver_contract.functions.positionsByUser(user), block + ) + dexStates = {} + for i in range(len(userPositions)): + if ( + vaultEntireDatas[i][3][8][0] == USDe + or vaultEntireDatas[i][3][8][1] == USDe + ) and userPositions[i][10] == 40000: + # underlying dex as supply token in the vault + dexAddress = vaultEntireDatas[i][3][6] + if dexAddress not in dexStates: + dexStates[dexAddress] = ( + dexResolver_contract.functions.getDexState(dexAddress).call( + block_identifier=block + ) + ) + # fetching the dex state to get the shares to tokens ratio + token0PerSupplyShare = dexStates[dexAddress][-4] + balance += userPositions[i][9] * token0PerSupplyShare + return balance / 1e18 + except Exception as e: + return 0 + + def get_participants(self, blocks: list[int] | None) -> set[str]: + participants = [] + current_block = W3_BY_CHAIN[self.chain]["w3"].eth.get_block_number() + relavantUserPositions = [] + + try: + for vault in self.relevant_vaults: + relavantUserPositions += call_with_retry( + vaultPositionResolver_contract.functions.getAllVaultPositions( + vault + ), + current_block, + ) + for userPosition in relavantUserPositions: + owner = userPosition[1] + if owner not in participants: + participants.append(owner) + except Exception as e: + print(f"Error: {str(e)}") + return set(participants) + + +if __name__ == "__main__": + example_integration = FluidIntegration() + current_block = W3_BY_CHAIN[example_integration.chain]["w3"].eth.get_block_number() + print("\n\n\ngetting participants") + print(example_integration.get_participants(None)) diff --git a/integrations/gmx_usde_poitions_aug.py b/integrations/gmx_usde_poitions_aug.py new file mode 100644 index 0000000..69c0bac --- /dev/null +++ b/integrations/gmx_usde_poitions_aug.py @@ -0,0 +1,100 @@ +import requests +from integrations.integration_ids import IntegrationID +from constants.chains import Chain + +from constants.gmx import ( + GMX_DATA_STORE_CONTRACT_ADDRESS, + GMX_WSTETH_USDE_MARKET_BLOCK, + GMX_SUBSQUID_ENDPOINT, + USDE_TOKEN_ADDRESS, +) +from utils.gmx import gmx_synthetics_reader_contract +from constants.summary_columns import SummaryColumn +from integrations.integration import Integration +from utils.web3_utils import call_with_retry + + +def fetch_data(url, query): + response = requests.post(url, json={"query": query}) + if response.status_code == 200: + response_json = response.json() + if "data" not in response_json: + print(f"Query failed with response: {response_json}") + return None + return response_json["data"] + else: + print(f"Query failed with status code {response.status_code}") + return None + + +class GMXPositionsIntegration(Integration): + def __init__( + self, + ): + super().__init__( + IntegrationID.GMX_USDE_POSITIONS, + GMX_WSTETH_USDE_MARKET_BLOCK, + Chain.ARBITRUM, + [SummaryColumn.GMX_ARBITRUM_SHARDS], + 20, + 1, + None, + None, + ) + + def get_balance(self, user: str, block: int) -> float: + accountPositions = call_with_retry( + gmx_synthetics_reader_contract.functions.getAccountPositions( + GMX_DATA_STORE_CONTRACT_ADDRESS, + user, + 0, + 1000, + ), + block, + ) + + total_collateral_amount = 0 + + for position in accountPositions: + collateral_token = position[0][2] + collateral_amount = position[1][2] + + if collateral_token == USDE_TOKEN_ADDRESS: + total_collateral_amount += collateral_amount + + return total_collateral_amount + + def get_participants(self, blocks: list[int] | None) -> set[str]: + if self.participants is not None: + return self.participants + + participants_query = """{{ + positions( + where: {{ + collateralToken_eq: "{collateralTokenw}", + }} + ) {{ + account + }} + }}""" + + participants = fetch_data( + url=GMX_SUBSQUID_ENDPOINT, + query=participants_query.format( + collateralTokenw=USDE_TOKEN_ADDRESS, + ), + ) + + accounts = [position["account"] for position in participants["positions"]] + + return set(accounts) + + +if __name__ == "__main__": + gmx_integration = GMXPositionsIntegration() + print(gmx_integration.get_participants(None)) + print( + gmx_integration.get_balance( + "0xDb59AB7d951f3D9F1d2E764c3A6F7507E11a4e4e", 238320844 + ) + ) diff --git a/integrations/gmx_usde_usdc_aug.py b/integrations/gmx_usde_usdc_aug.py new file mode 100644 index 0000000..75478a2 --- /dev/null +++ b/integrations/gmx_usde_usdc_aug.py @@ -0,0 +1,26 @@ +from integrations.integration_ids import IntegrationID + +from constants.gmx import ( + GMX_USDE_USDC_MARKET_BLOCK, + GMX_USDE_USDC_MARKET_ADDRESS, + USDC_TOKEN_ADDRESS, + USDE_TOKEN_ADDRESS, + WETH_TOKEN_ADDRESS, +) +from utils.gmx import GMXLPIntegration + +if __name__ == "__main__": + gmx_integration = GMXLPIntegration( + IntegrationID.GMX_USDE_USDC_LP, + GMX_USDE_USDC_MARKET_BLOCK, + GMX_USDE_USDC_MARKET_ADDRESS, + WETH_TOKEN_ADDRESS, + USDE_TOKEN_ADDRESS, + USDC_TOKEN_ADDRESS, + ) + print(gmx_integration.get_participants(None)) + print( + gmx_integration.get_balance( + "0x8F091A33f310EFd8Ca31f7aE4362d6306cA6Ec8d", 237999816 + ) + ) diff --git a/integrations/gmx_wsteth_usde_aug.py b/integrations/gmx_wsteth_usde_aug.py new file mode 100644 index 0000000..4528074 --- /dev/null +++ b/integrations/gmx_wsteth_usde_aug.py @@ -0,0 +1,26 @@ +from constants.gmx import ( + GMX_WSTETH_USDE_MARKET_BLOCK, + WSTETH_TOKEN_ADDRESS, + GMX_WSTETH_USDE_MARKET_ADDRESS, + USDE_TOKEN_ADDRESS, + WETH_TOKEN_ADDRESS, +) + +from integrations.integration_ids import IntegrationID +from utils.gmx import GMXLPIntegration + +if __name__ == "__main__": + gmx_integration = GMXLPIntegration( + IntegrationID.GMX_WSTETH_USDE_LP, + GMX_WSTETH_USDE_MARKET_BLOCK, + GMX_WSTETH_USDE_MARKET_ADDRESS, + WETH_TOKEN_ADDRESS, + WSTETH_TOKEN_ADDRESS, + USDE_TOKEN_ADDRESS, + ) + print(gmx_integration.get_participants(None)) + print( + gmx_integration.get_balance( + "0x596CDbB0d4b74Cb5dCdf86613d8012E0cD3E522f", 238329658 + ) + ) diff --git a/integrations/hyperdrive.py b/integrations/hyperdrive.py new file mode 100644 index 0000000..9808d75 --- /dev/null +++ b/integrations/hyperdrive.py @@ -0,0 +1,120 @@ +from decimal import Decimal +from constants.chains import Chain +from integrations.integration import Integration +from integrations.integration_ids import IntegrationID +from constants.hyperdrive import ( + HYPERDRIVE_SUSDE_POOL_ADDRESS, + HYPERDRIVE_SUSDE_POOL_DEPLOYMENT_BLOCK, + HYPERDRIVE_MORPHO_ABI, +) +from utils.hyperdrive import ( + get_hyperdrive_participants, + get_pool_details, + get_pool_positions, +) +from utils.web3_utils import w3 + + +class Hyperdrive(Integration): + def __init__(self): + super().__init__( + IntegrationID.HYPERDRIVE_SUSDE, + HYPERDRIVE_SUSDE_POOL_DEPLOYMENT_BLOCK, + Chain.ETHEREUM, + [], + 20, + 1, + None, + None, + ) + self.pool_ids = None + self.pool_users = None + self.pool_positions = None + + def update_participants(self): + self.pool_users, self.pool_ids = get_hyperdrive_participants( + pool=HYPERDRIVE_SUSDE_POOL_ADDRESS, + start_block=HYPERDRIVE_SUSDE_POOL_DEPLOYMENT_BLOCK, + ) + + def get_participants(self, blocks: list[int] | None) -> set[str]: + self.update_participants() + return self.pool_users # type: ignore + + def get_balance(self, user: str, block: int) -> float: + # update hyperdrive participants + if self.pool_positions is None: + if self.pool_users is None: + self.update_participants() + # get pool positions + pool_contract = w3.eth.contract( + address=w3.to_checksum_address(HYPERDRIVE_SUSDE_POOL_ADDRESS), + abi=HYPERDRIVE_MORPHO_ABI, + ) + _, lp_rewardable_tvl, short_rewardable_tvl = get_pool_details(pool_contract) + self.pool_positions = get_pool_positions( + pool_contract=pool_contract, + pool_users=self.pool_users, + pool_ids=self.pool_ids, + lp_rewardable_tvl=lp_rewardable_tvl, + short_rewardable_tvl=short_rewardable_tvl, + block=block, + ) + # get the user's balance + rewardable_tvl = sum( + position[5] for position in self.pool_positions if position[0] == user + ) + return rewardable_tvl / 1e18 + + def test_hyperdrive(self): + self.update_participants() + pool_contract = w3.eth.contract( + address=w3.to_checksum_address(HYPERDRIVE_SUSDE_POOL_ADDRESS), + abi=HYPERDRIVE_MORPHO_ABI, + ) + vault_shares_balance, lp_rewardable_tvl, short_rewardable_tvl = ( + get_pool_details(pool_contract) + ) + pool_positions = get_pool_positions( + pool_contract=pool_contract, + pool_users=self.pool_users, + pool_ids=self.pool_ids, + lp_rewardable_tvl=lp_rewardable_tvl, + short_rewardable_tvl=short_rewardable_tvl, + ) + + # Make sure rewards add up to rewardable TVL + combined_prefixes = [ + (0, 3), + (2,), + ] # Treat prefixes 0 and 3 together, 2 separately + for prefixes in combined_prefixes: + combined_shares = sum( + position[5] for position in pool_positions if position[2] in prefixes + ) + combined_rewardable = ( + lp_rewardable_tvl if prefixes[0] == 0 else short_rewardable_tvl + ) + if combined_shares == combined_rewardable: + print( + f"for prefixes={prefixes}, check combined_shares == combined_rewardable ({combined_shares} == {combined_rewardable}) ✅" + ) + else: + print( + f"for prefixes={prefixes}, check combined_shares == combined_rewardable ({combined_shares} != {combined_rewardable}) ❌" + ) + + total_rewardable = Decimal(sum(position[5] for position in pool_positions)) + if vault_shares_balance == total_rewardable: + print( + f"vault_shares_balance == total_rewardable ({vault_shares_balance} == {total_rewardable}) ✅" + ) + else: + print( + f"vault_shares_balance != total_rewardable ({vault_shares_balance} != {total_rewardable}) ❌" + ) + + +if __name__ == "__main__": + hyperdrive = Hyperdrive() + hyperdrive.test_hyperdrive() diff --git a/integrations/integration.py b/integrations/integration.py new file mode 100644 index 0000000..90ce12b --- /dev/null +++ b/integrations/integration.py @@ -0,0 +1,53 @@ +from abc import ABC, abstractmethod +from typing import Dict, List, Optional, Set +from eth_typing import ChecksumAddress + +from constants.chains import Chain +from integrations.integration_ids import IntegrationID +from constants.summary_columns import SummaryColumn + + +class Integration(ABC): + + def __init__( + self, + integration_id: IntegrationID, + start_block: int, + chain: Chain, + summary_cols: list[SummaryColumn] | None = None, + reward_multiplier: int = 1, + balance_multiplier: int = 1, + excluded_addresses: Optional[Set[ChecksumAddress]] = None, + end_block: Optional[int] = None, + reward_multiplier_func=None, + ethereal_multiplier: int = 0, + ethereal_multiplier_func=None, + ): + self.integration_id = integration_id + self.start_block = start_block + self.end_block = end_block + self.participants: set[str] = set() + self.chain = chain + self.summary_cols = summary_cols + self.reward_multiplier = reward_multiplier + self.balance_multiplier = balance_multiplier + self.excluded_addresses = excluded_addresses + self.reward_multiplier_func = reward_multiplier_func + self.ethereal_multiplier = ethereal_multiplier + self.ethereal_multiplier_func = ethereal_multiplier_func + + def get_balance(self, user: str, block: int) -> float: + raise NotImplementedError + + # either get_participants OR get_block_balances must be implemented + def get_participants( + self, + blocks: Optional[List[int]], + ) -> Set[str]: + raise NotImplementedError + + # either get_participants OR get_block_balances must be implemented + def get_block_balances( + self, cached_data: Dict[int, Dict[ChecksumAddress, float]], blocks: List[int] + ) -> Dict[int, Dict[ChecksumAddress, float]]: + raise NotImplementedError diff --git a/integrations/integration_ids.py b/integrations/integration_ids.py new file mode 100644 index 0000000..86e9618 --- /dev/null +++ b/integrations/integration_ids.py @@ -0,0 +1,411 @@ +from enum import Enum + +from constants.integration_token import Token + + +class IntegrationID(Enum): + EXAMPLE = ("example", "Example", Token.USDE) + PENDLE_USDE_LPT = ("pendle_effective_lpt_held", "Pendle USDe LPT") + PENDLE_USDE_YT = ("pendle_yt_held", "Pendle USDe YT") + PENDLE_SUSDE_LPT_APRIL_EXPIRY = ( + "pendle_effective_susde_apr_lpt_held", + "Pendle sUSDe LPT (April expiry)", + Token.SUSDE, + ) + PENDLE_SUSDE_YT_APRIL_EXPIRY = ( + "pendle_susde_apr_yt_held", + "Pendle sUSDe YT (April expiry)", + Token.SUSDE, + ) + PENDLE_SUSDE_LPT_JULY_EXPIRY = ( + "pendle_effective_susde_jul_lpt_held", + "Pendle sUSDe LPT (July expiry)", + Token.SUSDE, + ) + PENDLE_SUSDE_YT_JULY_EXPIRY = ( + "pendle_susde_jul_yt_held", + "Pendle sUSDe YT (July expiry)", + Token.SUSDE, + ) + PENDLE_SUSDE_LPT_SEPT_EXPIRY = ( + "pendle_effective_susde_sep_lpt_held", + "Pendle sUSDe LPT (Sept expiry)", + Token.SUSDE, + ) + PENDLE_SUSDE_YT_SEPT_EXPIRY = ( + "pendle_susde_sep_yt_held", + "Pendle sUSDe YT (Sept expiry)", + Token.SUSDE, + ) + PENDLE_ENA_LPT = ("pendle_effective_ena_lpt_held", "Pendle ENA LPT", Token.ENA) + PENDLE_ENA_YT = ("pendle_ena_yt_held", "Pendle ENA YT", Token.ENA) + PENDLE_ARBITRUM_USDE_LPT = ( + "pendle_arbtrium_effective_lpt_bal", + "Pendle Arbitrum USDe LPT", + ) + PENDLE_ARBITRUM_USDE_YT = ("pendle_arbtrium_yt_bal", "Pendle Arbitrum USDe YT") + PENDLE_KARAK_USDE_LPT = ("pendle_karak_usde_lpt_held", "Pendle Karak USDe LPT") + PENDLE_KARAK_USDE_YT = ("pendle_karak_usde_yt_held", "Pendle Karak USDe YT") + PENDLE_KARAK_SUSDE_LPT = ( + "pendle_karak_susde_lpt_held", + "Pendle Karak sUSDe LPT", + Token.SUSDE, + ) + PENDLE_KARAK_SUSDE_YT = ( + "pendle_karak_susde_yt_held", + "Pendle Karak sUSDe YT", + Token.SUSDE, + ) + PENDLE_MANTLE_USDE_LPT = ( + "pendle_mantle_effective_lpt_bal", + "Pendle Mantle USDe LPT", + ) + PENDLE_MANTLE_USDE_YT = ("pendle_mantle_yt_bal", "Pendle Mantle USDe YT") + PENDLE_ZIRCUIT_USDE_LPT = ( + "pendle_effective_zircuit_usde_lpt_held", + "Pendle Zircuit USDe LPT", + ) + PENDLE_ZIRCUIT_USDE_YT = ("pendle_zircuit_usde_yt_held", "Pendle Zircuit USDe YT") + + # Stake DAO + STAKEDAO_SUSDE_JULY_LPT = ( + "stakedao_susde_july_effective_lpt_held", + "Stake DAO sUSDe July LPT", + Token.SUSDE, + ) + STAKEDAO_SUSDE_SEPT_LPT = ( + "stakedao_susde_sept_effective_lpt_held", + "Stake DAO sUSDe Sept LPT", + Token.SUSDE, + ) + STAKEDAO_USDE_JULY_LPT = ( + "stakedao_usde_july_effective_lpt_held", + "Stake DAO USDe July LPT", + Token.USDE, + ) + + # PENPIE + PENPIE_SUSDE_JULY_LPT = ( + "penpie_susde_july_effective_lpt_held", + "PENPIE sUSDe July LPT", + Token.SUSDE, + ) + PENPIE_Karak_sUSDe_26SEP2024_LPT = ( + "PENPIE_Karak_sUSDe_26SEP2024_effective_lpt_held", + "Karak_sUSDe_26SEP2024", + Token.SUSDE, + ) + PENPIE_Karak_USDE_26SEP2024_LPT = ( + "PENPIE_Karak_USDE_26SEP2024_effective_lpt_held", + "Karak_USDE_26SEP2024", + Token.USDE, + ) + PENPIE_sUSDe25APR2024_LPT = ( + "PENPIE_sUSDe25APR2024_effective_lpt_held", + "sUSDe25APR2024", + Token.SUSDE, + ) + PENPIE_sUSDe26SEP2024_LPT = ( + "PENPIE_sUSDe26SEP2024_effective_lpt_held", + "sUSDe26SEP2024", + Token.SUSDE, + ) + PENPIE_USDe25JUL2024_LPT = ( + "PENPIE_USDe25JUL2024_effective_lpt_held", + "USDe25JUL2024", + Token.USDE, + ) + PENPIE_Zircuit_USDe27JUN2024_LPT = ( + "PENPIE_Zircuit_USDe27JUN2024_effective_lpt_held", + "Zircuit_USDe27JUN2024", + Token.USDE, + ) + PENPIE_ENA29AUG2024_LPT = ( + "PENPIE_ENA29AUG2024_effective_lpt_held", + "ENA29AUG2024", + Token.ENA, + ) + PENPIE_USDE_ARB_AUG2024_LPT = ( + "PENPIE_USDE_ARB_AUG2024_effective_lpt_held", + "USDE_ARB_AUG2024", + Token.USDE, + ) + PENPIE_USDe_24OCT2024_LPT = ( + "PENPIE_USDe_24OCT202_effective_lpt_held4", + "USDe_24OCT2024", + Token.USDE, + ) + PENPIE_ENA_31OCT2024_LPT = ( + "PENPIE_ENA_31OCT2024_effective_lpt_held", + "ENA_31OCT2024", + Token.ENA, + ) + PENPIE_rsUSDe_26SEP2024_LPT = ( + "PENPIE_rsUSDe_26SEP2024_effective_lpt_held", + "rsUSDe_26SEP2024", + Token.USDE, + ) + PENPIE_USDe_26DEC2024_LPT = ( + "PENPIE_USDe_26DEC2024_effective_lpt_held", + "USDe_26DEC2024", + Token.USDE, + ) + PENPIE_sUSDE_26DEC2024_LPT = ( + "PENPIE_sUSDE_26DEC2024_effective_lpt_held", + "sUSDE_26DEC2024", + Token.SUSDE, + ) + PENPIE_sUSDE_24OCT2024_LPT = ( + "PENPIE_sUSDE_24OCT2024_effective_lpt_held", + "sUSDE_24OCT2024", + Token.SUSDE, + ) + PENPIE_rsENA_26SEP2024_LPT = ( + "PENPIE_rsENA_26SEP2024_effective_lpt_held", + "rsENA_26SEP2024", + Token.ENA, + ) + PENPIE_USDE_ARB_NOV2024_LPT = ( + "PENPIE_USDE_ARB_NOV2024_effective_lpt_held", + "USDE_ARB_NOV2024", + Token.USDE, + ) + + # EQUILIBRIA + EQUILIBRIA_SUSDE_SEPT_LPT = ( + "equilibria_susde_sept_effective_lpt_held", + "Equilibria sUSDe Sept LPT", + Token.SUSDE, + ) + EQUILIBRIA_Karak_SUSDE_SEPT_SEPT = ( + "equilibria_karak_susde_sept_effective_lpt_held", + "Equilibria Karak sUSDe Sept LPT", + Token.SUSDE, + ) + EQUILIBRIA_Karak_USDE_SEPT_LPT = ( + "equilibria_karak_usde_sept_effective_lpt_held", + "Equilibria Karak USDe Sept LPT", + Token.USDE, + ) + EQUILIBRIA_Zircuit_USDE_AUG_LPT = ( + "equilibria_zircuit_usde_aug_effective_lpt_held", + "Equilibria Zircuit USDe Aug LPT", + Token.USDE, + ) + EQUILIBRIA_rUSDE_SEPT_LPT = ( + "equilibria_rusde_sept_effective_lpt_held", + "Equilibria rUSDe Sept LPT", + ) + EQUILIBRIA_USDE_LPT_EXPIRY = ( + "equilibria_usde_lpt_expiry_effective_lpt_held", + "Equilibria USDe LPT Expiry", + Token.USDE, + ) + EQUILIBRIA_SUSDE_APR_EXPIRY = ( + "equilibria_susde_apr_expiry_effective_lpt_held", + "Equilibria sUSDe Apr Expiry", + Token.SUSDE, + ) + + # EulerV2 + EULER_USDE = ("euler_usde_deposit", "EulerV2 USDe", Token.USDE) + EULER_SUSDE = ("euler_susde_deposit", "EulerV2 sUSDe", Token.SUSDE) + + # Term Finance + TERM_SUSDE = ("term_susde_held", "Term Finance sUSDe", Token.SUSDE) + + # Synthetix + SYNTHETIX_USDE_LP = ( + "synthetix_usde_arb_lp_bal", + "Synthetix V3 Arbitrum USDe LP", + Token.USDE, + ) + + # Lendle + LENDLE_USDE_LPT = ("lendle_usde_lpt_bal", "Lendle Mantle USDe LPT", Token.USDE) + + # Lyra + LYRA_SUSDE_BULL_MAINNET = ( + "lyra_susde_bull_mainnet", + "Lyra sUSDe Bull Vault Mainnet", + Token.SUSDE, + ) + LYRA_SUSDE_BULL_ARBITRUM = ( + "lyra_susde_bull_arbitrum", + "Lyra sUSDe Bull Vault Arbitrum", + Token.SUSDE, + ) + LYRA_SUSDE_EXCHANGE_DEPOSIT = ( + "lyra_susde_exchange_deposit", + "Lyra sUSDe Exchange Deposits", + Token.SUSDE, + ) + # Velodrome + VELODROME_MODE_USDE = ("velodrome_mode_usde", "Velodrome Mode USDe", Token.USDE) + VELODROME_MODE_SUSDE = ("velodrome_mode_susde", "Velodrome Mode sUSDe", Token.SUSDE) + # Ambient + AMBIENT_SCROLL_LP = ("ambient_usde_scroll_lp_bal", "Ambient Scroll LP", Token.USDE) + + # Balancer + BALANCER_ARBITRUM_GHO_USDE = ( + "balancer_arbitrum_gho_usde", + "Balancer Arbitrum GHO/USDe", + Token.USDE, + ) + BALANCER_ARBITRUM_WAGHO_USDE = ( + "balancer_arbitrum_wagho_usde", + "Balancer Arbitrum waGHO/USDe", + Token.USDE, + ) + BALANCER_ARBITRUM_GYD_SUSDE = ( + "balancer_arbitrum_gyd_susde", + "Balancer Arbitrum GYD/sUSDe", + Token.SUSDE, + ) + BALANCER_ARBITRUM_SUSDE_SFRAX = ( + "balancer_arbitrum_susde_sfrax", + "Balancer Arbitrum sUSDe/sFRAX", + Token.SUSDE, + ) + BALANCER_ARBITRUM_SUSDE_USDC = ( + "balancer_arbitrum_susde_usdc", + "Balancer Arbitrum sUSDe/USDC", + Token.SUSDE, + ) + BALANCER_ETHEREUM_WSTETH_SUSDE = ( + "balancer_ethereum_wsteth_susde", + "Balancer Ethereum 50wstETH/50sUSDe", + Token.SUSDE, + ) + BALANCER_ETHEREUM_BAOUSD_SUSDE = ( + "balancer_ethereum_baousd_susde", + "Balancer Ethereum baoUSD/sUSDe", + Token.SUSDE, + ) + BALANCER_ETHEREUM_SUSDE_USDC = ( + "balancer_ethereum_susde_usdc", + "Balancer Ethereum sUSDe/USDC", + Token.SUSDE, + ) + BALANCER_ETHEREUM_SUSDE_GYD = ( + "balancer_ethereum_susde_gyd", + "Balancer Ethereum sUSDe/GYD", + Token.SUSDE, + ) + BALANCER_FRAXTAL_FRAX_USDE = ( + "balancer_fraxtal_frax_usde", + "Balancer Fraxtal FRAX/USDe", + Token.USDE, + ) + BALANCER_FRAXTAL_SFRAX_SDAI_SUSDE = ( + "balancer_fraxtal_sfrax_sdai_susde", + "Balancer Fraxtal sFRAX/sDAI/sUSDe", + Token.SUSDE, + ) + BALANCER_FRAXTAL_FRAX_USDE_DAI_USDT_USDC = ( + "balancer_fraxtal_frax_usde_dai_usdt_usdc", + "Balancer Fraxtal FRAX/USDe/DAI/USDT/USDC", + Token.USDE, + ) + + # Nuri + NURI_USDE_LP = ("nuri_usde_lp_bal", "Nuri USDe LP", Token.USDE) + + # Merchant Moe + MERCHANT_MOE_METH_USDE_LBT = ( + "merchant_moe_in_range_lbt_liq_held", + "Merchant Moe mETH/USDe Liquidity Book Token", + ) + # Rho Markets + RHO_MARKETS_USDE_LP = ( + "rho_markets_usde_scroll_lp_bal", + "Rho Markets Scroll USDe LP", + Token.USDE, + ) + # Ramses + RAMSES_USDE_LP = ("ramses_usde_lp_bal", "Ramses USDe LP", Token.USDE) + + # Radiant + RADIANT_USDE_CORE_ARBITRUM = ( + "radiant_usde_arb", + "Radiant USDE Lending", + Token.USDE, + ) + + # Splice + SPLICE_USDE_YT = ("splice_usde_yt", "Splice USDe YT", Token.USDE) + SPLICE_USDE_LPT = ("splice_usde_lpt", "Splice USDe LPT", Token.USDE) + SPLICE_SUSDE_YT = ("splice_susde_yt", "Splice SUSDe YT", Token.SUSDE) + SPLICE_SUSDE_LPT = ("splice_susde_lpt", "Splice SUSDu LPT", Token.SUSDE) + + # GMX + GMX_USDE_POSITIONS = ("gmx_usde_positions", "GMX USDe Positions", Token.USDE) + GMX_USDE_USDC_LP = ("gmx_usde_usdc_aug", "GMX USDe/USDc LP", Token.USDE) + GMX_WSTETH_USDE_LP = ("gmx_wsteth_usde_aug", "GMX wstETH/USDe LP", Token.USDE) + + # CURVE + CURVE_ETHEREUM_USDE_BORROWERS = ( + "curve_ethereum_usde_borrowers", + "Curve.fi Ethereum USDe Borrowers", + Token.USDE, + ) + CURVE_ETHEREUM_SUSDE_BORROWERS = ( + "curve_ethereum_susde_borrowers", + "Curve.fi Ethereum sUSDe Borrowers", + Token.SUSDE, + ) + + # Beefy + BEEFY_ARBITRUM_USDE = ( + "beefy_arbitrum_usde_held", + "Beefy Arbitrum USDe", + Token.USDE, + ) + BEEFY_FRAXTAL_USDE = ("beefy_fraxtal_usde_held", "Beefy Fraxtal USDe", Token.USDE) + BEEFY_MANTLE_USDE = ("beefy_mantle_usde_held", "Beefy Mantle USDe", Token.USDE) + BEEFY_OPTIMISM_USDE = ( + "beefy_optimism_usde_held", + "Beefy Optimism USDe", + Token.USDE, + ) + + # Allstake + ALLSTAKE_USDE = ("allstake_usde", "Allstake USDe", Token.USDE) + ALLSTAKE_SUSDE = ("allstake_susde", "Allstake sUSDe", Token.SUSDE) + + # Inverse Finance FiRM + FIRM_SUSDE = ("firm_susde", "Inverse Finance FiRM sUSDe", Token.SUSDE) + + # Hyperdrive + HYPERDRIVE_SUSDE = ( + "hyperdrive_susde", + "ElementDAO 182 Day sUSDe Hyperdrive", + Token.SUSDE, + ) + + # Fluid + FLUID = ("Fluid_susde", "Fluid sUSDe", Token.SUSDE) + + # Claimed ENA + CLAIMED_ENA_EXAMPLE = ("claimed_ena_example", "Claimed ENA Example", Token.ENA) + BEEFY_CACHED_BALANCE_EXAMPLE = ( + "beefy_cached_balance_example", + "Beefy Cached Balance Example", + Token.USDE, + ) + # Upshift sUSDe + UPSHIFT_UPSUSDE = ("upshift_upsusde", "Upshift upsUSDe", Token.SUSDE) + + def __init__(self, column_name: str, description: str, token: Token = Token.USDE): + self.column_name = column_name + self.description = description + self.token = token + + def get_column_name(self) -> str: + return self.column_name + + def get_description(self) -> str: + return self.description + + def get_token(self) -> Token: + return self.token diff --git a/integrations/lendle_usde.py b/integrations/lendle_usde.py index ae51018..99b4b30 100644 --- a/integrations/lendle_usde.py +++ b/integrations/lendle_usde.py @@ -1,14 +1,13 @@ from constants.chains import Chain -from constants.integration_ids import IntegrationID -from models.integration import Integration +from integrations.integration_ids import IntegrationID +from integrations.integration import Integration from constants.summary_columns import SummaryColumn from constants.lendle import LENDLE_USDE_DEPLOYMENT_BLOCK from utils.web3_utils import w3_mantle, fetch_events_logs_with_retry, call_with_retry from utils.lendle import lendle_usde_contract -class LendleIntegration( - Integration -): + +class LendleIntegration(Integration): def __init__(self): super().__init__( IntegrationID.LENDLE_USDE_LPT, @@ -21,7 +20,7 @@ def __init__(self): None, ) - def get_balance(self, user: str, block: int) -> float: + def get_balance(self, user: str, block: int | str) -> float: bal = call_with_retry( lendle_usde_contract.functions.balanceOf(user), block, @@ -32,7 +31,7 @@ def get_balance(self, user: str, block: int) -> float: return round((bal / 10**18), 4) # Important: This function should only be called once and should cache the results by setting self.participants - def get_participants(self) -> list: + def get_participants(self, blocks: list[int] | None) -> set[str]: page_size = 1900 start_block = LENDLE_USDE_DEPLOYMENT_BLOCK target_block = w3_mantle.eth.get_block_number() @@ -50,16 +49,11 @@ def get_participants(self) -> list: all_users.add(transfer["args"]["to"]) start_block += page_size - all_users = list(all_users) - self.participants = all_users - return all_users + return set(all_users) if __name__ == "__main__": lendle_integration = LendleIntegration() - print(lendle_integration.get_participants()) - print( - lendle_integration.get_balance( - list(lendle_integration.participants)[0], "latest" - ) - ) + participants = lendle_integration.get_participants(None) + print(participants) + print(lendle_integration.get_balance(list(participants)[0], "latest")) diff --git a/integrations/lyra_susde_bull.py b/integrations/lyra_susde_bull.py new file mode 100644 index 0000000..29ff44e --- /dev/null +++ b/integrations/lyra_susde_bull.py @@ -0,0 +1,79 @@ +from utils.web3_utils import W3_BY_CHAIN +import logging + +from integrations.integration_ids import IntegrationID +from integrations.integration import Integration +from utils.lyra import ( + get_vault_users, + get_effective_balance, + get_exchange_users, + get_exchange_balance, +) +from constants.lyra import ( + LYRA_CONTRACTS_AND_START_BY_TOKEN, + LyraVaultDetails, + DetailType, +) + + +class LyraIntegration(Integration): + def __init__(self, integration_id: IntegrationID): + self.vault_data: LyraVaultDetails = LYRA_CONTRACTS_AND_START_BY_TOKEN[ + integration_id + ] + + print(self.vault_data) + + super().__init__( + integration_id, + self.vault_data["start"], + self.vault_data["chain"], + None, + 5, + 1, + None, + None, + ) + + def get_balance(self, user: str, block: int) -> float: + if self.vault_data["detail_type"] == DetailType.Vault: + return get_effective_balance( + user, + block, + integration_token=self.vault_data["integration_token"], # type: ignore + bridge=self.vault_data["bridge"], # type: ignore + vault_token=self.vault_data["vault_token"], # type: ignore + timestamp=W3_BY_CHAIN[self.chain]["w3"].eth.get_block(block)[ + "timestamp" + ], + ) + + else: + return get_exchange_balance(user, block) + + def get_participants(self, blocks: list[int] | None) -> set[str]: + logging.info( + f"[{self.integration_id.get_description()}] Getting participants..." + ) + if self.vault_data["detail_type"] == DetailType.Vault: + self.participants = get_vault_users( + start_block=self.start_block, + page_size=self.vault_data["page_size"], # type: ignore + vault_token=self.vault_data["vault_token"], # type: ignore + chain=self.chain, + ) + else: + self.participants = get_exchange_users() + + return set(self.participants) + + +if __name__ == "__main__": + example_integration = LyraIntegration(IntegrationID.LYRA_SUSDE_BULL_MAINNET) + current_block = W3_BY_CHAIN[example_integration.chain]["w3"].eth.get_block_number() + + print("Found Lyra Participants:") + participants = example_integration.get_participants(None) + print(participants) + print("Found Balance of First Participant:") + print(example_integration.get_balance(list(participants)[0], current_block)) diff --git a/integrations/merchantmoe_lbt_integration.py b/integrations/merchantmoe_lbt_integration.py new file mode 100644 index 0000000..3ef8a9f --- /dev/null +++ b/integrations/merchantmoe_lbt_integration.py @@ -0,0 +1,113 @@ +import logging + +from web3.contract import Contract + +from constants.chains import Chain +from integrations.integration_ids import IntegrationID +from constants.merchantmoe import ( + ZERO_ADDRESS, + DEAD_ADDRESS, + METH_USDE_MERCHANT_MOE_LBT_DEPLOYMENT_BLOCK, + METH_USDE_MERCHANT_MOE_LBT_CONTRACT, +) +from integrations.integration import Integration +from utils.merchantmoe import lb_pair_contract, liquidity_helper_contract +from utils.web3_utils import W3_BY_CHAIN, fetch_events_logs_with_retry, call_with_retry + + +class MerchantMoeIntegration(Integration): + def __init__( + self, + start_block: int, + lbt_contract: Contract, + liquidity_helper_contract: Contract, + ): + super().__init__( + IntegrationID.MERCHANT_MOE_METH_USDE_LBT, + start_block, + Chain.MANTLE, + None, + 20, + 1, + None, + None, + ) + self.name = "MerchantMoe" + self.lbt_contract = lbt_contract + self.liquidity_helper_contract = liquidity_helper_contract + + def get_balance(self, user: str, block: int | str = "latest") -> float: + active_id = call_with_retry(self.lbt_contract.functions.getActiveId(), block) + + # calculate the amount in bins for ids that are +/- 20% from active price + # 10bp pair, log(1.20)/log(1.001) = 183 bins each side of range + lower_bin_bound = active_id - 183 + upper_bin_bound = active_id + 183 + bin_range = list(range(lower_bin_bound, upper_bin_bound + 1)) + + total_liquidity = 0.0 + logging.info( + f"[{self.name}] Calling Liquidity Helper Contract for User: {user}, for bin ids: {bin_range}" + ) + liquidity = call_with_retry( + self.liquidity_helper_contract.functions.getLiquiditiesOf( + METH_USDE_MERCHANT_MOE_LBT_CONTRACT, user, bin_range + ), + block, + ) + total_liquidity += sum(liquidity) + + total_liquidity = round(total_liquidity / 10**18, 8) + + logging.info( + f"[{self.name}] {user} has {total_liquidity} total liquidity within 20% range of the active price" + ) + return total_liquidity + + def get_participants(self, blocks: list[int] | None) -> set[str]: + if self.participants: + return self.participants + + logging.info(f"[{self.name}] Getting participants...") + page_size = 1900 + start_block = self.start_block + w3_client = W3_BY_CHAIN[self.chain]["w3"] + target_block = w3_client.eth.get_block_number() + all_users = set() + while start_block < target_block: + to_block = min(start_block + page_size, target_block) + transfers = fetch_events_logs_with_retry( + f"{self.name} LBT TransferBatch events", + self.lbt_contract.events.TransferBatch(), + start_block, + to_block, + ) + + logging.info( + f"[{self.name}] Scanning blocks {start_block} to {to_block}, received {len(transfers)} mETH/USDe transfer events" + ) + for transfer in transfers: + from_address = transfer["args"]["from"] + to_address = transfer["args"]["to"] + + if from_address != ZERO_ADDRESS and from_address != DEAD_ADDRESS: + all_users.add(from_address) + if to_address != ZERO_ADDRESS and to_address != DEAD_ADDRESS: + all_users.add(to_address) + + start_block += page_size + + logging.info(f"[{self.name}] {len(all_users)} users found") + self.participants = all_users + return all_users + + +if __name__ == "__main__": + merchant_moe_integration = MerchantMoeIntegration( + METH_USDE_MERCHANT_MOE_LBT_DEPLOYMENT_BLOCK, + lb_pair_contract, + liquidity_helper_contract, + ) + participants = merchant_moe_integration.get_participants(None) + print(participants) + print(merchant_moe_integration.get_balance(list(participants)[1])) diff --git a/integrations/nuri.py b/integrations/nuri.py index b991eac..035c878 100644 --- a/integrations/nuri.py +++ b/integrations/nuri.py @@ -1,13 +1,17 @@ from constants.chains import Chain -from constants.integration_ids import IntegrationID -from models.integration import Integration -from constants.nuri import NURI_NFP_MANAGER_ADDRESS, NURI_POOL_ADDRESS, NURI_DEPLOYMENT_BLOCK, SCROLL_USDE_TOKEN_ADDRESS +from integrations.integration_ids import IntegrationID +from integrations.integration import Integration +from constants.nuri import ( + NURI_DEPLOYMENT_BLOCK, + SCROLL_USDE_TOKEN_ADDRESS, +) from constants.summary_columns import SummaryColumn from utils.nuri import nfp_manager, pool from utils.web3_utils import w3_scroll, fetch_events_logs_with_retry, call_with_retry -from web3 import Web3 + import math + class Nuri(Integration): def __init__(self): super().__init__( @@ -22,12 +26,26 @@ def __init__(self): def calculate_sqrt_price(self, tick): return math.sqrt(1.0001**tick) * (2**96) - def calculate_token_amounts(self, liquidity, current_tick, lower_tick, upper_tick, sqrt_price_x96, decimals0, decimals1): + def calculate_token_amounts( + self, + liquidity, + current_tick, + lower_tick, + upper_tick, + sqrt_price_x96, + decimals0, + decimals1, + ): sqrt_price_current = sqrt_price_x96 sqrt_price_lower = self.calculate_sqrt_price(lower_tick) sqrt_price_upper = self.calculate_sqrt_price(upper_tick) - amount0 = liquidity * (sqrt_price_upper - sqrt_price_current) / (sqrt_price_current * sqrt_price_upper) * (2**96) + amount0 = ( + liquidity + * (sqrt_price_upper - sqrt_price_current) + / (sqrt_price_current * sqrt_price_upper) + * (2**96) + ) amount1 = liquidity * (sqrt_price_current - sqrt_price_lower) / (2**96) amount0_adjusted = amount0 / (10**decimals0) @@ -44,7 +62,7 @@ def get_balance(self, user: str, block: int) -> float: sqrtPriceX96 = current_tick[0] tick = current_tick[1] - + balance = call_with_retry( nfp_manager.functions.balanceOf(user), block, @@ -81,7 +99,13 @@ def get_balance(self, user: str, block: int) -> float: if token0 == SCROLL_USDE_TOKEN_ADDRESS: # Calculate token amounts for this position amount0, amount1 = self.calculate_token_amounts( - liquidity, tick, tickLower, tickUpper, sqrtPriceX96, 18, 6 # Assuming USDe is 18 decimals and USDT is 6 + liquidity, + tick, + tickLower, + tickUpper, + sqrtPriceX96, + 18, + 6, # Assuming USDe is 18 decimals and USDT is 6 ) # Assuming we want to sum up the USDe amounts @@ -89,12 +113,12 @@ def get_balance(self, user: str, block: int) -> float: return total_balance - def get_participants(self) -> list: + def get_participants(self, blocks: list[int] | None) -> set[str]: page_size = 999 start_block = NURI_DEPLOYMENT_BLOCK target_block = w3_scroll.eth.get_block_number() - all_users = set() + all_users: set[str] = set() while start_block < target_block: to_block = min(start_block + page_size, target_block) try: @@ -105,23 +129,27 @@ def get_participants(self) -> list: to_block, ) print(f"Fetched {len(mint_events)} Mint events") - + for event in mint_events: - tx_hash = event['transactionHash'] + tx_hash = event["transactionHash"] tx = w3_scroll.eth.get_transaction(tx_hash) - user_address = tx['from'] + user_address = tx["from"] all_users.add(user_address) except Exception as e: - print(f"Error fetching events from block {start_block} to {to_block}: {e}") - + print( + f"Error fetching events from block {start_block} to {to_block}: {e}" + ) + start_block += page_size - self.participants = list(all_users) - return self.participants - + self.participants = all_users + return all_users + + if __name__ == "__main__": nuri = Nuri() - #print(nuri.get_balance(Web3.to_checksum_address("0xCE29ECB0D2d8c8f0126ED923C50A35cFb0B613A8"), 7249275)) - #print(nuri.get_participants()) - #print(nuri.get_balance(nuri.participants[0], 7249275)) + # print(nuri.get_balance(Web3.to_checksum_address("0xCE29ECB0D2d8c8f0126ED923C50A35cFb0B613A8"), 7249275)) + participants = nuri.get_participants(None) + print(participants) + # print(nuri.get_balance(nuri.participants[0], 7249275)) diff --git a/integrations/pendle_lpt_integration.py b/integrations/pendle_lpt_integration.py index a8596a1..4c05903 100644 --- a/integrations/pendle_lpt_integration.py +++ b/integrations/pendle_lpt_integration.py @@ -6,9 +6,9 @@ from constants.chains import Chain from constants.pendle import PENDLE_USDE_JULY_DEPLOYMENT_BLOCK -from models.integration import Integration +from integrations.integration import Integration from utils import pendle -from constants.integration_ids import IntegrationID +from integrations.integration_ids import IntegrationID from constants.summary_columns import SummaryColumn from utils.pendle import get_pendle_participants_v3 from utils.web3_utils import call_with_retry @@ -23,24 +23,24 @@ def __init__( sy_contract: Contract, lp_contract: Contract, get_participants_func: Callable[ - [[ChecksumAddress]], list # type: ignore + [list[ChecksumAddress]], set[str] ] = get_pendle_participants_v3, chain: Chain = Chain.ETHEREUM, - summary_cols: list[SummaryColumn] = None, + summary_cols: list[SummaryColumn] | None = None, reward_multiplier: int = 1, balance_multiplier: int = 1, - end_block: int = None, - reward_multiplier_func: Callable[[int], int] = None, + end_block: int | None = None, + reward_multiplier_func: Callable[[int], int] | None = None, ): super().__init__( - integration_id, - start_block, - chain, - summary_cols, - reward_multiplier, - balance_multiplier, - end_block, - reward_multiplier_func, + integration_id=integration_id, + start_block=start_block, + chain=chain, + summary_cols=summary_cols, + reward_multiplier=reward_multiplier, + balance_multiplier=balance_multiplier, + end_block=end_block, + reward_multiplier_func=reward_multiplier_func, ) self.sy_contract = sy_contract self.lp_contract = lp_contract @@ -49,9 +49,9 @@ def __init__( ) self.get_participants_func = get_participants_func - def get_balance(self, user: str, block: int) -> float: + def get_balance(self, user: str, block: int | str) -> float: logging.info( - f"[{self.get_description()}] Getting balance for {user} at block {block}" + f"[{self.integration_id.get_description()}] Getting balance for {user} at block {block}" ) sy_bal = call_with_retry( self.sy_contract.functions.balanceOf(self.lp_contract.address), @@ -79,16 +79,18 @@ def get_balance(self, user: str, block: int) -> float: print(round(((sy_bal / 10**18) * lpt_bal) / total_active_supply, 4)) return round(((sy_bal / 10**18) * lpt_bal) / total_active_supply, 4) - def get_participants(self) -> list: + def get_participants(self, blocks: list[int] | None) -> set[str]: if self.participants is not None: return self.participants - logging.info(f"[{self.get_description()}] Getting participants...") + logging.info( + f"[{self.integration_id.get_description()}] Getting participants..." + ) self.participants = self.get_participants_func( [self.sy_contract.address, self.lp_contract.address] ) logging.info( - f"[{self.get_description()}] Found {len(self.participants)} participants" + f"[{self.integration_id.get_description()}] Found {len(self.participants)} participants" ) return self.participants @@ -101,5 +103,6 @@ def get_participants(self) -> list: pendle.lpt_contract, reward_multiplier=20, ) - print(integration.get_participants()) - print(integration.get_balance(list(integration.get_participants())[0], "latest")) + participants = integration.get_participants(None) + print(participants) + print(integration.get_balance(list(participants)[0], "latest")) diff --git a/integrations/pendle_yt_integration.py b/integrations/pendle_yt_integration.py index e3952e0..aac5872 100644 --- a/integrations/pendle_yt_integration.py +++ b/integrations/pendle_yt_integration.py @@ -1,12 +1,12 @@ -from typing import Callable +from typing import Callable, List, Optional import logging from eth_typing import ChecksumAddress from web3.contract import Contract from constants.chains import Chain -from models.integration import Integration -from constants.integration_ids import IntegrationID +from integrations.integration import Integration +from integrations.integration_ids import IntegrationID from constants.summary_columns import SummaryColumn from utils.pendle import get_pendle_participants_v3 from utils.web3_utils import call_with_retry @@ -20,24 +20,24 @@ def __init__( start_block: int, yt_contract: Contract, get_participants_func: Callable[ - [[ChecksumAddress]], list # type: ignore + [list[ChecksumAddress]], set[str] ] = get_pendle_participants_v3, chain: Chain = Chain.ETHEREUM, - summary_cols: list[SummaryColumn] = None, + summary_cols: Optional[List[SummaryColumn]] = None, reward_multiplier: int = 1, balance_multiplier: int = 1, - end_block: int = None, - reward_multiplier_func: Callable[[int], int] = None, + end_block: int | None = None, + reward_multiplier_func: Callable[[int], int] | None = None, ): super().__init__( - integration_id, - start_block, - chain, - summary_cols, - reward_multiplier, - balance_multiplier, - end_block, - reward_multiplier_func, + integration_id=integration_id, + start_block=start_block, + chain=chain, + summary_cols=summary_cols, + reward_multiplier=reward_multiplier, + balance_multiplier=balance_multiplier, + end_block=end_block, + reward_multiplier_func=reward_multiplier_func, ) self.yt_contract = yt_contract self.summary_cols = ( @@ -46,20 +46,18 @@ def __init__( self.get_participants_func = get_participants_func def get_balance(self, user: str, block: int) -> float: - logging.info( - f"[{self.get_description()}] Getting balance for {user} at block {block}" - ) + logging.info(f"[Pendle YT] Getting balance for {user} at block {block}") # protect against silent rpc errors leading to large erroneous values res = call_with_retry(self.yt_contract.functions.balanceOf(user), block) if not isinstance(res, (int, float)): return 0 return round(res / 10**18, 4) - def get_participants(self) -> list: + def get_participants(self, blocks: list[int] | None = None) -> set[str]: if self.participants is not None: return self.participants - logging.info(f"[{self.get_description()}] Getting participants...") + logging.info("[Pendle YT] Getting participants...") self.participants = self.get_participants_func([self.yt_contract.address]) logging.info( f"[{self.get_description()}] Found {len(self.participants)} participants" diff --git a/integrations/penpie_ena_aug.py b/integrations/penpie_ena_aug.py index e425e34..27878cf 100644 --- a/integrations/penpie_ena_aug.py +++ b/integrations/penpie_ena_aug.py @@ -1,6 +1,6 @@ -from constants.integration_ids import IntegrationID +from integrations.integration_ids import IntegrationID from utils.penpie import PENPIEIntegration -from constants.penpie import ENA29AUG2024_PRT, ENA29AUG2024_PRT_DEPLOYMENT_BLOCK +from constants.penpie import ENA29AUG2024_PRT, ENA29AUG2024_PRT_DEPLOYMENT_BLOCK from constants.chains import Chain from constants.penpie import PENDLE_LOCKER_ETHEREUM @@ -12,8 +12,11 @@ Chain.ETHEREUM, 30, 1, - [PENDLE_LOCKER_ETHEREUM] - + {PENDLE_LOCKER_ETHEREUM}, ) # print(penpie_integration.get_participants()) - print(penpie_integration.get_balance("0xb60c9094FF0DFfF6aA266063A4C176B00Ad07fE8", "latest")) \ No newline at end of file + print( + penpie_integration.get_balance( + "0xb60c9094FF0DFfF6aA266063A4C176B00Ad07fE8", "latest" + ) + ) diff --git a/integrations/penpie_ena_oct.py b/integrations/penpie_ena_oct.py new file mode 100644 index 0000000..0a02437 --- /dev/null +++ b/integrations/penpie_ena_oct.py @@ -0,0 +1,22 @@ +from integrations.integration_ids import IntegrationID +from utils.penpie import PENPIEIntegration +from constants.penpie import ENA_31OCT2024, ENA_31OCT2024_DEPLOYMENT_BLOCK +from constants.chains import Chain +from constants.penpie import PENDLE_LOCKER_ETHEREUM + +if __name__ == "__main__": + penpie_integration = PENPIEIntegration( + IntegrationID.PENPIE_ENA_31OCT2024_LPT, + ENA_31OCT2024_DEPLOYMENT_BLOCK, + ENA_31OCT2024, + Chain.ETHEREUM, + 30, + 1, + {PENDLE_LOCKER_ETHEREUM}, + ) + # print(penpie_integration.get_participants()) + print( + penpie_integration.get_balance( + "0x9EF171A8C62Eea6455830Bde5de99Db5A7cA5119", "latest" + ) + ) diff --git a/integrations/penpie_karak_susde_sep.py b/integrations/penpie_karak_susde_sep.py index d60765d..38d52ea 100644 --- a/integrations/penpie_karak_susde_sep.py +++ b/integrations/penpie_karak_susde_sep.py @@ -1,6 +1,9 @@ -from constants.integration_ids import IntegrationID +from integrations.integration_ids import IntegrationID from utils.penpie import PENPIEIntegration -from constants.penpie import Karak_sUSDe_26SEP2024_PRT, Karak_sUSDe_26SEP2024_PRT_DEPLOYMENT_BLOCK +from constants.penpie import ( + Karak_sUSDe_26SEP2024_PRT, + Karak_sUSDe_26SEP2024_PRT_DEPLOYMENT_BLOCK, +) from constants.chains import Chain from constants.penpie import PENDLE_LOCKER_ETHEREUM @@ -12,8 +15,11 @@ Chain.ETHEREUM, 5, 1, - [PENDLE_LOCKER_ETHEREUM] - + {PENDLE_LOCKER_ETHEREUM}, ) # print(penpie_integration.get_participants()) - print(penpie_integration.get_balance("0xb873BCF80afA89c2A9e5182f5792d64a03Eb4311", "latest")) \ No newline at end of file + print( + penpie_integration.get_balance( + "0xb873BCF80afA89c2A9e5182f5792d64a03Eb4311", "latest" + ) + ) diff --git a/integrations/penpie_karak_usde_sep.py b/integrations/penpie_karak_usde_sep.py index 7afd1f0..a445f69 100644 --- a/integrations/penpie_karak_usde_sep.py +++ b/integrations/penpie_karak_usde_sep.py @@ -1,6 +1,9 @@ -from constants.integration_ids import IntegrationID +from integrations.integration_ids import IntegrationID from utils.penpie import PENPIEIntegration -from constants.penpie import Karak_USDE_26SEP2024_PRT, Karak_USDE_26SEP2024_PRT_DEPLOYMENT_BLOCK +from constants.penpie import ( + Karak_USDE_26SEP2024_PRT, + Karak_USDE_26SEP2024_PRT_DEPLOYMENT_BLOCK, +) from constants.chains import Chain from constants.penpie import PENDLE_LOCKER_ETHEREUM @@ -12,8 +15,11 @@ Chain.ETHEREUM, 20, 1, - [PENDLE_LOCKER_ETHEREUM] - + {PENDLE_LOCKER_ETHEREUM}, ) # print(penpie_integration.get_participants()) - print(penpie_integration.get_balance("0x404581FA706E4E0d649A40eA503f9bCee3D2d76c", "latest")) \ No newline at end of file + print( + penpie_integration.get_balance( + "0x404581FA706E4E0d649A40eA503f9bCee3D2d76c", "latest" + ) + ) diff --git a/integrations/penpie_mellow_rsena_sep.py b/integrations/penpie_mellow_rsena_sep.py new file mode 100644 index 0000000..7042c28 --- /dev/null +++ b/integrations/penpie_mellow_rsena_sep.py @@ -0,0 +1,17 @@ +from integrations.integration_ids import IntegrationID +from utils.penpie import PENPIEIntegration +from constants.penpie import rsENA_26SEP2024, rsENA_26SEP2024_DEPLOYMENT_BLOCK +from constants.chains import Chain +from constants.penpie import PENDLE_LOCKER_ETHEREUM + +if __name__ == "__main__": + penpie_integration = PENPIEIntegration( + IntegrationID.PENPIE_rsENA_26SEP2024_LPT, + rsENA_26SEP2024_DEPLOYMENT_BLOCK, + rsENA_26SEP2024, + Chain.ETHEREUM, + 30, + 1, + {PENDLE_LOCKER_ETHEREUM}, + ) + print(penpie_integration.get_participants(None)) diff --git a/integrations/penpie_mellow_rusde_sep.py b/integrations/penpie_mellow_rusde_sep.py new file mode 100644 index 0000000..1118317 --- /dev/null +++ b/integrations/penpie_mellow_rusde_sep.py @@ -0,0 +1,17 @@ +from integrations.integration_ids import IntegrationID +from utils.penpie import PENPIEIntegration +from constants.penpie import rsUSDe_26SEP2024, rsUSDe_26SEP2024_DEPLOYMENT_BLOCK +from constants.chains import Chain +from constants.penpie import PENDLE_LOCKER_ETHEREUM + +if __name__ == "__main__": + penpie_integration = PENPIEIntegration( + IntegrationID.PENPIE_rsUSDe_26SEP2024_LPT, + rsUSDe_26SEP2024_DEPLOYMENT_BLOCK, + rsUSDe_26SEP2024, + Chain.ETHEREUM, + 10, + 1, + {PENDLE_LOCKER_ETHEREUM}, + ) + print(penpie_integration.get_participants(None)) diff --git a/integrations/penpie_susde_25apr.py b/integrations/penpie_susde_25apr.py index 512c55b..d1ecda6 100644 --- a/integrations/penpie_susde_25apr.py +++ b/integrations/penpie_susde_25apr.py @@ -1,6 +1,6 @@ -from constants.integration_ids import IntegrationID +from integrations.integration_ids import IntegrationID from utils.penpie import PENPIEIntegration -from constants.penpie import sUSDe25APR2024_PRT, sUSDe25APR2024_PRT_DEPLOYMENT_BLOCK +from constants.penpie import sUSDe25APR2024_PRT, sUSDe25APR2024_PRT_DEPLOYMENT_BLOCK from constants.chains import Chain from constants.penpie import PENDLE_LOCKER_ETHEREUM @@ -12,8 +12,11 @@ Chain.ETHEREUM, 20, 1, - [PENDLE_LOCKER_ETHEREUM] - + {PENDLE_LOCKER_ETHEREUM}, ) # print(penpie_integration.get_participants()) - print(penpie_integration.get_balance("0x48553662B61D9B246206fdC5Ee06C643ED85cb00", "latest")) \ No newline at end of file + print( + penpie_integration.get_balance( + "0x48553662B61D9B246206fdC5Ee06C643ED85cb00", "latest" + ) + ) diff --git a/integrations/penpie_susde_dec.py b/integrations/penpie_susde_dec.py new file mode 100644 index 0000000..2b6def1 --- /dev/null +++ b/integrations/penpie_susde_dec.py @@ -0,0 +1,18 @@ +from integrations.integration_ids import IntegrationID +from utils.penpie import PENPIEIntegration +from constants.penpie import sUSDE_26DEC2024, sUSDE_26DEC2024_DEPLOYMENT_BLOCK +from constants.chains import Chain +from constants.penpie import PENDLE_LOCKER_ETHEREUM + +if __name__ == "__main__": + penpie_integration = PENPIEIntegration( + IntegrationID.PENPIE_sUSDE_26DEC2024_LPT, + sUSDE_26DEC2024_DEPLOYMENT_BLOCK, + sUSDE_26DEC2024, + Chain.ETHEREUM, + 20, + 1, + {PENDLE_LOCKER_ETHEREUM}, + ) + print(penpie_integration.get_participants(None)) + # print(penpie_integration.get_balance("0xe95176DF139a93D706655B32Df087a97e212B78E", "latest")) diff --git a/integrations/penpie_susde_july.py b/integrations/penpie_susde_july.py index e218a09..bc7c961 100644 --- a/integrations/penpie_susde_july.py +++ b/integrations/penpie_susde_july.py @@ -1,6 +1,6 @@ -from constants.integration_ids import IntegrationID +from integrations.integration_ids import IntegrationID from utils.penpie import PENPIEIntegration -from constants.penpie import SUSDE_JULY, SUSDE_JULY_DEPLOYMENT_BLOCK +from constants.penpie import SUSDE_JULY, SUSDE_JULY_DEPLOYMENT_BLOCK from constants.chains import Chain from constants.penpie import PENDLE_LOCKER_ETHEREUM @@ -12,8 +12,11 @@ Chain.ETHEREUM, 20, 1, - [PENDLE_LOCKER_ETHEREUM] - + {PENDLE_LOCKER_ETHEREUM}, ) # print(penpie_integration.get_participants()) - print(penpie_integration.get_balance("0x79E40Ab4BAc23E2910C03E2Fc24819fE498A9491", "latest")) \ No newline at end of file + print( + penpie_integration.get_balance( + "0x79E40Ab4BAc23E2910C03E2Fc24819fE498A9491", "latest" + ) + ) diff --git a/integrations/penpie_susde_oct.py b/integrations/penpie_susde_oct.py new file mode 100644 index 0000000..9b8b0dd --- /dev/null +++ b/integrations/penpie_susde_oct.py @@ -0,0 +1,18 @@ +from integrations.integration_ids import IntegrationID +from utils.penpie import PENPIEIntegration +from constants.penpie import sUSDE_24OCT2024, sUSDE_24OCT2024_DEPLOYMENT_BLOCK +from constants.chains import Chain +from constants.penpie import PENDLE_LOCKER_ETHEREUM + +if __name__ == "__main__": + penpie_integration = PENPIEIntegration( + IntegrationID.PENPIE_sUSDE_24OCT2024_LPT, + sUSDE_24OCT2024_DEPLOYMENT_BLOCK, + sUSDE_24OCT2024, + Chain.ETHEREUM, + 20, + 1, + {PENDLE_LOCKER_ETHEREUM}, + ) + print(penpie_integration.get_participants(None)) + # print(penpie_integration.get_balance("0xe95176DF139a93D706655B32Df087a97e212B78E", "latest")) diff --git a/integrations/penpie_susde_sep.py b/integrations/penpie_susde_sep.py index 3d113bc..fa2bf7d 100644 --- a/integrations/penpie_susde_sep.py +++ b/integrations/penpie_susde_sep.py @@ -1,6 +1,6 @@ -from constants.integration_ids import IntegrationID +from integrations.integration_ids import IntegrationID from utils.penpie import PENPIEIntegration -from constants.penpie import sUSDe26SEP2024_PRT, sUSDe26SEP2024_PRT_DEPLOYMENT_BLOCK +from constants.penpie import sUSDe26SEP2024_PRT, sUSDe26SEP2024_PRT_DEPLOYMENT_BLOCK from constants.chains import Chain from constants.penpie import PENDLE_LOCKER_ETHEREUM @@ -12,8 +12,11 @@ Chain.ETHEREUM, 20, 1, - [PENDLE_LOCKER_ETHEREUM] - + {PENDLE_LOCKER_ETHEREUM}, ) # print(penpie_integration.get_participants()) - print(penpie_integration.get_balance("0xe95176DF139a93D706655B32Df087a97e212B78E", "latest")) \ No newline at end of file + print( + penpie_integration.get_balance( + "0xe95176DF139a93D706655B32Df087a97e212B78E", "latest" + ) + ) diff --git a/integrations/penpie_usde_aug_Arb.py b/integrations/penpie_usde_aug_Arb.py index 4a51db1..33fb497 100644 --- a/integrations/penpie_usde_aug_Arb.py +++ b/integrations/penpie_usde_aug_Arb.py @@ -1,6 +1,6 @@ -from constants.integration_ids import IntegrationID +from integrations.integration_ids import IntegrationID from utils.penpie import PENPIEIntegration -from constants.penpie import USDE_ARB_AUG2024, USDE_ARB_AUG2024_DEPLOYMENT_BLOCK +from constants.penpie import USDE_ARB_AUG2024, USDE_ARB_AUG2024_DEPLOYMENT_BLOCK from constants.chains import Chain from constants.penpie import PENDLE_LOCKER_ARBITRUM @@ -12,8 +12,7 @@ Chain.ARBITRUM, 20, 1, - [PENDLE_LOCKER_ARBITRUM] - + {PENDLE_LOCKER_ARBITRUM}, ) - print(penpie_integration.get_participants()) - # print(penpie_integration.get_balance("0xe95176DF139a93D706655B32Df087a97e212B78E", "latest")) \ No newline at end of file + print(penpie_integration.get_participants(None)) + # print(penpie_integration.get_balance("0xe95176DF139a93D706655B32Df087a97e212B78E", "latest")) diff --git a/integrations/penpie_usde_dec.py b/integrations/penpie_usde_dec.py new file mode 100644 index 0000000..dcfb519 --- /dev/null +++ b/integrations/penpie_usde_dec.py @@ -0,0 +1,22 @@ +from integrations.integration_ids import IntegrationID +from utils.penpie import PENPIEIntegration +from constants.penpie import USDe_26DEC2024, USDe_26DEC2024_DEPLOYMENT_BLOCK +from constants.chains import Chain +from constants.penpie import PENDLE_LOCKER_ETHEREUM + +if __name__ == "__main__": + penpie_integration = PENPIEIntegration( + IntegrationID.PENPIE_USDe_26DEC2024_LPT, + USDe_26DEC2024_DEPLOYMENT_BLOCK, + USDe_26DEC2024, + Chain.ETHEREUM, + 25, + 1, + {PENDLE_LOCKER_ETHEREUM}, + ) + # print(penpie_integration.get_participants()) + print( + penpie_integration.get_balance( + "0xe95176DF139a93D706655B32Df087a97e212B78E", "latest" + ) + ) diff --git a/integrations/penpie_usde_july.py b/integrations/penpie_usde_july.py index 47dd3ef..62052e3 100644 --- a/integrations/penpie_usde_july.py +++ b/integrations/penpie_usde_july.py @@ -1,6 +1,6 @@ -from constants.integration_ids import IntegrationID +from integrations.integration_ids import IntegrationID from utils.penpie import PENPIEIntegration -from constants.penpie import USDe25JUL2024_PRT, USDe25JUL2024_PRT_DEPLOYMENT_BLOCK +from constants.penpie import USDe25JUL2024_PRT, USDe25JUL2024_PRT_DEPLOYMENT_BLOCK from constants.chains import Chain from constants.penpie import PENDLE_LOCKER_ETHEREUM @@ -10,10 +10,9 @@ USDe25JUL2024_PRT_DEPLOYMENT_BLOCK, USDe25JUL2024_PRT, Chain.ETHEREUM, - 20, + 25, 1, - [PENDLE_LOCKER_ETHEREUM] - + {PENDLE_LOCKER_ETHEREUM}, ) # print(penpie_integration.get_participants()) - print(penpie_integration.get_balance("0x79E40Ab4BAc23E2910C03E2Fc24819fE498A9491", "latest")) \ No newline at end of file + print(penpie_integration.get_balance("0x79E40Ab4BAc23E2910C03E2Fc24819fE498A9491")) diff --git a/integrations/penpie_usde_nov_arb.py b/integrations/penpie_usde_nov_arb.py new file mode 100644 index 0000000..57d11f8 --- /dev/null +++ b/integrations/penpie_usde_nov_arb.py @@ -0,0 +1,17 @@ +from integrations.integration_ids import IntegrationID +from utils.penpie import PENPIEIntegration +from constants.penpie import USDE_ARB_NOV2024, USDE_ARB_NOV2024_DEPLOYMENT_BLOCK +from constants.chains import Chain +from constants.penpie import PENDLE_LOCKER_ARBITRUM + +if __name__ == "__main__": + penpie_integration = PENPIEIntegration( + IntegrationID.PENPIE_USDE_ARB_NOV2024_LPT, + USDE_ARB_NOV2024_DEPLOYMENT_BLOCK, + USDE_ARB_NOV2024, + Chain.ARBITRUM, + 20, + 1, + {PENDLE_LOCKER_ARBITRUM}, + ) + print(penpie_integration.get_balance("0xe95176DF139a93D706655B32Df087a97e212B78E")) diff --git a/integrations/penpie_usde_oct.py b/integrations/penpie_usde_oct.py new file mode 100644 index 0000000..f443d7b --- /dev/null +++ b/integrations/penpie_usde_oct.py @@ -0,0 +1,22 @@ +from integrations.integration_ids import IntegrationID +from utils.penpie import PENPIEIntegration +from constants.penpie import USDe_24OCT2024, USDe_24OCT2024_DEPLOYMENT_BLOCK +from constants.chains import Chain +from constants.penpie import PENDLE_LOCKER_ETHEREUM + +if __name__ == "__main__": + penpie_integration = PENPIEIntegration( + IntegrationID.PENPIE_USDe_24OCT2024_LPT, + USDe_24OCT2024_DEPLOYMENT_BLOCK, + USDe_24OCT2024, + Chain.ETHEREUM, + 25, + 1, + {PENDLE_LOCKER_ETHEREUM}, + ) + # print(penpie_integration.get_participants()) + print( + penpie_integration.get_balance( + "0x79E40Ab4BAc23E2910C03E2Fc24819fE498A9491", "latest" + ) + ) diff --git a/integrations/penpie_zircuit_usde_jun.py b/integrations/penpie_zircuit_usde_jun.py index b005b62..b22b4b3 100644 --- a/integrations/penpie_zircuit_usde_jun.py +++ b/integrations/penpie_zircuit_usde_jun.py @@ -1,6 +1,9 @@ -from constants.integration_ids import IntegrationID +from integrations.integration_ids import IntegrationID from utils.penpie import PENPIEIntegration -from constants.penpie import Zircuit_USDe27JUN2024_PRT, Zircuit_USDe27JUN2024_PRT_DEPLOYMENT_BLOCK +from constants.penpie import ( + Zircuit_USDe27JUN2024_PRT, + Zircuit_USDe27JUN2024_PRT_DEPLOYMENT_BLOCK, +) from constants.chains import Chain from constants.penpie import PENDLE_LOCKER_ETHEREUM @@ -10,10 +13,13 @@ Zircuit_USDe27JUN2024_PRT_DEPLOYMENT_BLOCK, Zircuit_USDe27JUN2024_PRT, Chain.ETHEREUM, - 20, + 25, 1, - [PENDLE_LOCKER_ETHEREUM] - + {PENDLE_LOCKER_ETHEREUM}, ) # print(penpie_integration.get_participants()) - print(penpie_integration.get_balance("0xC5FBC522B2C1Ff8A47c2b7BF947321C808be5e64", "latest")) \ No newline at end of file + print( + penpie_integration.get_balance( + "0xC5FBC522B2C1Ff8A47c2b7BF947321C808be5e64", "latest" + ) + ) diff --git a/integrations/radiant_usde.py b/integrations/radiant_usde.py new file mode 100644 index 0000000..2dfebcb --- /dev/null +++ b/integrations/radiant_usde.py @@ -0,0 +1,59 @@ +from utils.web3_utils import W3_BY_CHAIN +import logging + +from integrations.integration_ids import IntegrationID +from integrations.integration import Integration +from utils.radiant import get_radiant_lenders, get_effective_balance +from constants.radiant import ( + RADIANT_CONTRACTS_AND_START_BY_TOKEN, + RadiantLendingDetails, +) + + +class RadiantIntegration(Integration): + def __init__(self, integration_id: IntegrationID): + self.vault_data: RadiantLendingDetails = RADIANT_CONTRACTS_AND_START_BY_TOKEN[ + integration_id + ] + + print(self.vault_data) + + super().__init__( + integration_id=integration_id, + start_block=self.vault_data["start"], + chain=self.vault_data["chain"], + summary_cols=None, + reward_multiplier=20, + ) + + def get_balance(self, user: str, block: int) -> float: + return get_effective_balance( + user, + block, + self.vault_data["collateral_address"], + self.vault_data["r_token_contract"], + self.vault_data["lending_pool"], + ) + + def get_participants(self, blocks: list[int] | None = None) -> set[str]: + logging.info( + f"[{self.integration_id.get_description()}] Getting participants..." + ) + self.participants = get_radiant_lenders( + self.vault_data["graph_url"], + self.vault_data["collateral_address"], + ) + + return self.participants + + +if __name__ == "__main__": + example_integration = RadiantIntegration(IntegrationID.RADIANT_USDE_CORE_ARBITRUM) + current_block = W3_BY_CHAIN[example_integration.chain]["w3"].eth.get_block_number() + + print("Block:", current_block) + print("Found Radiant Participants:") + participants = example_integration.get_participants(None) + print(len(participants)) + print("Found Balance of First Participant:", list(participants)[0]) + print(example_integration.get_balance(list(participants)[0], current_block)) diff --git a/integrations/ramses.py b/integrations/ramses.py new file mode 100644 index 0000000..559f732 --- /dev/null +++ b/integrations/ramses.py @@ -0,0 +1,169 @@ +from constants.chains import Chain +from integrations.integration_ids import IntegrationID +from integrations.integration import Integration +from constants.ramses import ( + RAMSES_DEPLOYMENT_BLOCK, + RAMSES_NFP_MANAGER_ADDRESS, + RAMSES_POOL_ADDRESS, + ARBITRUM_USDE_TOKEN_ADDRESS, +) +from constants.summary_columns import SummaryColumn +from utils.ramses import nfp_manager, pool +from utils.web3_utils import w3_arb, fetch_events_logs_with_retry, call_with_retry +from web3 import Web3 +import math + + +class Ramses(Integration): + def __init__(self): + super().__init__( + IntegrationID.RAMSES_USDE_LP, + RAMSES_DEPLOYMENT_BLOCK, + Chain.ARBITRUM, + [SummaryColumn.RAMSES_SHARDS], + 20, + 1, + ) + + def calculate_sqrt_price(self, tick): + return math.sqrt(1.0001**tick) * (2**96) + + def calculate_token_amounts( + self, + liquidity, + current_tick, + lower_tick, + upper_tick, + sqrt_price_x96, + decimals0, + decimals1, + ): + sqrt_price_current = sqrt_price_x96 / (2**96) + sqrt_price_lower = self.calculate_sqrt_price(lower_tick) / (2**96) + sqrt_price_upper = self.calculate_sqrt_price(upper_tick) / (2**96) + + if current_tick < lower_tick: + amount0 = liquidity * (1 / sqrt_price_lower - 1 / sqrt_price_upper) + amount1 = 0 + elif current_tick < upper_tick: + amount0 = liquidity * (1 / sqrt_price_current - 1 / sqrt_price_upper) + amount1 = liquidity * (sqrt_price_current - sqrt_price_lower) + else: + amount0 = 0 + amount1 = liquidity * (sqrt_price_upper - sqrt_price_lower) + + amount0_adjusted = amount0 / (10**decimals0) + amount1_adjusted = amount1 / (10**decimals1) + + return max(amount0_adjusted, 0), max(amount1_adjusted, 0) + + def get_balance(self, user: str, block: int) -> float: + # get pool current tick + current_tick = call_with_retry( + pool.functions.slot0(), + block, + ) + + sqrtPriceX96 = current_tick[0] + tick = current_tick[1] + + balance = call_with_retry( + nfp_manager.functions.balanceOf(user), + block, + ) + + print(f"User NFT balance: {balance}") + + positions = [] + + for i in range(balance): + tokenOfOwnerByIndex = call_with_retry( + nfp_manager.functions.tokenOfOwnerByIndex(user, i), + block, + ) + + positions.append(tokenOfOwnerByIndex) + + print(f"User positions: {positions}") + + total_balance = 0 + + for position in positions: + position_info = call_with_retry( + nfp_manager.functions.positions(position), + block, + ) + print(f"Position info: {position_info}") + token0 = position_info[2] + token1 = position_info[3] + tickLower = position_info[5] + tickUpper = position_info[6] + liquidity = position_info[7] + + if token0 == ARBITRUM_USDE_TOKEN_ADDRESS: + # Calculate token amounts for this position + amount0, amount1 = self.calculate_token_amounts( + liquidity, tick, tickLower, tickUpper, sqrtPriceX96, 18, 18 + ) + + # Assuming we want to sum up the USDe amounts + total_balance += amount0 + + return total_balance + + def get_participants(self, blocks: list[int] | None = None) -> set[str]: + page_size = 999 + start_block = RAMSES_DEPLOYMENT_BLOCK + target_block = w3_arb.eth.get_block_number() + + all_users: set[str] = set() + while start_block < target_block: + to_block = min(start_block + page_size, target_block) + try: + mint_events = fetch_events_logs_with_retry( + f"USDe pool Mint events from {start_block} to {to_block}", + pool.events.Mint(), + start_block, + to_block, + ) + print(f"Fetched {len(mint_events)} Mint events") + + for event in mint_events: + tx_hash = event["transactionHash"] + tx = w3_arb.eth.get_transaction(tx_hash) + user_address = tx["from"] + all_users.add(user_address) + + except Exception as e: + print( + f"Error fetching events from block {start_block} to {to_block}: {e}" + ) + + start_block += page_size + + self.participants = all_users + return all_users + + +if __name__ == "__main__": + ramses = Ramses() + try: + latest_block = w3_arb.eth.get_block_number() + test_block = latest_block - 100 + print(f"Testing with block number: {test_block}") + + test_address = Web3.to_checksum_address( + "0xED12959952FAb1d304555cFb0146Ed3E6265DE42" + ) + balance = ramses.get_balance(test_address, test_block) + print(f"Balance for {test_address}: {balance}") + + participants = ramses.get_participants() + print(f"Number of participants: {len(participants)}") + if participants: + first_participant_balance = ramses.get_balance( + list(participants)[0], test_block + ) + print(f"Balance for first participant: {first_participant_balance}") + except Exception as e: + print(f"An error occurred: {e}") diff --git a/integrations/rho_markets.py b/integrations/rho_markets.py new file mode 100644 index 0000000..8baf9f9 --- /dev/null +++ b/integrations/rho_markets.py @@ -0,0 +1,12 @@ +from utils.rho_markets import RhoMarkets +from utils.web3_utils import w3_scroll + +if __name__ == "__main__": + rho_markets = RhoMarkets() + participants = rho_markets.get_participants(None) + print(len(participants)) + print( + rho_markets.get_balance( + w3_scroll.to_checksum_address(list(participants)[0]), 7751774 + ) + ) diff --git a/integrations/splice_susde_lpt.py b/integrations/splice_susde_lpt.py new file mode 100644 index 0000000..aad5432 --- /dev/null +++ b/integrations/splice_susde_lpt.py @@ -0,0 +1,9 @@ +from integrations.integration_ids import IntegrationID +from utils.splice import SpliceIntegration + +if __name__ == "__main__": + integration = SpliceIntegration(IntegrationID.SPLICE_SUSDE_LPT) + print(integration.get_participants(None)) + print( + integration.get_balance(list(integration.get_participants(None))[0], "latest") + ) diff --git a/integrations/splice_susde_yt.py b/integrations/splice_susde_yt.py new file mode 100644 index 0000000..f0871a7 --- /dev/null +++ b/integrations/splice_susde_yt.py @@ -0,0 +1,9 @@ +from integrations.integration_ids import IntegrationID +from utils.splice import SpliceIntegration + +if __name__ == "__main__": + integration = SpliceIntegration(IntegrationID.SPLICE_SUSDE_YT) + print(integration.get_participants(None)) + print( + integration.get_balance(list(integration.get_participants(None))[0], "latest") + ) diff --git a/integrations/splice_usde_lpt.py b/integrations/splice_usde_lpt.py new file mode 100644 index 0000000..fee66d9 --- /dev/null +++ b/integrations/splice_usde_lpt.py @@ -0,0 +1,7 @@ +from integrations.integration_ids import IntegrationID +from utils.splice import SpliceIntegration + +if __name__ == "__main__": + integration = SpliceIntegration(IntegrationID.SPLICE_USDE_LPT) + print(integration.get_participants(None)) + print(integration.get_balance(list(integration.get_participants(None))[0])) diff --git a/integrations/splice_usde_yt.py b/integrations/splice_usde_yt.py new file mode 100644 index 0000000..f5c57b1 --- /dev/null +++ b/integrations/splice_usde_yt.py @@ -0,0 +1,7 @@ +from integrations.integration_ids import IntegrationID +from utils.splice import SpliceIntegration + +if __name__ == "__main__": + integration = SpliceIntegration(IntegrationID.SPLICE_USDE_YT) + print(integration.get_participants(None)) + print(integration.get_balance(list(integration.get_participants(None))[0])) diff --git a/integrations/stakedao_susde_july.py b/integrations/stakedao_susde_july.py index df2f3ad..8092b7d 100644 --- a/integrations/stakedao_susde_july.py +++ b/integrations/stakedao_susde_july.py @@ -1,6 +1,6 @@ -from constants.integration_ids import IntegrationID +from integrations.integration_ids import IntegrationID from utils.stakedao import StakeDAOIntegration -from constants.stakedao import SUSDE_JULY, SUSDE_JULY_DEPLOYMENT_BLOCK +from constants.stakedao import SUSDE_JULY, SUSDE_JULY_DEPLOYMENT_BLOCK if __name__ == "__main__": stakedao_integration = StakeDAOIntegration( @@ -8,4 +8,4 @@ SUSDE_JULY_DEPLOYMENT_BLOCK, SUSDE_JULY, ) - print(stakedao_integration.get_participants()) + print(stakedao_integration.get_participants(None)) diff --git a/integrations/stakedao_susde_sept.py b/integrations/stakedao_susde_sept.py index 3add097..4f3fb20 100644 --- a/integrations/stakedao_susde_sept.py +++ b/integrations/stakedao_susde_sept.py @@ -1,6 +1,6 @@ -from constants.integration_ids import IntegrationID +from integrations.integration_ids import IntegrationID from utils.stakedao import StakeDAOIntegration -from constants.stakedao import SUSDE_SEPT, SUSDE_SEPT_DEPLOYMENT_BLOCK +from constants.stakedao import SUSDE_SEPT, SUSDE_SEPT_DEPLOYMENT_BLOCK if __name__ == "__main__": stakedao_integration = StakeDAOIntegration( @@ -8,4 +8,4 @@ SUSDE_SEPT_DEPLOYMENT_BLOCK, SUSDE_SEPT, ) - print(stakedao_integration.get_participants()) + print(stakedao_integration.get_participants(None)) diff --git a/integrations/stakedao_usde_july.py b/integrations/stakedao_usde_july.py index 2c5f637..9cc1aa9 100644 --- a/integrations/stakedao_usde_july.py +++ b/integrations/stakedao_usde_july.py @@ -1,6 +1,6 @@ -from constants.integration_ids import IntegrationID +from integrations.integration_ids import IntegrationID from utils.stakedao import StakeDAOIntegration -from constants.stakedao import USDE_JULY, USDE_JULY_DEPLOYMENT_BLOCK +from constants.stakedao import USDE_JULY, USDE_JULY_DEPLOYMENT_BLOCK if __name__ == "__main__": stakedao_integration = StakeDAOIntegration( @@ -8,4 +8,4 @@ USDE_JULY_DEPLOYMENT_BLOCK, USDE_JULY, ) - print(stakedao_integration.get_participants()) + print(stakedao_integration.get_participants(None)) diff --git a/integrations/synthetix.py b/integrations/synthetix.py index cf7035c..394e5d0 100644 --- a/integrations/synthetix.py +++ b/integrations/synthetix.py @@ -1,6 +1,6 @@ from constants.chains import Chain -from constants.integration_ids import IntegrationID -from models.integration import Integration +from integrations.integration_ids import IntegrationID +from integrations.integration import Integration from constants.synthetix import SYNTHETIX_ARB_DEPLOYMENT_BLOCK, ARB_USDE_TOKEN_ADDRESS from constants.summary_columns import SummaryColumn from utils.synthetix import core_proxy_contract, core_account_proxy_contract @@ -46,12 +46,12 @@ def get_balance(self, user: str, block: int) -> float: total_balance += balance return total_balance / 1e18 - def get_participants(self) -> list: + def get_participants(self, blocks: list[int] | None) -> set[str]: page_size = 1900 start_block = SYNTHETIX_ARB_DEPLOYMENT_BLOCK target_block = w3_arb.eth.get_block_number() - all_users = set() + all_users: set[str] = set() while start_block < target_block: to_block = min(start_block + page_size, target_block) transfers = fetch_events_logs_with_retry( @@ -64,12 +64,12 @@ def get_participants(self) -> list: all_users.add(transfer["args"]["to"]) start_block += page_size - all_users = list(all_users) self.participants = all_users return all_users if __name__ == "__main__": synthetix = Synthetix() - print(synthetix.get_participants()) - print(synthetix.get_balance(synthetix.participants[0], 227610000)) + participants = synthetix.get_participants(None) + print(len(participants)) + print(synthetix.get_balance(list(participants)[0], 227610000)) diff --git a/integrations/template.py b/integrations/template.py index 941194f..3116684 100644 --- a/integrations/template.py +++ b/integrations/template.py @@ -1,39 +1,103 @@ +from typing import Callable, Dict, List, Optional, Set from constants.chains import Chain -from constants.integration_ids import IntegrationID -from models.integration import Integration +from constants.summary_columns import SummaryColumn +from integrations.cached_balances_integration import CachedBalancesIntegration +from integrations.integration_ids import IntegrationID +from web3 import Web3 +from eth_typing import ChecksumAddress class ProtocolNameIntegration( - Integration + CachedBalancesIntegration ): # TODO: Change ProtocolNameIntegration to the name of the protocol - def __init__(self): + def __init__( + self, + integration_id: IntegrationID, + start_block: int, + chain: Chain = Chain.ETHEREUM, + summary_cols: Optional[List[SummaryColumn]] = None, + reward_multiplier: int = 1, + balance_multiplier: int = 1, + excluded_addresses: Optional[Set[ChecksumAddress]] = None, + end_block: Optional[int] = None, + ethereal_multiplier: int = 0, + ethereal_multiplier_func: Optional[Callable[[int, str], int]] = None, + ): super().__init__( - IntegrationID.EXAMPLE, # TODO: Change EXAMPLE to the name of the protocol - 20000000, # TODO: Change 20000000 to the start block of the protocol when events/balances should first be tracked - Chain.ETHEREUM, # TODO: Change ETHEREUM to the chain of the protocol - None, # TODO: Optional, change None to a list of SummaryColumn enums that this protocol should be associated with, see Pendle grouping example - 20, # TODO: Change 20 to the sats multiplier for the protocol that has been agreed upon - 1, # TODO: Almost always 1, optionally change to a different value if an adjustment needs to be applied to balances - None, # TODO: Optional, change None to the end block of the protocol when events/balances should stop being tracked - None, # TODO: Optional, change None to a function that takes a block number and returns the reward multiplier for that block if it has or will change over time + integration_id, + start_block, + chain, + summary_cols, + reward_multiplier, + balance_multiplier, + excluded_addresses, + end_block, + ethereal_multiplier, + ethereal_multiplier_func, ) - # TODO: Implement function for getting a given user's balance at a given block - def get_balance(self, user: str, block: int) -> float: - pass + # TODO: Implement this function + def get_block_balances( + self, cached_data: Dict[int, Dict[ChecksumAddress, float]], blocks: List[int] + ) -> Dict[int, Dict[ChecksumAddress, float]]: + """Get user balances for specified blocks, using cached data when available. - # TODO: Implement function for getting all participants of the protocol, ever - # Important: This function should only be called once and should cache the results by setting self.participants - def get_participants(self) -> list: - pass + Args: + cached_data (Dict[int, Dict[ChecksumAddress, float]]): Dictionary mapping block numbers + to user balances at that block. Used to avoid recomputing known balances. + The inner dictionary maps user addresses to their token balance. + blocks (List[int]): List of block numbers to get balances for. + + Returns: + Dict[int, Dict[ChecksumAddress, float]]: Dictionary mapping block numbers to user balances, + where each inner dictionary maps user addresses to their token balance + at that block. + """ + # TODO: Implement your logic here + return {} if __name__ == "__main__": # TODO: Write simple tests for the integration - example_integration = ProtocolNameIntegration() - print(example_integration.get_participants()) + example_integration = ProtocolNameIntegration( + integration_id=IntegrationID.EXAMPLE, + start_block=20000000, + summary_cols=[SummaryColumn.TEMPLATE_PTS], + chain=Chain.ETHEREUM, + reward_multiplier=20, + excluded_addresses={ + Web3.to_checksum_address("0x0000000000000000000000000000000000000000") + }, + end_block=40000000, + ) + print( + example_integration.get_block_balances( + cached_data={}, blocks=[20000000, 20000001, 20000002] + ) + ) + # Example output: + # { + # 20000000: {"0x123": 100, "0x456": 200}, + # 20000001: {"0x123": 101, "0x456": 201}, + # 20000002: {"0x123": 102, "0x456": 202}, + # } + print( - example_integration.get_balance( - list(example_integration.get_participants())[0], 20000001 + example_integration.get_block_balances( + cached_data={ + 20000000: { + Web3.to_checksum_address("0x123"): 100, + Web3.to_checksum_address("0x456"): 200, + }, + 20000001: { + Web3.to_checksum_address("0x123"): 101, + Web3.to_checksum_address("0x456"): 201, + }, + }, + blocks=[20000002], ) ) + # Example output: + # { + # 20000002: {"0x123": 102, "0x456": 202}, + # } diff --git a/integrations/term_susde.py b/integrations/term_susde.py index c361097..8ec9777 100644 --- a/integrations/term_susde.py +++ b/integrations/term_susde.py @@ -1,11 +1,10 @@ -from typing import List import requests from constants.chains import Chain -from constants.integration_ids import IntegrationID +from integrations.integration_ids import IntegrationID from constants.integration_token import Token from constants.summary_columns import SummaryColumn -from models.integration import Integration - +from integrations.integration import Integration +from web3 import Web3 ############################################################################### # Integration helpers ######################################################### @@ -90,20 +89,21 @@ """ collateral_token_addresses = { - Token.SUSDE: "0x9d39a5de30e57443bff2a8307a4256c8797a3497", # Mainnet address for SUSDE + Token.SUSDE: "0x9d39a5de30e57443bff2a8307a4256c8797a3497", # Mainnet address for SUSDE # Token.USDE: "0x7e7e112A68d8D2E221E11047f6E4D7a8eB2dC5e1", # Unsupported # Token.ENA: "0x5e0489aF6e9fd2177eA34aa7A3fD5cD205e3fEe6", # Unsupported } + # Helper for making graphql queries def fetch_data(url, query): - response = requests.post(url, json={'query': query}) + response = requests.post(url, json={"query": query}) if response.status_code == 200: response_json = response.json() - if 'data' not in response_json: + if "data" not in response_json: print(f"Query failed with response: {response_json}") return None - return response_json['data'] + return response_json["data"] else: print(f"Query failed with status code {response.status_code}") return None @@ -113,27 +113,26 @@ def fetch_data(url, query): # TermFinance integration ##################################################### ############################################################################### -class TermFinanceIntegration( - Integration -): + +class TermFinanceIntegration(Integration): def __init__(self): repo_lockers_response = fetch_data( url=term_finance_subgraph_url_mainnet, query=repo_lockers_query, ) - repo_lockers = [] + repo_lockers = set() if repo_lockers_response is not None: - for result in repo_lockers_response['termRepos']: - repo_lockers.append(result['termRepoLocker']) + for result in repo_lockers_response["termRepos"]: + repo_lockers.add(Web3.to_checksum_address(result["termRepoLocker"])) super().__init__( integration_id=IntegrationID.TERM_SUSDE, start_block=16380765, chain=Chain.ETHEREUM, summary_cols=None, - reward_multiplier=20, # TODO: Change 20 to the sats multiplier for the protocol that has been agreed upon - balance_multiplier=1, # TODO: Almost always 1, optionally change to a different value if an adjustment needs to be applied to balances + reward_multiplier=20, # TODO: Change 20 to the sats multiplier for the protocol that has been agreed upon + balance_multiplier=1, # TODO: Almost always 1, optionally change to a different value if an adjustment needs to be applied to balances excluded_addresses=repo_lockers, - end_block=None, # No end block, protocol is still active + end_block=None, # No end block, protocol is still active reward_multiplier_func=None, # reward_multiplier should be the same across blocks ) @@ -151,16 +150,16 @@ def get_balance(self, user: str, block: int) -> float: # Add the results together (amount + amountLocked) to get the total balance total_balance = 0 if balance_results is not None: - for result in balance_results['termRepoCollaterals']: - total_balance += int(result['amountLocked']) - for result in balance_results['termBidCollaterals']: - total_balance += int(result['amount']) + for result in balance_results["termRepoCollaterals"]: + total_balance += int(result["amountLocked"]) + for result in balance_results["termBidCollaterals"]: + total_balance += int(result["amount"]) else: print(f"Failed to get balance for user {user} at block {block}") return total_balance - - def get_participants(self) -> list: + + def get_participants(self, blocks: list[int] | None) -> set[str]: # Make two queries: one to get borrower repo collateral and one to get borrower bid collateral participants_results = fetch_data( url=term_finance_subgraph_url_mainnet, @@ -172,14 +171,14 @@ def get_participants(self) -> list: # Build a set of all possible borrowers (de-duplicating them during set add) participants = set() if participants_results is not None: - for result in participants_results['termRepoCollaterals']: - participants.add(result['repoExposure']['borrower']) - for result in participants_results['termBidCollaterals']: - participants.add(result['bid']['bidder']) + for result in participants_results["termRepoCollaterals"]: + participants.add(result["repoExposure"]["borrower"]) + for result in participants_results["termBidCollaterals"]: + participants.add(result["bid"]["bidder"]) else: - print(f"Failed to get participants") + print("Failed to get participants") - return list(participants) + return participants def get_id(self) -> IntegrationID: return self.integration_id @@ -196,33 +195,9 @@ def get_col_name(self) -> str: def get_chain(self) -> Chain: return self.chain - def get_summary_cols(self) -> list[SummaryColumn]: - return self.summary_cols - - def get_reward_multiplier(self, block: int) -> int: - if self.reward_multiplier_func is not None: - return self.reward_multiplier_func(block) - return self.reward_multiplier - - def get_balance_multiplier(self) -> int: - return self.balance_multiplier - - def get_start_block(self) -> int: - return self.start_block - - def get_end_block(self) -> int: - if self.end_block is None: - return ( - 2**31 - 1 - ) # if no end block is specified, return the maximum possible block number - return self.end_block - - def get_excluded_addresses(self) -> List[str]: - return self.excluded_addresses - def is_user_a_participant(self, user: str) -> bool: if self.participants is None: - self.get_participants() + self.get_participants(None) return user in self.participants @@ -232,5 +207,9 @@ def is_user_a_participant(self, user: str) -> bool: if __name__ == "__main__": example_integration = TermFinanceIntegration() - print(example_integration.get_participants()) - print(example_integration.get_balance(list(example_integration.get_participants())[0], 20169604)) + print(example_integration.get_participants(None)) + print( + example_integration.get_balance( + list(example_integration.get_participants(None))[0], 20169604 + ) + ) diff --git a/integrations/upshift_upsusde_integration.py b/integrations/upshift_upsusde_integration.py new file mode 100644 index 0000000..8824507 --- /dev/null +++ b/integrations/upshift_upsusde_integration.py @@ -0,0 +1,138 @@ +import json +import logging +from copy import deepcopy +from typing import Callable, Dict, List, Optional, Set + +from eth_typing import ChecksumAddress +from web3 import Web3 +from utils.web3_utils import w3 + +from constants.chains import Chain +from constants.example_integrations import PAGINATION_SIZE +from constants.summary_columns import SummaryColumn +from integrations.cached_balances_integration import CachedBalancesIntegration +from integrations.integration_ids import IntegrationID +from utils.web3_utils import fetch_events_logs_with_retry + +UPSUSDE_ADDRESS = Web3.to_checksum_address("0xd684AF965b1c17D628ee0d77cae94259c41260F4") +with open("abi/ERC4626_abi.json") as f: + ERC4626_ABI = json.load(f) + +UPSUSDE_CONTRACT = w3.eth.contract( + address=UPSUSDE_ADDRESS, + abi=ERC4626_ABI, +) +ZERO_ADDRESS = Web3.to_checksum_address("0x0000000000000000000000000000000000000000") + + +class UpshiftupsUSDeIntegration(CachedBalancesIntegration): + def __init__( + self, + integration_id: IntegrationID, + start_block: int, + chain: Chain = Chain.ETHEREUM, + summary_cols: Optional[List[SummaryColumn]] = None, + reward_multiplier: int = 1, + balance_multiplier: int = 1, + excluded_addresses: Optional[Set[ChecksumAddress]] = None, + end_block: Optional[int] = None, + ethereal_multiplier: int = 0, + ethereal_multiplier_func: Optional[Callable[[int, str], int]] = None, + ): + super().__init__( + integration_id, + start_block, + chain, + summary_cols, + reward_multiplier, + balance_multiplier, + excluded_addresses, + end_block, + ethereal_multiplier, + ethereal_multiplier_func, + ) + + def get_block_balances( + self, cached_data: Dict[int, Dict[ChecksumAddress, float]], blocks: List[int] + ) -> Dict[int, Dict[ChecksumAddress, float]]: + logging.info("Getting block data for upSUSDe") + new_block_data: Dict[int, Dict[ChecksumAddress, float]] = {} + if not blocks: + logging.error("No blocks provided to get_block_balances") + return new_block_data + sorted_blocks = sorted(blocks) + cache_copy: Dict[int, Dict[ChecksumAddress, float]] = deepcopy(cached_data) + for block in sorted_blocks: + total_supply = UPSUSDE_CONTRACT.functions.totalSupply().call( + block_identifier=block + ) + total_assets = UPSUSDE_CONTRACT.functions.totalAssets().call( + block_identifier=block + ) + + # convert balance of upsUSDe to implied sUSDe for this block + assets_per_share = total_assets / total_supply if total_supply != 0 else 0 + + # find the closest prev block in the data + # list keys parsed as ints and in descending order + sorted_existing_blocks = sorted( + cache_copy, + reverse=True, + ) + # loop through the sorted blocks and find the closest previous block + prev_block = self.start_block + start = prev_block + bals = {} + for existing_block in sorted_existing_blocks: + if existing_block < block: + prev_block = existing_block + start = existing_block + 1 + bals = deepcopy(cache_copy[prev_block]) + break + + # parse transfer events since and update bals + while start <= block: + to_block = min(start + PAGINATION_SIZE, block) + # print(f"Fetching transfers from {start} to {to_block}") + transfers = fetch_events_logs_with_retry( + "Token transfers upsUSDe", + UPSUSDE_CONTRACT.events.Transfer(), + start, + to_block, + ) + for transfer in transfers: + recipient = transfer["args"]["to"] + sender = transfer["args"]["from"] + value = transfer["args"]["value"] / 10**18 + if recipient not in bals: + bals[recipient] = 0 + if sender not in bals: + bals[sender] = 0 + bals[recipient] += round(value, 4) + bals[sender] -= round(value, 4) + start = to_block + 1 + cache_copy[block] = bals + + converted_bals = {} + for addr, bal in bals.items(): + converted_bals[addr] = max(bal * assets_per_share, 0) + new_block_data[block] = converted_bals + + return new_block_data + + +if __name__ == "__main__": + example_integration = UpshiftupsUSDeIntegration( + integration_id=IntegrationID.UPSHIFT_UPSUSDE, + start_block=21324190, # contract deployment + summary_cols=[SummaryColumn.TEMPLATE_PTS], + chain=Chain.ETHEREUM, + reward_multiplier=20, + excluded_addresses={ZERO_ADDRESS, UPSUSDE_ADDRESS}, + end_block=None, + ) + print( + example_integration.get_block_balances( + cached_data={}, blocks=[21324292, 21324963] + ) + ) diff --git a/integrations/velodrome_mode_susde.py b/integrations/velodrome_mode_susde.py new file mode 100644 index 0000000..feb9737 --- /dev/null +++ b/integrations/velodrome_mode_susde.py @@ -0,0 +1,29 @@ +from constants.chains import Chain +from integrations.integration_ids import IntegrationID +from integrations.integration import Integration +from constants.velodrome import VELODROME_MODE_START_BLOCK, SUSDE_MODE_TOKEN +from utils.velodrome import fetch_balance, fetch_participants + + +class VelodromeIntegration(Integration): + def __init__(self): + super().__init__( + IntegrationID.VELODROME_MODE_SUSDE, + VELODROME_MODE_START_BLOCK, + Chain.MODE, + None, + 20, + 1, + None, + None, + ) + + def get_balance(self, user: str, block: int) -> float: + return fetch_balance(user, block, SUSDE_MODE_TOKEN) + + def get_participants(self, blocks: list[int] | None = None) -> set[str]: + return fetch_participants(SUSDE_MODE_TOKEN) + + +if __name__ == "__main__": + velodrome_integration = VelodromeIntegration() diff --git a/integrations/velodrome_mode_usde.py b/integrations/velodrome_mode_usde.py new file mode 100644 index 0000000..5b741b8 --- /dev/null +++ b/integrations/velodrome_mode_usde.py @@ -0,0 +1,33 @@ +from constants.chains import Chain +from integrations.integration_ids import IntegrationID +from integrations.integration import Integration +from constants.velodrome import VELODROME_MODE_START_BLOCK, USDE_MODE_TOKEN +from utils.velodrome import fetch_balance, fetch_participants + + +class VelodromeIntegration(Integration): + def __init__(self): + super().__init__( + IntegrationID.VELODROME_MODE_USDE, + VELODROME_MODE_START_BLOCK, + Chain.MODE, + None, + 20, + 1, + None, + None, + ) + + def get_balance(self, user: str, block: int) -> float: + return fetch_balance(user, block, USDE_MODE_TOKEN) + + def get_participants(self, blocks: list[int] | None) -> set[str]: + self.participants = fetch_participants(USDE_MODE_TOKEN) + return self.participants + + +if __name__ == "__main__": + velodrome_integration = VelodromeIntegration() + participants = velodrome_integration.get_participants(None) + print(participants) + print(velodrome_integration.get_balance(list(participants)[0], 10100000)) diff --git a/models/integration.py b/models/integration.py deleted file mode 100644 index d425370..0000000 --- a/models/integration.py +++ /dev/null @@ -1,40 +0,0 @@ -from abc import ABC, abstractmethod -from typing import List - -from constants.chains import Chain -from constants.integration_ids import IntegrationID -from constants.summary_columns import SummaryColumn - - -class Integration(ABC): - - def __init__( - self, - integration_id: IntegrationID, - start_block: int, - chain: Chain, - summary_cols: list[SummaryColumn], - reward_multiplier: int = 1, - balance_multiplier: int = 1, - excluded_addresses: List[str] = None, - end_block: int = None, - reward_multiplier_func=None, - ): - self.integration_id = integration_id - self.start_block = start_block - self.end_block = end_block - self.participants = None - self.chain = chain - self.summary_cols = summary_cols - self.reward_multiplier = reward_multiplier - self.balance_multiplier = balance_multiplier - self.excluded_addresses = excluded_addresses - self.reward_multiplier_func = reward_multiplier_func - - @abstractmethod - def get_balance(self, user: str, block: int) -> float: - pass - - @abstractmethod - def get_participants(self) -> list: - pass diff --git a/requirements.txt b/requirements.txt index fe5a087..bf1b473 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,7 @@ DateTime~=4.9 web3~=6.19.0 python-dotenv~=1.0.0 -requests~=2.31.0 -tqdm~=4.66.4 \ No newline at end of file +requests==2.32.0 +tqdm~=4.66.4 +rich==13.7.1 +types-requests==2.31.0.6 diff --git a/utils/allstake.py b/utils/allstake.py new file mode 100644 index 0000000..b861add --- /dev/null +++ b/utils/allstake.py @@ -0,0 +1,101 @@ +from utils.web3_utils import ( + W3_BY_CHAIN, + fetch_events_logs_with_retry, +) +from web3.contract import Contract +from utils.web3_utils import call_with_retry +import logging +from constants.chains import Chain +from integrations.integration_ids import IntegrationID +from constants.allstake import ALLSTAKE_STRATEGIES +from integrations.integration import Integration +from decimal import Decimal + + +SHARES_OFFSET = 1000 +BALANCE_OFFSET = 1000 + + +def get_underlying_balance( + user: str, block: int, underlying: Contract, strategy: Contract +): + """ + User's underlying token balance = underlying token balance of strategy contract * strategy.balanceOf(user) / strategy.totalSupply() + """ + + total_underlying_balance = ( + call_with_retry(underlying.functions.balanceOf(strategy.address), block) + + BALANCE_OFFSET + ) + total_shares = ( + call_with_retry(strategy.functions.totalSupply(), block) + SHARES_OFFSET + ) + user_shares = call_with_retry(strategy.functions.balanceOf(user), block) + return Decimal(user_shares * total_underlying_balance) / Decimal(total_shares) + + +def get_strategy_users( + start_block: int, page_size: int, strategy: Contract, chain: Chain +): + """ + Gets all participants that have ever interacted with the strategy by fetching all transfer events. + """ + all_users = set() + + target_block = W3_BY_CHAIN[chain]["w3"].eth.get_block_number() + + while start_block < target_block: + to_block = min(start_block + page_size, target_block) + event_label = f"Getting participants from {start_block} to {to_block}" + + transfers = fetch_events_logs_with_retry( + event_label, + strategy.events.Transfer(), + start_block, + to_block, + ) + print(event_label, ": found", len(transfers), "transfers") + for transfer in transfers: + to = transfer["args"]["to"] + # exclude strategy contract address + if to != strategy.address: + all_users.add(to) + start_block += page_size + return all_users + + +class AllstakeIntegration(Integration): + def __init__(self, integration_id: IntegrationID): + self.strategy_info = ALLSTAKE_STRATEGIES[integration_id] + + print(self.strategy_info) + + super().__init__( + integration_id=integration_id, + start_block=self.strategy_info["start"], + chain=self.strategy_info["chain"], + summary_cols=None, + reward_multiplier=20, + balance_multiplier=1, + ) + + def get_balance(self, user: str, block: int) -> float: + return get_underlying_balance( + user, + block, + self.strategy_info["underlying"], + self.strategy_info["strategy"], + ) + + def get_participants(self, blocks: list[int] | None) -> set[str]: + logging.info( + f"[{self.integration_id.get_description()}] Getting participants..." + ) + self.participants = get_strategy_users( + self.start_block, + self.strategy_info["page_size"], + self.strategy_info["strategy"], + self.chain, + ) + + return self.participants diff --git a/utils/balancer.py b/utils/balancer.py new file mode 100644 index 0000000..5d3456c --- /dev/null +++ b/utils/balancer.py @@ -0,0 +1,117 @@ +import json +from web3 import Web3 + +from constants.chains import Chain +from constants.balancer import AURA_VOTER_PROXY, BALANCER_VAULT +from utils.web3_utils import W3_BY_CHAIN, fetch_events_logs_with_retry, call_with_retry + + +with open("abi/ERC20_abi.json") as f: + erc20_abi = json.load(f) + +with open("abi/balancer_vault.json") as f: + vault_abi = json.load(f) + +with open("abi/balancer_csp.json") as f: + composable_abi = json.load(f) + +PAGE_SIZE = 1900 + +ZERO_ADRESS = "0x0000000000000000000000000000000000000000" + + +def get_vault_pool_token_balance( + chain: Chain, pool_id: str, token_address: str, block: int | str +) -> float: + w3 = W3_BY_CHAIN[chain]["w3"] + + vaut_contract = w3.eth.contract( + address=w3.to_checksum_address(BALANCER_VAULT), abi=vault_abi + ) + + tokens, balances, _ = call_with_retry( + vaut_contract.functions.getPoolTokens(pool_id), + block, + ) + + try: + token_index = tokens.index(token_address) + return balances[token_index] + except ValueError: + raise ValueError(f"Token {token_address} not found in the Pool {pool_id}") + + +def get_user_balance( + chain: Chain, user: str, token_address: str, block: int | str +) -> float: + w3 = W3_BY_CHAIN[chain]["w3"] + + token_contract = w3.eth.contract( + address=w3.to_checksum_address(token_address), abi=erc20_abi + ) + + user_balance = call_with_retry( + token_contract.functions.balanceOf(user), + block, + ) + + return user_balance + + +def get_bpt_supply( + chain: Chain, bpt_address: str, has_preminted_bpts: bool, block: int | str +) -> float: + w3 = W3_BY_CHAIN[chain]["w3"] + + if has_preminted_bpts: + bpt_contract = w3.eth.contract( + address=Web3.to_checksum_address(bpt_address), abi=composable_abi + ) + + bpt_supply = call_with_retry( + bpt_contract.functions.getActualSupply(), + block, + ) + else: + bpt_contract = w3.eth.contract( + address=Web3.to_checksum_address(bpt_address), abi=erc20_abi + ) + + bpt_supply = call_with_retry( + bpt_contract.functions.totalSupply(), + block, + ) + + return bpt_supply + + +def get_potential_token_holders( + chain: Chain, token_address: str, start_block: int +) -> list: + w3 = W3_BY_CHAIN[chain]["w3"] + + token_contract = w3.eth.contract( + address=Web3.to_checksum_address(token_address), abi=erc20_abi + ) + + token_holders = set() + latest_block = w3.eth.get_block_number() + + while start_block < latest_block: + to_block = min(start_block + PAGE_SIZE, latest_block) + transfers = fetch_events_logs_with_retry( + f"Getting Balancer Staked BPT Holders {token_address}", + token_contract.events.Transfer(), + start_block, + to_block, + ) + + print(start_block, to_block, len(transfers), "Getting Balancer ERC20 Transfers") + + for transfer in transfers: + if transfer["args"]["to"] not in [AURA_VOTER_PROXY[chain], ZERO_ADRESS]: + token_holders.add(transfer["args"]["to"]) + + start_block += PAGE_SIZE + + return list(token_holders) diff --git a/utils/beefy.py b/utils/beefy.py new file mode 100644 index 0000000..8189992 --- /dev/null +++ b/utils/beefy.py @@ -0,0 +1,58 @@ +import requests +from constants.chains import Chain +from integrations.integration import Integration +from integrations.integration_ids import IntegrationID + +from constants.beefy import BEEFY_LRT_API_URL + +CHAIN_TO_API_URL_PREFIX = { + Chain.ARBITRUM: f"{BEEFY_LRT_API_URL}/api/v2/partner/ethena/arbitrum", + Chain.FRAXTAL: f"{BEEFY_LRT_API_URL}/api/v2/partner/ethena/fraxtal", + Chain.MANTLE: f"{BEEFY_LRT_API_URL}/api/v2/partner/ethena/mantle", + Chain.OPTIMISM: f"{BEEFY_LRT_API_URL}/api/v2/partner/ethena/optimism", +} + + +class BeefyIntegration(Integration): + def __init__( + self, + integration_id: IntegrationID, + start_block: int, + chain: Chain, + ): + super().__init__( + integration_id, + start_block, + chain, + None, + 20, + 1, + None, + None, + ) + + def get_balance(self, user: str, block: int) -> float: + """ + Get the balance of a user at a given block + """ + + base_url = CHAIN_TO_API_URL_PREFIX[self.chain] + url = f"{base_url}/user/{user}/balance/{block}" + response = requests.get(url) + data = response.json() + + return float(data["effective_balance"]) + + def get_participants(self, blocks: list[int] | None) -> set[str]: + """ + Get all participants of the protocol, ever. + This function should only be called once and should cache the results by setting self.participants + """ + base_url = CHAIN_TO_API_URL_PREFIX[self.chain] + url = f"{base_url}/users" + response = requests.get(url) + data = response.json() + + self.participants = data + + return data diff --git a/utils/curve.py b/utils/curve.py new file mode 100644 index 0000000..8b14984 --- /dev/null +++ b/utils/curve.py @@ -0,0 +1,173 @@ +import json +from dataclasses import dataclass +from typing import List + +from web3 import Web3 + +from constants.summary_columns import SummaryColumn +from constants.curve import RewardContractConfig + +from integrations.integration import Integration + +from utils.web3_utils import ( + W3_BY_CHAIN, + fetch_events_logs_with_retry, + call_with_retry, + multicall, +) + + +@dataclass(frozen=True) +class UserState: + address: str + state: tuple + block: int + + def __init__(self, address: str, state: list, block: int): + object.__setattr__(self, "address", address) + object.__setattr__(self, "state", tuple(state)) + object.__setattr__(self, "block", block) + + def __hash__(self): + return hash((self.address, self.state, self.block)) + + +class Curve(Integration): + """ + Base class for Curve integrations. + """ + + def __init__( + self, + reward_config: RewardContractConfig, + ): + """ + Initialize the Curve integration. + + Args: + reward_config (RewardContractConfig): The configuration for the reward contract. + """ + + super().__init__( + integration_id=reward_config.integration_id, + start_block=reward_config.genesis_block, + chain=reward_config.chain, + summary_cols=[SummaryColumn.CURVE_LLAMALEND_SHARDS], + ) + + self.w3 = W3_BY_CHAIN[self.chain]["w3"] + self.reward_config = reward_config + with open(self.reward_config.abi_filename, "r") as f: + abi = json.load(f) + self.contract = self.w3.eth.contract( + address=Web3.to_checksum_address(self.reward_config.address), abi=abi + ) + self.contract_function = self.contract.functions.user_state + self.contract_event = self.contract.events.Borrow() + self.start_state: List[UserState] = [] + self.last_indexed_block: int = 0 + + def get_balance(self, user: str, block: int) -> float: + """ + Retrieve the collateral balance for a user at a specific block. + + Args: + user (str): EVM address of the user. + block (int): Block number to query the balance at. + + Returns: + float: The user's collateral balance in wei. + """ + return self.get_user_state(user, block)[self.reward_config.state_arg_no] + + def get_user_states(self, block: int) -> list: + """ + Retrieve user states for all participants at a specific block. + + Args: + block (int): Block number to query the balances at. + + Returns: + List[Tuple[str, float]]: A list of tuples containing (address, balance) pairs. + """ + + self.get_participants() # Ensure participants list is up to date + + calls = [ + (self.contract, self.contract_function.fn_name, [user_info.address]) + for user_info in self.start_state + ] + results = multicall(self.w3, calls, block) + + states = [] + for user_info, result in zip(self.start_state, results): + states.append( + UserState( + address=user_info.address, + state=result[self.reward_config.state_arg_no], + block=block, + ) + ) + + return states + + def get_user_state(self, user: str, block: int) -> list: + """ + Retrieve the collateral balance for a user at a specific block. + + Args: + user (str): EVM address of the user. + block (int): Block number to query the balance at. + + Returns: + float: The user's collateral balance in wei. + """ + return call_with_retry( + self.contract_function(user), + block, + ) + + def get_current_block(self) -> int: + return self.w3.eth.get_block_number() + + def get_participants(self, blocks: list[int] | None = None) -> set[str]: + """ + Fetch all participants who have borrowed from the LlamaLend market. + + Returns: + list: A list of unique Ethereum addresses that have borrowed. + """ + page_size = 50000 + current_block = self.get_current_block() + if self.last_indexed_block == current_block: + return {user_info.address for user_info in self.start_state} + + start_block = max(self.start_block, self.last_indexed_block + 1) + + all_users = set() + while start_block <= current_block: + to_block = min(start_block + page_size, current_block) + events = fetch_events_logs_with_retry( + f"Curve LlamaLend {self.chain.name} {self.integration_id.get_description()} " + f"market borrowers from its genesis block " + f"({start_block}) to the current block ({to_block})", + self.contract_event, + start_block, + to_block, + ) + for event in events: + user = event["args"][self.reward_config.event_arg_name] + block = event["blockNumber"] + all_users.add( + UserState( + address=user, + state=self.get_user_state(user, block), + block=block, + ) + ) + start_block += page_size + + self.start_state.extend(all_users) + self.last_indexed_block = current_block + + return {user_info.address for user_info in self.start_state} diff --git a/utils/equilibria.py b/utils/equilibria.py index 85eafa3..5ee1410 100644 --- a/utils/equilibria.py +++ b/utils/equilibria.py @@ -1,6 +1,6 @@ from constants.chains import Chain -from constants.integration_ids import IntegrationID -from models.integration import Integration +from integrations.integration_ids import IntegrationID +from integrations.integration import Integration from constants.equilibria import PENDLE_LOCKER_ETHEREUM from constants.equilibria import equilibria_deposit_ethereum import json @@ -8,9 +8,10 @@ fetch_events_logs_with_retry, call_with_retry, w3, - w3_arb, ) -from typing import List +from typing import Optional, Set +from web3 import Web3 +from eth_typing import ChecksumAddress with open("abi/equilibria_deposit.json") as f: equilibria_deposit = json.load(f) @@ -24,32 +25,31 @@ class EquilibriaIntegration(Integration): def __init__( - self, - integration_id: IntegrationID, - start_block: int, - lp_contract: str, - lp_contract_id: int, - chain: Chain, - reward_multiplier: int, - balance_multiplier: int, - excluded_addresses: List[str], + self, + integration_id: IntegrationID, + start_block: int, + lp_contract: str, + lp_contract_id: int, + chain: Chain, + reward_multiplier: int, + balance_multiplier: int, + excluded_addresses: Optional[Set[ChecksumAddress]] = None, ): super().__init__( - integration_id, - start_block, - chain, - None, - reward_multiplier, - balance_multiplier, - excluded_addresses, - None, - None, + integration_id=integration_id, + start_block=start_block, + chain=chain, + reward_multiplier=reward_multiplier, + balance_multiplier=balance_multiplier, + excluded_addresses=excluded_addresses, ) - self.lp_contract = lp_contract + self.lp_contract = Web3.to_checksum_address(lp_contract) self.lp_contract_id = lp_contract_id - def get_balance(self, user: str, block: int) -> float: - equilibria_deposit_contract = w3.eth.contract(address=equilibria_deposit_ethereum, abi=equilibria_deposit) + def get_balance(self, user: str, block: int | str = "latest") -> float: + equilibria_deposit_contract = w3.eth.contract( + address=equilibria_deposit_ethereum, abi=equilibria_deposit + ) # Get lpt token address from Stake DAO vault poolInfo = call_with_retry( @@ -99,9 +99,9 @@ def get_balance(self, user: str, block: int) -> float: print("total_active_supply is 0") return 0 - lockerSyBalance = round(((sy_bal / 10 ** 18) * lpt_bal) / total_active_supply, 4) - print(sy_bal / 10 ** 18) - print(lpt_bal / 10 ** 18) + lockerSyBalance = round(((sy_bal / 10**18) * lpt_bal) / total_active_supply, 4) + print(sy_bal / 10**18) + print(lpt_bal / 10**18) receipt_contract = w3.eth.contract(address=self.lp_contract, abi=erc20_abi) @@ -111,30 +111,30 @@ def get_balance(self, user: str, block: int) -> float: block, ) - print('equilibria_pool_TotalSupply', equilibria_pool_TotalSupply) + print("equilibria_pool_TotalSupply", equilibria_pool_TotalSupply) # Get gauge user balance user_equilibria_pool_bal = call_with_retry( receipt_contract.functions.balanceOf(user), block, ) - print('user_equilibria_pool_bal', user_equilibria_pool_bal) + print("user_equilibria_pool_bal", user_equilibria_pool_bal) # Get user share based on gauge#totalSupply / gauge#balanceOf(user) and lockerSyBalance userShare = user_equilibria_pool_bal * 100 / equilibria_pool_TotalSupply # print(user, userShare * lpt_bal / 100) - print('userShare lockerSyBalance:', userShare * lockerSyBalance / 100) - print('-------------------------------------------------') + print("userShare lockerSyBalance:", userShare * lockerSyBalance / 100) + print("-------------------------------------------------") return userShare * lockerSyBalance / 100 - def get_participants(self) -> list: + def get_participants(self, blocks: list[int] | None) -> set[str]: if self.participants is not None: return self.participants self.participants = self.get_equilibria_participants() return self.participants - def get_equilibria_participants(self): + def get_equilibria_participants(self) -> set[str]: all_users = set() start = self.start_block @@ -149,13 +149,18 @@ def get_equilibria_participants(self): start, to_block, ) - print('deposits', deposits) - print(start, to_block, len(deposits), "getting Equilibria Finance contract data") + print("deposits", deposits) + print( + start, + to_block, + len(deposits), + "getting Equilibria Finance contract data", + ) for deposit in deposits: - if (deposit["args"]["_user"]): + if deposit["args"]["_user"]: all_users.add(deposit["args"]["_user"]) print(deposit["args"]["_user"]) start += page_size - print('all_users', len(all_users)) - print('-------------------------------------------------') + print("all_users", len(all_users)) + print("-------------------------------------------------") return all_users diff --git a/utils/firm.py b/utils/firm.py new file mode 100644 index 0000000..70d7c66 --- /dev/null +++ b/utils/firm.py @@ -0,0 +1,27 @@ +import json +from web3 import Web3 +from utils.web3_utils import ( + w3, +) + +from constants.firm import SUSDE_MARKET_ADDRESS + +with open("abi/firm_market.json") as f: + firm_market_abi = json.load(f) + +with open("abi/firm_simple_escrow.json") as f: + firm_simple_escrow_abi = json.load(f) + + +firm_susde_market_contract = w3.eth.contract( + address=SUSDE_MARKET_ADDRESS, abi=firm_market_abi +) + + +def get_escrow_contract(user_address: str): + escrow_address: str = firm_susde_market_contract.functions.escrows( + user_address + ).call() + return w3.eth.contract( + address=Web3.to_checksum_address(escrow_address), abi=firm_simple_escrow_abi + ) diff --git a/utils/fluid.py b/utils/fluid.py new file mode 100644 index 0000000..c0940ac --- /dev/null +++ b/utils/fluid.py @@ -0,0 +1,18 @@ +import json +from utils.web3_utils import ( + w3, +) +from constants.fluid import vaultResolver, vaultPositionResolver, dexResolver + +with open("abi/fluid_vault_resolver.json") as f: + resolver_abi = json.load(f) + +with open("abi/fluid_vault_position_resolver.json") as j: + position_resolver_abi = json.load(j) + +with open("abi/fluid_dex_resolver.json") as j: + dex_resolver_abi = json.load(j) + +vaultResolver_contract = w3.eth.contract(address=vaultResolver, abi=resolver_abi) +vaultPositionResolver_contract = w3.eth.contract(address = vaultPositionResolver, abi=position_resolver_abi) +dexResolver_contract = w3.eth.contract(address = dexResolver, abi=dex_resolver_abi) diff --git a/utils/gmx.py b/utils/gmx.py new file mode 100644 index 0000000..dccad49 --- /dev/null +++ b/utils/gmx.py @@ -0,0 +1,167 @@ +import json +from typing import List, Optional, Set +import requests +from constants.chains import Chain +from integrations.integration_ids import IntegrationID +from integrations.integration import Integration +from constants.summary_columns import SummaryColumn +from utils.web3_utils import w3_arb, fetch_events_logs_with_retry, call_with_retry +from web3.contract import Contract + +from constants.gmx import ( + GMX_SYNTHETICS_READER_CONTRACT_ADDRESS, + GMX_WSTETH_USDE_MARKET_ADDRESS, + GMX_DATA_STORE_CONTRACT_ADDRESS, + GMX_USDE_USDC_MARKET_ADDRESS, + GMX_MAX_PNL_FACTOR_FOR_TRADERS_KEY, + GMX_PRICES_ENDPOINT, +) + +with open("abi/gmx_gm_token.json") as f: + gmx_gm_token_abi = json.load(f) + +with open("abi/gmx_synthetics_reader_contract.json") as f: + gmx_synthetics_reader_contract_abi = json.load(f) + +gmx_usde_usdc_market_contract = w3_arb.eth.contract( + address=GMX_USDE_USDC_MARKET_ADDRESS, abi=gmx_gm_token_abi +) + +gmx_wsteth_usde_market_contract = w3_arb.eth.contract( + address=GMX_WSTETH_USDE_MARKET_ADDRESS, abi=gmx_gm_token_abi +) + +gmx_synthetics_reader_contract = w3_arb.eth.contract( + address=GMX_SYNTHETICS_READER_CONTRACT_ADDRESS, + abi=gmx_synthetics_reader_contract_abi, +) + + +def makePriceTuple(prices, token): + return ( + int(prices[token]["minPrice"]), + int(prices[token]["maxPrice"]), + ) + + +def getContract(contract_address) -> Optional[Contract]: + if contract_address == GMX_USDE_USDC_MARKET_ADDRESS: + return gmx_usde_usdc_market_contract + elif contract_address == GMX_WSTETH_USDE_MARKET_ADDRESS: + return gmx_wsteth_usde_market_contract + else: + return None + + +class GMXLPIntegration(Integration): + prices = None + market_address = None + market_contract = None + index_token_address = None + long_token_address = None + short_token_address = None + + def __init__( + self, + integration_id: IntegrationID, + start_block: int, + market_address: str, + index_token_address: str, + long_token_address: str, + short_token_address: str, + ): + super().__init__( + integration_id, + start_block, + Chain.ARBITRUM, + [SummaryColumn.GMX_ARBITRUM_SHARDS], + 20, + 1, + None, + None, + ) + self.market_address = market_address + self.market_contract = getContract(market_address) + self.index_token_address = index_token_address + self.long_token_address = long_token_address + self.short_token_address = short_token_address + + def get_balance(self, user: str, block: int) -> float: + marketPrices = self.fetchTokenPrices() + + marketParams = [ + self.market_address, + self.index_token_address, + self.long_token_address, + self.short_token_address, + ] + + marketTokenPrice = call_with_retry( + gmx_synthetics_reader_contract.functions.getMarketTokenPrice( + GMX_DATA_STORE_CONTRACT_ADDRESS, + marketParams, + makePriceTuple(marketPrices, self.index_token_address), + makePriceTuple(marketPrices, self.long_token_address), + makePriceTuple(marketPrices, self.short_token_address), + GMX_MAX_PNL_FACTOR_FOR_TRADERS_KEY, + False, + ) + ) + + if self.market_contract is None: + return 0 + user_token_balance = call_with_retry( + self.market_contract.functions.balanceOf(user), + block, + ) + + gm_token_price = marketTokenPrice[0] + oracle_price_decimals = 1e30 + + return gm_token_price * user_token_balance / oracle_price_decimals + + def get_participants( + self, + blocks: Optional[List[int]], + ) -> Set[str]: + if self.participants is not None: + return self.participants + + page_size = 1900 + start_block = self.start_block + target_block = w3_arb.eth.get_block_number() + + all_users: set[str] = set() + while start_block < target_block: + to_block = min(start_block + page_size, target_block) + transfers = fetch_events_logs_with_retry( + f"GMX V2 Arbitrum USDE/USDC LP users from {start_block} to {to_block}", + self.market_contract.events.Transfer(), + start_block, + to_block, + ) + for transfer in transfers: + all_users.add(transfer["args"]["to"]) + start_block += page_size + + all_users = list(all_users) + self.participants = all_users + return all_users + + def fetchTokenPrices(self): + if self.prices: + return self.prices + + response = requests.get(GMX_PRICES_ENDPOINT) + + if response.status_code == 200: + pricesCollection = response.json() + pricesDict = {item["tokenAddress"]: item for item in pricesCollection} + self.prices = pricesDict + return self.prices + + print( + f"GMX: failed to fetch token prices with status code {response.status_code}" + ) + + return None diff --git a/utils/hyperdrive.py b/utils/hyperdrive.py new file mode 100644 index 0000000..2042c5c --- /dev/null +++ b/utils/hyperdrive.py @@ -0,0 +1,190 @@ +import itertools +from decimal import Decimal, getcontext + +from dotenv import load_dotenv + +from constants.hyperdrive import ERC20_ABI, HYPERDRIVE_MORPHO_ABI, HyperdrivePrefix +from utils.web3_utils import fetch_events_logs_with_retry, w3 + +load_dotenv() + +PAGE_SIZE = 1900 +getcontext().prec = 100 # Set precision for Decimal calculations + + +def get_first_contract_block(contract_address): + # do binary search up to latest block + latest_block: int = w3.eth.get_block_number() + earliest_block: int = 0 + while earliest_block < latest_block: + mid_block: int = (earliest_block + latest_block) // 2 + attempt_to_get_code = w3.eth.get_code( + account=contract_address, block_identifier=mid_block + ) + if attempt_to_get_code == b"": + # Contract not yet deployed, continue searching in the later blocks + earliest_block = mid_block + 1 + else: + # Contract deployed, continue searching in the earlier blocks + latest_block = mid_block - 1 + # At this point, earliest_block and latest_block should be the same, + # and it represents the block where we can first retrieve the contract code. + assert ( + earliest_block >= latest_block + ), f"something fucked up since {earliest_block=} isn't greater than or equal to {latest_block=}" + return earliest_block + + +def get_hyperdrive_participants(pool, start_block=None): + target_block: int = w3.eth.get_block_number() + all_users: set[str] = set() + all_ids: set[int] = set() + start_block = start_block or get_first_contract_block(pool) + assert all_users is not None, "error: all_users is None" + assert all_ids is not None, "error: all_ids is None" + assert start_block is not None, "error: start_block is None" + contract = w3.eth.contract(address=pool, abi=HYPERDRIVE_MORPHO_ABI) + + current_block = start_block + while current_block < target_block: + to_block = min(current_block + PAGE_SIZE, target_block) + transfers = fetch_events_logs_with_retry( + label=f"Hyperdrive users {pool}", + contract_event=contract.events.TransferSingle(), + from_block=current_block, + to_block=to_block, + delay=0, + ) + for transfer in transfers: + all_users.add(transfer["args"]["to"]) + all_ids.add(transfer["args"]["id"]) + current_block = to_block + + return all_users, all_ids + + +def decode_asset_id(asset_id: int) -> tuple[int, int]: + r"""Decodes a transaction asset ID into its constituent parts of an identifier, data, and a timestamp. + + First calculate the prefix mask by left-shifting 1 by 248 bits and subtracting 1 from the result. + This gives us a bit-mask with 248 bits set to 1 and the rest set to 0. + Then apply this mask to the input ID using the bitwise-and operator `&` to extract + the lower 248 bits as the timestamp. + + The prefix is a unique asset ID which denotes the following trade types: + LP = 0 + LONG = 1 + SHORT = 2 + WITHDRAWAL_SHARE = 3 + + Arguments + --------- + asset_id: int + Encoded ID from a transaction. It is a concatenation, [identifier: 8 bits][timestamp: 248 bits] + + Returns + ------- + tuple[int, int] + identifier, timestamp + """ + prefix_mask = (1 << 248) - 1 + prefix = asset_id >> 248 # shr 248 bits + timestamp = asset_id & prefix_mask # apply the prefix mask + return prefix, timestamp + + +def get_pool_details(pool_contract): + config_values = pool_contract.functions.getPoolConfig().call() + config_outputs = pool_contract.functions.getPoolConfig().abi["outputs"][0][ + "components" + ] + config_keys = [i["name"] for i in config_outputs if "name" in i] + config = dict(zip(config_keys, config_values)) + for k, v in config.items(): + print(f"{k}: {v}") + info_values = pool_contract.functions.getPoolInfo().call() + info_outputs = pool_contract.functions.getPoolInfo().abi["outputs"][0]["components"] + info_keys = [i["name"] for i in info_outputs if "name" in i] + info = dict(zip(info_keys, info_values)) + + # query pool holdings + vault_shares_balance = None + if config["vaultSharesToken"] != "0x0000000000000000000000000000000000000000": + vault_shares_contract = w3.eth.contract( + address=config["vaultSharesToken"], abi=ERC20_ABI + ) + vault_shares_balance = vault_shares_contract.functions.balanceOf( + pool_contract.address + ).call() + short_rewardable_tvl = info["shortsOutstanding"] + lp_rewardable_tvl = vault_shares_balance - short_rewardable_tvl + + return vault_shares_balance, lp_rewardable_tvl, short_rewardable_tvl + + +def get_pool_positions( + pool_contract, + pool_users, + pool_ids, + lp_rewardable_tvl, + short_rewardable_tvl, + block=None, +): + pool_positions = [] + combined_prefixes = [(0, 3), (2,)] # Treat prefixes 0 and 3 together, 2 separately + bal_by_prefix = {0: Decimal(0), 1: Decimal(0), 2: Decimal(0), 3: Decimal(0)} + + # First pass: collect balances + for user, id in itertools.product(pool_users, pool_ids): + trade_type, prefix, timestamp = get_trade_details(int(id)) + bal = pool_contract.functions.balanceOf(int(id), user).call( + block_identifier=block or "latest" + ) + if bal > Decimal(1): + pool_positions.append( + [user, trade_type, prefix, timestamp, bal, Decimal(0)] + ) + bal_by_prefix[prefix] += bal + + # Second pass: calculate shares (prefix 1 (longs) get nothing, so we skip it) + for position in pool_positions: + prefix = position[2] + if prefix in [0, 3]: # assign rewards for LPs and withdrawal shares + combined_lp_balance = ( + bal_by_prefix[0] + bal_by_prefix[3] + ) # combine LP and withdrawal share balance + if combined_lp_balance != Decimal(0): + share_of_rewardable = position[4] / combined_lp_balance + position[5] = (lp_rewardable_tvl * share_of_rewardable).quantize( + Decimal("0") + ) + elif prefix == 2: # assign rewards for shorts + if bal_by_prefix[2] != Decimal(0): + share_of_rewardable = position[4] / bal_by_prefix[2] + position[5] = (short_rewardable_tvl * share_of_rewardable).quantize( + Decimal("0") + ) + + # Correction step to fix rounding errors + for prefixes in combined_prefixes: + combined_shares = sum( + position[5] for position in pool_positions if position[2] in prefixes + ) + combined_rewardable = ( + lp_rewardable_tvl if prefixes[0] == 0 else short_rewardable_tvl + ) + if combined_shares != combined_rewardable: + diff = combined_rewardable - combined_shares + # Find the position with the largest share among the combined prefixes + max_position = max( + (p for p in pool_positions if p[2] in prefixes), key=lambda x: x[5] + ) + max_position[5] += diff + + return pool_positions + + +def get_trade_details(asset_id: int) -> tuple[str, int, int]: + prefix, timestamp = decode_asset_id(asset_id) + trade_type = HyperdrivePrefix(prefix).name + return trade_type, prefix, timestamp diff --git a/utils/lendle.py b/utils/lendle.py index 13c0f1c..fe99d33 100644 --- a/utils/lendle.py +++ b/utils/lendle.py @@ -1,4 +1,6 @@ import json +from web3.contract import Contract +from web3 import Web3 from utils.web3_utils import ( w3_mantle, ) @@ -9,5 +11,6 @@ erc20_abi = json.load(f) -lendle_usde_contract = w3_mantle.eth.contract(address=LENDLE_USDE_TOKEN, abi=erc20_abi) - +lendle_usde_contract: Contract = w3_mantle.eth.contract( + address=Web3.to_checksum_address(LENDLE_USDE_TOKEN), abi=erc20_abi +) diff --git a/utils/lyra.py b/utils/lyra.py new file mode 100644 index 0000000..977b88d --- /dev/null +++ b/utils/lyra.py @@ -0,0 +1,210 @@ +from utils.web3_utils import ( + W3_BY_CHAIN, + fetch_events_logs_with_retry, +) +import os + +import requests +from web3.contract import Contract +from utils.web3_utils import call_with_retry +from constants.chains import Chain +from web3 import Web3 + +url = "https://app.sentio.xyz/api/v1/graphql/derive/v2_subgraph" +SUSDE_VAULT_ADDRESS = Web3.to_checksum_address( + "0x0b4eD379da8eF4FCF06F697c5782CA7b4c3E505E" +) + +user_balance_query = """ +{ + accounts(where: {or: [{id: "{user}"}, {owner: "{user}"}]}, block: {number: {block}}) { + id + owner + subaccounts{ + subaccountId + balances(where:{asset: "0x375804cdcf0d534fdd2657584a7c4ff5ab14a2bb000000000000000000000000"}){ + balance + } + } + depositedSubaccounts{ + subaccountId + balances(where:{asset: "0x375804cdcf0d534fdd2657584a7c4ff5ab14a2bb000000000000000000000000"}){ + balance + } + } + } +} +""" + + +def get_exchange_balance(user: str, block: int) -> float: + user = user.lower() + # Replace the user and block placeholders in the query + user_balance_query_filled = user_balance_query.replace("{user}", user).replace( + "{block}", str(block) + ) + + headers = { + "Content-Type": "application/json", + "api-key": str(os.getenv("DERIVE_SUBGRAPH_API_KEY", "")), + } + print(user_balance_query_filled) + + # Send the POST request + response = requests.post( + url, json={"query": user_balance_query_filled}, headers=headers + ) + + total_balance = 0.0 + if response.status_code == 200: + response_json = response.json() + accounts = response_json["data"]["accounts"] + for account in accounts: + for subaccount in account["subaccounts"]: + for balance in subaccount["balances"]: + total_balance += float(balance["balance"]) + for subaccount in account["depositedSubaccounts"]: + for balance in subaccount["balances"]: + total_balance += float(balance["balance"]) + else: + print(f"Query failed with status code {response.status_code}: {response.text}") + return total_balance + + +def get_effective_balance( + user: str, + block: int, + integration_token: Contract, + bridge: Contract, + vault_token: Contract, + timestamp, +): + """ + Since vault tokens can be transferred, calculates the portion of totalSupply() of the vault held by user. + + User's effective ethena integration token balance = (vault.balanceOf(user) / vault.totalSupply()) * total bridge balance + + """ + user_vault_token_balance = call_with_retry( + vault_token.functions.balanceOf(user), block + ) + + headers = {"Content-Type": "application/json"} + + # Send the POST request + response = requests.post( + "https://api.lyra.finance/public/get_vault_share", + json={ + "from_timestamp_sec": 0, + "to_timestamp_sec": timestamp, + "vault_name": "sUSDePrincipal Protected Bull Call Spread", + "page_size": 1, + }, + headers=headers, + ) + try: + response_json = response.json() + vault_price = float(response_json["result"]["vault_shares"][0]["base_value"]) + except: + print("Failed to get vault price, using default") + vault_price = float(1) + + return user_vault_token_balance * vault_price / 1e18 + + +all_users_query = """ +{ + subAccountBalances(where: {asset: "0x375804cdcf0d534fdd2657584a7c4ff5ab14a2bb000000000000000000000000"}) { + subaccount { + id + owner { + id + owner + } + matchingOwner { + id + owner + } + } + } +} +""" + + +def get_exchange_users() -> set: + headers = { + "Content-Type": "application/json", + "api-key": str(os.getenv("DERIVE_SUBGRAPH_API_KEY", "")), + } + + response = requests.post(url, json={"query": all_users_query}, headers=headers) + + users = set() + if response.status_code == 200: + response_json = response.json() + balances = response_json["data"]["subAccountBalances"] + for balance in balances: + if balance["subaccount"]["matchingOwner"] is not None: + if balance["subaccount"]["matchingOwner"]["owner"] is not None: + users.add( + Web3.to_checksum_address( + balance["subaccount"]["matchingOwner"]["owner"] + ) + ) + else: + users.add( + Web3.to_checksum_address( + balance["subaccount"]["matchingOwner"]["id"] + ) + ) + else: + if balance["subaccount"]["owner"]["owner"] is not None: + users.add( + Web3.to_checksum_address( + balance["subaccount"]["owner"]["owner"] + ) + ) + else: + users.add( + Web3.to_checksum_address(balance["subaccount"]["owner"]["id"]) + ) + else: + print(f"Query failed with status code {response.status_code}: {response.text}") + + try: + users.remove( + SUSDE_VAULT_ADDRESS + ) # Ignore the sUSDe vault which is accounted for separately + except: + pass + + return users + + +def get_vault_users( + start_block: int, page_size: int, vault_token: Contract, chain: Chain +): + """ + Gets all participants that have ever interacted with the vault token by fetching all vault transfer events. + + Note: does not support cross-chain bridging of vault tokens. + """ + all_users = set() + + target_block = W3_BY_CHAIN[chain]["w3"].eth.get_block_number() + + while start_block < target_block: + to_block = min(start_block + page_size, target_block) + event_label = f"Getting Lyra participants from {start_block} to {to_block}" + + transfers = fetch_events_logs_with_retry( + event_label, + vault_token.events.Transfer(), + start_block, + to_block, + ) + print(event_label, ": found", len(transfers), "transfers") + for transfer in transfers: + all_users.add(transfer["args"]["to"]) + start_block += page_size + return all_users diff --git a/utils/merchantmoe.py b/utils/merchantmoe.py new file mode 100644 index 0000000..b5ff31a --- /dev/null +++ b/utils/merchantmoe.py @@ -0,0 +1,30 @@ +import json +from pathlib import Path + +from dotenv import load_dotenv + +from constants.merchantmoe import ( + MERCHANT_MOE_LIQUIDITY_HELPER_CONTRACT, + METH_USDE_MERCHANT_MOE_LBT_CONTRACT, +) +from utils.web3_utils import w3_mantle +from web3 import Web3 + +load_dotenv() + +merchant_moe_lb_pair_abi = json.load( + open(Path(__file__).parent.parent / "abi/merchant_moe_lb_pair.json") +) + +merchant_moe_liquidity_helper_abi = json.load( + open(Path(__file__).parent.parent / "abi/merchant_moe_liquidity_helper.json") +) + +lb_pair_contract = w3_mantle.eth.contract( + address=Web3.to_checksum_address(METH_USDE_MERCHANT_MOE_LBT_CONTRACT), + abi=merchant_moe_lb_pair_abi, +) +liquidity_helper_contract = w3_mantle.eth.contract( + address=Web3.to_checksum_address(MERCHANT_MOE_LIQUIDITY_HELPER_CONTRACT), + abi=merchant_moe_liquidity_helper_abi, +) diff --git a/utils/nuri.py b/utils/nuri.py index cc29084..340565e 100644 --- a/utils/nuri.py +++ b/utils/nuri.py @@ -1,6 +1,4 @@ -import os import json -from dotenv import load_dotenv from utils.web3_utils import ( w3_scroll, ) @@ -18,7 +16,4 @@ address=NURI_NFP_MANAGER_ADDRESS, abi=nfp_manager_abi ) -pool = w3_scroll.eth.contract( - address=NURI_POOL_ADDRESS, abi=pool_abi -) - +pool = w3_scroll.eth.contract(address=NURI_POOL_ADDRESS, abi=pool_abi) diff --git a/utils/pendle.py b/utils/pendle.py index f1c8e12..a404758 100644 --- a/utils/pendle.py +++ b/utils/pendle.py @@ -1,5 +1,6 @@ import os import json +from typing import Any, Dict from dotenv import load_dotenv from utils.web3_utils import ( W3_BY_CHAIN, @@ -8,6 +9,9 @@ w3_mantle, w3_arb, ) +from constants.chains import Chain +from web3.contract import Contract + from constants.pendle import ( LPT, @@ -128,195 +132,195 @@ usde_arb_SY_contract = w3_arb.eth.contract(address=usde_arb_SY, abi=erc20_abi) usde_arb_YT_contract = w3_arb.eth.contract(address=usde_arb_YT, abi=erc20_abi) -PENDLE_CONTRACT_AND_START_BY_LP_TOKEN = { +PENDLE_CONTRACT_AND_START_BY_LP_TOKEN: Dict[str, Dict[str, Any]] = { SY: { "start": PENDLE_USDE_JULY_DEPLOYMENT_BLOCK, "contract": sy_contract, - "chain": "eth", + "chain": Chain.ETHEREUM, "type": "sy", }, LPT: { "start": PENDLE_USDE_JULY_DEPLOYMENT_BLOCK, "contract": lpt_contract, - "chain": "eth", + "chain": Chain.ETHEREUM, "type": "lpt", "sats": 20, }, YT: { "start": PENDLE_USDE_JULY_DEPLOYMENT_BLOCK, "contract": yt_contract, - "chain": "eth", + "chain": Chain.ETHEREUM, "type": "yt", }, sUSDe_LPT: { "start": PENDLE_SUSDE_JULY_DEPLOYMENT_BLOCK, "contract": susde_lpt_contract, - "chain": "eth", + "chain": Chain.ETHEREUM, "type": "lpt", "sats": 20, }, sUSDe_SY: { "start": PENDLE_SUSDE_JULY_DEPLOYMENT_BLOCK, "contract": susde_sy_contract, - "chain": "eth", + "chain": Chain.ETHEREUM, "type": "sy", }, sUSDe_YT: { "start": PENDLE_SUSDE_JULY_DEPLOYMENT_BLOCK, "contract": susde_yt_contract, - "chain": "eth", + "chain": Chain.ETHEREUM, "type": "yt", }, SUSDE_LPT_SEPT: { "start": PENDLE_SUSDE_SEPT_DEPLOYMENT_BLOCK, "contract": SUSDE_LPT_SEPT_CONTRACT, - "chain": "eth", + "chain": Chain.ETHEREUM, "type": "lpt", "sats": 20, }, SUSDE_SY_SEPT: { "start": PENDLE_SUSDE_SEPT_DEPLOYMENT_BLOCK, "contract": SUSDE_SY_SEPT_CONTRACT, - "chain": "eth", + "chain": Chain.ETHEREUM, "type": "sy", }, SUSDE_YT_SEPT: { "start": PENDLE_SUSDE_SEPT_DEPLOYMENT_BLOCK, "contract": SUSDE_YT_SEPT_CONTRACT, - "chain": "eth", + "chain": Chain.ETHEREUM, "type": "yt", }, sUSDe_LPT_old: { "start": PENDLE_SUSDE_APRIL_DEPLOYMENT_BLOCK, "contract": susde_lpt_contract_old, - "chain": "eth", + "chain": Chain.ETHEREUM, "type": "lpt", "sats": 5, }, sUSDe_SY_old: { "start": PENDLE_SUSDE_APRIL_DEPLOYMENT_BLOCK, "contract": susde_sy_contract_old, - "chain": "eth", + "chain": Chain.ETHEREUM, "type": "sy", }, sUSDe_YT_old: { "start": PENDLE_SUSDE_APRIL_DEPLOYMENT_BLOCK, "contract": susde_yt_contract_old, - "chain": "eth", + "chain": Chain.ETHEREUM, "type": "yt", }, mantle_LPT: { "start": PENDLE_MANTLE_DEPLOYMENT_BLOCK, "contract": mantle_lpt_contract, - "chain": "mantle", + "chain": Chain.MANTLE, "type": "lpt", "sats": 20, }, mantle_SY: { "start": PENDLE_MANTLE_DEPLOYMENT_BLOCK, "contract": mantle_sy_contract, - "chain": "mantle", + "chain": Chain.MANTLE, "type": "sy", }, mantle_YT: { "start": PENDLE_MANTLE_DEPLOYMENT_BLOCK, "contract": mantle_yt_contract, - "chain": "mantle", + "chain": Chain.MANTLE, "type": "yt", }, USDe_zircuit_LPT: { "start": PENDLE_USDE_ZIRCUIT_DEPLOYMENT_BLOCK, "contract": USDe_zircuit_LPT_contract, - "chain": "eth", + "chain": Chain.ETHEREUM, "type": "lpt", "sats": 20, }, USDe_zircuit_SY: { "start": PENDLE_USDE_ZIRCUIT_DEPLOYMENT_BLOCK, "contract": USDe_zircuit_SY_contract, - "chain": "eth", + "chain": Chain.ETHEREUM, "type": "sy", }, USDe_zircuit_YT: { "start": PENDLE_USDE_ZIRCUIT_DEPLOYMENT_BLOCK, "contract": USDe_zircuit_YT_contract, - "chain": "eth", + "chain": Chain.ETHEREUM, "type": "yt", }, ENA_LP: { "start": PENDLE_ENA_DEPLOYMENT_BLOCK, "contract": ENA_LPT_contract, - "chain": "eth", + "chain": Chain.ETHEREUM, "type": "lpt", "sats": 30, }, ENA_YT: { "start": PENDLE_ENA_DEPLOYMENT_BLOCK, "contract": ENA_YT_contract, - "chain": "eth", + "chain": Chain.ETHEREUM, "type": "yt", }, ENA_SY: { "start": PENDLE_ENA_DEPLOYMENT_BLOCK, "contract": ENA_SY_contract, - "chain": "eth", + "chain": Chain.ETHEREUM, "type": "sy", }, usde_arb_LP: { "start": PENDLE_USDE_ARB_DEPLOYMENT_BLOCK, "contract": usde_arb_LPT_contract, - "chain": "arb", + "chain": Chain.ARBITRUM, "type": "lpt", "sats": 20, }, usde_arb_SY: { "start": PENDLE_USDE_ARB_DEPLOYMENT_BLOCK, "contract": usde_arb_SY_contract, - "chain": "arb", + "chain": Chain.ARBITRUM, "type": "sy", }, usde_arb_YT: { "start": PENDLE_USDE_ARB_DEPLOYMENT_BLOCK, "contract": usde_arb_YT_contract, - "chain": "arb", + "chain": Chain.ARBITRUM, "type": "yt", }, PENDLE_USDE_KARAK_LP: { "start": PENDLE_USDE_KARAK_DEPLOYMENT_BLOCK, "contract": PENDLE_USDE_KARAK_LP_CONTRACT, - "chain": "eth", + "chain": Chain.ETHEREUM, "type": "lpt", "sats": 20, }, PENDLE_USDE_KARAK_SY: { "start": PENDLE_USDE_KARAK_DEPLOYMENT_BLOCK, "contract": PENDLE_USDE_KARAK_SY_CONTRACT, - "chain": "eth", + "chain": Chain.ETHEREUM, "type": "sy", }, PENDLE_USDE_KARAK_YT: { "start": PENDLE_USDE_KARAK_DEPLOYMENT_BLOCK, "contract": PENDLE_USDE_KARAK_YT_CONTRACT, - "chain": "eth", + "chain": Chain.ETHEREUM, "type": "yt", }, PENDLE_SUSDE_KARAK_LP: { "start": PENDLE_SUSDE_KARAK_DEPLOYMENT_BLOCK, "contract": PENDLE_SUSDE_KARAK_LP_CONTRACT, - "chain": "eth", + "chain": Chain.ETHEREUM, "type": "lpt", "sats": 5, }, PENDLE_SUSDE_KARAK_SY: { "start": PENDLE_SUSDE_KARAK_DEPLOYMENT_BLOCK, "contract": PENDLE_SUSDE_KARAK_SY_CONTRACT, - "chain": "eth", + "chain": Chain.ETHEREUM, "type": "sy", }, PENDLE_SUSDE_KARAK_YT: { "start": PENDLE_SUSDE_KARAK_DEPLOYMENT_BLOCK, "contract": PENDLE_SUSDE_KARAK_YT_CONTRACT, - "chain": "eth", + "chain": Chain.ETHEREUM, "type": "yt", }, } @@ -328,8 +332,10 @@ def get_pendle_participants_v3(token_addresses): token_data = PENDLE_CONTRACT_AND_START_BY_LP_TOKEN[token] if not token_data: continue - start = token_data["start"] - contract = token_data["contract"] + start: int = token_data["start"] + if start is None: + continue + contract: Contract = token_data["contract"] chain = token_data["chain"] web3_for_token = W3_BY_CHAIN[chain]["w3"] page_size = 1900 diff --git a/utils/penpie.py b/utils/penpie.py index eabeb8d..c74ffba 100644 --- a/utils/penpie.py +++ b/utils/penpie.py @@ -1,6 +1,6 @@ from constants.chains import Chain -from constants.integration_ids import IntegrationID -from models.integration import Integration +from integrations.integration_ids import IntegrationID +from integrations.integration import Integration from constants.penpie import PENDLE_LOCKER_ETHEREUM from constants.penpie import PENDLE_LOCKER_ARBITRUM from constants.penpie import master_penpie_ethereum @@ -13,7 +13,9 @@ w3, w3_arb, ) -from typing import List +from typing import Optional, Set +from web3.contract import Contract +from eth_typing import ChecksumAddress with open("abi/penpie_master.json") as f: master_penpie = json.load(f) @@ -25,7 +27,6 @@ penpie_tokens = json.load(f) - class PENPIEIntegration(Integration): def __init__( self, @@ -33,30 +34,30 @@ def __init__( start_block: int, lp_contract: str, chain: Chain, - reward_multiplier: int , + reward_multiplier: int, balance_multiplier: int, - excluded_addresses: List[str], + excluded_addresses: Optional[Set[ChecksumAddress]] = None, ): super().__init__( - integration_id, - start_block, - chain, - None, - reward_multiplier, - balance_multiplier, - excluded_addresses, - None, - None, + integration_id=integration_id, + start_block=start_block, + chain=chain, + reward_multiplier=reward_multiplier, + balance_multiplier=balance_multiplier, + excluded_addresses=excluded_addresses, ) self.lp_contract = lp_contract - def get_balance(self, user: str, block: int) -> float: - # print(self.chain==Chain.ETHEREUM) - - if(self.chain==Chain.ETHEREUM): - masterpenpiecontract = w3.eth.contract(address=master_penpie_ethereum, abi=master_penpie) - if(self.chain==Chain.ARBITRUM): - masterpenpiecontract = w3_arb.eth.contract(address=master_penpie_arbitrum, abi=master_penpie) + def get_balance(self, user: str, block: int | str = "latest") -> float: + if self.chain == Chain.ETHEREUM: + masterpenpiecontract = w3.eth.contract( + address=master_penpie_ethereum, abi=master_penpie + ) + if self.chain == Chain.ARBITRUM: + masterpenpiecontract = w3_arb.eth.contract( + address=w3_arb.to_checksum_address(master_penpie_arbitrum), + abi=master_penpie, + ) # Get lpt token address from Stake DAO vault pendlePoolAddress = call_with_retry( @@ -64,9 +65,9 @@ def get_balance(self, user: str, block: int) -> float: block, ) # pendlePoolAddress = "0x107a2e3cD2BB9a32B9eE2E4d51143149F8367eBa" - if(self.chain==Chain.ETHEREUM): + if self.chain == Chain.ETHEREUM: lptContract = w3.eth.contract(address=pendlePoolAddress, abi=lpt_abi) - if(self.chain==Chain.ARBITRUM): + if self.chain == Chain.ARBITRUM: lptContract = w3_arb.eth.contract(address=pendlePoolAddress, abi=lpt_abi) print(pendlePoolAddress) # Get SY address @@ -76,9 +77,9 @@ def get_balance(self, user: str, block: int) -> float: ) sy = tokens[0] - if(self.chain==Chain.ETHEREUM): + if self.chain == Chain.ETHEREUM: sy_contract = w3.eth.contract(address=sy, abi=erc20_abi) - if(self.chain==Chain.ARBITRUM): + if self.chain == Chain.ARBITRUM: sy_contract = w3_arb.eth.contract(address=sy, abi=erc20_abi) # Get SY balance in the Pendle pool @@ -88,10 +89,10 @@ def get_balance(self, user: str, block: int) -> float: ) if sy_bal == 0: return 0 - if(self.chain==Chain.ETHEREUM): - PENDLE_LOCKER=PENDLE_LOCKER_ETHEREUM - if(self.chain==Chain.ARBITRUM): - PENDLE_LOCKER=PENDLE_LOCKER_ARBITRUM + if self.chain == Chain.ETHEREUM: + PENDLE_LOCKER = PENDLE_LOCKER_ETHEREUM + if self.chain == Chain.ARBITRUM: + PENDLE_LOCKER = PENDLE_LOCKER_ARBITRUM # Get Stake DAO lpt balance lpt_bal = call_with_retry( lptContract.functions.activeBalance(PENDLE_LOCKER), @@ -110,15 +111,17 @@ def get_balance(self, user: str, block: int) -> float: return 0 lockerSyBalance = round(((sy_bal / 10**18) * lpt_bal) / total_active_supply, 4) - print(sy_bal/10**18) - print(lpt_bal/10**18) - - + print(sy_bal / 10**18) + print(lpt_bal / 10**18) - if(self.chain==Chain.ETHEREUM): - receiptcontract = w3.eth.contract(address=self.lp_contract, abi=erc20_abi) - if(self.chain==Chain.ARBITRUM): - receiptcontract = w3_arb.eth.contract(address=self.lp_contract, abi=erc20_abi) + if self.chain == Chain.ETHEREUM: + receiptcontract = w3.eth.contract( + address=w3.to_checksum_address(self.lp_contract), abi=erc20_abi + ) + if self.chain == Chain.ARBITRUM: + receiptcontract = w3_arb.eth.contract( + address=w3_arb.to_checksum_address(self.lp_contract), abi=erc20_abi + ) # Get gauge total suply penpeiepoolTotalSupply = call_with_retry( @@ -138,11 +141,10 @@ def get_balance(self, user: str, block: int) -> float: print(user, userShare * lpt_bal / 100) return userShare * lockerSyBalance / 100 - def get_participants(self) -> list: + def get_participants(self, blocks: list[int] | None) -> set[str]: if self.participants is not None: return self.participants - # logging.info(f"[{self.get_description()}] Getting participants...") self.participants = self.get_penpie_participants() logging.info( f"[{self.get_description()}] Found {len(self.participants)} participants" @@ -151,17 +153,25 @@ def get_participants(self) -> list: def get_penpie_participants(self): all_users = set() - start = self.start_block - if(self.chain==Chain.ETHEREUM): - contract = w3.eth.contract(address=self.lp_contract, abi=erc20_abi) - if(self.chain==Chain.ARBITRUM): - contract = w3_arb.eth.contract(address=self.lp_contract, abi=erc20_abi) + + if self.chain == Chain.ETHEREUM: + contract = w3.eth.contract( + address=w3.to_checksum_address(self.lp_contract), abi=erc20_abi + ) + elif self.chain == Chain.ARBITRUM: + contract = w3_arb.eth.contract( + address=w3_arb.to_checksum_address(self.lp_contract), abi=erc20_abi + ) + else: + return set() page_size = 1900 - if(self.chain==Chain.ETHEREUM): + if self.chain == Chain.ETHEREUM: target_block = w3.eth.get_block_number() - if(self.chain==Chain.ARBITRUM): + elif self.chain == Chain.ARBITRUM: target_block = w3_arb.eth.get_block_number() + else: + return set() while start < target_block: to_block = min(start + page_size, target_block) deposits = fetch_events_logs_with_retry( @@ -170,9 +180,12 @@ def get_penpie_participants(self): start, to_block, ) - print(start, to_block, len(deposits), "getting Stake DAO contract data") + # print(start, to_block, len(deposits), "getting Stake DAO contract data") for deposit in deposits: - if (deposit["args"]["to"]!="0x0000000000000000000000000000000000000000"): + if ( + deposit["args"]["to"] + != "0x0000000000000000000000000000000000000000" + ): all_users.add(deposit["args"]["to"]) print(deposit["args"]["to"]) start += page_size diff --git a/utils/radiant.py b/utils/radiant.py new file mode 100644 index 0000000..e7e1992 --- /dev/null +++ b/utils/radiant.py @@ -0,0 +1,52 @@ +import requests + +from web3 import Web3 +from web3.contract import Contract +from utils.web3_utils import call_with_retry + +def get_effective_balance(user: str, block: int, collateral_address: str, r_token_contract: Contract, lending_pool: Contract): + """ + User's effective ethena integration token balance = scaledBalanceOf(user) * liquidityIndex + + """ + user_checksum = Web3.to_checksum_address(user) + + user_scaled_balance = call_with_retry(r_token_contract.functions.scaledBalanceOf(user_checksum), block) + reserve_data = call_with_retry(lending_pool.functions.getReserveData(collateral_address), block) + usde_liquidity_index = reserve_data[1] + return (user_scaled_balance * usde_liquidity_index) / (10 ** 45) # 10 ** (27 + 18) + +def get_radiant_lenders(graph_url: str, collateral_address: str): + url = graph_url + skip = 0 + all_positions = [] + + while True: + query = """ + { + positions(first: 1000, skip: %s, where :{ side: COLLATERAL, asset: "%s" }) { + account { + id + } + } + } + """ % (skip, collateral_address) + + response = requests.post(url, json={'query': query}) + + + if response.status_code == 200: + data = response.json() + + positions = data['data']['positions'] + + if not positions: + break + filtered_positions = [position['account']['id'] for position in positions if position['account']['id'] + != '0x0000000000000000000000000000000000000000'] + all_positions.extend(filtered_positions) + skip += 1000 + else: + raise Exception(f"Query failed with status code {response.status_code}: {response.text}") + + return list(set(all_positions)) diff --git a/utils/ramses.py b/utils/ramses.py new file mode 100644 index 0000000..eb753b8 --- /dev/null +++ b/utils/ramses.py @@ -0,0 +1,24 @@ +import os +import json +from dotenv import load_dotenv +from utils.web3_utils import ( + w3_arb, +) + +from constants.ramses import RAMSES_NFP_MANAGER_ADDRESS, RAMSES_POOL_ADDRESS + +with open("abi/ramses_nfp_manager.json") as f: + nfp_manager_abi = json.load(f) + +with open("abi/ramses_pool.json") as f: + pool_abi = json.load(f) + + +nfp_manager = w3_arb.eth.contract( + address=w3_arb.to_checksum_address(RAMSES_NFP_MANAGER_ADDRESS), + abi=nfp_manager_abi, +) + +pool = w3_arb.eth.contract( + address=w3_arb.to_checksum_address(RAMSES_POOL_ADDRESS), abi=pool_abi +) diff --git a/utils/request_utils.py b/utils/request_utils.py new file mode 100644 index 0000000..55ec194 --- /dev/null +++ b/utils/request_utils.py @@ -0,0 +1,23 @@ +import requests +from requests.adapters import HTTPAdapter +from urllib3.util.retry import Retry + + +def requests_retry_session( + retries=5, + backoff_factor=0.3, + status_forcelist=(400, 404, 500, 502, 504), + session=None, +): + session = session or requests.Session() + retry = Retry( + total=retries, + read=retries, + connect=retries, + backoff_factor=backoff_factor, + status_forcelist=status_forcelist, + ) + adapter = HTTPAdapter(max_retries=retry) + session.mount("http://", adapter) + session.mount("https://", adapter) + return session diff --git a/utils/rho_markets.py b/utils/rho_markets.py new file mode 100644 index 0000000..a3b7323 --- /dev/null +++ b/utils/rho_markets.py @@ -0,0 +1,103 @@ +from utils.web3_utils import call_with_retry +from constants.rho_markets import ( + RHO_MARKETS_SCROLL_DEPLOYMENT_BLOCK, + RHO_MARKETS_SCROLL_RUSDE_ADDRESS, +) +from integrations.integration import Integration +from constants.summary_columns import SummaryColumn +from integrations.integration_ids import IntegrationID +from constants.chains import Chain +import json +import requests +from utils.web3_utils import ( + w3_scroll, +) + +with open("abi/r_token.json") as f: + r_token_abi = json.load(f) + + +class RhoMarkets(Integration): + def __init__(self): + super().__init__( + IntegrationID.RHO_MARKETS_USDE_LP, + RHO_MARKETS_SCROLL_DEPLOYMENT_BLOCK, + Chain.SCROLL, + [SummaryColumn.RHO_MARKETS_SCROLL_SHARDS], + 20, + 1, + ) + + def get_balance(self, user: str, block: int) -> float: + if w3_scroll.is_connected(): + print("Connected to Ethereum node") + else: + print("Failed to connect to Ethereum node") + + r_usde_contract = w3_scroll.eth.contract( + address=RHO_MARKETS_SCROLL_RUSDE_ADDRESS, abi=r_token_abi + ) + balance = call_with_retry(r_usde_contract.functions.balanceOf(user), block) + + exchangeRate = call_with_retry( + r_usde_contract.functions.exchangeRateStored(), block + ) + return balance * exchangeRate / (1e18 * 1e18) + + def get_participants(self, blocks: list[int] | None) -> set[str]: + all_users: set[str] = set() + try: + users = self.fetch_compound_users("rUSDe") + for user in users: + all_users.add(user["id"]) + except Exception as e: + print(e) + self.participants = all_users + return all_users + + def fetch_compound_users(self, asset_symbol): + url = "https://api.studio.thegraph.com/query/79909/rho-markets-mainnet/version/latest" + last_id = "" + all_accounts = [] + + while True: + query = """ + { + accounts(first: 1000, where: { tokens_: { symbol: "%s" }, id_gt: "%s" }) { + id + tokens(where: { symbol: "%s" }) { + storedBorrowBalanceUSD + symbol + storedBorrowBalance + cTokenBalanceUSD + cTokenBalance + } + } + } + """ % ( + asset_symbol, + last_id, + asset_symbol, + ) + + response = requests.post(url, json={"query": query}) + + if response.status_code == 200: + data = response.json() + accounts = data["data"]["accounts"] + if not accounts: + break + # 过滤掉0地址 + filtered_accounts = [ + account + for account in accounts + if account["id"] != "0x0000000000000000000000000000000000000000" + ] + all_accounts.extend(filtered_accounts) + last_id = accounts[-1]["id"] + else: + raise Exception( + f"Query failed with status code {response.status_code}: {response.text}" + ) + + return all_accounts diff --git a/utils/slack.py b/utils/slack.py index a58f142..7fd6909 100644 --- a/utils/slack.py +++ b/utils/slack.py @@ -5,12 +5,13 @@ load_dotenv() + def slack_message(message: str): response = requests.post( - os.getenv("SLACK_WEBHOOK"), + os.getenv("SLACK_WEBHOOK", ""), json={ "text": message, }, timeout=60, ) - logging.info(f"Slack response: {response}") \ No newline at end of file + logging.info(f"Slack response: {response}") diff --git a/utils/splice.py b/utils/splice.py new file mode 100644 index 0000000..9456086 --- /dev/null +++ b/utils/splice.py @@ -0,0 +1,199 @@ +import json +import logging +from typing import Callable + +from utils.web3_utils import W3_BY_CHAIN, call_with_retry, fetch_events_logs_with_retry +from web3.contract import Contract +from functools import partial +from constants.chains import Chain +from integrations.integration_ids import IntegrationID +from integrations.integration import Integration + +from constants.splice import ( + USDE_SY, + USDE_YT, + USDE_LPT, + USDE_DEPLOYMENT_BLOCK, + SUSDE_SY, + SUSDE_YT, + SUSDE_LPT, + SUSDE_DEPLOYMENT_BLOCK, +) + +w3 = W3_BY_CHAIN[Chain.MODE]["w3"] + + +######################################################################## +# Contracts +######################################################################## + +with open("abi/ERC20_abi.json") as f: + erc20_abi = json.load(f) + +with open("abi/pendle_lpt.json") as f: + lpt_abi = json.load(f) + + +usde_sy_contract = w3.eth.contract(address=USDE_SY, abi=erc20_abi) +usde_yt_contract = w3.eth.contract(address=USDE_YT, abi=erc20_abi) +usde_lpt_contract = w3.eth.contract(address=USDE_LPT, abi=lpt_abi) + +susde_sy_contract = w3.eth.contract(address=SUSDE_SY, abi=erc20_abi) +susde_yt_contract = w3.eth.contract(address=SUSDE_YT, abi=erc20_abi) +susde_lpt_contract = w3.eth.contract(address=SUSDE_LPT, abi=lpt_abi) + + +######################################################################## +# Get Balance Functions +######################################################################## + + +def get_lpt_balance( + user: str, + block: int, + sy_contract: Contract, + lp_contract: Contract, +): + sy_bal = call_with_retry( + sy_contract.functions.balanceOf(lp_contract.address), block + ) + if sy_bal == 0: + return 0 + lpt_bal = call_with_retry(lp_contract.functions.activeBalance(user), block) + if lpt_bal == 0: + return 0 + total_active_supply = call_with_retry( + lp_contract.functions.totalActiveSupply(), block + ) + + if total_active_supply == 0: + print("total_active_supply is 0") + return 0 + + print( + f"sy_bal: {sy_bal}, lpt_bal: {lpt_bal}, total_active_supply: {total_active_supply}" + ) + print(round(((sy_bal / 10**18) * lpt_bal) / total_active_supply, 4)) + return round(((sy_bal / 10**18) * lpt_bal) / total_active_supply, 4) + + +def get_yt_balance(user: str, block: int, yt_contract: Contract) -> float: + res = call_with_retry(yt_contract.functions.balanceOf(user), block) + if not isinstance(res, (int, float)): + return 0 + return round(res / 10**18, 4) + + +######################################################################## +# Get Participants Functions +######################################################################## + + +def get_splice_participants_v3(token_addresses, start: int): + page_size = 1900 + all_users = set() + target_block = w3.eth.get_block_number() + + for i in range(len(token_addresses)): + token = token_addresses[i] + contract = w3.eth.contract(address=token, abi=erc20_abi) + + while start < target_block: + to_block = min(start + page_size, target_block) + transfers = fetch_events_logs_with_retry( + f"Splice v3 users {token}", + contract.events.Transfer(), + start, + to_block, + ) + print(start, to_block, len(transfers), "getting Splice contract data") + for transfer in transfers: + all_users.add(transfer["args"]["to"]) + start += page_size + return all_users + + +######################################################################## +# Configs +######################################################################## + +config: dict[IntegrationID, dict] = { + IntegrationID.SPLICE_USDE_YT: { + "chain": Chain.MODE, + "start_block": USDE_DEPLOYMENT_BLOCK, + "end_block": None, + "sats_multiplier": 20, + "token_addresses": [usde_yt_contract.address], + "get_balance_func": partial(get_yt_balance, yt_contract=usde_yt_contract), + }, + IntegrationID.SPLICE_USDE_LPT: { + "chain": Chain.MODE, + "start_block": USDE_DEPLOYMENT_BLOCK, + "end_block": None, + "sats_multiplier": 20, + "token_addresses": [usde_sy_contract.address, usde_lpt_contract.address], + "get_balance_func": partial( + get_lpt_balance, sy_contract=usde_sy_contract, lp_contract=usde_lpt_contract + ), + }, + IntegrationID.SPLICE_SUSDE_YT: { + "chain": Chain.MODE, + "start_block": SUSDE_DEPLOYMENT_BLOCK, + "end_block": None, + "sats_multiplier": 20, + "token_addresses": [susde_yt_contract.address], + "get_balance_func": partial(get_yt_balance, yt_contract=susde_yt_contract), + }, + IntegrationID.SPLICE_SUSDE_LPT: { + "chain": Chain.MODE, + "start_block": SUSDE_DEPLOYMENT_BLOCK, + "end_block": None, + "sats_multiplier": 20, + "token_addresses": [susde_sy_contract.address, susde_lpt_contract.address], + "get_balance_func": partial( + get_lpt_balance, + sy_contract=susde_sy_contract, + lp_contract=susde_lpt_contract, + ), + }, +} + + +######################################################################## +# Integration Class +######################################################################## + + +class SpliceIntegration(Integration): + def __init__(self, integration_id: IntegrationID): + super().__init__( + integration_id=integration_id, + start_block=config[integration_id]["start_block"], + chain=config[integration_id]["chain"], + reward_multiplier=config[integration_id]["sats_multiplier"], + balance_multiplier=1, + end_block=config[integration_id]["end_block"], + ) + self.token_addresses = config[integration_id]["token_addresses"] + self.get_balance_func = config[integration_id]["get_balance_func"] + + def get_description(self): + return self.integration_id.get_description() + + def get_balance(self, user: str, block: int | str = "latest") -> float: + logging.info( + f"[{self.get_description()}] Getting balance for {user} at block {block}" + ) + return self.get_balance_func(user, block) # type: ignore + + def get_participants(self, blocks: list[int] | None) -> set[str]: + if self.participants is not None: + return self.participants + logging.info(f"[{self.get_description()}] Getting participants...") + self.participants = get_splice_participants_v3( + self.token_addresses, self.start_block + ) + logging.info( + f"[{self.get_description()}] Found {len(self.participants)} participants" + ) + return set(self.participants) diff --git a/utils/stakedao.py b/utils/stakedao.py index 14c9339..69378fa 100644 --- a/utils/stakedao.py +++ b/utils/stakedao.py @@ -1,6 +1,6 @@ from constants.chains import Chain -from constants.integration_ids import IntegrationID -from models.integration import Integration +from integrations.integration_ids import IntegrationID +from integrations.integration import Integration from constants.stakedao import PENDLE_LOCKER import logging import json @@ -9,7 +9,9 @@ call_with_retry, w3, ) -from typing import List +from typing import Optional, Set +from eth_typing import ChecksumAddress +from web3 import Web3 with open("abi/stakedao_vault.json") as f: vault_abi = json.load(f) @@ -28,24 +30,25 @@ def __init__( chain: Chain = Chain.ETHEREUM, reward_multiplier: int = 20, balance_multiplier: int = 1, - excluded_addresses: List[str] = [PENDLE_LOCKER], + excluded_addresses: Optional[Set[ChecksumAddress]] = { + Web3.to_checksum_address(PENDLE_LOCKER), + }, ): super().__init__( - integration_id, - start_block, - chain, - None, - reward_multiplier, - balance_multiplier, - excluded_addresses, - None, - None, + integration_id=integration_id, + start_block=start_block, + chain=chain, + reward_multiplier=reward_multiplier, + balance_multiplier=balance_multiplier, + excluded_addresses=excluded_addresses, ) - self.lp_contract = lp_contract + self.lp_contract = Web3.to_checksum_address(lp_contract) def get_balance(self, user: str, block: int) -> float: - stakeDAOVaultContract = w3.eth.contract(address=self.lp_contract, abi=vault_abi) + stakeDAOVaultContract = w3.eth.contract( + address=w3.to_checksum_address(self.lp_contract), abi=vault_abi + ) # Get lpt token address from Stake DAO vault pendlePoolAddress = call_with_retry( @@ -117,7 +120,7 @@ def get_balance(self, user: str, block: int) -> float: print(user, userShare * lockerSyBalance / 100) return userShare * lockerSyBalance / 100 - def get_participants(self) -> list: + def get_participants(self, blocks: list[int] | None) -> set[str]: if self.participants is not None: return self.participants diff --git a/utils/velodrome.py b/utils/velodrome.py new file mode 100644 index 0000000..0553c9e --- /dev/null +++ b/utils/velodrome.py @@ -0,0 +1,100 @@ +import json +from utils.web3_utils import ( + w3_mode, + fetch_events_logs_with_retry, + call_with_retry, +) +from web3 import Web3 +from constants.velodrome import ( + VELODROME_MODE_SUGAR_ADDRESS, + PAGE_SIZE, + VELODROME_MODE_START_BLOCK, +) + +with open("abi/velodrome_sugar.json") as f: + sugar_abi = json.load(f) + +with open("abi/velodrome_pool.json") as f: + pool_abi = json.load(f) + +sugar_contract = w3_mode.eth.contract( + address=Web3.to_checksum_address(VELODROME_MODE_SUGAR_ADDRESS), + abi=sugar_abi, +) + + +def fetch_pools(block): + total_pools = [] + offset = 0 + + while True: + # get all of the current pools + pools = call_with_retry( + sugar_contract.functions.all(PAGE_SIZE, offset), + block, + ) + + total_pools.extend(pools) + + if len(pools) < PAGE_SIZE: + break + + offset += PAGE_SIZE + + return total_pools + + +def fetch_participants(token): + latest_block = w3_mode.eth.get_block_number() + all_pools = fetch_pools(latest_block) + pool_addresses = [] + participants = set() + + for pool_data in all_pools: + if pool_data[7] == token or pool_data[10] == token: + pool_addresses.append(pool_data[0]) + + for pool in pool_addresses: + pool_contract = w3_mode.eth.contract(address=pool, abi=pool_abi) + + lps = fetch_events_logs_with_retry( + f"Velodrome Mode users from {VELODROME_MODE_START_BLOCK} to {latest_block}", + pool_contract.events.Mint(), + VELODROME_MODE_START_BLOCK, + latest_block, + ) + for lp in lps: + participants.add(lp["args"]["to"]) + + return participants + + +def fetch_balance(user, block, token): + all_pools = fetch_pools(block) + total_pools_size = len(all_pools) + offset = 0 + balance = 0 + + while True: + # get the positions + positions = call_with_retry( + sugar_contract.functions.positions(PAGE_SIZE, offset, user), + block, + ) + + for pos in positions: + lp_address = pos[1] + for pool in all_pools: + if pool[0] == lp_address: + if pool[7] == token: + balance += pos[4] + balance += pos[6] + if pool[10] == token: + balance += pos[5] + balance += pos[7] + break + + offset += PAGE_SIZE + if offset > total_pools_size: + break + return balance diff --git a/utils/web3_utils.py b/utils/web3_utils.py index 2619f4c..c8150ef 100644 --- a/utils/web3_utils.py +++ b/utils/web3_utils.py @@ -4,9 +4,13 @@ import traceback from dotenv import load_dotenv +from eth_abi.abi import decode + from web3 import Web3 +from web3.types import BlockIdentifier from utils.slack import slack_message +from constants.chains import Chain load_dotenv() ETH_NODE_URL = os.getenv("ETH_NODE_URL") @@ -19,34 +23,77 @@ w3_blast = Web3(Web3.HTTPProvider(BLAST_NODE_URL)) SCROLL_NODE_URL = os.getenv("SCROLL_NODE_URL") w3_scroll = Web3(Web3.HTTPProvider(SCROLL_NODE_URL)) +MODE_NODE_URL = os.getenv("MODE_NODE_URL") +w3_mode = Web3(Web3.HTTPProvider(MODE_NODE_URL)) +FRAXTAL_NODE_URL = os.getenv("FRAXTAL_NODE_URL") +w3_fraxtal = Web3(Web3.HTTPProvider(FRAXTAL_NODE_URL)) +LYRA_NODE_URL = os.getenv("LYRA_NODE_URL") +w3_lyra = Web3(Web3.HTTPProvider(LYRA_NODE_URL)) W3_BY_CHAIN = { - "eth": { + Chain.ETHEREUM: { "w3": w3, }, - "arb": { + Chain.ARBITRUM: { "w3": w3_arb, }, - "mantle": { + Chain.MANTLE: { "w3": w3_mantle, }, - "blast": { + Chain.BLAST: { "w3": w3_blast, }, - "scroll": { + Chain.SCROLL: { "w3": w3_scroll, }, + Chain.MODE: { + "w3": w3_mode, + }, + Chain.FRAXTAL: { + "w3": w3_fraxtal, + }, + Chain.Lyra: { + "w3": w3_lyra, + }, } +MULTICALL_ABI = [ + { + "inputs": [ + { + "components": [ + {"internalType": "address", "name": "target", "type": "address"}, + {"internalType": "bytes", "name": "callData", "type": "bytes"}, + ], + "internalType": "struct Multicall2.Call[]", + "name": "calls", + "type": "tuple[]", + } + ], + "name": "aggregate", + "outputs": [ + {"internalType": "uint256", "name": "blockNumber", "type": "uint256"}, + {"internalType": "bytes[]", "name": "returnData", "type": "bytes[]"}, + ], + "stateMutability": "nonpayable", + "type": "function", + } +] + +MULTICALL_ADDRESS = ( + "0x5BA1e12693Dc8F9c48aAD8770482f4739bEeD696" # Ethereum mainnet address +) + + def fetch_events_logs_with_retry( label: str, contract_event, from_block: int, - to_block: int = "latest", + to_block: int | str = "latest", retries: int = 3, delay: int = 2, - filter: dict = None, + filter: dict | None = None, ) -> dict: for attempt in range(retries): try: @@ -63,6 +110,7 @@ def fetch_events_logs_with_retry( logging.error(msg) slack_message(msg) raise e + return {} def call_with_retry(contract_function, block="latest", retries=3, delay=2): @@ -78,3 +126,28 @@ def call_with_retry(contract_function, block="latest", retries=3, delay=2): logging.error(msg) slack_message(msg) raise e + + +def multicall(w3: Web3, calls: list, block_identifier: BlockIdentifier = "latest"): + multicall_contract = w3.eth.contract( + address=Web3.to_checksum_address(MULTICALL_ADDRESS), abi=MULTICALL_ABI + ) + + aggregate_calls = [] + for call in calls: + contract, fn_name, args = call + call_data = contract.encodeABI(fn_name=fn_name, args=args) + aggregate_calls.append((contract.address, call_data)) + + result = multicall_contract.functions.aggregate(aggregate_calls).call( + block_identifier=block_identifier + ) + + decoded_results = [] + for i, call in enumerate(calls): + contract, fn_name, _ = call + function = contract.get_function_by_name(fn_name) + output_types = [output["type"] for output in function.abi["outputs"]] + decoded_results.append(decode(output_types, result[1][i])) + + return decoded_results