From b7739e5f634175c1224194a9bb6df39492633e29 Mon Sep 17 00:00:00 2001 From: Ed Noepel Date: Sat, 18 Mar 2023 17:51:41 -0400 Subject: [PATCH 01/12] doco and cleanup script --- README.md | 39 +++++++++++++++++++++++---------------- clean.sh | 5 +++++ docker-compose.yml | 2 +- 3 files changed, 29 insertions(+), 17 deletions(-) create mode 100755 clean.sh diff --git a/README.md b/README.md index c0a2a91..7223b3f 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,23 @@ sudo yarn global add @graphprotocol/graph-cli yarn install ``` +Configure `ETH_RPC_URL` for your target network in `.env`. + +## Querying + +Below are some examples of queries that can be made to the Ajna Subgraph. + +``` +{ + pools { + id + createdAtBlockNumber + createdAtTimestamp + txCount + } +} +``` + ## Development Commands for adding new data sources to the subgraph are listed in the [add-commands.txt](./add-commands.txt) file. @@ -41,21 +58,6 @@ Run the Matchstick tests by executing: npm run test ``` -## Querying - -Below are some examples of queries that can be made to the Ajna Subgraph. - -``` -{ - pools { - id - createdAtBlockNumber - createdAtTimestamp - txCount - } -} -``` - ## Maintenance To update for new release candidates: @@ -65,4 +67,9 @@ To update for new release candidates: ``` 2. Update addresses in `constants.ts` and `subgraph.yaml`. 3. Run `npm run codegen` to find and resolve errors in code generation. -4. Review contract changes, adjusting subgraph and schema accordingly. Update handlers and unit tests. Run `npm run test` to find and resolve issues. \ No newline at end of file +4. Review contract changes, adjusting subgraph and schema accordingly. +5. Run `npm run build` to and resolve compliation errors. +6. Update handlers, test mocks, and unit tests. Run `npm run test` to find and resolve issues. +7. Start the dockerized environment and deploy to confirm functionality. + +To clean out container data and autogenerated code, run the `clean.sh` script. \ No newline at end of file diff --git a/clean.sh b/clean.sh new file mode 100755 index 0000000..cbfb2f7 --- /dev/null +++ b/clean.sh @@ -0,0 +1,5 @@ +#!/bin/bash +docker-compose down -v +rm -rf build +sudo rm -rf data +rm -rf generated \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 1fd4cd3..6527279 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,7 +12,7 @@ services: - ipfs - postgres extra_hosts: - - host.docker.internal:host-gateway + - host.docker.internal:host-gateway environment: postgres_host: postgres postgres_user: graph-node From 0d426ce3dc69f36a3341a138964a15e7849f289e Mon Sep 17 00:00:00 2001 From: Ed Noepel Date: Sat, 18 Mar 2023 17:53:27 -0400 Subject: [PATCH 02/12] PositionManager and RewardsManager updates, eliminate RAYs everywhere --- README.md | 2 +- abis/PositionManager.json | 688 +++++++++++--------------- abis/RewardsManager.json | 321 +++++------- schema.graphql | 4 + src/erc-20-pool.ts | 34 +- src/position-manager.ts | 4 + src/utils/bucket.ts | 6 +- src/utils/common.ts | 4 +- src/utils/convert.ts | 6 +- subgraph.yaml | 6 +- tests/erc-20-pool.test.ts | 2 +- tests/utils/common.ts | 8 +- tests/utils/position-manager-utils.ts | 41 +- 13 files changed, 490 insertions(+), 636 deletions(-) diff --git a/README.md b/README.md index 7223b3f..bfe4522 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,6 @@ To update for new release candidates: 4. Review contract changes, adjusting subgraph and schema accordingly. 5. Run `npm run build` to and resolve compliation errors. 6. Update handlers, test mocks, and unit tests. Run `npm run test` to find and resolve issues. -7. Start the dockerized environment and deploy to confirm functionality. +7. Start the dockerized environment and perform a local deployment to confirm functionality. To clean out container data and autogenerated code, run the `clean.sh` script. \ No newline at end of file diff --git a/abis/PositionManager.json b/abis/PositionManager.json index 0863e3b..75e9334 100644 --- a/abis/PositionManager.json +++ b/abis/PositionManager.json @@ -1,566 +1,468 @@ [ { + "type": "constructor", + "payable": false, "inputs": [ - { - "internalType": "contract ERC20PoolFactory", - "name": "erc20Factory_", - "type": "address" - }, - { - "internalType": "contract ERC721PoolFactory", - "name": "erc721Factory_", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" + { "type": "address", "name": "erc20Factory_" }, + { "type": "address", "name": "erc721Factory_" } + ] }, - { "inputs": [], "name": "BucketIndexOutOfBounds", "type": "error" }, - { "inputs": [], "name": "LiquidityNotRemoved", "type": "error" }, - { "inputs": [], "name": "NoAuth", "type": "error" }, - { "inputs": [], "name": "NotAjnaPool", "type": "error" }, + { "type": "error", "name": "BucketBankrupt", "inputs": [] }, + { "type": "error", "name": "BucketIndexOutOfBounds", "inputs": [] }, + { "type": "error", "name": "LiquidityNotRemoved", "inputs": [] }, + { "type": "error", "name": "NoAuth", "inputs": [] }, + { "type": "error", "name": "NotAjnaPool", "inputs": [] }, { - "inputs": [{ "internalType": "int256", "name": "x", "type": "int256" }], - "name": "PRBMathSD59x18__ConvertOverflow", - "type": "error" + "type": "error", + "name": "PRBMathSD59x18__Exp2InputTooBig", + "inputs": [{ "type": "int256", "name": "x" }] }, { - "inputs": [{ "internalType": "int256", "name": "x", "type": "int256" }], - "name": "PRBMathSD59x18__ConvertUnderflow", - "type": "error" + "type": "error", + "name": "PRBMathSD59x18__FromIntOverflow", + "inputs": [{ "type": "int256", "name": "x" }] }, { - "inputs": [{ "internalType": "SD59x18", "name": "x", "type": "int256" }], - "name": "PRBMathSD59x18__Exp2InputTooBig", - "type": "error" + "type": "error", + "name": "PRBMathSD59x18__FromIntUnderflow", + "inputs": [{ "type": "int256", "name": "x" }] }, { - "inputs": [{ "internalType": "SD59x18", "name": "x", "type": "int256" }], + "type": "error", "name": "PRBMathSD59x18__LogInputTooSmall", - "type": "error" + "inputs": [{ "type": "int256", "name": "x" }] }, - { "inputs": [], "name": "PRBMathSD59x18__MulInputTooSmall", "type": "error" }, + { "type": "error", "name": "PRBMathSD59x18__MulInputTooSmall", "inputs": [] }, { - "inputs": [ - { "internalType": "SD59x18", "name": "x", "type": "int256" }, - { "internalType": "SD59x18", "name": "y", "type": "int256" } - ], + "type": "error", "name": "PRBMathSD59x18__MulOverflow", - "type": "error" + "inputs": [{ "type": "uint256", "name": "rAbs" }] }, { - "inputs": [ - { "internalType": "uint256", "name": "x", "type": "uint256" }, - { "internalType": "uint256", "name": "y", "type": "uint256" } - ], - "name": "PRBMath__MulDiv18Overflow", - "type": "error" + "type": "error", + "name": "PRBMath__MulDivFixedPointOverflow", + "inputs": [{ "type": "uint256", "name": "prod1" }] }, - { "inputs": [], "name": "RemoveLiquidityFailed", "type": "error" }, - { "inputs": [], "name": "WrongPool", "type": "error" }, + { "type": "error", "name": "RemovePositionFailed", "inputs": [] }, + { "type": "error", "name": "WrongPool", "inputs": [] }, { + "type": "event", "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" + "inputs": [ + { "type": "address", "name": "owner", "indexed": true }, + { "type": "address", "name": "approved", "indexed": true }, + { "type": "uint256", "name": "tokenId", "indexed": true } + ] }, { + "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" + "inputs": [ + { "type": "address", "name": "owner", "indexed": true }, + { "type": "address", "name": "operator", "indexed": true }, + { "type": "bool", "name": "approved", "indexed": false } + ] }, { + "type": "event", "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "lender", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], "name": "Burn", - "type": "event" + "inputs": [ + { "type": "address", "name": "lender", "indexed": true }, + { "type": "uint256", "name": "tokenId", "indexed": true } + ] }, { + "type": "event", "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "lender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], "name": "MemorializePosition", - "type": "event" + "inputs": [ + { "type": "address", "name": "lender", "indexed": true }, + { "type": "uint256", "name": "tokenId", "indexed": false }, + { "type": "uint256[]", "name": "indexes", "indexed": false } + ] }, { + "type": "event", "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "lender", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "pool", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], "name": "Mint", - "type": "event" + "inputs": [ + { "type": "address", "name": "lender", "indexed": true }, + { "type": "address", "name": "pool", "indexed": true }, + { "type": "uint256", "name": "tokenId", "indexed": false } + ] }, { + "type": "event", "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "lender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], "name": "MoveLiquidity", - "type": "event" + "inputs": [ + { "type": "address", "name": "lender", "indexed": true }, + { "type": "uint256", "name": "tokenId", "indexed": false }, + { "type": "uint256", "name": "fromIndex", "indexed": false }, + { "type": "uint256", "name": "toIndex", "indexed": false } + ] }, { + "type": "event", "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "lender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], "name": "RedeemPosition", - "type": "event" + "inputs": [ + { "type": "address", "name": "lender", "indexed": true }, + { "type": "uint256", "name": "tokenId", "indexed": false }, + { "type": "uint256[]", "name": "indexes", "indexed": false } + ] }, { + "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": [ + { "type": "address", "name": "from", "indexed": true }, + { "type": "address", "name": "to", "indexed": true }, + { "type": "uint256", "name": "tokenId", "indexed": true } + ] }, { - "inputs": [], + "type": "function", "name": "DOMAIN_SEPARATOR", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "constant": true, "stateMutability": "view", - "type": "function" + "payable": false, + "inputs": [], + "outputs": [{ "type": "bytes32" }] }, { - "inputs": [], + "type": "function", "name": "PERMIT_TYPEHASH", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "constant": true, "stateMutability": "view", - "type": "function" + "payable": false, + "inputs": [], + "outputs": [{ "type": "bytes32" }] }, { + "type": "function", + "name": "approve", + "constant": false, + "payable": false, "inputs": [ - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "tokenId", "type": "uint256" } + { "type": "address", "name": "to" }, + { "type": "uint256", "name": "tokenId" } ], - "name": "approve", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "outputs": [] }, { - "inputs": [ - { "internalType": "address", "name": "owner", "type": "address" } - ], + "type": "function", "name": "balanceOf", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "constant": true, "stateMutability": "view", - "type": "function" + "payable": false, + "inputs": [{ "type": "address", "name": "owner" }], + "outputs": [{ "type": "uint256" }] }, { + "type": "function", + "name": "burn", + "constant": false, + "payable": false, "inputs": [ { - "components": [ - { "internalType": "uint256", "name": "tokenId", "type": "uint256" }, - { "internalType": "address", "name": "pool", "type": "address" } - ], - "internalType": "struct IPositionManagerOwnerActions.BurnParams", + "type": "tuple", "name": "params_", - "type": "tuple" + "components": [ + { "type": "uint256", "name": "tokenId" }, + { "type": "address", "name": "pool" } + ] } ], - "name": "burn", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "outputs": [] }, { - "inputs": [ - { "internalType": "uint256", "name": "tokenId", "type": "uint256" } - ], + "type": "function", "name": "getApproved", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "constant": true, "stateMutability": "view", - "type": "function" + "payable": false, + "inputs": [{ "type": "uint256", "name": "tokenId" }], + "outputs": [{ "type": "address" }] }, { + "type": "function", + "name": "getLPs", + "constant": true, + "stateMutability": "view", + "payable": false, "inputs": [ - { "internalType": "uint256", "name": "tokenId_", "type": "uint256" }, - { "internalType": "uint256", "name": "index_", "type": "uint256" } + { "type": "uint256", "name": "tokenId_" }, + { "type": "uint256", "name": "index_" } ], - "name": "getLPTokens", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" + "outputs": [{ "type": "uint256" }] }, { - "inputs": [ - { "internalType": "uint256", "name": "tokenId_", "type": "uint256" } - ], + "type": "function", "name": "getPositionIndexes", - "outputs": [ - { "internalType": "uint256[]", "name": "", "type": "uint256[]" } - ], + "constant": true, "stateMutability": "view", - "type": "function" + "payable": false, + "inputs": [{ "type": "uint256", "name": "tokenId_" }], + "outputs": [{ "type": "uint256[]" }] }, { + "type": "function", + "name": "getPositionIndexesFiltered", + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [{ "type": "uint256", "name": "tokenId_" }], + "outputs": [{ "type": "uint256[]", "name": "filteredIndexes_" }] + }, + { + "type": "function", + "name": "getPositionInfo", + "constant": true, + "stateMutability": "view", + "payable": false, "inputs": [ - { "internalType": "address", "name": "owner", "type": "address" }, - { "internalType": "address", "name": "operator", "type": "address" } + { "type": "uint256", "name": "tokenId_" }, + { "type": "uint256", "name": "index_" } ], + "outputs": [{ "type": "uint256" }, { "type": "uint256" }] + }, + { + "type": "function", "name": "isApprovedForAll", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "constant": true, "stateMutability": "view", - "type": "function" + "payable": false, + "inputs": [ + { "type": "address", "name": "owner" }, + { "type": "address", "name": "operator" } + ], + "outputs": [{ "type": "bool" }] }, { + "type": "function", + "name": "isIndexInPosition", + "constant": true, + "stateMutability": "view", + "payable": false, "inputs": [ - { "internalType": "uint256", "name": "tokenId_", "type": "uint256" }, - { "internalType": "uint256", "name": "index_", "type": "uint256" } + { "type": "uint256", "name": "tokenId_" }, + { "type": "uint256", "name": "index_" } ], - "name": "isIndexInPosition", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [{ "type": "bool" }] + }, + { + "type": "function", + "name": "isPositionBucketBankrupt", + "constant": true, "stateMutability": "view", - "type": "function" + "payable": false, + "inputs": [ + { "type": "uint256", "name": "tokenId_" }, + { "type": "uint256", "name": "index_" } + ], + "outputs": [{ "type": "bool" }] }, { + "type": "function", + "name": "memorializePositions", + "constant": false, + "payable": false, "inputs": [ { - "components": [ - { "internalType": "uint256", "name": "tokenId", "type": "uint256" }, - { - "internalType": "uint256[]", - "name": "indexes", - "type": "uint256[]" - } - ], - "internalType": "struct IPositionManagerOwnerActions.MemorializePositionsParams", + "type": "tuple", "name": "params_", - "type": "tuple" + "components": [ + { "type": "uint256", "name": "tokenId" }, + { "type": "uint256[]", "name": "indexes" } + ] } ], - "name": "memorializePositions", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "outputs": [] }, { + "type": "function", + "name": "mint", + "constant": false, + "payable": false, "inputs": [ { - "components": [ - { "internalType": "address", "name": "recipient", "type": "address" }, - { "internalType": "address", "name": "pool", "type": "address" }, - { - "internalType": "bytes32", - "name": "poolSubsetHash", - "type": "bytes32" - } - ], - "internalType": "struct IPositionManagerOwnerActions.MintParams", + "type": "tuple", "name": "params_", - "type": "tuple" + "components": [ + { "type": "address", "name": "recipient" }, + { "type": "address", "name": "pool" }, + { "type": "bytes32", "name": "poolSubsetHash" } + ] } ], - "name": "mint", - "outputs": [ - { "internalType": "uint256", "name": "tokenId_", "type": "uint256" } - ], - "stateMutability": "nonpayable", - "type": "function" + "outputs": [{ "type": "uint256", "name": "tokenId_" }] }, { + "type": "function", + "name": "moveLiquidity", + "constant": false, + "payable": false, "inputs": [ { - "components": [ - { "internalType": "uint256", "name": "tokenId", "type": "uint256" }, - { "internalType": "address", "name": "pool", "type": "address" }, - { "internalType": "uint256", "name": "fromIndex", "type": "uint256" }, - { "internalType": "uint256", "name": "toIndex", "type": "uint256" } - ], - "internalType": "struct IPositionManagerOwnerActions.MoveLiquidityParams", + "type": "tuple", "name": "params_", - "type": "tuple" + "components": [ + { "type": "uint256", "name": "tokenId" }, + { "type": "address", "name": "pool" }, + { "type": "uint256", "name": "fromIndex" }, + { "type": "uint256", "name": "toIndex" }, + { "type": "uint256", "name": "expiry" } + ] } ], - "name": "moveLiquidity", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "outputs": [] }, { - "inputs": [ - { "internalType": "bytes[]", "name": "data", "type": "bytes[]" } - ], + "type": "function", "name": "multicall", - "outputs": [ - { "internalType": "bytes[]", "name": "results", "type": "bytes[]" } - ], - "stateMutability": "nonpayable", - "type": "function" + "constant": false, + "payable": false, + "inputs": [{ "type": "bytes[]", "name": "data" }], + "outputs": [{ "type": "bytes[]", "name": "results" }] }, { - "inputs": [], + "type": "function", "name": "name", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "constant": true, "stateMutability": "view", - "type": "function" + "payable": false, + "inputs": [], + "outputs": [{ "type": "string" }] }, { - "inputs": [ - { "internalType": "uint256", "name": "tokenId", "type": "uint256" } - ], + "type": "function", "name": "ownerOf", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "constant": true, "stateMutability": "view", - "type": "function" + "payable": false, + "inputs": [{ "type": "uint256", "name": "tokenId" }], + "outputs": [{ "type": "address" }] }, { + "type": "function", + "name": "permit", + "constant": false, + "payable": false, "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" } + { "type": "address", "name": "spender_" }, + { "type": "uint256", "name": "tokenId_" }, + { "type": "uint256", "name": "deadline_" }, + { "type": "uint8", "name": "v_" }, + { "type": "bytes32", "name": "r_" }, + { "type": "bytes32", "name": "s_" } ], - "name": "permit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "outputs": [] }, { - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "type": "function", "name": "poolKey", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "constant": true, "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" }, - { "internalType": "uint256", "name": "", "type": "uint256" } - ], - "name": "positionLPs", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" + "payable": false, + "inputs": [{ "type": "uint256" }], + "outputs": [{ "type": "address" }] }, { + "type": "function", + "name": "reedemPositions", + "constant": false, + "payable": false, "inputs": [ { - "components": [ - { "internalType": "uint256", "name": "tokenId", "type": "uint256" }, - { "internalType": "address", "name": "pool", "type": "address" }, - { - "internalType": "uint256[]", - "name": "indexes", - "type": "uint256[]" - } - ], - "internalType": "struct IPositionManagerOwnerActions.RedeemPositionsParams", + "type": "tuple", "name": "params_", - "type": "tuple" + "components": [ + { "type": "uint256", "name": "tokenId" }, + { "type": "address", "name": "pool" }, + { "type": "uint256[]", "name": "indexes" } + ] } ], - "name": "reedemPositions", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "outputs": [] }, { - "inputs": [ - { "internalType": "address", "name": "from", "type": "address" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "tokenId", "type": "uint256" } - ], + "type": "function", "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { + "constant": false, + "payable": false, "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" } + { "type": "address", "name": "from" }, + { "type": "address", "name": "to" }, + { "type": "uint256", "name": "tokenId" } ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "outputs": [] }, { + "type": "function", + "name": "safeTransferFrom", + "constant": false, + "payable": false, "inputs": [ - { "internalType": "address", "name": "from_", "type": "address" }, - { "internalType": "address", "name": "to_", "type": "address" }, - { "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" } + { "type": "address", "name": "from" }, + { "type": "address", "name": "to" }, + { "type": "uint256", "name": "tokenId" }, + { "type": "bytes", "name": "data" } ], - "name": "safeTransferFromWithPermit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "outputs": [] }, { + "type": "function", + "name": "setApprovalForAll", + "constant": false, + "payable": false, "inputs": [ - { "internalType": "address", "name": "operator", "type": "address" }, - { "internalType": "bool", "name": "approved", "type": "bool" } + { "type": "address", "name": "operator" }, + { "type": "bool", "name": "approved" } ], - "name": "setApprovalForAll", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "outputs": [] }, { - "inputs": [ - { "internalType": "bytes4", "name": "interfaceId", "type": "bytes4" } - ], + "type": "function", "name": "supportsInterface", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "constant": true, "stateMutability": "view", - "type": "function" + "payable": false, + "inputs": [{ "type": "bytes4", "name": "interfaceId" }], + "outputs": [{ "type": "bool" }] }, { - "inputs": [], + "type": "function", "name": "symbol", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "constant": true, "stateMutability": "view", - "type": "function" + "payable": false, + "inputs": [], + "outputs": [{ "type": "string" }] }, { - "inputs": [ - { "internalType": "uint256", "name": "tokenId_", "type": "uint256" } - ], + "type": "function", "name": "tokenURI", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "constant": true, "stateMutability": "view", - "type": "function" + "payable": false, + "inputs": [{ "type": "uint256", "name": "tokenId_" }], + "outputs": [{ "type": "string" }] }, { + "type": "function", + "name": "transferFrom", + "constant": false, + "payable": false, "inputs": [ - { "internalType": "address", "name": "from", "type": "address" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "tokenId", "type": "uint256" } + { "type": "address", "name": "from" }, + { "type": "address", "name": "to" }, + { "type": "uint256", "name": "tokenId" } ], - "name": "transferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "outputs": [] } ] diff --git a/abis/RewardsManager.json b/abis/RewardsManager.json index 10891de..1b6ed04 100644 --- a/abis/RewardsManager.json +++ b/abis/RewardsManager.json @@ -1,264 +1,197 @@ [ { + "type": "constructor", + "payable": false, "inputs": [ - { "internalType": "address", "name": "ajnaToken_", "type": "address" }, - { - "internalType": "contract IPositionManager", - "name": "positionManager_", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" + { "type": "address", "name": "ajnaToken_" }, + { "type": "address", "name": "positionManager_" } + ] }, - { "inputs": [], "name": "AlreadyClaimed", "type": "error" }, - { "inputs": [], "name": "ExchangeRateUpdateTooLate", "type": "error" }, - { "inputs": [], "name": "NotOwnerOfDeposit", "type": "error" }, + { "type": "error", "name": "AlreadyClaimed", "inputs": [] }, + { "type": "error", "name": "EpochNotAvailable", "inputs": [] }, + { "type": "error", "name": "ExchangeRateUpdateTooLate", "inputs": [] }, + { "type": "error", "name": "MoveStakedLiquidityInvalid", "inputs": [] }, + { "type": "error", "name": "NotOwnerOfDeposit", "inputs": [] }, { + "type": "event", "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "ajnaPool", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256[]", - "name": "epochsClaimed", - "type": "uint256[]" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], "name": "ClaimRewards", - "type": "event" + "inputs": [ + { "type": "address", "name": "owner", "indexed": true }, + { "type": "address", "name": "ajnaPool", "indexed": true }, + { "type": "uint256", "name": "tokenId", "indexed": true }, + { "type": "uint256[]", "name": "epochsClaimed", "indexed": false }, + { "type": "uint256", "name": "amount", "indexed": false } + ] }, { + "type": "event", "anonymous": false, + "name": "MoveStakedLiquidity", "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "ajnaPool", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Stake", - "type": "event" + { "type": "uint256", "name": "tokenId", "indexed": false }, + { "type": "uint256[]", "name": "fromIndexes", "indexed": false }, + { "type": "uint256[]", "name": "toIndexes", "indexed": false } + ] }, { + "type": "event", "anonymous": false, + "name": "Stake", "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "ajnaPool", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Unstake", - "type": "event" + { "type": "address", "name": "owner", "indexed": true }, + { "type": "address", "name": "ajnaPool", "indexed": true }, + { "type": "uint256", "name": "tokenId", "indexed": true } + ] }, { + "type": "event", "anonymous": false, + "name": "Unstake", "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "caller", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "ajnaPool", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256[]", - "name": "indexesUpdated", - "type": "uint256[]" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "rewardsClaimed", - "type": "uint256" - } - ], + { "type": "address", "name": "owner", "indexed": true }, + { "type": "address", "name": "ajnaPool", "indexed": true }, + { "type": "uint256", "name": "tokenId", "indexed": true } + ] + }, + { + "type": "event", + "anonymous": false, "name": "UpdateExchangeRates", - "type": "event" + "inputs": [ + { "type": "address", "name": "caller", "indexed": true }, + { "type": "address", "name": "ajnaPool", "indexed": true }, + { "type": "uint256[]", "name": "indexesUpdated", "indexed": false }, + { "type": "uint256", "name": "rewardsClaimed", "indexed": false } + ] }, { - "inputs": [], + "type": "function", "name": "ajnaToken", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "constant": true, "stateMutability": "view", - "type": "function" + "payable": false, + "inputs": [], + "outputs": [{ "type": "address" }] }, { - "inputs": [ - { "internalType": "uint256", "name": "tokenId_", "type": "uint256" }, - { - "internalType": "uint256", - "name": "burnEpochToStartClaim_", - "type": "uint256" - } - ], + "type": "function", "name": "calculateRewards", - "outputs": [ - { "internalType": "uint256", "name": "rewards_", "type": "uint256" } + "constant": true, + "stateMutability": "view", + "payable": false, + "inputs": [ + { "type": "uint256", "name": "tokenId_" }, + { "type": "uint256", "name": "epochToClaim_" } ], - "stateMutability": "nonpayable", - "type": "function" + "outputs": [{ "type": "uint256", "name": "rewards_" }] }, { + "type": "function", + "name": "claimRewards", + "constant": false, + "payable": false, "inputs": [ - { "internalType": "uint256", "name": "tokenId_", "type": "uint256" }, - { - "internalType": "uint256", - "name": "burnEpochToStartClaim_", - "type": "uint256" - } + { "type": "uint256", "name": "tokenId_" }, + { "type": "uint256", "name": "epochToClaim_" } ], - "name": "claimRewards", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "outputs": [] }, { + "type": "function", + "name": "getBucketStateStakeInfo", + "constant": true, + "stateMutability": "view", + "payable": false, "inputs": [ - { "internalType": "uint256", "name": "tokenId_", "type": "uint256" } + { "type": "uint256", "name": "tokenId_" }, + { "type": "uint256", "name": "bucketId_" } ], + "outputs": [{ "type": "uint256" }, { "type": "uint256" }] + }, + { + "type": "function", "name": "getStakeInfo", - "outputs": [ - { "internalType": "address", "name": "", "type": "address" }, - { "internalType": "address", "name": "", "type": "address" }, - { "internalType": "uint256", "name": "", "type": "uint256" } - ], + "constant": true, "stateMutability": "view", - "type": "function" + "payable": false, + "inputs": [{ "type": "uint256", "name": "tokenId_" }], + "outputs": [{ "type": "address" }, { "type": "address" }, { "type": "uint256" }] }, { - "inputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" }, - { "internalType": "uint256", "name": "", "type": "uint256" } - ], + "type": "function", "name": "isEpochClaimed", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "constant": true, "stateMutability": "view", - "type": "function" + "payable": false, + "inputs": [{ "type": "uint256" }, { "type": "uint256" }], + "outputs": [{ "type": "bool" }] }, { + "type": "function", + "name": "moveStakedLiquidity", + "constant": false, + "payable": false, "inputs": [ - { "internalType": "address", "name": "", "type": "address" }, - { "internalType": "address", "name": "", "type": "address" }, - { "internalType": "uint256", "name": "", "type": "uint256" }, - { "internalType": "bytes", "name": "", "type": "bytes" } + { "type": "uint256", "name": "tokenId_" }, + { "type": "uint256[]", "name": "fromBuckets_" }, + { "type": "uint256[]", "name": "toBuckets_" }, + { "type": "uint256", "name": "expiry_" } ], - "name": "onERC721Received", - "outputs": [{ "internalType": "bytes4", "name": "", "type": "bytes4" }], - "stateMutability": "pure", - "type": "function" + "outputs": [] }, { - "inputs": [], + "type": "function", "name": "positionManager", - "outputs": [ - { - "internalType": "contract IPositionManager", - "name": "", - "type": "address" - } - ], + "constant": true, "stateMutability": "view", - "type": "function" + "payable": false, + "inputs": [], + "outputs": [{ "type": "address" }] }, { - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "type": "function", "name": "rewardsClaimed", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "constant": true, "stateMutability": "view", - "type": "function" + "payable": false, + "inputs": [{ "type": "uint256" }], + "outputs": [{ "type": "uint256" }] }, { - "inputs": [ - { "internalType": "uint256", "name": "tokenId_", "type": "uint256" } - ], + "type": "function", "name": "stake", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "constant": false, + "payable": false, + "inputs": [{ "type": "uint256", "name": "tokenId_" }], + "outputs": [] }, { - "inputs": [ - { "internalType": "uint256", "name": "tokenId_", "type": "uint256" } - ], + "type": "function", "name": "unstake", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "constant": false, + "payable": false, + "inputs": [{ "type": "uint256", "name": "tokenId_" }], + "outputs": [] }, { - "inputs": [ - { "internalType": "address", "name": "pool_", "type": "address" }, - { "internalType": "uint256[]", "name": "indexes_", "type": "uint256[]" } - ], + "type": "function", "name": "updateBucketExchangeRatesAndClaim", - "outputs": [ - { "internalType": "uint256", "name": "updateReward", "type": "uint256" } + "constant": false, + "payable": false, + "inputs": [ + { "type": "address", "name": "pool_" }, + { "type": "uint256[]", "name": "indexes_" } ], - "stateMutability": "nonpayable", - "type": "function" + "outputs": [{ "type": "uint256", "name": "updateReward" }] }, { - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "type": "function", "name": "updateRewardsClaimed", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "constant": true, "stateMutability": "view", - "type": "function" + "payable": false, + "inputs": [{ "type": "uint256" }], + "outputs": [{ "type": "uint256" }] } ] diff --git a/schema.graphql b/schema.graphql index 0c31d77..eb4dd95 100644 --- a/schema.graphql +++ b/schema.graphql @@ -495,6 +495,7 @@ type MemorializePosition @entity(immutable: true) { id: Bytes! lender: Bytes! # address tokenId: BigInt! # uint256 + indexes: [BigInt!]! # uint256[] blockNumber: BigInt! blockTimestamp: BigInt! transactionHash: Bytes! @@ -514,6 +515,8 @@ type MoveLiquidity @entity(immutable: true) { id: Bytes! lender: Bytes! # address tokenId: BigInt! # uint256 + fromIndex: BigInt! # uint256 + toIndex: BigInt! # uint256 blockNumber: BigInt! blockTimestamp: BigInt! transactionHash: Bytes! @@ -523,6 +526,7 @@ type RedeemPosition @entity(immutable: true) { id: Bytes! lender: Bytes! # address tokenId: BigInt! # uint256 + indexesRedeemed: [BigInt!]! # uint256[] blockNumber: BigInt! blockTimestamp: BigInt! transactionHash: Bytes! diff --git a/src/erc-20-pool.ts b/src/erc-20-pool.ts index 81bf4cf..0954bd3 100644 --- a/src/erc-20-pool.ts +++ b/src/erc-20-pool.ts @@ -44,7 +44,7 @@ import { } from "../generated/schema" import { ZERO_BD, ONE_BI } from "./utils/constants" -import { addressToBytes, wadToDecimal, rayToDecimal } from "./utils/convert" +import { addressToBytes, wadToDecimal } from "./utils/convert" import { loadOrCreateAccount, updateAccountLends, updateAccountLoans, updateAccountPools, updateAccountKicks, updateAccountTakes, updateAccountSettles, updateAccountReserveAuctions } from "./utils/account" import { getBucketId, getBucketInfo, loadOrCreateBucket } from "./utils/bucket" import { getLendId, loadOrCreateLend } from "./utils/lend" @@ -84,8 +84,8 @@ export function handleAddCollateral(event: AddCollateralEvent): void { const bucketInfo = getBucketInfo(pool.id, bucket.bucketIndex) bucket.collateral = wadToDecimal(bucketInfo.collateral) bucket.quoteTokens = wadToDecimal(bucketInfo.quoteTokens) - bucket.lpb = rayToDecimal(bucketInfo.lpb) - bucket.exchangeRate = rayToDecimal(bucketInfo.exchangeRate) + bucket.lpb = wadToDecimal(bucketInfo.lpb) + bucket.exchangeRate = wadToDecimal(bucketInfo.exchangeRate) // update account state const accountId = addressToBytes(event.params.actor) @@ -95,7 +95,7 @@ export function handleAddCollateral(event: AddCollateralEvent): void { // update lend state const lendId = getLendId(bucketId, accountId) const lend = loadOrCreateLend(bucketId, lendId, pool.id, addCollateral.actor) - lend.lpb = lend.lpb.plus(rayToDecimal(event.params.lpAwarded)) + lend.lpb = lend.lpb.plus(wadToDecimal(event.params.lpAwarded)) lend.lpbValueInQuote = lpbValueInQuote(pool.id, bucket, lend) // update account's list of pools and lends if necessary @@ -145,8 +145,8 @@ export function handleAddQuoteToken(event: AddQuoteTokenEvent): void { const bucketInfo = getBucketInfo(pool.id, bucket.bucketIndex) bucket.collateral = wadToDecimal(bucketInfo.collateral) bucket.quoteTokens = wadToDecimal(bucketInfo.quoteTokens) - bucket.lpb = rayToDecimal(bucketInfo.lpb) - bucket.exchangeRate = rayToDecimal(bucketInfo.exchangeRate) + bucket.lpb = wadToDecimal(bucketInfo.lpb) + bucket.exchangeRate = wadToDecimal(bucketInfo.exchangeRate) // update account state const accountId = addressToBytes(event.params.lender) @@ -157,7 +157,7 @@ export function handleAddQuoteToken(event: AddQuoteTokenEvent): void { const lendId = getLendId(bucketId, accountId) const lend = loadOrCreateLend(bucketId, lendId, pool.id, addQuoteToken.lender) lend.deposit = lend.deposit.plus(wadToDecimal(event.params.amount)) - lend.lpb = lend.lpb.plus(rayToDecimal(event.params.lpAwarded)) + lend.lpb = lend.lpb.plus(wadToDecimal(event.params.lpAwarded)) lend.lpbValueInQuote = lpbValueInQuote(pool.id, bucket, lend) // update account's list of pools and lends if necessary @@ -385,13 +385,13 @@ export function handleBucketTakeLPAwarded( const bucketInfo = getBucketInfo(pool.id, bucket.bucketIndex) bucket.collateral = wadToDecimal(bucketInfo.collateral) bucket.quoteTokens = wadToDecimal(bucketInfo.quoteTokens) - bucket.lpb = rayToDecimal(bucketInfo.lpb) - bucket.exchangeRate = rayToDecimal(bucketInfo.exchangeRate) + bucket.lpb = wadToDecimal(bucketInfo.lpb) + bucket.exchangeRate = wadToDecimal(bucketInfo.exchangeRate) // update lend state for kicker const kickerLendId = getLendId(bucketId, bucketTakeLpAwarded.kicker) const kickerLend = loadOrCreateLend(bucketId, kickerLendId, pool.id, bucketTakeLpAwarded.kicker) - kickerLend.lpb = kickerLend.lpb.plus(rayToDecimal(bucketTakeLpAwarded.lpAwardedTaker)) + kickerLend.lpb = kickerLend.lpb.plus(wadToDecimal(bucketTakeLpAwarded.lpAwardedTaker)) kickerLend.lpbValueInQuote = lpbValueInQuote(pool.id, bucket, kickerLend) // update kicker account state if they weren't a lender already @@ -404,7 +404,7 @@ export function handleBucketTakeLPAwarded( const takerLend = loadOrCreateLend(bucketId, takerLendId, pool.id, bucketTakeLpAwarded.taker) // TODO: determine how to best update lend.deposit -> is it even possible? // lend.deposit = lend.deposit.plus(wadToDecimal(event.params.amount)) - takerLend.lpb = takerLend.lpb.plus(rayToDecimal(bucketTakeLpAwarded.lpAwardedTaker)) + takerLend.lpb = takerLend.lpb.plus(wadToDecimal(bucketTakeLpAwarded.lpAwardedTaker)) takerLend.lpbValueInQuote = lpbValueInQuote(pool.id, bucket, takerLend) // save entities to store @@ -575,8 +575,8 @@ export function handleMoveQuoteToken(event: MoveQuoteTokenEvent): void { const fromBucketInfo = getBucketInfo(pool.id, event.params.from) fromBucket.collateral = wadToDecimal(fromBucketInfo.collateral) fromBucket.quoteTokens = wadToDecimal(fromBucketInfo.quoteTokens) - fromBucket.lpb = rayToDecimal(fromBucketInfo.lpb) - fromBucket.exchangeRate = rayToDecimal(fromBucketInfo.exchangeRate) + fromBucket.lpb = wadToDecimal(fromBucketInfo.lpb) + fromBucket.exchangeRate = wadToDecimal(fromBucketInfo.exchangeRate) // update to bucket state const toBucketId = getBucketId(pool.id, event.params.to) @@ -584,21 +584,21 @@ export function handleMoveQuoteToken(event: MoveQuoteTokenEvent): void { const toBucketInfo = getBucketInfo(pool.id, event.params.to) toBucket.collateral = wadToDecimal(toBucketInfo.collateral) toBucket.quoteTokens = wadToDecimal(toBucketInfo.quoteTokens) - toBucket.lpb = rayToDecimal(toBucketInfo.lpb) - toBucket.exchangeRate = rayToDecimal(toBucketInfo.exchangeRate) + toBucket.lpb = wadToDecimal(toBucketInfo.lpb) + toBucket.exchangeRate = wadToDecimal(toBucketInfo.exchangeRate) // update from bucket lend state const fromBucketLendId = getLendId(fromBucketId, event.params.lender) const fromBucketLend = loadOrCreateLend(fromBucketId, fromBucketLendId, pool.id, moveQuoteToken.lender) fromBucketLend.deposit = fromBucketLend.deposit.minus(wadToDecimal(event.params.amount)) - fromBucketLend.lpb = fromBucketLend.lpb.minus(rayToDecimal(event.params.lpRedeemedFrom)) + fromBucketLend.lpb = fromBucketLend.lpb.minus(wadToDecimal(event.params.lpRedeemedFrom)) fromBucketLend.lpbValueInQuote = lpbValueInQuote(pool.id, fromBucket, fromBucketLend) // update to bucket lend state const toBucketLendId = getLendId(toBucketId, event.params.lender) const toBucketLend = loadOrCreateLend(toBucketId, toBucketLendId, pool.id, moveQuoteToken.lender) toBucketLend.deposit = toBucketLend.deposit.plus(wadToDecimal(event.params.amount)) - toBucketLend.lpb = toBucketLend.lpb.plus(rayToDecimal(event.params.lpAwardedTo)) + toBucketLend.lpb = toBucketLend.lpb.plus(wadToDecimal(event.params.lpAwardedTo)) toBucketLend.lpbValueInQuote = lpbValueInQuote(pool.id, toBucket, toBucketLend) // update account state diff --git a/src/position-manager.ts b/src/position-manager.ts index 7a3c8e1..20d2879 100644 --- a/src/position-manager.ts +++ b/src/position-manager.ts @@ -71,6 +71,7 @@ export function handleMemorializePosition( ) entity.lender = event.params.lender entity.tokenId = event.params.tokenId + entity.indexes = event.params.indexes entity.blockNumber = event.block.number entity.blockTimestamp = event.block.timestamp @@ -100,6 +101,8 @@ export function handleMoveLiquidity(event: MoveLiquidityEvent): void { ) entity.lender = event.params.lender entity.tokenId = event.params.tokenId + entity.fromIndex = event.params.fromIndex + entity.toIndex = event.params.toIndex entity.blockNumber = event.block.number entity.blockTimestamp = event.block.timestamp @@ -114,6 +117,7 @@ export function handleRedeemPosition(event: RedeemPositionEvent): void { ) entity.lender = event.params.lender entity.tokenId = event.params.tokenId + entity.indexesRedeemed = event.params.indexes entity.blockNumber = event.block.number entity.blockTimestamp = event.block.timestamp diff --git a/src/utils/bucket.ts b/src/utils/bucket.ts index e8baa4f..3742f3e 100644 --- a/src/utils/bucket.ts +++ b/src/utils/bucket.ts @@ -4,7 +4,7 @@ import { Bucket } from "../../generated/schema" import { PoolInfoUtils } from '../../generated/templates/ERC20Pool/PoolInfoUtils' import { poolInfoUtilsNetworkLookUpTable, ONE_BD, ONE_BI, ONE_RAY_BD, ZERO_BD, ZERO_BI } from "./constants" -import { rayToDecimal, wadToDecimal } from "./convert" +import { wadToDecimal } from "./convert" export function getBucketId(pool: Bytes, index: BigInt): Bytes { return pool.concat(Bytes.fromUTF8('#' + index.toString())) @@ -63,6 +63,6 @@ export function loadOrCreateBucket(poolId: Bytes, bucketId: Bytes, index: BigInt export function updateBucket(bucket: Bucket, bucketInfo: BucketInfo): void { bucket.collateral = wadToDecimal(bucketInfo.collateral) bucket.quoteTokens = wadToDecimal(bucketInfo.quoteTokens) - bucket.lpb = rayToDecimal(bucketInfo.lpb) - bucket.exchangeRate = rayToDecimal(bucketInfo.exchangeRate) + bucket.lpb = wadToDecimal(bucketInfo.lpb) + bucket.exchangeRate = wadToDecimal(bucketInfo.exchangeRate) } diff --git a/src/utils/common.ts b/src/utils/common.ts index 1ceff19..0f1ec3f 100644 --- a/src/utils/common.ts +++ b/src/utils/common.ts @@ -4,14 +4,14 @@ import { Bucket, Lend } from "../../generated/schema" import { PoolInfoUtils } from '../../generated/templates/ERC20Pool/PoolInfoUtils' import { poolInfoUtilsNetworkLookUpTable } from "./constants" -import { bigDecimalRayToBigInt, wadToDecimal } from "./convert" +import { bigDecimalWadToBigInt, wadToDecimal } from "./convert" export function lpbValueInQuote(pool: Bytes, bucket: Bucket, lend: Lend): BigDecimal { const poolAddress = Address.fromBytes(pool) const poolInfoUtilsAddress = poolInfoUtilsNetworkLookUpTable.get(dataSource.network())! const poolInfoUtilsContract = PoolInfoUtils.bind(poolInfoUtilsAddress) - const quoteTokenAmount = poolInfoUtilsContract.lpsToQuoteTokens(poolAddress, bigDecimalRayToBigInt(lend.lpb), bucket.bucketIndex) + const quoteTokenAmount = poolInfoUtilsContract.lpsToQuoteTokens(poolAddress, bigDecimalWadToBigInt(lend.lpb), bucket.bucketIndex) return wadToDecimal(quoteTokenAmount) } diff --git a/src/utils/convert.ts b/src/utils/convert.ts index f587796..4e4a0d7 100644 --- a/src/utils/convert.ts +++ b/src/utils/convert.ts @@ -2,9 +2,9 @@ import { BigInt, BigDecimal, Bytes, Address, log } from '@graphprotocol/graph-ts import { ONE_BI, ZERO_BD, ZERO_BI } from './constants' -// converts a BigDecimal RAY to a BigInt -export function bigDecimalRayToBigInt(value: BigDecimal): BigInt { - return BigInt.fromString(value.times(bigDecimalExp27()).toString()) +// converts a BigDecimal WAD to a BigInt +export function bigDecimalWadToBigInt(value: BigDecimal): BigInt { + return BigInt.fromString(value.times(bigDecimalExp18()).toString()) } export function bigDecimalExp18(): BigDecimal { diff --git a/subgraph.yaml b/subgraph.yaml index d1cce6e..33298f3 100644 --- a/subgraph.yaml +++ b/subgraph.yaml @@ -31,13 +31,13 @@ dataSources: handler: handleApprovalForAll - event: Burn(indexed address,indexed uint256) handler: handleBurn - - event: MemorializePosition(indexed address,uint256) + - event: MemorializePosition(indexed address,uint256,uint256[]) handler: handleMemorializePosition - event: Mint(indexed address,indexed address,uint256) handler: handleMint - - event: MoveLiquidity(indexed address,uint256) + - event: MoveLiquidity(indexed address,uint256,uint256,uint256) handler: handleMoveLiquidity - - event: RedeemPosition(indexed address,uint256) + - event: RedeemPosition(indexed address,uint256,uint256[]) handler: handleRedeemPosition - event: Transfer(indexed address,indexed address,indexed uint256) handler: handleTransfer diff --git a/tests/erc-20-pool.test.ts b/tests/erc-20-pool.test.ts index 8da105a..26aecbf 100644 --- a/tests/erc-20-pool.test.ts +++ b/tests/erc-20-pool.test.ts @@ -25,7 +25,7 @@ import { mockPoolInfoUtilsPoolUpdateCalls } from "./utils/common" import { BucketInfo, getBucketId } from "../src/utils/bucket" -import { addressToBytes, bigDecimalExp18, rayToDecimal, wadToDecimal } from "../src/utils/convert" +import { addressToBytes, bigDecimalExp18, wadToDecimal } from "../src/utils/convert" import { FIVE_PERCENT_BD, FIVE_PERCENT_BI, MAX_PRICE, MAX_PRICE_BI, MAX_PRICE_INDEX, ONE_BI, ONE_RAY_BI, ONE_WAD_BI, ZERO_ADDRESS, ZERO_BD, ZERO_BI } from "../src/utils/constants" import { Account, Lend, Loan, ReserveAuction } from "../generated/schema" import { getLendId } from "../src/utils/lend" diff --git a/tests/utils/common.ts b/tests/utils/common.ts index 47797e4..a535cbe 100644 --- a/tests/utils/common.ts +++ b/tests/utils/common.ts @@ -5,7 +5,7 @@ import { handlePoolCreated } from "../../src/erc-20-pool-factory" import { createPoolCreatedEvent } from "./erc-20-pool-factory-utils" import { BucketInfo, getBucketId } from "../../src/utils/bucket" -import { addressToBytes, rayToDecimal, wadToDecimal } from "../../src/utils/convert" +import { addressToBytes, wadToDecimal } from "../../src/utils/convert" import { poolInfoUtilsNetworkLookUpTable } from "../../src/utils/constants" import { BurnInfo, LoansInfo, PoolPricesInfo, PoolUtilizationInfo, ReservesInfo } from "../../src/utils/pool" import { AuctionInfo } from "../../src/utils/liquidation" @@ -39,13 +39,13 @@ export function assertBucketUpdate(params: BucketUpdatedParams): void { "Bucket", `${params.id.toHexString()}`, "exchangeRate", - `${rayToDecimal(params.exchangeRate)}` + `${wadToDecimal(params.exchangeRate)}` ) assert.fieldEquals( "Bucket", `${params.id.toHexString()}`, "lpb", - `${rayToDecimal(params.lpb)}` + `${wadToDecimal(params.lpb)}` ) } @@ -72,7 +72,7 @@ export function assertLendUpdate(params: LendUpdatedParams): void { "Lend", `${params.id.toHexString()}`, "lpb", - `${rayToDecimal(params.lpb)}` + `${wadToDecimal(params.lpb)}` ) assert.fieldEquals( "Lend", diff --git a/tests/utils/position-manager-utils.ts b/tests/utils/position-manager-utils.ts index 57cf21b..c785e06 100644 --- a/tests/utils/position-manager-utils.ts +++ b/tests/utils/position-manager-utils.ts @@ -78,7 +78,8 @@ export function createBurnEvent(lender: Address, tokenId: BigInt): Burn { export function createMemorializePositionEvent( lender: Address, - tokenId: BigInt + tokenId: BigInt, + indexes: Array ): MemorializePosition { let memorializePositionEvent = changetype(newMockEvent()) @@ -93,6 +94,12 @@ export function createMemorializePositionEvent( ethereum.Value.fromUnsignedBigInt(tokenId) ) ) + memorializePositionEvent.parameters.push( + new ethereum.EventParam( + "indexes", + ethereum.Value.fromUnsignedBigIntArray(indexes) + ) + ) return memorializePositionEvent } @@ -113,10 +120,7 @@ export function createMintEvent( new ethereum.EventParam("pool", ethereum.Value.fromAddress(pool)) ) mintEvent.parameters.push( - new ethereum.EventParam( - "tokenId", - ethereum.Value.fromUnsignedBigInt(tokenId) - ) + new ethereum.EventParam("tokenId", ethereum.Value.fromUnsignedBigInt(tokenId)) ) return mintEvent @@ -124,7 +128,9 @@ export function createMintEvent( export function createMoveLiquidityEvent( lender: Address, - tokenId: BigInt + tokenId: BigInt, + fromIndex: BigInt, + toIndex: BigInt ): MoveLiquidity { let moveLiquidityEvent = changetype(newMockEvent()) @@ -139,13 +145,21 @@ export function createMoveLiquidityEvent( ethereum.Value.fromUnsignedBigInt(tokenId) ) ) + moveLiquidityEvent.parameters.push( + new ethereum.EventParam("fromIndex", ethereum.Value.fromUnsignedBigInt(fromIndex)) + ) + moveLiquidityEvent.parameters.push( + new ethereum.EventParam("toIndex", ethereum.Value.fromUnsignedBigInt(toIndex)) + ) + return moveLiquidityEvent } export function createRedeemPositionEvent( lender: Address, - tokenId: BigInt + tokenId: BigInt, + indexes: Array ): RedeemPosition { let redeemPositionEvent = changetype(newMockEvent()) @@ -155,10 +169,10 @@ export function createRedeemPositionEvent( new ethereum.EventParam("lender", ethereum.Value.fromAddress(lender)) ) redeemPositionEvent.parameters.push( - new ethereum.EventParam( - "tokenId", - ethereum.Value.fromUnsignedBigInt(tokenId) - ) + new ethereum.EventParam("tokenId", ethereum.Value.fromUnsignedBigInt(tokenId)) + ) + redeemPositionEvent.parameters.push( + new ethereum.EventParam("indexes", ethereum.Value.fromUnsignedBigIntArray(indexes)) ) return redeemPositionEvent @@ -180,10 +194,7 @@ export function createTransferEvent( new ethereum.EventParam("to", ethereum.Value.fromAddress(to)) ) transferEvent.parameters.push( - new ethereum.EventParam( - "tokenId", - ethereum.Value.fromUnsignedBigInt(tokenId) - ) + new ethereum.EventParam("tokenId", ethereum.Value.fromUnsignedBigInt(tokenId)) ) return transferEvent From 2971e9f7f0cdaca8cf100073f85f3bd48694f7f7 Mon Sep 17 00:00:00 2001 From: Ed Noepel Date: Sun, 19 Mar 2023 15:03:29 -0400 Subject: [PATCH 03/12] script to copy ABIs, re-linted pool ABIs --- README.md | 1 - abis/ERC20Pool.json | 30 +++++------------------------- abis/ERC20PoolFactory.json | 12 ++---------- abis/ERC721PoolFactory.json | 12 ++---------- copy-abis.sh | 11 +++++++++++ 5 files changed, 20 insertions(+), 46 deletions(-) create mode 100755 copy-abis.sh diff --git a/README.md b/README.md index bfe4522..0d5ea66 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,6 @@ npm run build This subgraph can be run locally using provided docker containers. To start, set the environment variable *ETH_RPC_URL* in your .env file. Then, run `docker-compose up`. Once the node is running, deploy the subgraph with: ``` -npm run build npm run create-local npm run deploy-local ``` diff --git a/abis/ERC20Pool.json b/abis/ERC20Pool.json index 7bd2c6f..a0d7add 100644 --- a/abis/ERC20Pool.json +++ b/abis/ERC20Pool.json @@ -274,11 +274,7 @@ "anonymous": false, "name": "ReserveAuction", "inputs": [ - { - "type": "uint256", - "name": "claimableReservesRemaining", - "indexed": false - }, + { "type": "uint256", "name": "claimableReservesRemaining", "indexed": false }, { "type": "uint256", "name": "auctionPrice", "indexed": false }, { "type": "uint256", "name": "currentBurnEpoch", "indexed": false } ] @@ -420,11 +416,7 @@ "stateMutability": "view", "payable": false, "inputs": [{ "type": "address", "name": "borrower_" }], - "outputs": [ - { "type": "uint256" }, - { "type": "uint256" }, - { "type": "uint256" } - ] + "outputs": [{ "type": "uint256" }, { "type": "uint256" }, { "type": "uint256" }] }, { "type": "function", @@ -478,11 +470,7 @@ "stateMutability": "view", "payable": false, "inputs": [{ "type": "uint256", "name": "burnEventEpoch_" }], - "outputs": [ - { "type": "uint256" }, - { "type": "uint256" }, - { "type": "uint256" } - ] + "outputs": [{ "type": "uint256" }, { "type": "uint256" }, { "type": "uint256" }] }, { "type": "function", @@ -518,11 +506,7 @@ "stateMutability": "view", "payable": false, "inputs": [], - "outputs": [ - { "type": "uint256" }, - { "type": "uint256" }, - { "type": "uint256" } - ] + "outputs": [{ "type": "uint256" }, { "type": "uint256" }, { "type": "uint256" }] }, { "type": "function", @@ -712,11 +696,7 @@ "stateMutability": "view", "payable": false, "inputs": [], - "outputs": [ - { "type": "address" }, - { "type": "uint256" }, - { "type": "uint256" } - ] + "outputs": [{ "type": "address" }, { "type": "uint256" }, { "type": "uint256" }] }, { "type": "function", diff --git a/abis/ERC20PoolFactory.json b/abis/ERC20PoolFactory.json index 515d7ce..5ee85fe 100644 --- a/abis/ERC20PoolFactory.json +++ b/abis/ERC20PoolFactory.json @@ -1,9 +1,5 @@ [ - { - "type": "constructor", - "payable": false, - "inputs": [{ "type": "address", "name": "ajna_" }] - }, + { "type": "constructor", "payable": false, "inputs": [{ "type": "address", "name": "ajna_" }] }, { "type": "error", "name": "CreateFail", "inputs": [] }, { "type": "error", "name": "DeployWithZeroAddress", "inputs": [] }, { "type": "error", "name": "PoolAlreadyExists", "inputs": [] }, @@ -68,11 +64,7 @@ "constant": true, "stateMutability": "view", "payable": false, - "inputs": [ - { "type": "bytes32" }, - { "type": "address" }, - { "type": "address" } - ], + "inputs": [{ "type": "bytes32" }, { "type": "address" }, { "type": "address" }], "outputs": [{ "type": "address" }] }, { diff --git a/abis/ERC721PoolFactory.json b/abis/ERC721PoolFactory.json index 6a98448..39d4b0f 100644 --- a/abis/ERC721PoolFactory.json +++ b/abis/ERC721PoolFactory.json @@ -1,9 +1,5 @@ [ - { - "type": "constructor", - "payable": false, - "inputs": [{ "type": "address", "name": "ajna_" }] - }, + { "type": "constructor", "payable": false, "inputs": [{ "type": "address", "name": "ajna_" }] }, { "type": "error", "name": "CreateFail", "inputs": [] }, { "type": "error", "name": "DeployWithZeroAddress", "inputs": [] }, { "type": "error", "name": "NFTNotSupported", "inputs": [] }, @@ -71,11 +67,7 @@ "constant": true, "stateMutability": "view", "payable": false, - "inputs": [ - { "type": "bytes32" }, - { "type": "address" }, - { "type": "address" } - ], + "inputs": [{ "type": "bytes32" }, { "type": "address" }, { "type": "address" }], "outputs": [{ "type": "address" }] }, { diff --git a/copy-abis.sh b/copy-abis.sh new file mode 100755 index 0000000..f31804e --- /dev/null +++ b/copy-abis.sh @@ -0,0 +1,11 @@ +#!/bin/bash +ABI_PATH="${1:-../sdk/packages/sdk-api/src/abis}" + +rm abis/* +cp "${ABI_PATH}/ERC20.json" abis/ +cp "${ABI_PATH}/ERC20Pool.json" abis/ +cp "${ABI_PATH}/ERC20PoolFactory.json" abis/ +cp "${ABI_PATH}/ERC721PoolFactory.json" abis/ +cp "${ABI_PATH}/PoolInfoUtils.json" abis/ +cp "${ABI_PATH}/PositionManager.json" abis/ +cp "${ABI_PATH}/RewardsManager.json" abis/ From 9db99db29ac86e1b09995421be77e0945fb5d85e Mon Sep 17 00:00:00 2001 From: Ed Noepel Date: Mon, 20 Mar 2023 15:43:38 -0400 Subject: [PATCH 04/12] renamed indexesRedeemed to indexes for consistency with MemorializePosition --- schema.graphql | 2 +- src/position-manager.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/schema.graphql b/schema.graphql index eb4dd95..c7360a9 100644 --- a/schema.graphql +++ b/schema.graphql @@ -526,7 +526,7 @@ type RedeemPosition @entity(immutable: true) { id: Bytes! lender: Bytes! # address tokenId: BigInt! # uint256 - indexesRedeemed: [BigInt!]! # uint256[] + indexes: [BigInt!]! # uint256[] blockNumber: BigInt! blockTimestamp: BigInt! transactionHash: Bytes! diff --git a/src/position-manager.ts b/src/position-manager.ts index 20d2879..eff73b7 100644 --- a/src/position-manager.ts +++ b/src/position-manager.ts @@ -117,7 +117,7 @@ export function handleRedeemPosition(event: RedeemPositionEvent): void { ) entity.lender = event.params.lender entity.tokenId = event.params.tokenId - entity.indexesRedeemed = event.params.indexes + entity.indexes = event.params.indexes entity.blockNumber = event.block.number entity.blockTimestamp = event.block.timestamp From 3a7a106c505d7f05329dfc6d0f107c351b769153 Mon Sep 17 00:00:00 2001 From: Ed Noepel Date: Mon, 20 Mar 2023 15:44:00 -0400 Subject: [PATCH 05/12] updated addresses --- add-commands.txt | 11 +++++++---- networks.json | 13 +++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/add-commands.txt b/add-commands.txt index 022e29a..01f40cd 100644 --- a/add-commands.txt +++ b/add-commands.txt @@ -1,12 +1,15 @@ # Goerli ERC20PoolFactory -graph add 0xbF332da94B818AC7972484997100c8cBB400b991 --abi ../contracts/forge_out/ERC20PoolFactory.sol/ERC20PoolFactory.json --contract-name ERC20PoolFactory +graph add 0x9684b8eC942985b23d343cB82D2F30EdA8fD7179 --abi ../contracts/forge_out/ERC20PoolFactory.sol/ERC20PoolFactory.json --contract-name ERC20PoolFactory # Goerli ERC721PoolFactory -graph add 0x0bBd35022094a75b5A58A2E6Fa6F1989A0F682F5 --abi ../contracts/forge_out/ERC721PoolFactory.sol/ERC721PoolFactory.json --contract-name ERC721PoolFactory +graph add 0x7DB5ba7cB6dAD74b45AAB027A7E7388eF18656DF --abi ../contracts/forge_out/ERC721PoolFactory.sol/ERC721PoolFactory.json --contract-name ERC721PoolFactory + +# Goerli PoolInfoUtils +graph add 0xEa36b2a4703182d07df9DdEe46BF97f9979F0cCf --abi ../contracts/forge_out/ERC721PoolFactory.sol/ERC721PoolFactory.json --contract-name PoolInfoUtils # Goerli PositionManager -graph add 0x235162AF9407e485DeB9E2f65CDC621B087B540C --abi ../contracts/forge_out/PositionManager.sol/PositionManager.json --contract-name PositionManager +graph add 0x31BcbE14Ad30B2f7E1E4A14caB2C16849B73Dac3 --abi ../contracts/forge_out/PositionManager.sol/PositionManager.json --contract-name PositionManager # Goerli RewardsManager -graph add 0x6757ccD59eCD0088f01c5F2d4992258CB12cC376 --abi ../contracts/forge_out/RewardsManager.sol/RewardsManager.json --contract-name RewardsManager +graph add 0xEd6890d748e62ddbb3f80e7256Deeb2fBb853476 --abi ../contracts/forge_out/RewardsManager.sol/RewardsManager.json --contract-name RewardsManager diff --git a/networks.json b/networks.json index def0743..05f83ef 100644 --- a/networks.json +++ b/networks.json @@ -1,22 +1,19 @@ { "goerli": { - "ERC20Pool": { - "address": "0x0bde5e31af1a88113158fb577cb3c61df9843afe" - }, "PositionManager": { - "address": "0x235162AF9407e485DeB9E2f65CDC621B087B540C" + "address": "0x31BcbE14Ad30B2f7E1E4A14caB2C16849B73Dac3" }, "PoolInfoUtils": { - "address": "0x32DA971821E6d88FCcD9861EbaCF8590553A2aA8" + "address": "0xEa36b2a4703182d07df9DdEe46BF97f9979F0cCf" }, "ERC20PoolFactory": { - "address": "0xbF332da94B818AC7972484997100c8cBB400b991" + "address": "0x9684b8eC942985b23d343cB82D2F30EdA8fD7179" }, "RewardsManager": { - "address": "0x6757ccD59eCD0088f01c5F2d4992258CB12cC376" + "address": "0xEd6890d748e62ddbb3f80e7256Deeb2fBb853476" }, "ERC721PoolFactory": { - "address": "0x0bBd35022094a75b5A58A2E6Fa6F1989A0F682F5" + "address": "0x7DB5ba7cB6dAD74b45AAB027A7E7388eF18656DF" } } } \ No newline at end of file From 27f48c4e855fdc2383d3d016beb3cfe0fbb7d813 Mon Sep 17 00:00:00 2001 From: Ed Noepel Date: Tue, 21 Mar 2023 07:09:29 -0400 Subject: [PATCH 06/12] eliminated duplicate errors in ABI --- abis/ERC20Pool.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/abis/ERC20Pool.json b/abis/ERC20Pool.json index a0d7add..3b088b0 100644 --- a/abis/ERC20Pool.json +++ b/abis/ERC20Pool.json @@ -5,7 +5,6 @@ { "type": "error", "name": "AuctionActive", "inputs": [] }, { "type": "error", "name": "AuctionNotClearable", "inputs": [] }, { "type": "error", "name": "AuctionNotCleared", "inputs": [] }, - { "type": "error", "name": "AuctionNotCleared", "inputs": [] }, { "type": "error", "name": "AuctionPriceGtBucketPrice", "inputs": [] }, { "type": "error", "name": "BorrowerNotSender", "inputs": [] }, { "type": "error", "name": "BorrowerOk", "inputs": [] }, @@ -90,11 +89,9 @@ { "type": "error", "name": "PoolUnderCollateralized", "inputs": [] }, { "type": "error", "name": "PriceBelowLUP", "inputs": [] }, { "type": "error", "name": "RemoveDepositLockedByAuctionDebt", "inputs": [] }, - { "type": "error", "name": "RemoveDepositLockedByAuctionDebt", "inputs": [] }, { "type": "error", "name": "ReserveAuctionTooSoon", "inputs": [] }, { "type": "error", "name": "TakeNotPastCooldown", "inputs": [] }, { "type": "error", "name": "TransactionExpired", "inputs": [] }, - { "type": "error", "name": "TransactionExpired", "inputs": [] }, { "type": "error", "name": "TransferToSameOwner", "inputs": [] }, { "type": "error", "name": "TransferorNotApproved", "inputs": [] }, { "type": "error", "name": "ZeroThresholdPrice", "inputs": [] }, From bc45b7ea89af6920de785ee2adf3c63fd2084112 Mon Sep 17 00:00:00 2001 From: Ed Noepel Date: Tue, 21 Mar 2023 13:43:41 -0400 Subject: [PATCH 07/12] add MoveStakedLiquidity and LoanStamped events --- schema.graphql | 18 ++++++++++++++++++ src/erc-20-pool.ts | 13 +++++++++++++ src/rewards-manager.ts | 16 ++++++++++++++++ subgraph.yaml | 10 +++++++--- 4 files changed, 54 insertions(+), 3 deletions(-) diff --git a/schema.graphql b/schema.graphql index c7360a9..fd171dd 100644 --- a/schema.graphql +++ b/schema.graphql @@ -349,6 +349,14 @@ type Kick @entity { transactionHash: Bytes! } +type LoanStamped @entity(immutable: true) { + id: Bytes! + borrower: Bytes! # address + blockNumber: BigInt! + blockTimestamp: BigInt! + transactionHash: Bytes! +} + type MoveQuoteToken @entity(immutable: true) { id: Bytes! pool: Pool! # Pool in which quote tokens were moved @@ -522,6 +530,16 @@ type MoveLiquidity @entity(immutable: true) { transactionHash: Bytes! } +type MoveStakedLiquidity @entity(immutable: true) { + id: Bytes! + tokenId: BigInt! # uint256 + fromIndexes: [BigInt!]! # uint256 + toIndexes: [BigInt!]! # uint256 + blockNumber: BigInt! + blockTimestamp: BigInt! + transactionHash: Bytes! +} + type RedeemPosition @entity(immutable: true) { id: Bytes! lender: Bytes! # address diff --git a/src/erc-20-pool.ts b/src/erc-20-pool.ts index 0954bd3..a65232f 100644 --- a/src/erc-20-pool.ts +++ b/src/erc-20-pool.ts @@ -10,6 +10,7 @@ import { BucketTakeLPAwarded as BucketTakeLPAwardedEvent, DrawDebt as DrawDebtEvent, Kick as KickEvent, + LoanStamped as LoanStampedEvent, MoveQuoteToken as MoveQuoteTokenEvent, RemoveCollateral as RemoveCollateralEvent, RemoveQuoteToken as RemoveQuoteTokenEvent, @@ -31,6 +32,7 @@ import { DrawDebt, Kick, LiquidationAuction, + LoanStamped, MoveQuoteToken, Pool, RemoveCollateral, @@ -545,6 +547,17 @@ export function handleKick(event: KickEvent): void { kick.save() } +export function handleLoanStamped(event: LoanStampedEvent): void { + const entity = new LoanStamped( + event.transaction.hash.concatI32(event.logIndex.toI32()) + ) + entity.borrower = event.params.borrower + + entity.blockNumber = event.block.number + entity.blockTimestamp = event.block.timestamp + entity.transactionHash = event.transaction.hash +} + export function handleMoveQuoteToken(event: MoveQuoteTokenEvent): void { const moveQuoteToken = new MoveQuoteToken( event.transaction.hash.concatI32(event.logIndex.toI32()) diff --git a/src/rewards-manager.ts b/src/rewards-manager.ts index f90c23b..b758dea 100644 --- a/src/rewards-manager.ts +++ b/src/rewards-manager.ts @@ -1,11 +1,13 @@ import { ClaimRewards as ClaimRewardsEvent, + MoveStakedLiquidity as MoveStakedLiquidityEvent, Stake as StakeEvent, Unstake as UnstakeEvent, UpdateExchangeRates as UpdateExchangeRatesEvent } from "../generated/RewardsManager/RewardsManager" import { ClaimRewards, + MoveStakedLiquidity, Stake, Unstake, UpdateExchangeRates @@ -28,6 +30,20 @@ export function handleClaimRewards(event: ClaimRewardsEvent): void { entity.save() } +export function handleMoveStakedLiquidity(event: MoveStakedLiquidityEvent): void { + let entity = new MoveStakedLiquidity( + event.transaction.hash.concatI32(event.logIndex.toI32()) + ) + entity.fromIndexes = event.params.fromIndexes + entity.toIndexes = event.params.toIndexes + + entity.blockNumber = event.block.number + entity.blockTimestamp = event.block.timestamp + entity.transactionHash = event.transaction.hash + + entity.save() +} + export function handleStake(event: StakeEvent): void { let entity = new Stake( event.transaction.hash.concatI32(event.logIndex.toI32()) diff --git a/subgraph.yaml b/subgraph.yaml index 33298f3..544cd1a 100644 --- a/subgraph.yaml +++ b/subgraph.yaml @@ -76,6 +76,7 @@ dataSources: language: wasm/assemblyscript entities: - ClaimRewards + - MoveStakedLiquidity - Stake - Unstake - UpdateExchangeRates @@ -85,6 +86,8 @@ dataSources: eventHandlers: - event: ClaimRewards(indexed address,indexed address,indexed uint256,uint256[],uint256) handler: handleClaimRewards + - event: MoveStakedLiquidity(uint256,uint256[],uint256[]) + handler: handleMoveStakedLiquidity - event: Stake(indexed address,indexed address,indexed uint256) handler: handleStake - event: Unstake(indexed address,indexed address,indexed uint256) @@ -108,7 +111,7 @@ dataSources: - name: ERC721PoolFactory file: ./abis/ERC721PoolFactory.json - name: ERC20 - file: ./abis/ERC20.json + file: ./abis/ERC20.json eventHandlers: - event: PoolCreated(address) handler: handlePoolCreated @@ -166,8 +169,9 @@ templates: handler: handleDrawDebt - event: Kick(indexed address,uint256,uint256,uint256) handler: handleKick - - event: MoveQuoteToken(indexed address,indexed uint256,indexed - uint256,uint256,uint256,uint256,uint256) + - event: LoanStamped(indexed address) + handler: handleLoanStamped + - event: MoveQuoteToken(indexed address,indexed uint256,indexed uint256,uint256,uint256,uint256,uint256) handler: handleMoveQuoteToken - event: RemoveCollateral(indexed address,indexed uint256,uint256,uint256) handler: handleRemoveCollateral From 25193ddaf54038664851fae67df903a696d517d0 Mon Sep 17 00:00:00 2001 From: Ed Noepel Date: Tue, 21 Mar 2023 15:40:28 -0400 Subject: [PATCH 08/12] reinstalled matchstick --- package.json | 4 ++- yarn.lock | 78 +++++++++++++++++++++++++--------------------------- 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/package.json b/package.json index 48b404c..3c3da08 100644 --- a/package.json +++ b/package.json @@ -15,5 +15,7 @@ "@graphprotocol/graph-cli": "0.37.6", "@graphprotocol/graph-ts": "0.29.1" }, - "devDependencies": { "matchstick-as": "0.5.0" } + "devDependencies": { + "matchstick-as": "0.5.0" + } } diff --git a/yarn.lock b/yarn.lock index 68d6f8c..673aeb7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -24,9 +24,9 @@ js-tokens "^4.0.0" "@babel/runtime@^7.9.2": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.20.7.tgz#fcb41a5a70550e04a7b708037c7c32f7f356d8fd" - integrity sha512-UF0tvkUtxwAgZ5W/KrkHf0Rn0fdnLDU9ScxBrEVNUprE/MzirjK4MJUX1/BVDv00Sv8cljtukVK1aky++X1SjQ== + version "7.21.0" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.21.0.tgz#5b55c9d394e5fcf304909a8b00c07dc217b56673" + integrity sha512-xwII0//EObnq89Ji5AKYQaRYiW/nZ3llSv29d49IuxPhKbtJoLP+9QUUZ4nVragQVtaVGeZrpB+ZtG/Pdy/POw== dependencies: regenerator-runtime "^0.13.11" @@ -208,9 +208,9 @@ "@ethersproject/strings" "^5.7.0" "@float-capital/float-subgraph-uncrashable@^0.0.0-alpha.4": - version "0.0.0-internal-testing.4" - resolved "https://registry.yarnpkg.com/@float-capital/float-subgraph-uncrashable/-/float-subgraph-uncrashable-0.0.0-internal-testing.4.tgz#7886b6fc1c75ea5b36d4c953e7150875954b94cf" - integrity sha512-jjGnze6R8ro5Stf1mQwOPVCCmOf6smEZeDD7q2QEP14Mg8O5zTfvE/3U2bHAiV1y8G+affZsBu9sG1yarD/WRw== + version "0.0.0-internal-testing.5" + resolved "https://registry.yarnpkg.com/@float-capital/float-subgraph-uncrashable/-/float-subgraph-uncrashable-0.0.0-internal-testing.5.tgz#060f98440f6e410812766c5b040952d2d02e2b73" + integrity sha512-yZ0H5e3EpAYKokX/AbtplzlvSxEJY7ZfpvQyDzyODkks0hakAAlDG6fQu1SlDJMWorY7bbq1j7fCiFeTWci6TA== dependencies: "@rescript/std" "9.0.0" graphql "^16.6.0" @@ -289,9 +289,9 @@ "@types/node" "*" "@types/express-serve-static-core@^4.17.9": - version "4.17.32" - resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.17.32.tgz#93dda387f5516af616d8d3f05f2c4c79d81e1b82" - integrity sha512-aI5h/VOkxOF2Z1saPy0Zsxs5avets/iaiAJYznQFm5By/pamU31xWKL//epiF4OfUA2qTOc9PV6tCUjhO8wlZA== + version "4.17.33" + resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.17.33.tgz#de35d30a9d637dc1450ad18dd583d75d5733d543" + integrity sha512-TPBqmR/HRYI3eC2E5hmiivIzv+bidAfXofM+sbonAGvyDhySGw9/PQZFt2BLOrjUUR++4eJVpx6KnLQK1Fk9tA== dependencies: "@types/node" "*" "@types/qs" "*" @@ -310,9 +310,9 @@ integrity sha512-BdZ5BCCvho3EIXw6wUCXHe7rS53AIDPLE+JzwgT+OsJk53oBfbSmZZ7CX4VaRoN78N+TJpFi9QPlfIVNmJYWxQ== "@types/node@*": - version "18.11.18" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.11.18.tgz#8dfb97f0da23c2293e554c5a50d61ef134d7697f" - integrity sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA== + version "18.15.5" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.15.5.tgz#3af577099a99c61479149b716183e70b5239324a" + integrity sha512-Ark2WDjjZO7GmvsyFFf81MXuGTA/d6oP38anyxWOL6EREyBKAxKoFHwBhaZxCfLRLpO8JgVXwqOwSwa7jRcjew== "@types/node@^10.0.3": version "10.17.60" @@ -1444,9 +1444,9 @@ glob@^7.1.3: once "^1.3.0" path-is-absolute "^1.0.0" -"gluegun@https://github.com/edgeandnode/gluegun#v4.3.1-pin-colors-dep": +"gluegun@git+https://github.com/edgeandnode/gluegun.git#v4.3.1-pin-colors-dep": version "4.3.1" - resolved "https://github.com/edgeandnode/gluegun#b34b9003d7bf556836da41b57ef36eb21570620a" + resolved "git+https://github.com/edgeandnode/gluegun.git#b34b9003d7bf556836da41b57ef36eb21570620a" dependencies: apisauce "^1.0.1" app-module-path "^2.2.0" @@ -1481,9 +1481,9 @@ glob@^7.1.3: yargs-parser "^16.1.0" graceful-fs@^4.1.6, graceful-fs@^4.2.0: - version "4.2.10" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c" - integrity sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA== + version "4.2.11" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" + integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== graphql-import-node@^0.0.5: version "0.0.5" @@ -1777,9 +1777,9 @@ is-circular@^1.0.2: integrity sha512-YttjnrswnUYRVJvxCvu8z+PGMUSzC2JttP0OEXezlAEdp3EXzhf7IZ3j0gRAybJBQupedIZFhY61Tga6E0qASA== is-electron@^2.2.0: - version "2.2.1" - resolved "https://registry.yarnpkg.com/is-electron/-/is-electron-2.2.1.tgz#751b1dd8a74907422faa5c35aaa0cf66d98086e9" - integrity sha512-r8EEQQsqT+Gn0aXFx7lTFygYQhILLCB+wn0WCDL5LZRINeLH/Rvw1j2oKodELLXYNImQ3CRlVsY8wW4cGOsyuw== + version "2.2.2" + resolved "https://registry.yarnpkg.com/is-electron/-/is-electron-2.2.2.tgz#3778902a2044d76de98036f5dc58089ac4d80bb9" + integrity sha512-FO/Rhvz5tuw4MCWkpMzHFKWD2LsfHzIb7i6MdPYZ/KW7AlxawyLkqdy+jPZP1WubqEADE3O4FUENlJHDfQASRg== is-extglob@^2.1.1: version "2.1.1" @@ -2284,9 +2284,9 @@ minimatch@^3.0.2, minimatch@^3.0.4, minimatch@^3.1.1: brace-expansion "^1.1.7" minimist@^1.2.0, minimist@^1.2.6: - version "1.2.7" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.7.tgz#daa1c4d91f507390437c6a8bc01078e7000c4d18" - integrity sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g== + version "1.2.8" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" + integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== minipass@^3.0.0: version "3.3.6" @@ -2296,11 +2296,9 @@ minipass@^3.0.0: yallist "^4.0.0" minipass@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/minipass/-/minipass-4.0.0.tgz#7cebb0f9fa7d56f0c5b17853cbe28838a8dbbd3b" - integrity sha512-g2Uuh2jEKoht+zvO6vJqXmYpflPqzRBT+Th2h01DKh5z7wbY/AZ2gCQ78cP70YoHPyFdY30YBV5WxgLOEwOykw== - dependencies: - yallist "^4.0.0" + version "4.2.5" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-4.2.5.tgz#9e0e5256f1e3513f8c34691dd68549e85b2c8ceb" + integrity sha512-+yQl7SX3bIT83Lhb4BVorMAHVuqsskxRdlmO9kTpyukp8vsm2Sn/fUOV9xlnG8/a5JsypJzap21lz/y3FBMJ8Q== minizlib@^2.1.1: version "2.1.2" @@ -2499,9 +2497,9 @@ node-fetch@2.6.0: integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA== node-fetch@^2.3.0: - version "2.6.8" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.8.tgz#a68d30b162bc1d8fd71a367e81b997e1f4d4937e" - integrity sha512-RZ6dBYuj8dRSfxpUSu+NsdF1dpPpluJxwOp+6IoDp/sH2QNDSvurYsAa+F1WxY2RjA1iP93xhcsUoYbF2XBqVg== + version "2.6.9" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.9.tgz#7c7f744b5cc6eb5fd404e0c7a9fec630a55657e6" + integrity sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg== dependencies: whatwg-url "^5.0.0" @@ -2786,9 +2784,9 @@ punycode@^2.1.0, punycode@^2.1.1: integrity sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA== qs@^6.4.0, qs@^6.5.2: - version "6.11.0" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.11.0.tgz#fd0d963446f7a65e1367e01abd85429453f0c37a" - integrity sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q== + version "6.11.1" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.11.1.tgz#6c29dff97f0c0060765911ba65cbc9764186109f" + integrity sha512-0wsrzgTz/kAVIeuxSjnpGC56rzYtr6JT/2BwEvMaPhFIoYa1aGO8LbzuU1R0uUYQkLpWBTOj0l/CLAJB64J6nQ== dependencies: side-channel "^1.0.4" @@ -2822,18 +2820,18 @@ randombytes@^2.1.0: safe-buffer "^5.1.0" "readable-stream@2 || 3", readable-stream@^3.0.0, readable-stream@^3.0.1, readable-stream@^3.0.2, readable-stream@^3.1.1, readable-stream@^3.4.0, readable-stream@^3.6.0: - version "3.6.0" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" - integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== + version "3.6.2" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967" + integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA== dependencies: inherits "^2.0.3" string_decoder "^1.1.1" util-deprecate "^1.0.1" readable-stream@^2.2.2, readable-stream@^2.3.0, readable-stream@^2.3.5: - version "2.3.7" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57" - integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw== + version "2.3.8" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.8.tgz#91125e8042bba1b9887f49345f6277027ce8be9b" + integrity sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA== dependencies: core-util-is "~1.0.0" inherits "~2.0.3" From 3206bcc36cbbc43d59f6c8fa49c36a3f3f85f82e Mon Sep 17 00:00:00 2001 From: Ed Noepel Date: Wed, 22 Mar 2023 07:22:58 -0400 Subject: [PATCH 09/12] added BondWithdrawn event --- schema.graphql | 10 ++++++++++ src/erc-20-pool.ts | 17 +++++++++++++++++ subgraph.yaml | 4 ++++ 3 files changed, 31 insertions(+) diff --git a/schema.graphql b/schema.graphql index fd171dd..0378309 100644 --- a/schema.graphql +++ b/schema.graphql @@ -279,6 +279,16 @@ type AuctionSettle @entity(immutable: true) { transactionHash: Bytes! } +type BondWithdrawn @entity(immutable: true) { + id: Bytes! + kicker: Bytes! # address + reciever: Bytes! # address + amount: BigInt! # uint256 + blockNumber: BigInt! + blockTimestamp: BigInt! + transactionHash: Bytes! +} + type BucketBankruptcy @entity(immutable: true) { id: Bytes! bucket: Bucket! # Bucket which was bankrupted diff --git a/src/erc-20-pool.ts b/src/erc-20-pool.ts index a65232f..74c8511 100644 --- a/src/erc-20-pool.ts +++ b/src/erc-20-pool.ts @@ -5,6 +5,7 @@ import { AddQuoteToken as AddQuoteTokenEvent, AuctionNFTSettle as AuctionNFTSettleEvent, AuctionSettle as AuctionSettleEvent, + BondWithdrawn as BondWithdrawnEvent, BucketBankruptcy as BucketBankruptcyEvent, BucketTake as BucketTakeEvent, BucketTakeLPAwarded as BucketTakeLPAwardedEvent, @@ -26,6 +27,7 @@ import { AddQuoteToken, AuctionNFTSettle, AuctionSettle, + BondWithdrawn, BucketBankruptcy, BucketTake, BucketTakeLPAwarded, @@ -234,6 +236,21 @@ export function handleAuctionSettle(event: AuctionSettleEvent): void { auctionSettle.save() } +export function handleBondWithdrawn(event: BondWithdrawnEvent): void { + let entity = new BondWithdrawn( + event.transaction.hash.concatI32(event.logIndex.toI32()) + ) + entity.kicker = event.params.kicker + entity.reciever = event.params.reciever + entity.amount = event.params.amount + + entity.blockNumber = event.block.number + entity.blockTimestamp = event.block.timestamp + entity.transactionHash = event.transaction.hash + + entity.save() +} + export function handleBucketBankruptcy(event: BucketBankruptcyEvent): void { const bucketBankruptcy = new BucketBankruptcy( event.transaction.hash.concatI32(event.logIndex.toI32()) diff --git a/subgraph.yaml b/subgraph.yaml index 544cd1a..6626b56 100644 --- a/subgraph.yaml +++ b/subgraph.yaml @@ -131,11 +131,13 @@ templates: - AddQuoteToken - AuctionNFTSettle - AuctionSettle + - BondWithdrawn - BucketBankruptcy - BucketTake - BucketTakeLPAwarded - DrawDebt - Kick + - LoanStamped - MoveQuoteToken - RemoveCollateral - RemoveQuoteToken @@ -159,6 +161,8 @@ templates: handler: handleAuctionNFTSettle - event: AuctionSettle(indexed address,uint256) handler: handleAuctionSettle + - event: BondWithdrawn(indexed address,indexed address,uint256) + handler: handleBondWithdrawn - event: BucketBankruptcy(indexed uint256,uint256) handler: handleBucketBankruptcy - event: BucketTake(indexed address,uint256,uint256,uint256,uint256,bool) From cd9a40e5bd1932f762f3d7e74e104554dccfc76c Mon Sep 17 00:00:00 2001 From: Ed Noepel Date: Wed, 22 Mar 2023 13:28:03 -0400 Subject: [PATCH 10/12] transferors and allowances entity plumbing --- schema.graphql | 26 +++++++++++++++++++- src/erc-20-pool.ts | 47 +++++++++++++++++++++++++++++++++++++ src/utils/lp-allowances.ts | 27 +++++++++++++++++++++ src/utils/lp-transferors.ts | 30 +++++++++++++++++++++++ subgraph.yaml | 15 +++++++++++- 5 files changed, 143 insertions(+), 2 deletions(-) create mode 100644 src/utils/lp-allowances.ts create mode 100644 src/utils/lp-transferors.ts diff --git a/schema.graphql b/schema.graphql index 0378309..262dd8e 100644 --- a/schema.graphql +++ b/schema.graphql @@ -192,7 +192,7 @@ type Account @entity { # TODO: determine if it's worth adding borrowerDebt field updated in kick mapping type LiquidationAuction @entity { - id: Bytes! # $poolAddress + '|' + $loanId + id: Bytes! # $poolAddress + '|' + $loanId // FIXME: collides with Loan entity's ID field pool: Pool! # pool in which the liquidation occurred borrower: Bytes! # address of the borrower being liquidated # borrowerDebt: BigDecimal! # total debt of the borrower at kickTime @@ -226,6 +226,30 @@ type ReserveAuctionProcess @entity { ajnaBurnedAcrossAllTakes: BigDecimal! # total amount of ajna burned across all takes in the reserve auction } +# updated upon ApproveLpTransferors and RevokeLpTransferors +type LPTransferors @entity { + id: Bytes! # $poolAddress + '|' + $lender + pool: Pool! # pool in which these transferors have been approved + lender: Bytes! # address of the lender who has approved transferors + transferors: [Bytes!]! # addresses of approved transferors +} + +# represents a LP allowance for a single bucket +type LPAllowance @entity { + id: Bytes! # LPAllowances.id + '|' + $index + index: BigInt! # bucket index where an allowance has been granted + amount: BigInt! # size of the allowance (measured in LP) +} + +# updated upon SetLpAllowance and RevokeLpAllowance +type LPAllowances @entity { + id: Bytes! # $poolAddress + '|' + $lender + '|' + $spender + pool: Pool! # pool in which LP allowances have been granted + lender: Bytes! # address of the lender who has granted an allowance + spender: Bytes! # address who has been granted an allowance + allowances: [LPAllowance!]! # list of LP allowances +} + # # # # # # # EVENTS # # # # # # # diff --git a/src/erc-20-pool.ts b/src/erc-20-pool.ts index 74c8511..63b71b2 100644 --- a/src/erc-20-pool.ts +++ b/src/erc-20-pool.ts @@ -3,6 +3,7 @@ import { Bytes } from "@graphprotocol/graph-ts" import { AddCollateral as AddCollateralEvent, AddQuoteToken as AddQuoteTokenEvent, + ApproveLpTransferors as ApproveLpTransferorsEvent, AuctionNFTSettle as AuctionNFTSettleEvent, AuctionSettle as AuctionSettleEvent, BondWithdrawn as BondWithdrawnEvent, @@ -17,6 +18,9 @@ import { RemoveQuoteToken as RemoveQuoteTokenEvent, RepayDebt as RepayDebtEvent, ReserveAuction as ReserveAuctionEvent, + RevokeLpAllowance as RevokeLpAllowanceEvent, + RevokeLpTransferors as RevokeLpTransferorsEvent, + SetLpAllowance as SetLpAllowanceEvent, Settle as SettleEvent, Take as TakeEvent, TransferLPs as TransferLPsEvent, @@ -35,6 +39,9 @@ import { Kick, LiquidationAuction, LoanStamped, + LPAllowance, + LPAllowances, + LPTransferors, MoveQuoteToken, Pool, RemoveCollateral, @@ -58,6 +65,8 @@ import { getBurnInfo, getCurrentBurnEpoch, updatePool, updatePoolLiquidationAuct import { collateralizationAtLup, lpbValueInQuote, thresholdPrice } from "./utils/common" import { getReserveAuctionId, loadOrCreateReserveAuctionProcess, reserveAuctionKickerReward } from "./utils/reserve-auction" import { incrementTokenTxCount } from "./utils/token" +import { approveTransferors, loadOrCreateTransferors, revokeTransferors } from "./utils/lp-transferors" +import { loadOrCreateAllowances, revokeAllowances, setAllowances } from "./utils/lp-allowances" export function handleAddCollateral(event: AddCollateralEvent): void { let addCollateral = new AddCollateral( @@ -181,6 +190,44 @@ export function handleAddQuoteToken(event: AddQuoteTokenEvent): void { addQuoteToken.save() } +export function handleApproveLpTransferors( + event: ApproveLpTransferorsEvent +): void { + const poolId = addressToBytes(event.transaction.to!) + const entity = loadOrCreateTransferors(poolId, event.params.lender) + approveTransferors(entity, event.params.transferors) + + entity.save() +} + +export function handleRevokeLpTransferors( + event: RevokeLpTransferorsEvent +): void { + const poolId = addressToBytes(event.transaction.to!) + const entity = loadOrCreateTransferors(poolId, event.params.lender) + revokeTransferors(entity, event.params.transferors) + + entity.save() +} + +export function handleSetLpAllowance(event: SetLpAllowanceEvent): void { + const poolId = addressToBytes(event.transaction.to!) + const lender = event.transaction.from + const entity = loadOrCreateAllowances(poolId, lender, event.params.spender) + setAllowances(entity, event.params.indexes, event.params.amounts) + + entity.save() +} + +export function handleRevokeLpAllowance(event: RevokeLpAllowanceEvent): void { + const poolId = addressToBytes(event.transaction.to!) + const lender = event.transaction.from + const entity = loadOrCreateAllowances(poolId, lender, event.params.spender) + revokeAllowances(entity, event.params.indexes) + + entity.save() +} + // ERC721Pool only export function handleAuctionNFTSettle(event: AuctionNFTSettleEvent): void { let entity = new AuctionNFTSettle( diff --git a/src/utils/lp-allowances.ts b/src/utils/lp-allowances.ts new file mode 100644 index 0000000..12e39e9 --- /dev/null +++ b/src/utils/lp-allowances.ts @@ -0,0 +1,27 @@ +import { Address, BigDecimal, BigInt, Bytes } from "@graphprotocol/graph-ts" +import { LPAllowance, LPAllowances } from "../../generated/schema"; + +export function getAllowanceId(poolId: Bytes, lenderId: Bytes, spenderId: Bytes): Bytes { + return poolId.concat(Bytes.fromUTF8('|' + lenderId.toString() + '|' + spenderId.toString())) +} + +export function loadOrCreateAllowances(poolId: Bytes, lenderId: Bytes, spenderId: Bytes): LPAllowances { + let id = getAllowanceId(poolId, lenderId, spenderId) + let entity = LPAllowances.load(id) + if (entity == null) { + entity = new LPAllowances(id) as LPAllowances + entity.pool = poolId + entity.lender = lenderId + entity.spender = spenderId + entity.allowances = [] + } + return entity; +} + +export function setAllowances(entity: LPAllowances, indexes: Array, amounts: Array): void { + // TODO: create LPAllowance entities, iterate and add/update array +} + +export function revokeAllowances(entity: LPAllowances, indexes: Array): void { + // TODO: iterate and remove from array +} \ No newline at end of file diff --git a/src/utils/lp-transferors.ts b/src/utils/lp-transferors.ts new file mode 100644 index 0000000..893aa5a --- /dev/null +++ b/src/utils/lp-transferors.ts @@ -0,0 +1,30 @@ +import { Address, Bytes } from "@graphprotocol/graph-ts" +import { LPTransferors, Pool } from "../../generated/schema"; + +export function getTransferorId(poolId: Bytes, lenderId: Bytes): Bytes { + return poolId.concat(Bytes.fromUTF8('|' + lenderId.toString())); +} + +export function loadOrCreateTransferors(poolId: Bytes, lenderId: Bytes): LPTransferors { + let id = getTransferorId(poolId, lenderId) + let entity = LPTransferors.load(id) + if (entity == null) { + entity = new LPTransferors(id) as LPTransferors + entity.pool = poolId + entity.lender = lenderId + entity.transferors = [] + } + return entity; +} + +export function approveTransferors(entity: LPTransferors, transferorsApproved: Address[]): void { + // TODO: iterate through, pushing each transfer if not already there + // entity.transferors = entity.transferors.concat(transferorsApproved); +} + +export function revokeTransferors(entity: LPTransferors, transferorsRevoked: Address[]): void { + // TODO: iterate through, removing each transferor + // const index = entity.transferors.indexOf(transferor) + // if (index != -1) + // entity.transferors = entity.transferors.slice(index, 1) +} \ No newline at end of file diff --git a/subgraph.yaml b/subgraph.yaml index 6626b56..da45bd8 100644 --- a/subgraph.yaml +++ b/subgraph.yaml @@ -129,6 +129,7 @@ templates: entities: - AddCollateral - AddQuoteToken + - ApproveLpTransferors - AuctionNFTSettle - AuctionSettle - BondWithdrawn @@ -143,6 +144,9 @@ templates: - RemoveQuoteToken - RepayDebt - ReserveAuction + - RevokeLpAllowance + - RevokeLpTransferors + - SetLpAllowance - Settle - Take - TransferLPs @@ -157,6 +161,8 @@ templates: handler: handleAddCollateral - event: AddQuoteToken(indexed address,indexed uint256,uint256,uint256,uint256) handler: handleAddQuoteToken + - event: ApproveLpTransferors(indexed address,address[]) + handler: handleApproveLpTransferors - event: AuctionNFTSettle(indexed address,uint256,uint256,uint256) handler: handleAuctionNFTSettle - event: AuctionSettle(indexed address,uint256) @@ -175,7 +181,8 @@ templates: handler: handleKick - event: LoanStamped(indexed address) handler: handleLoanStamped - - event: MoveQuoteToken(indexed address,indexed uint256,indexed uint256,uint256,uint256,uint256,uint256) + - event: MoveQuoteToken(indexed address,indexed uint256,indexed + uint256,uint256,uint256,uint256,uint256) handler: handleMoveQuoteToken - event: RemoveCollateral(indexed address,indexed uint256,uint256,uint256) handler: handleRemoveCollateral @@ -185,6 +192,12 @@ templates: handler: handleRepayDebt - event: ReserveAuction(uint256,uint256,uint256) handler: handleReserveAuction + - event: RevokeLpAllowance(indexed address,uint256[]) + handler: handleRevokeLpAllowance + - event: RevokeLpTransferors(indexed address,address[]) + handler: handleRevokeLpTransferors + - event: SetLpAllowance(indexed address,uint256[],uint256[]) + handler: handleSetLpAllowance - event: Settle(indexed address,uint256) handler: handleSettle - event: Take(indexed address,uint256,uint256,uint256,bool) From bb3ed7e7e8c647e614089f1c0c047ce636802043 Mon Sep 17 00:00:00 2001 From: Ed Noepel Date: Wed, 22 Mar 2023 21:50:03 -0400 Subject: [PATCH 11/12] deployable ABIs --- README.md | 7 +- abis/ERC20.json | 255 ++-- abis/ERC20Pool.json | 2541 ++++++++++++++++++++++++++--------- abis/ERC20PoolFactory.json | 228 +++- abis/ERC721PoolFactory.json | 268 +++- abis/PoolInfoUtils.json | 692 +++++++--- abis/PositionManager.json | 1074 +++++++++++---- abis/RewardsManager.json | 499 +++++-- copy-abis.sh | 21 +- 9 files changed, 4142 insertions(+), 1443 deletions(-) diff --git a/README.md b/README.md index 0d5ea66..0b70dbb 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,8 @@ yarn install Configure `ETH_RPC_URL` for your target network in `.env`. +If you will change ABIs, please install `jq`. + ## Querying Below are some examples of queries that can be made to the Ajna Subgraph. @@ -60,10 +62,7 @@ npm run test ## Maintenance To update for new release candidates: -1. Copy ABIs from an `sdk` checkout from the appropriate branch. - ``` - rsync -avz --existing ../sdk/packages/sdk-api/src/abis abis - ``` +1. Update ABIs using the provided `copy-abis.sh` script. This script requires `jq` be installed. Note `codegen` and `build` commands are not sensitive to ABI formatting, but deployment is. ABIs formatted by Ethers.js will not work. ABIs generated by `graph add` will not work. In the ABI, note that all _output_ parameters must have a `name` field. It may be blank, but the field must exist. 2. Update addresses in `constants.ts` and `subgraph.yaml`. 3. Run `npm run codegen` to find and resolve errors in code generation. 4. Review contract changes, adjusting subgraph and schema accordingly. diff --git a/abis/ERC20.json b/abis/ERC20.json index 1237511..e1f61ef 100644 --- a/abis/ERC20.json +++ b/abis/ERC20.json @@ -1,261 +1,288 @@ [ { - "type": "constructor", - "payable": false, "inputs": [ { - "type": "string", - "name": "name_" + "internalType": "string", + "name": "name_", + "type": "string" }, { - "type": "string", - "name": "symbol_" + "internalType": "string", + "name": "symbol_", + "type": "string" } - ] + ], + "stateMutability": "nonpayable", + "type": "constructor" }, { - "type": "event", "anonymous": false, - "name": "Approval", "inputs": [ { - "type": "address", + "indexed": true, + "internalType": "address", "name": "owner", - "indexed": true + "type": "address" }, { - "type": "address", + "indexed": true, + "internalType": "address", "name": "spender", - "indexed": true + "type": "address" }, { - "type": "uint256", + "indexed": false, + "internalType": "uint256", "name": "value", - "indexed": false + "type": "uint256" } - ] + ], + "name": "Approval", + "type": "event" }, { - "type": "event", "anonymous": false, - "name": "Transfer", "inputs": [ { - "type": "address", + "indexed": true, + "internalType": "address", "name": "from", - "indexed": true + "type": "address" }, { - "type": "address", + "indexed": true, + "internalType": "address", "name": "to", - "indexed": true + "type": "address" }, { - "type": "uint256", + "indexed": false, + "internalType": "uint256", "name": "value", - "indexed": false + "type": "uint256" } - ] + ], + "name": "Transfer", + "type": "event" }, { - "type": "function", - "name": "allowance", - "constant": true, - "stateMutability": "view", - "payable": false, "inputs": [ { - "type": "address", - "name": "owner" + "internalType": "address", + "name": "owner", + "type": "address" }, { - "type": "address", - "name": "spender" + "internalType": "address", + "name": "spender", + "type": "address" } ], + "name": "allowance", "outputs": [ { + "internalType": "uint256", + "name": "", "type": "uint256" } - ] + ], + "stateMutability": "view", + "type": "function" }, { - "type": "function", - "name": "approve", - "constant": false, - "payable": false, "inputs": [ { - "type": "address", - "name": "spender" + "internalType": "address", + "name": "spender", + "type": "address" }, { - "type": "uint256", - "name": "amount" + "internalType": "uint256", + "name": "amount", + "type": "uint256" } ], + "name": "approve", "outputs": [ { + "internalType": "bool", + "name": "", "type": "bool" } - ] + ], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", - "name": "balanceOf", - "constant": true, - "stateMutability": "view", - "payable": false, "inputs": [ { - "type": "address", - "name": "account" + "internalType": "address", + "name": "account", + "type": "address" } ], + "name": "balanceOf", "outputs": [ { + "internalType": "uint256", + "name": "", "type": "uint256" } - ] + ], + "stateMutability": "view", + "type": "function" }, { - "type": "function", - "name": "decimals", - "constant": true, - "stateMutability": "view", - "payable": false, "inputs": [], + "name": "decimals", "outputs": [ { + "internalType": "uint8", + "name": "", "type": "uint8" } - ] + ], + "stateMutability": "view", + "type": "function" }, { - "type": "function", - "name": "decreaseAllowance", - "constant": false, - "payable": false, "inputs": [ { - "type": "address", - "name": "spender" + "internalType": "address", + "name": "spender", + "type": "address" }, { - "type": "uint256", - "name": "subtractedValue" + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" } ], + "name": "decreaseAllowance", "outputs": [ { + "internalType": "bool", + "name": "", "type": "bool" } - ] + ], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", - "name": "increaseAllowance", - "constant": false, - "payable": false, "inputs": [ { - "type": "address", - "name": "spender" + "internalType": "address", + "name": "spender", + "type": "address" }, { - "type": "uint256", - "name": "addedValue" + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" } ], + "name": "increaseAllowance", "outputs": [ { + "internalType": "bool", + "name": "", "type": "bool" } - ] + ], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", - "name": "name", - "constant": true, - "stateMutability": "view", - "payable": false, "inputs": [], + "name": "name", "outputs": [ { + "internalType": "string", + "name": "", "type": "string" } - ] + ], + "stateMutability": "view", + "type": "function" }, { - "type": "function", - "name": "symbol", - "constant": true, - "stateMutability": "view", - "payable": false, "inputs": [], + "name": "symbol", "outputs": [ { + "internalType": "string", + "name": "", "type": "string" } - ] + ], + "stateMutability": "view", + "type": "function" }, { - "type": "function", - "name": "totalSupply", - "constant": true, - "stateMutability": "view", - "payable": false, "inputs": [], + "name": "totalSupply", "outputs": [ { + "internalType": "uint256", + "name": "", "type": "uint256" } - ] + ], + "stateMutability": "view", + "type": "function" }, { - "type": "function", - "name": "transfer", - "constant": false, - "payable": false, "inputs": [ { - "type": "address", - "name": "to" + "internalType": "address", + "name": "to", + "type": "address" }, { - "type": "uint256", - "name": "amount" + "internalType": "uint256", + "name": "amount", + "type": "uint256" } ], + "name": "transfer", "outputs": [ { + "internalType": "bool", + "name": "", "type": "bool" } - ] + ], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", - "name": "transferFrom", - "constant": false, - "payable": false, "inputs": [ { - "type": "address", - "name": "from" + "internalType": "address", + "name": "from", + "type": "address" }, { - "type": "address", - "name": "to" + "internalType": "address", + "name": "to", + "type": "address" }, { - "type": "uint256", - "name": "amount" + "internalType": "uint256", + "name": "amount", + "type": "uint256" } ], + "name": "transferFrom", "outputs": [ { + "internalType": "bool", + "name": "", "type": "bool" } - ] + ], + "stateMutability": "nonpayable", + "type": "function" } ] diff --git a/abis/ERC20Pool.json b/abis/ERC20Pool.json index 3b088b0..1beef09 100644 --- a/abis/ERC20Pool.json +++ b/abis/ERC20Pool.json @@ -1,971 +1,2280 @@ [ - { "type": "error", "name": "AllowanceAlreadySet", "inputs": [] }, - { "type": "error", "name": "AlreadyInitialized", "inputs": [] }, - { "type": "error", "name": "AmountLTMinDebt", "inputs": [] }, - { "type": "error", "name": "AuctionActive", "inputs": [] }, - { "type": "error", "name": "AuctionNotClearable", "inputs": [] }, - { "type": "error", "name": "AuctionNotCleared", "inputs": [] }, - { "type": "error", "name": "AuctionPriceGtBucketPrice", "inputs": [] }, - { "type": "error", "name": "BorrowerNotSender", "inputs": [] }, - { "type": "error", "name": "BorrowerOk", "inputs": [] }, - { "type": "error", "name": "BorrowerUnderCollateralized", "inputs": [] }, - { "type": "error", "name": "BucketBankruptcyBlock", "inputs": [] }, - { "type": "error", "name": "BucketIndexOutOfBounds", "inputs": [] }, - { "type": "error", "name": "CannotMergeToHigherPrice", "inputs": [] }, - { "type": "error", "name": "DustAmountNotExceeded", "inputs": [] }, - { "type": "error", "name": "FlashloanCallbackFailed", "inputs": [] }, - { "type": "error", "name": "FlashloanIncorrectBalance", "inputs": [] }, - { "type": "error", "name": "FlashloanUnavailableForToken", "inputs": [] }, - { "type": "error", "name": "InsufficientCollateral", "inputs": [] }, - { "type": "error", "name": "InsufficientLPs", "inputs": [] }, - { "type": "error", "name": "InsufficientLiquidity", "inputs": [] }, - { "type": "error", "name": "InvalidAmount", "inputs": [] }, - { "type": "error", "name": "InvalidIndex", "inputs": [] }, - { "type": "error", "name": "LUPBelowHTP", "inputs": [] }, - { "type": "error", "name": "LUPGreaterThanTP", "inputs": [] }, - { "type": "error", "name": "LimitIndexExceeded", "inputs": [] }, - { "type": "error", "name": "MoveToSameIndex", "inputs": [] }, - { "type": "error", "name": "NoAllowance", "inputs": [] }, - { "type": "error", "name": "NoAuction", "inputs": [] }, - { "type": "error", "name": "NoClaim", "inputs": [] }, - { "type": "error", "name": "NoDebt", "inputs": [] }, - { "type": "error", "name": "NoReserves", "inputs": [] }, - { "type": "error", "name": "NoReservesAuction", "inputs": [] }, - { "type": "error", "name": "PRBMathSD59x18__DivInputTooSmall", "inputs": [] }, - { - "type": "error", + { + "inputs": [], + "name": "AllowanceAlreadySet", + "type": "error" + }, + { + "inputs": [], + "name": "AlreadyInitialized", + "type": "error" + }, + { + "inputs": [], + "name": "AmountLTMinDebt", + "type": "error" + }, + { + "inputs": [], + "name": "AuctionActive", + "type": "error" + }, + { + "inputs": [], + "name": "AuctionNotClearable", + "type": "error" + }, + { + "inputs": [], + "name": "AuctionNotCleared", + "type": "error" + }, + { + "inputs": [], + "name": "AuctionNotCleared", + "type": "error" + }, + { + "inputs": [], + "name": "AuctionPriceGtBucketPrice", + "type": "error" + }, + { + "inputs": [], + "name": "BorrowerNotSender", + "type": "error" + }, + { + "inputs": [], + "name": "BorrowerOk", + "type": "error" + }, + { + "inputs": [], + "name": "BorrowerUnderCollateralized", + "type": "error" + }, + { + "inputs": [], + "name": "BucketBankruptcyBlock", + "type": "error" + }, + { + "inputs": [], + "name": "BucketIndexOutOfBounds", + "type": "error" + }, + { + "inputs": [], + "name": "CannotMergeToHigherPrice", + "type": "error" + }, + { + "inputs": [], + "name": "DustAmountNotExceeded", + "type": "error" + }, + { + "inputs": [], + "name": "FlashloanCallbackFailed", + "type": "error" + }, + { + "inputs": [], + "name": "FlashloanIncorrectBalance", + "type": "error" + }, + { + "inputs": [], + "name": "FlashloanUnavailableForToken", + "type": "error" + }, + { + "inputs": [], + "name": "InsufficientCollateral", + "type": "error" + }, + { + "inputs": [], + "name": "InsufficientLPs", + "type": "error" + }, + { + "inputs": [], + "name": "InsufficientLiquidity", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidAmount", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidIndex", + "type": "error" + }, + { + "inputs": [], + "name": "LUPBelowHTP", + "type": "error" + }, + { + "inputs": [], + "name": "LUPGreaterThanTP", + "type": "error" + }, + { + "inputs": [], + "name": "LimitIndexExceeded", + "type": "error" + }, + { + "inputs": [], + "name": "MoveToSameIndex", + "type": "error" + }, + { + "inputs": [], + "name": "NoAllowance", + "type": "error" + }, + { + "inputs": [], + "name": "NoAuction", + "type": "error" + }, + { + "inputs": [], + "name": "NoClaim", + "type": "error" + }, + { + "inputs": [], + "name": "NoDebt", + "type": "error" + }, + { + "inputs": [], + "name": "NoReserves", + "type": "error" + }, + { + "inputs": [], + "name": "NoReservesAuction", + "type": "error" + }, + { + "inputs": [], + "name": "PRBMathSD59x18__DivInputTooSmall", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "rAbs", + "type": "uint256" + } + ], "name": "PRBMathSD59x18__DivOverflow", - "inputs": [{ "type": "uint256", "name": "rAbs" }] + "type": "error" }, { - "type": "error", + "inputs": [ + { + "internalType": "int256", + "name": "x", + "type": "int256" + } + ], "name": "PRBMathSD59x18__Exp2InputTooBig", - "inputs": [{ "type": "int256", "name": "x" }] + "type": "error" }, { - "type": "error", + "inputs": [ + { + "internalType": "int256", + "name": "x", + "type": "int256" + } + ], "name": "PRBMathSD59x18__FromIntOverflow", - "inputs": [{ "type": "int256", "name": "x" }] + "type": "error" }, { - "type": "error", + "inputs": [ + { + "internalType": "int256", + "name": "x", + "type": "int256" + } + ], "name": "PRBMathSD59x18__FromIntUnderflow", - "inputs": [{ "type": "int256", "name": "x" }] + "type": "error" }, { - "type": "error", + "inputs": [ + { + "internalType": "int256", + "name": "x", + "type": "int256" + } + ], "name": "PRBMathSD59x18__LogInputTooSmall", - "inputs": [{ "type": "int256", "name": "x" }] + "type": "error" }, - { "type": "error", "name": "PRBMathSD59x18__MulInputTooSmall", "inputs": [] }, { - "type": "error", + "inputs": [], + "name": "PRBMathSD59x18__MulInputTooSmall", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "rAbs", + "type": "uint256" + } + ], "name": "PRBMathSD59x18__MulOverflow", - "inputs": [{ "type": "uint256", "name": "rAbs" }] + "type": "error" }, { - "type": "error", + "inputs": [ + { + "internalType": "int256", + "name": "x", + "type": "int256" + } + ], "name": "PRBMathSD59x18__SqrtNegativeInput", - "inputs": [{ "type": "int256", "name": "x" }] + "type": "error" }, { - "type": "error", + "inputs": [ + { + "internalType": "int256", + "name": "x", + "type": "int256" + } + ], "name": "PRBMathSD59x18__SqrtOverflow", - "inputs": [{ "type": "int256", "name": "x" }] + "type": "error" }, { - "type": "error", + "inputs": [ + { + "internalType": "uint256", + "name": "prod1", + "type": "uint256" + } + ], "name": "PRBMath__MulDivFixedPointOverflow", - "inputs": [{ "type": "uint256", "name": "prod1" }] + "type": "error" }, { - "type": "error", - "name": "PRBMath__MulDivOverflow", "inputs": [ - { "type": "uint256", "name": "prod1" }, - { "type": "uint256", "name": "denominator" } - ] - }, - { "type": "error", "name": "PoolUnderCollateralized", "inputs": [] }, - { "type": "error", "name": "PriceBelowLUP", "inputs": [] }, - { "type": "error", "name": "RemoveDepositLockedByAuctionDebt", "inputs": [] }, - { "type": "error", "name": "ReserveAuctionTooSoon", "inputs": [] }, - { "type": "error", "name": "TakeNotPastCooldown", "inputs": [] }, - { "type": "error", "name": "TransactionExpired", "inputs": [] }, - { "type": "error", "name": "TransferToSameOwner", "inputs": [] }, - { "type": "error", "name": "TransferorNotApproved", "inputs": [] }, - { "type": "error", "name": "ZeroThresholdPrice", "inputs": [] }, - { - "type": "event", + { + "internalType": "uint256", + "name": "prod1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "denominator", + "type": "uint256" + } + ], + "name": "PRBMath__MulDivOverflow", + "type": "error" + }, + { + "inputs": [], + "name": "PoolUnderCollateralized", + "type": "error" + }, + { + "inputs": [], + "name": "PriceBelowLUP", + "type": "error" + }, + { + "inputs": [], + "name": "RemoveDepositLockedByAuctionDebt", + "type": "error" + }, + { + "inputs": [], + "name": "RemoveDepositLockedByAuctionDebt", + "type": "error" + }, + { + "inputs": [], + "name": "ReserveAuctionTooSoon", + "type": "error" + }, + { + "inputs": [], + "name": "TakeNotPastCooldown", + "type": "error" + }, + { + "inputs": [], + "name": "TransactionExpired", + "type": "error" + }, + { + "inputs": [], + "name": "TransactionExpired", + "type": "error" + }, + { + "inputs": [], + "name": "TransferToSameOwner", + "type": "error" + }, + { + "inputs": [], + "name": "TransferorNotApproved", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroThresholdPrice", + "type": "error" + }, + { "anonymous": false, - "name": "AddCollateral", "inputs": [ - { "type": "address", "name": "actor", "indexed": true }, - { "type": "uint256", "name": "index", "indexed": true }, - { "type": "uint256", "name": "amount", "indexed": false }, - { "type": "uint256", "name": "lpAwarded", "indexed": false } - ] + { + "indexed": true, + "internalType": "address", + "name": "actor", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "index", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "lpAwarded", + "type": "uint256" + } + ], + "name": "AddCollateral", + "type": "event" }, { - "type": "event", "anonymous": false, - "name": "AddQuoteToken", "inputs": [ - { "type": "address", "name": "lender", "indexed": true }, - { "type": "uint256", "name": "index", "indexed": true }, - { "type": "uint256", "name": "amount", "indexed": false }, - { "type": "uint256", "name": "lpAwarded", "indexed": false }, - { "type": "uint256", "name": "lup", "indexed": false } - ] + { + "indexed": true, + "internalType": "address", + "name": "lender", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "index", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "lpAwarded", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "lup", + "type": "uint256" + } + ], + "name": "AddQuoteToken", + "type": "event" }, { - "type": "event", "anonymous": false, - "name": "ApproveLpTransferors", "inputs": [ - { "type": "address", "name": "lender", "indexed": true }, - { "type": "address[]", "name": "transferors", "indexed": false } - ] + { + "indexed": true, + "internalType": "address", + "name": "lender", + "type": "address" + }, + { + "indexed": false, + "internalType": "address[]", + "name": "transferors", + "type": "address[]" + } + ], + "name": "ApproveLpTransferors", + "type": "event" }, { - "type": "event", "anonymous": false, - "name": "AuctionNFTSettle", "inputs": [ - { "type": "address", "name": "borrower", "indexed": true }, - { "type": "uint256", "name": "collateral", "indexed": false }, - { "type": "uint256", "name": "lps", "indexed": false }, - { "type": "uint256", "name": "index", "indexed": false } - ] + { + "indexed": true, + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "collateral", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "lps", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "AuctionNFTSettle", + "type": "event" }, { - "type": "event", "anonymous": false, - "name": "AuctionSettle", "inputs": [ - { "type": "address", "name": "borrower", "indexed": true }, - { "type": "uint256", "name": "collateral", "indexed": false } - ] + { + "indexed": true, + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "collateral", + "type": "uint256" + } + ], + "name": "AuctionSettle", + "type": "event" }, { - "type": "event", "anonymous": false, - "name": "BondWithdrawn", "inputs": [ - { "type": "address", "name": "kicker", "indexed": true }, - { "type": "address", "name": "reciever", "indexed": true }, - { "type": "uint256", "name": "amount", "indexed": false } - ] + { + "indexed": true, + "internalType": "address", + "name": "kicker", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "reciever", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "BondWithdrawn", + "type": "event" }, { - "type": "event", "anonymous": false, - "name": "BucketBankruptcy", "inputs": [ - { "type": "uint256", "name": "index", "indexed": true }, - { "type": "uint256", "name": "lpForfeited", "indexed": false } - ] + { + "indexed": true, + "internalType": "uint256", + "name": "index", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "lpForfeited", + "type": "uint256" + } + ], + "name": "BucketBankruptcy", + "type": "event" }, { - "type": "event", "anonymous": false, - "name": "BucketTake", "inputs": [ - { "type": "address", "name": "borrower", "indexed": true }, - { "type": "uint256", "name": "index", "indexed": false }, - { "type": "uint256", "name": "amount", "indexed": false }, - { "type": "uint256", "name": "collateral", "indexed": false }, - { "type": "uint256", "name": "bondChange", "indexed": false }, - { "type": "bool", "name": "isReward", "indexed": false } - ] + { + "indexed": true, + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "index", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "collateral", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "bondChange", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isReward", + "type": "bool" + } + ], + "name": "BucketTake", + "type": "event" }, { - "type": "event", "anonymous": false, - "name": "BucketTakeLPAwarded", "inputs": [ - { "type": "address", "name": "taker", "indexed": true }, - { "type": "address", "name": "kicker", "indexed": true }, - { "type": "uint256", "name": "lpAwardedTaker", "indexed": false }, - { "type": "uint256", "name": "lpAwardedKicker", "indexed": false } - ] + { + "indexed": true, + "internalType": "address", + "name": "taker", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "kicker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "lpAwardedTaker", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "lpAwardedKicker", + "type": "uint256" + } + ], + "name": "BucketTakeLPAwarded", + "type": "event" }, { - "type": "event", "anonymous": false, - "name": "DrawDebt", "inputs": [ - { "type": "address", "name": "borrower", "indexed": true }, - { "type": "uint256", "name": "amountBorrowed", "indexed": false }, - { "type": "uint256", "name": "collateralPledged", "indexed": false }, - { "type": "uint256", "name": "lup", "indexed": false } - ] + { + "indexed": true, + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountBorrowed", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "collateralPledged", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "lup", + "type": "uint256" + } + ], + "name": "DrawDebt", + "type": "event" }, { - "type": "event", "anonymous": false, - "name": "Kick", "inputs": [ - { "type": "address", "name": "borrower", "indexed": true }, - { "type": "uint256", "name": "debt", "indexed": false }, - { "type": "uint256", "name": "collateral", "indexed": false }, - { "type": "uint256", "name": "bond", "indexed": false } - ] + { + "indexed": true, + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "debt", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "collateral", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "bond", + "type": "uint256" + } + ], + "name": "Kick", + "type": "event" }, { - "type": "event", "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "borrower", + "type": "address" + } + ], "name": "LoanStamped", - "inputs": [{ "type": "address", "name": "borrower", "indexed": true }] + "type": "event" }, { - "type": "event", "anonymous": false, - "name": "MoveQuoteToken", "inputs": [ - { "type": "address", "name": "lender", "indexed": true }, - { "type": "uint256", "name": "from", "indexed": true }, - { "type": "uint256", "name": "to", "indexed": true }, - { "type": "uint256", "name": "amount", "indexed": false }, - { "type": "uint256", "name": "lpRedeemedFrom", "indexed": false }, - { "type": "uint256", "name": "lpAwardedTo", "indexed": false }, - { "type": "uint256", "name": "lup", "indexed": false } - ] + { + "indexed": true, + "internalType": "address", + "name": "lender", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "from", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "to", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "lpRedeemedFrom", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "lpAwardedTo", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "lup", + "type": "uint256" + } + ], + "name": "MoveQuoteToken", + "type": "event" }, { - "type": "event", "anonymous": false, - "name": "RemoveCollateral", "inputs": [ - { "type": "address", "name": "claimer", "indexed": true }, - { "type": "uint256", "name": "index", "indexed": true }, - { "type": "uint256", "name": "amount", "indexed": false }, - { "type": "uint256", "name": "lpRedeemed", "indexed": false } - ] + { + "indexed": true, + "internalType": "address", + "name": "claimer", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "index", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "lpRedeemed", + "type": "uint256" + } + ], + "name": "RemoveCollateral", + "type": "event" }, { - "type": "event", "anonymous": false, - "name": "RemoveQuoteToken", "inputs": [ - { "type": "address", "name": "lender", "indexed": true }, - { "type": "uint256", "name": "index", "indexed": true }, - { "type": "uint256", "name": "amount", "indexed": false }, - { "type": "uint256", "name": "lpRedeemed", "indexed": false }, - { "type": "uint256", "name": "lup", "indexed": false } - ] + { + "indexed": true, + "internalType": "address", + "name": "lender", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "index", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "lpRedeemed", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "lup", + "type": "uint256" + } + ], + "name": "RemoveQuoteToken", + "type": "event" }, { - "type": "event", "anonymous": false, - "name": "RepayDebt", "inputs": [ - { "type": "address", "name": "borrower", "indexed": true }, - { "type": "uint256", "name": "quoteRepaid", "indexed": false }, - { "type": "uint256", "name": "collateralPulled", "indexed": false }, - { "type": "uint256", "name": "lup", "indexed": false } - ] + { + "indexed": true, + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "quoteRepaid", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "collateralPulled", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "lup", + "type": "uint256" + } + ], + "name": "RepayDebt", + "type": "event" }, { - "type": "event", "anonymous": false, - "name": "ReserveAuction", "inputs": [ - { "type": "uint256", "name": "claimableReservesRemaining", "indexed": false }, - { "type": "uint256", "name": "auctionPrice", "indexed": false }, - { "type": "uint256", "name": "currentBurnEpoch", "indexed": false } - ] + { + "indexed": false, + "internalType": "uint256", + "name": "claimableReservesRemaining", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "auctionPrice", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "currentBurnEpoch", + "type": "uint256" + } + ], + "name": "ReserveAuction", + "type": "event" }, { - "type": "event", "anonymous": false, - "name": "RevokeLpAllowance", "inputs": [ - { "type": "address", "name": "spender", "indexed": true }, - { "type": "uint256[]", "name": "indexes", "indexed": false } - ] + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "indexes", + "type": "uint256[]" + } + ], + "name": "RevokeLpAllowance", + "type": "event" }, { - "type": "event", "anonymous": false, - "name": "RevokeLpTransferors", "inputs": [ - { "type": "address", "name": "lender", "indexed": true }, - { "type": "address[]", "name": "transferors", "indexed": false } - ] + { + "indexed": true, + "internalType": "address", + "name": "lender", + "type": "address" + }, + { + "indexed": false, + "internalType": "address[]", + "name": "transferors", + "type": "address[]" + } + ], + "name": "RevokeLpTransferors", + "type": "event" }, { - "type": "event", "anonymous": false, - "name": "SetLpAllowance", "inputs": [ - { "type": "address", "name": "spender", "indexed": true }, - { "type": "uint256[]", "name": "indexes", "indexed": false }, - { "type": "uint256[]", "name": "amounts", "indexed": false } - ] + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "indexes", + "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + } + ], + "name": "SetLpAllowance", + "type": "event" }, { - "type": "event", "anonymous": false, - "name": "Settle", "inputs": [ - { "type": "address", "name": "borrower", "indexed": true }, - { "type": "uint256", "name": "settledDebt", "indexed": false } - ] + { + "indexed": true, + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "settledDebt", + "type": "uint256" + } + ], + "name": "Settle", + "type": "event" }, { - "type": "event", "anonymous": false, - "name": "Take", "inputs": [ - { "type": "address", "name": "borrower", "indexed": true }, - { "type": "uint256", "name": "amount", "indexed": false }, - { "type": "uint256", "name": "collateral", "indexed": false }, - { "type": "uint256", "name": "bondChange", "indexed": false }, - { "type": "bool", "name": "isReward", "indexed": false } - ] + { + "indexed": true, + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "collateral", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "bondChange", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isReward", + "type": "bool" + } + ], + "name": "Take", + "type": "event" }, { - "type": "event", "anonymous": false, - "name": "TransferLPs", "inputs": [ - { "type": "address", "name": "owner", "indexed": false }, - { "type": "address", "name": "newOwner", "indexed": false }, - { "type": "uint256[]", "name": "indexes", "indexed": false }, - { "type": "uint256", "name": "lps", "indexed": false } - ] + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newOwner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "indexes", + "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "lps", + "type": "uint256" + } + ], + "name": "TransferLPs", + "type": "event" }, { - "type": "event", "anonymous": false, - "name": "UpdateInterestRate", "inputs": [ - { "type": "uint256", "name": "oldRate", "indexed": false }, - { "type": "uint256", "name": "newRate", "indexed": false } - ] + { + "indexed": false, + "internalType": "uint256", + "name": "oldRate", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newRate", + "type": "uint256" + } + ], + "name": "UpdateInterestRate", + "type": "event" }, { - "type": "function", - "name": "addCollateral", - "constant": false, - "payable": false, "inputs": [ - { "type": "uint256", "name": "amountToAdd_" }, - { "type": "uint256", "name": "index_" }, - { "type": "uint256", "name": "expiry_" } + { + "internalType": "uint256", + "name": "amountToAdd_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "index_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expiry_", + "type": "uint256" + } + ], + "name": "addCollateral", + "outputs": [ + { + "internalType": "uint256", + "name": "bucketLPs_", + "type": "uint256" + } ], - "outputs": [{ "type": "uint256", "name": "bucketLPs_" }] + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", - "name": "addQuoteToken", - "constant": false, - "payable": false, "inputs": [ - { "type": "uint256", "name": "quoteTokenAmountToAdd_" }, - { "type": "uint256", "name": "index_" }, - { "type": "uint256", "name": "expiry_" } + { + "internalType": "uint256", + "name": "quoteTokenAmountToAdd_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "index_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expiry_", + "type": "uint256" + } + ], + "name": "addQuoteToken", + "outputs": [ + { + "internalType": "uint256", + "name": "bucketLPs_", + "type": "uint256" + } ], - "outputs": [{ "type": "uint256", "name": "bucketLPs_" }] + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "address[]", + "name": "transferors_", + "type": "address[]" + } + ], "name": "approveLpTransferors", - "constant": false, - "payable": false, - "inputs": [{ "type": "address[]", "name": "transferors_" }], - "outputs": [] + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "name": "approvedTransferors", - "constant": true, + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [{ "type": "address" }, { "type": "address" }], - "outputs": [{ "type": "bool" }] + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "address", + "name": "borrower_", + "type": "address" + } + ], "name": "auctionInfo", - "constant": true, + "outputs": [ + { + "internalType": "address", + "name": "kicker", + "type": "address" + }, + { + "internalType": "uint256", + "name": "bondFactor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "bondSize", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "kickTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "kickMomp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "neutralPrice", + "type": "uint256" + }, + { + "internalType": "address", + "name": "head", + "type": "address" + }, + { + "internalType": "address", + "name": "next", + "type": "address" + }, + { + "internalType": "address", + "name": "prev", + "type": "address" + }, + { + "internalType": "bool", + "name": "alreadyTaken", + "type": "bool" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [{ "type": "address", "name": "borrower_" }], - "outputs": [ - { "type": "address", "name": "kicker" }, - { "type": "uint256", "name": "bondFactor" }, - { "type": "uint256", "name": "bondSize" }, - { "type": "uint256", "name": "kickTime" }, - { "type": "uint256", "name": "kickMomp" }, - { "type": "uint256", "name": "neutralPrice" }, - { "type": "address", "name": "head" }, - { "type": "address", "name": "next" }, - { "type": "address", "name": "prev" }, - { "type": "bool", "name": "alreadyTaken" } - ] - }, - { - "type": "function", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "borrower_", + "type": "address" + } + ], "name": "borrowerInfo", - "constant": true, + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [{ "type": "address", "name": "borrower_" }], - "outputs": [{ "type": "uint256" }, { "type": "uint256" }, { "type": "uint256" }] + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "uint256", + "name": "bucketIndex", + "type": "uint256" + } + ], "name": "bucketCollateralDust", - "constant": true, + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "pure", - "payable": false, - "inputs": [{ "type": "uint256", "name": "bucketIndex" }], - "outputs": [{ "type": "uint256" }] + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "uint256", + "name": "index_", + "type": "uint256" + } + ], "name": "bucketExchangeRate", - "constant": true, + "outputs": [ + { + "internalType": "uint256", + "name": "exchangeRate_", + "type": "uint256" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [{ "type": "uint256", "name": "index_" }], - "outputs": [{ "type": "uint256", "name": "exchangeRate_" }] + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "uint256", + "name": "index_", + "type": "uint256" + } + ], "name": "bucketInfo", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [{ "type": "uint256", "name": "index_" }], "outputs": [ - { "type": "uint256" }, - { "type": "uint256" }, - { "type": "uint256" }, - { "type": "uint256" }, - { "type": "uint256" } - ] + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" }, { - "type": "function", - "name": "bucketTake", - "constant": false, - "payable": false, "inputs": [ - { "type": "address", "name": "borrowerAddress_" }, - { "type": "bool", "name": "depositTake_" }, - { "type": "uint256", "name": "index_" } + { + "internalType": "address", + "name": "borrowerAddress_", + "type": "address" + }, + { + "internalType": "bool", + "name": "depositTake_", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "index_", + "type": "uint256" + } ], - "outputs": [] + "name": "bucketTake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "uint256", + "name": "burnEventEpoch_", + "type": "uint256" + } + ], "name": "burnInfo", - "constant": true, + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [{ "type": "uint256", "name": "burnEventEpoch_" }], - "outputs": [{ "type": "uint256" }, { "type": "uint256" }, { "type": "uint256" }] + "type": "function" }, { - "type": "function", + "inputs": [], "name": "collateralAddress", - "constant": true, + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "stateMutability": "pure", - "payable": false, - "inputs": [], - "outputs": [{ "type": "address" }] + "type": "function" }, { - "type": "function", + "inputs": [], "name": "collateralScale", - "constant": true, + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "pure", - "payable": false, - "inputs": [], - "outputs": [{ "type": "uint256" }] + "type": "function" }, { - "type": "function", + "inputs": [], "name": "currentBurnEpoch", - "constant": true, + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [{ "type": "uint256" }] + "type": "function" }, { - "type": "function", + "inputs": [], "name": "debtInfo", - "constant": true, + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [{ "type": "uint256" }, { "type": "uint256" }, { "type": "uint256" }] + "type": "function" }, { - "type": "function", - "name": "decreaseLPAllowance", - "constant": false, - "payable": false, "inputs": [ - { "type": "address", "name": "spender_" }, - { "type": "uint256[]", "name": "indexes_" }, - { "type": "uint256[]", "name": "amounts_" } + { + "internalType": "address", + "name": "spender_", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "indexes_", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "amounts_", + "type": "uint256[]" + } ], - "outputs": [] + "name": "decreaseLPAllowance", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "uint256", + "name": "debt_", + "type": "uint256" + } + ], "name": "depositIndex", - "constant": true, + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [{ "type": "uint256", "name": "debt_" }], - "outputs": [{ "type": "uint256" }] + "type": "function" }, { - "type": "function", + "inputs": [], "name": "depositSize", - "constant": true, + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [{ "type": "uint256" }] + "type": "function" }, { - "type": "function", + "inputs": [], "name": "depositUtilization", - "constant": true, + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [{ "type": "uint256" }] + "type": "function" }, { - "type": "function", - "name": "drawDebt", - "constant": false, - "payable": false, "inputs": [ - { "type": "address", "name": "borrowerAddress_" }, - { "type": "uint256", "name": "amountToBorrow_" }, - { "type": "uint256", "name": "limitIndex_" }, - { "type": "uint256", "name": "collateralToPledge_" } + { + "internalType": "address", + "name": "borrowerAddress_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amountToBorrow_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "limitIndex_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "collateralToPledge_", + "type": "uint256" + } ], - "outputs": [] + "name": "drawDebt", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", - "name": "emasInfo", - "constant": true, - "stateMutability": "view", - "payable": false, "inputs": [], + "name": "emasInfo", "outputs": [ - { "type": "uint256" }, - { "type": "uint256" }, - { "type": "uint256" }, - { "type": "uint256" } - ] + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "address", + "name": "token_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "name": "flashFee", - "constant": true, + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [{ "type": "address", "name": "token_" }, { "type": "uint256" }], - "outputs": [{ "type": "uint256" }] + "type": "function" }, { - "type": "function", - "name": "flashLoan", - "constant": false, - "payable": false, "inputs": [ - { "type": "address", "name": "receiver_" }, - { "type": "address", "name": "token_" }, - { "type": "uint256", "name": "amount_" }, - { "type": "bytes", "name": "data_" } + { + "internalType": "contract IERC3156FlashBorrower", + "name": "receiver_", + "type": "address" + }, + { + "internalType": "address", + "name": "token_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount_", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data_", + "type": "bytes" + } ], - "outputs": [{ "type": "bool", "name": "success_" }] + "name": "flashLoan", + "outputs": [ + { + "internalType": "bool", + "name": "success_", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", - "name": "increaseLPAllowance", - "constant": false, - "payable": false, "inputs": [ - { "type": "address", "name": "spender_" }, - { "type": "uint256[]", "name": "indexes_" }, - { "type": "uint256[]", "name": "amounts_" } + { + "internalType": "address", + "name": "spender_", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "indexes_", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "amounts_", + "type": "uint256[]" + } ], - "outputs": [] + "name": "increaseLPAllowance", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", + "inputs": [], "name": "inflatorInfo", - "constant": true, + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [{ "type": "uint256" }, { "type": "uint256" }] + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "uint256", + "name": "rate_", + "type": "uint256" + } + ], "name": "initialize", - "constant": false, - "payable": false, - "inputs": [{ "type": "uint256", "name": "rate_" }], - "outputs": [] + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", + "inputs": [], "name": "interestRateInfo", - "constant": true, + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [{ "type": "uint256" }, { "type": "uint256" }] + "type": "function" }, { - "type": "function", - "name": "kick", - "constant": false, - "payable": false, "inputs": [ - { "type": "address", "name": "borrowerAddress_" }, - { "type": "uint256", "name": "limitIndex_" } + { + "internalType": "address", + "name": "borrowerAddress_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "limitIndex_", + "type": "uint256" + } ], - "outputs": [] + "name": "kick", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", - "name": "kickWithDeposit", - "constant": false, - "payable": false, "inputs": [ - { "type": "uint256", "name": "index_" }, - { "type": "uint256", "name": "limitIndex_" } + { + "internalType": "uint256", + "name": "index_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "limitIndex_", + "type": "uint256" + } ], - "outputs": [] + "name": "kickWithDeposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "address", + "name": "kicker_", + "type": "address" + } + ], "name": "kickerInfo", - "constant": true, + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [{ "type": "address", "name": "kicker_" }], - "outputs": [{ "type": "uint256" }, { "type": "uint256" }] + "type": "function" }, { - "type": "function", - "name": "lenderInfo", - "constant": true, - "stateMutability": "view", - "payable": false, "inputs": [ - { "type": "uint256", "name": "index_" }, - { "type": "address", "name": "lender_" } + { + "internalType": "uint256", + "name": "index_", + "type": "uint256" + }, + { + "internalType": "address", + "name": "lender_", + "type": "address" + } ], + "name": "lenderInfo", "outputs": [ - { "type": "uint256", "name": "lpBalance_" }, - { "type": "uint256", "name": "depositTime_" } - ] + { + "internalType": "uint256", + "name": "lpBalance_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "depositTime_", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "uint256", + "name": "loanId_", + "type": "uint256" + } + ], "name": "loanInfo", - "constant": true, + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [{ "type": "uint256", "name": "loanId_" }], - "outputs": [{ "type": "address" }, { "type": "uint256" }] + "type": "function" }, { - "type": "function", + "inputs": [], "name": "loansInfo", - "constant": true, + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [{ "type": "address" }, { "type": "uint256" }, { "type": "uint256" }] + "type": "function" }, { - "type": "function", - "name": "lpAllowance", - "constant": true, - "stateMutability": "view", - "payable": false, "inputs": [ - { "type": "uint256", "name": "index_" }, - { "type": "address", "name": "spender_" }, - { "type": "address", "name": "owner_" } + { + "internalType": "uint256", + "name": "index_", + "type": "uint256" + }, + { + "internalType": "address", + "name": "spender_", + "type": "address" + }, + { + "internalType": "address", + "name": "owner_", + "type": "address" + } ], - "outputs": [{ "type": "uint256", "name": "allowance_" }] + "name": "lpAllowance", + "outputs": [ + { + "internalType": "uint256", + "name": "allowance_", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "address", + "name": "token_", + "type": "address" + } + ], "name": "maxFlashLoan", - "constant": true, + "outputs": [ + { + "internalType": "uint256", + "name": "maxLoan_", + "type": "uint256" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [{ "type": "address", "name": "token_" }], - "outputs": [{ "type": "uint256", "name": "maxLoan_" }] + "type": "function" }, { - "type": "function", - "name": "moveQuoteToken", - "constant": false, - "payable": false, "inputs": [ - { "type": "uint256", "name": "maxAmountToMove_" }, - { "type": "uint256", "name": "fromIndex_" }, - { "type": "uint256", "name": "toIndex_" }, - { "type": "uint256", "name": "expiry_" } + { + "internalType": "uint256", + "name": "maxAmountToMove_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "fromIndex_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "toIndex_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expiry_", + "type": "uint256" + } ], + "name": "moveQuoteToken", "outputs": [ - { "type": "uint256", "name": "fromBucketLPs_" }, - { "type": "uint256", "name": "toBucketLPs_" }, - { "type": "uint256", "name": "movedAmount_" } - ] + { + "internalType": "uint256", + "name": "fromBucketLPs_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "toBucketLPs_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "movedAmount_", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], "name": "multicall", - "constant": false, - "payable": false, - "inputs": [{ "type": "bytes[]", "name": "data" }], - "outputs": [{ "type": "bytes[]", "name": "results" }] + "outputs": [ + { + "internalType": "bytes[]", + "name": "results", + "type": "bytes[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", + "inputs": [], "name": "pledgedCollateral", - "constant": true, + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [{ "type": "uint256" }] + "type": "function" }, { - "type": "function", + "inputs": [], "name": "poolType", - "constant": true, + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], "stateMutability": "pure", - "payable": false, - "inputs": [], - "outputs": [{ "type": "uint8" }] + "type": "function" }, { - "type": "function", + "inputs": [], "name": "quoteTokenAddress", - "constant": true, + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "stateMutability": "pure", - "payable": false, - "inputs": [], - "outputs": [{ "type": "address" }] + "type": "function" }, { - "type": "function", + "inputs": [], "name": "quoteTokenDust", - "constant": true, + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "pure", - "payable": false, - "inputs": [], - "outputs": [{ "type": "uint256" }] + "type": "function" }, { - "type": "function", + "inputs": [], "name": "quoteTokenScale", - "constant": true, + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "pure", - "payable": false, - "inputs": [], - "outputs": [{ "type": "uint256" }] + "type": "function" }, { - "type": "function", - "name": "removeCollateral", - "constant": false, - "payable": false, "inputs": [ - { "type": "uint256", "name": "maxAmount_" }, - { "type": "uint256", "name": "index_" } + { + "internalType": "uint256", + "name": "maxAmount_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "index_", + "type": "uint256" + } ], + "name": "removeCollateral", "outputs": [ - { "type": "uint256", "name": "collateralAmount_" }, - { "type": "uint256", "name": "lpAmount_" } - ] + { + "internalType": "uint256", + "name": "collateralAmount_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lpAmount_", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", - "name": "removeQuoteToken", - "constant": false, - "payable": false, "inputs": [ - { "type": "uint256", "name": "maxAmount_" }, - { "type": "uint256", "name": "index_" } + { + "internalType": "uint256", + "name": "maxAmount_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "index_", + "type": "uint256" + } ], + "name": "removeQuoteToken", "outputs": [ - { "type": "uint256", "name": "removedAmount_" }, - { "type": "uint256", "name": "redeemedLPs_" } - ] + { + "internalType": "uint256", + "name": "removedAmount_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "redeemedLPs_", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", - "name": "repayDebt", - "constant": false, - "payable": false, "inputs": [ - { "type": "address", "name": "borrowerAddress_" }, - { "type": "uint256", "name": "maxQuoteTokenAmountToRepay_" }, - { "type": "uint256", "name": "collateralAmountToPull_" }, - { "type": "address", "name": "collateralReceiver_" }, - { "type": "uint256", "name": "limitIndex_" } + { + "internalType": "address", + "name": "borrowerAddress_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "maxQuoteTokenAmountToRepay_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "collateralAmountToPull_", + "type": "uint256" + }, + { + "internalType": "address", + "name": "collateralReceiver_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "limitIndex_", + "type": "uint256" + } ], - "outputs": [] + "name": "repayDebt", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", - "name": "reservesInfo", - "constant": true, - "stateMutability": "view", - "payable": false, "inputs": [], + "name": "reservesInfo", "outputs": [ - { "type": "uint256" }, - { "type": "uint256" }, - { "type": "uint256" }, - { "type": "uint256" } - ] + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" }, { - "type": "function", - "name": "revokeLPAllowance", - "constant": false, - "payable": false, "inputs": [ - { "type": "address", "name": "spender_" }, - { "type": "uint256[]", "name": "indexes_" } + { + "internalType": "address", + "name": "spender_", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "indexes_", + "type": "uint256[]" + } ], - "outputs": [] + "name": "revokeLPAllowance", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "address[]", + "name": "transferors_", + "type": "address[]" + } + ], "name": "revokeLpTransferors", - "constant": false, - "payable": false, - "inputs": [{ "type": "address[]", "name": "transferors_" }], - "outputs": [] + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", - "name": "settle", - "constant": false, - "payable": false, "inputs": [ - { "type": "address", "name": "borrowerAddress_" }, - { "type": "uint256", "name": "maxDepth_" } + { + "internalType": "address", + "name": "borrowerAddress_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "maxDepth_", + "type": "uint256" + } ], - "outputs": [] + "name": "settle", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", - "name": "stampLoan", - "constant": false, - "payable": false, "inputs": [], - "outputs": [] + "name": "stampLoan", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", - "name": "startClaimableReserveAuction", - "constant": false, - "payable": false, "inputs": [], - "outputs": [] + "name": "startClaimableReserveAuction", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", - "name": "take", - "constant": false, - "payable": false, "inputs": [ - { "type": "address", "name": "borrowerAddress_" }, - { "type": "uint256", "name": "collateral_" }, - { "type": "address", "name": "callee_" }, - { "type": "bytes", "name": "data_" } + { + "internalType": "address", + "name": "borrowerAddress_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "collateral_", + "type": "uint256" + }, + { + "internalType": "address", + "name": "callee_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data_", + "type": "bytes" + } ], - "outputs": [] + "name": "take", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "uint256", + "name": "maxAmount_", + "type": "uint256" + } + ], "name": "takeReserves", - "constant": false, - "payable": false, - "inputs": [{ "type": "uint256", "name": "maxAmount_" }], - "outputs": [{ "type": "uint256", "name": "amount_" }] + "outputs": [ + { + "internalType": "uint256", + "name": "amount_", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", + "inputs": [], "name": "totalAuctionsInPool", - "constant": true, + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [{ "type": "uint256" }] + "type": "function" }, { - "type": "function", + "inputs": [], "name": "totalT0Debt", - "constant": true, + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [{ "type": "uint256" }] + "type": "function" }, { - "type": "function", + "inputs": [], "name": "totalT0DebtInAuction", - "constant": true, + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [{ "type": "uint256" }] + "type": "function" }, { - "type": "function", - "name": "transferLPs", - "constant": false, - "payable": false, "inputs": [ - { "type": "address", "name": "owner_" }, - { "type": "address", "name": "newOwner_" }, - { "type": "uint256[]", "name": "indexes_" } + { + "internalType": "address", + "name": "owner_", + "type": "address" + }, + { + "internalType": "address", + "name": "newOwner_", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "indexes_", + "type": "uint256[]" + } ], - "outputs": [] + "name": "transferLPs", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", - "name": "updateInterest", - "constant": false, - "payable": false, "inputs": [], - "outputs": [] + "name": "updateInterest", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", - "name": "withdrawBonds", - "constant": false, - "payable": false, "inputs": [ - { "type": "address", "name": "recipient_" }, - { "type": "uint256", "name": "maxAmount_" } + { + "internalType": "address", + "name": "recipient_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "maxAmount_", + "type": "uint256" + } ], - "outputs": [] + "name": "withdrawBonds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" } ] diff --git a/abis/ERC20PoolFactory.json b/abis/ERC20PoolFactory.json index 5ee85fe..cbcf0cd 100644 --- a/abis/ERC20PoolFactory.json +++ b/abis/ERC20PoolFactory.json @@ -1,106 +1,214 @@ [ - { "type": "constructor", "payable": false, "inputs": [{ "type": "address", "name": "ajna_" }] }, - { "type": "error", "name": "CreateFail", "inputs": [] }, - { "type": "error", "name": "DeployWithZeroAddress", "inputs": [] }, - { "type": "error", "name": "PoolAlreadyExists", "inputs": [] }, - { "type": "error", "name": "PoolInterestRateInvalid", "inputs": [] }, { - "type": "event", + "inputs": [ + { + "internalType": "address", + "name": "ajna_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "CreateFail", + "type": "error" + }, + { + "inputs": [], + "name": "DeployWithZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "PoolAlreadyExists", + "type": "error" + }, + { + "inputs": [], + "name": "PoolInterestRateInvalid", + "type": "error" + }, + { "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "pool_", + "type": "address" + } + ], "name": "PoolCreated", - "inputs": [{ "type": "address", "name": "pool_", "indexed": false }] + "type": "event" }, { - "type": "function", + "inputs": [], "name": "ERC20_NON_SUBSET_HASH", - "constant": true, + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [{ "type": "bytes32" }] + "type": "function" }, { - "type": "function", + "inputs": [], "name": "MAX_RATE", - "constant": true, + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [{ "type": "uint256" }] + "type": "function" }, { - "type": "function", + "inputs": [], "name": "MIN_RATE", - "constant": true, + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [{ "type": "uint256" }] + "type": "function" }, { - "type": "function", + "inputs": [], "name": "ajna", - "constant": true, + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [{ "type": "address" }] + "type": "function" }, { - "type": "function", - "name": "deployPool", - "constant": false, - "payable": false, "inputs": [ - { "type": "address", "name": "collateral_" }, - { "type": "address", "name": "quote_" }, - { "type": "uint256", "name": "interestRate_" } + { + "internalType": "address", + "name": "collateral_", + "type": "address" + }, + { + "internalType": "address", + "name": "quote_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "interestRate_", + "type": "uint256" + } + ], + "name": "deployPool", + "outputs": [ + { + "internalType": "address", + "name": "pool_", + "type": "address" + } ], - "outputs": [{ "type": "address", "name": "pool_" }] + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "name": "deployedPools", - "constant": true, + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [{ "type": "bytes32" }, { "type": "address" }, { "type": "address" }], - "outputs": [{ "type": "address" }] + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "name": "deployedPoolsList", - "constant": true, + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [{ "type": "uint256" }], - "outputs": [{ "type": "address" }] + "type": "function" }, { - "type": "function", + "inputs": [], "name": "getDeployedPoolsList", - "constant": true, + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [{ "type": "address[]" }] + "type": "function" }, { - "type": "function", + "inputs": [], "name": "getNumberOfDeployedPools", - "constant": true, + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [{ "type": "uint256" }] + "type": "function" }, { - "type": "function", + "inputs": [], "name": "implementation", - "constant": true, + "outputs": [ + { + "internalType": "contract ERC20Pool", + "name": "", + "type": "address" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [{ "type": "address" }] + "type": "function" } ] diff --git a/abis/ERC721PoolFactory.json b/abis/ERC721PoolFactory.json index 39d4b0f..3d31358 100644 --- a/abis/ERC721PoolFactory.json +++ b/abis/ERC721PoolFactory.json @@ -1,118 +1,248 @@ [ - { "type": "constructor", "payable": false, "inputs": [{ "type": "address", "name": "ajna_" }] }, - { "type": "error", "name": "CreateFail", "inputs": [] }, - { "type": "error", "name": "DeployWithZeroAddress", "inputs": [] }, - { "type": "error", "name": "NFTNotSupported", "inputs": [] }, - { "type": "error", "name": "PoolAlreadyExists", "inputs": [] }, - { "type": "error", "name": "PoolInterestRateInvalid", "inputs": [] }, - { "type": "error", "name": "TokenIdSubsetInvalid", "inputs": [] }, - { - "type": "event", + { + "inputs": [ + { + "internalType": "address", + "name": "ajna_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "CreateFail", + "type": "error" + }, + { + "inputs": [], + "name": "DeployWithZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "NFTNotSupported", + "type": "error" + }, + { + "inputs": [], + "name": "PoolAlreadyExists", + "type": "error" + }, + { + "inputs": [], + "name": "PoolInterestRateInvalid", + "type": "error" + }, + { + "inputs": [], + "name": "TokenIdSubsetInvalid", + "type": "error" + }, + { "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "pool_", + "type": "address" + } + ], "name": "PoolCreated", - "inputs": [{ "type": "address", "name": "pool_", "indexed": false }] + "type": "event" }, { - "type": "function", + "inputs": [], "name": "ERC721_NON_SUBSET_HASH", - "constant": true, + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [{ "type": "bytes32" }] + "type": "function" }, { - "type": "function", + "inputs": [], "name": "MAX_RATE", - "constant": true, + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [{ "type": "uint256" }] + "type": "function" }, { - "type": "function", + "inputs": [], "name": "MIN_RATE", - "constant": true, + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [{ "type": "uint256" }] + "type": "function" }, { - "type": "function", + "inputs": [], "name": "ajna", - "constant": true, + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [{ "type": "address" }] + "type": "function" }, { - "type": "function", - "name": "deployPool", - "constant": false, - "payable": false, "inputs": [ - { "type": "address", "name": "collateral_" }, - { "type": "address", "name": "quote_" }, - { "type": "uint256[]", "name": "tokenIds_" }, - { "type": "uint256", "name": "interestRate_" } + { + "internalType": "address", + "name": "collateral_", + "type": "address" + }, + { + "internalType": "address", + "name": "quote_", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "tokenIds_", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "interestRate_", + "type": "uint256" + } + ], + "name": "deployPool", + "outputs": [ + { + "internalType": "address", + "name": "pool_", + "type": "address" + } ], - "outputs": [{ "type": "address", "name": "pool_" }] + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "name": "deployedPools", - "constant": true, + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [{ "type": "bytes32" }, { "type": "address" }, { "type": "address" }], - "outputs": [{ "type": "address" }] + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "name": "deployedPoolsList", - "constant": true, + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [{ "type": "uint256" }], - "outputs": [{ "type": "address" }] + "type": "function" }, { - "type": "function", + "inputs": [], "name": "getDeployedPoolsList", - "constant": true, + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [{ "type": "address[]" }] + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "uint256[]", + "name": "tokenIds_", + "type": "uint256[]" + } + ], "name": "getNFTSubsetHash", - "constant": true, + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], "stateMutability": "pure", - "payable": false, - "inputs": [{ "type": "uint256[]", "name": "tokenIds_" }], - "outputs": [{ "type": "bytes32" }] + "type": "function" }, { - "type": "function", + "inputs": [], "name": "getNumberOfDeployedPools", - "constant": true, + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [{ "type": "uint256" }] + "type": "function" }, { - "type": "function", + "inputs": [], "name": "implementation", - "constant": true, + "outputs": [ + { + "internalType": "contract ERC721Pool", + "name": "", + "type": "address" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [{ "type": "address" }] + "type": "function" } ] diff --git a/abis/PoolInfoUtils.json b/abis/PoolInfoUtils.json index b1db73d..3fb3bbe 100644 --- a/abis/PoolInfoUtils.json +++ b/abis/PoolInfoUtils.json @@ -1,274 +1,632 @@ [ - { "type": "error", "name": "BucketIndexOutOfBounds", "inputs": [] }, - { "type": "error", "name": "BucketPriceOutOfBounds", "inputs": [] }, { - "type": "error", + "inputs": [], + "name": "BucketIndexOutOfBounds", + "type": "error" + }, + { + "inputs": [], + "name": "BucketPriceOutOfBounds", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "int256", + "name": "x", + "type": "int256" + } + ], "name": "PRBMathSD59x18__CeilOverflow", - "inputs": [{ "type": "int256", "name": "x" }] + "type": "error" + }, + { + "inputs": [], + "name": "PRBMathSD59x18__DivInputTooSmall", + "type": "error" }, - { "type": "error", "name": "PRBMathSD59x18__DivInputTooSmall", "inputs": [] }, { - "type": "error", + "inputs": [ + { + "internalType": "uint256", + "name": "rAbs", + "type": "uint256" + } + ], "name": "PRBMathSD59x18__DivOverflow", - "inputs": [{ "type": "uint256", "name": "rAbs" }] + "type": "error" }, { - "type": "error", + "inputs": [ + { + "internalType": "int256", + "name": "x", + "type": "int256" + } + ], "name": "PRBMathSD59x18__Exp2InputTooBig", - "inputs": [{ "type": "int256", "name": "x" }] + "type": "error" }, { - "type": "error", + "inputs": [ + { + "internalType": "int256", + "name": "x", + "type": "int256" + } + ], "name": "PRBMathSD59x18__FromIntOverflow", - "inputs": [{ "type": "int256", "name": "x" }] + "type": "error" }, { - "type": "error", + "inputs": [ + { + "internalType": "int256", + "name": "x", + "type": "int256" + } + ], "name": "PRBMathSD59x18__FromIntUnderflow", - "inputs": [{ "type": "int256", "name": "x" }] + "type": "error" }, { - "type": "error", + "inputs": [ + { + "internalType": "int256", + "name": "x", + "type": "int256" + } + ], "name": "PRBMathSD59x18__LogInputTooSmall", - "inputs": [{ "type": "int256", "name": "x" }] + "type": "error" }, - { "type": "error", "name": "PRBMathSD59x18__MulInputTooSmall", "inputs": [] }, { - "type": "error", + "inputs": [], + "name": "PRBMathSD59x18__MulInputTooSmall", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "rAbs", + "type": "uint256" + } + ], "name": "PRBMathSD59x18__MulOverflow", - "inputs": [{ "type": "uint256", "name": "rAbs" }] + "type": "error" }, { - "type": "error", + "inputs": [ + { + "internalType": "uint256", + "name": "prod1", + "type": "uint256" + } + ], "name": "PRBMath__MulDivFixedPointOverflow", - "inputs": [{ "type": "uint256", "name": "prod1" }] + "type": "error" }, { - "type": "error", - "name": "PRBMath__MulDivOverflow", "inputs": [ - { "type": "uint256", "name": "prod1" }, - { "type": "uint256", "name": "denominator" } - ] + { + "internalType": "uint256", + "name": "prod1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "denominator", + "type": "uint256" + } + ], + "name": "PRBMath__MulDivOverflow", + "type": "error" }, { - "type": "function", + "inputs": [ + { + "internalType": "address", + "name": "ajnaPool_", + "type": "address" + } + ], "name": "borrowFeeRate", - "constant": true, + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [{ "type": "address", "name": "ajnaPool_" }], - "outputs": [{ "type": "uint256" }] + "type": "function" }, { - "type": "function", - "name": "borrowerInfo", - "constant": true, - "stateMutability": "view", - "payable": false, "inputs": [ - { "type": "address", "name": "ajnaPool_" }, - { "type": "address", "name": "borrower_" } + { + "internalType": "address", + "name": "ajnaPool_", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower_", + "type": "address" + } ], + "name": "borrowerInfo", "outputs": [ - { "type": "uint256", "name": "debt_" }, - { "type": "uint256", "name": "collateral_" }, - { "type": "uint256", "name": "t0Np_" } - ] + { + "internalType": "uint256", + "name": "debt_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "collateral_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "t0Np_", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" }, { - "type": "function", - "name": "bucketInfo", - "constant": true, - "stateMutability": "view", - "payable": false, "inputs": [ - { "type": "address", "name": "ajnaPool_" }, - { "type": "uint256", "name": "index_" } + { + "internalType": "address", + "name": "ajnaPool_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index_", + "type": "uint256" + } ], + "name": "bucketInfo", "outputs": [ - { "type": "uint256", "name": "price_" }, - { "type": "uint256", "name": "quoteTokens_" }, - { "type": "uint256", "name": "collateral_" }, - { "type": "uint256", "name": "bucketLPs_" }, - { "type": "uint256", "name": "scale_" }, - { "type": "uint256", "name": "exchangeRate_" } - ] + { + "internalType": "uint256", + "name": "price_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "quoteTokens_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "collateral_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "bucketLPs_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "scale_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "exchangeRate_", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "address", + "name": "ajnaPool_", + "type": "address" + } + ], "name": "hpb", - "constant": true, + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [{ "type": "address", "name": "ajnaPool_" }], - "outputs": [{ "type": "uint256" }] + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "address", + "name": "ajnaPool_", + "type": "address" + } + ], "name": "hpbIndex", - "constant": true, + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [{ "type": "address", "name": "ajnaPool_" }], - "outputs": [{ "type": "uint256" }] + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "address", + "name": "ajnaPool_", + "type": "address" + } + ], "name": "htp", - "constant": true, + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [{ "type": "address", "name": "ajnaPool_" }], - "outputs": [{ "type": "uint256" }] + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "uint256", + "name": "index_", + "type": "uint256" + } + ], "name": "indexToPrice", - "constant": true, + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "pure", - "payable": false, - "inputs": [{ "type": "uint256", "name": "index_" }], - "outputs": [{ "type": "uint256" }] + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "address", + "name": "ajnaPool_", + "type": "address" + } + ], "name": "lenderInterestMargin", - "constant": true, + "outputs": [ + { + "internalType": "uint256", + "name": "lenderInterestMargin_", + "type": "uint256" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [{ "type": "address", "name": "ajnaPool_" }], - "outputs": [{ "type": "uint256", "name": "lenderInterestMargin_" }] + "type": "function" }, { - "type": "function", - "name": "lpsToCollateral", - "constant": true, - "stateMutability": "view", - "payable": false, "inputs": [ - { "type": "address", "name": "ajnaPool_" }, - { "type": "uint256", "name": "lps_" }, - { "type": "uint256", "name": "index_" } + { + "internalType": "address", + "name": "ajnaPool_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "lps_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "index_", + "type": "uint256" + } + ], + "name": "lpsToCollateral", + "outputs": [ + { + "internalType": "uint256", + "name": "collateralAmount_", + "type": "uint256" + } ], - "outputs": [{ "type": "uint256", "name": "collateralAmount_" }] + "stateMutability": "view", + "type": "function" }, { - "type": "function", - "name": "lpsToQuoteTokens", - "constant": true, - "stateMutability": "view", - "payable": false, "inputs": [ - { "type": "address", "name": "ajnaPool_" }, - { "type": "uint256", "name": "lps_" }, - { "type": "uint256", "name": "index_" } + { + "internalType": "address", + "name": "ajnaPool_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "lps_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "index_", + "type": "uint256" + } + ], + "name": "lpsToQuoteTokens", + "outputs": [ + { + "internalType": "uint256", + "name": "quoteAmount_", + "type": "uint256" + } ], - "outputs": [{ "type": "uint256", "name": "quoteAmount_" }] + "stateMutability": "view", + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "address", + "name": "ajnaPool_", + "type": "address" + } + ], "name": "lup", - "constant": true, + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [{ "type": "address", "name": "ajnaPool_" }], - "outputs": [{ "type": "uint256" }] + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "address", + "name": "ajnaPool_", + "type": "address" + } + ], "name": "lupIndex", - "constant": true, + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [{ "type": "address", "name": "ajnaPool_" }], - "outputs": [{ "type": "uint256" }] + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "address", + "name": "ajnaPool_", + "type": "address" + } + ], "name": "momp", - "constant": true, + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [{ "type": "address", "name": "ajnaPool_" }], - "outputs": [{ "type": "uint256" }] + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "address", + "name": "ajnaPool_", + "type": "address" + } + ], "name": "poolLoansInfo", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [{ "type": "address", "name": "ajnaPool_" }], "outputs": [ - { "type": "uint256", "name": "poolSize_" }, - { "type": "uint256", "name": "loansCount_" }, - { "type": "address", "name": "maxBorrower_" }, - { "type": "uint256", "name": "pendingInflator_" }, - { "type": "uint256", "name": "pendingInterestFactor_" } - ] + { + "internalType": "uint256", + "name": "poolSize_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "loansCount_", + "type": "uint256" + }, + { + "internalType": "address", + "name": "maxBorrower_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "pendingInflator_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "pendingInterestFactor_", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "address", + "name": "ajnaPool_", + "type": "address" + } + ], "name": "poolPricesInfo", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [{ "type": "address", "name": "ajnaPool_" }], "outputs": [ - { "type": "uint256", "name": "hpb_" }, - { "type": "uint256", "name": "hpbIndex_" }, - { "type": "uint256", "name": "htp_" }, - { "type": "uint256", "name": "htpIndex_" }, - { "type": "uint256", "name": "lup_" }, - { "type": "uint256", "name": "lupIndex_" } - ] + { + "internalType": "uint256", + "name": "hpb_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "hpbIndex_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "htp_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "htpIndex_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lup_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lupIndex_", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "address", + "name": "ajnaPool_", + "type": "address" + } + ], "name": "poolReservesInfo", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [{ "type": "address", "name": "ajnaPool_" }], "outputs": [ - { "type": "uint256", "name": "reserves_" }, - { "type": "uint256", "name": "claimableReserves_" }, - { "type": "uint256", "name": "claimableReservesRemaining_" }, - { "type": "uint256", "name": "auctionPrice_" }, - { "type": "uint256", "name": "timeRemaining_" } - ] + { + "internalType": "uint256", + "name": "reserves_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "claimableReserves_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "claimableReservesRemaining_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "auctionPrice_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "timeRemaining_", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "address", + "name": "ajnaPool_", + "type": "address" + } + ], "name": "poolUtilizationInfo", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [{ "type": "address", "name": "ajnaPool_" }], "outputs": [ - { "type": "uint256", "name": "poolMinDebtAmount_" }, - { "type": "uint256", "name": "poolCollateralization_" }, - { "type": "uint256", "name": "poolActualUtilization_" }, - { "type": "uint256", "name": "poolTargetUtilization_" } - ] + { + "internalType": "uint256", + "name": "poolMinDebtAmount_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "poolCollateralization_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "poolActualUtilization_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "poolTargetUtilization_", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "uint256", + "name": "price_", + "type": "uint256" + } + ], "name": "priceToIndex", - "constant": true, + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "pure", - "payable": false, - "inputs": [{ "type": "uint256", "name": "price_" }], - "outputs": [{ "type": "uint256" }] + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "address", + "name": "ajnaPool_", + "type": "address" + } + ], "name": "unutilizedDepositFeeRate", - "constant": true, + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [{ "type": "address", "name": "ajnaPool_" }], - "outputs": [{ "type": "uint256" }] + "type": "function" } ] diff --git a/abis/PositionManager.json b/abis/PositionManager.json index 75e9334..cae3091 100644 --- a/abis/PositionManager.json +++ b/abis/PositionManager.json @@ -1,468 +1,976 @@ [ { - "type": "constructor", - "payable": false, "inputs": [ - { "type": "address", "name": "erc20Factory_" }, - { "type": "address", "name": "erc721Factory_" } - ] + { + "internalType": "contract ERC20PoolFactory", + "name": "erc20Factory_", + "type": "address" + }, + { + "internalType": "contract ERC721PoolFactory", + "name": "erc721Factory_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "BucketBankrupt", + "type": "error" + }, + { + "inputs": [], + "name": "BucketIndexOutOfBounds", + "type": "error" + }, + { + "inputs": [], + "name": "LiquidityNotRemoved", + "type": "error" + }, + { + "inputs": [], + "name": "NoAuth", + "type": "error" + }, + { + "inputs": [], + "name": "NotAjnaPool", + "type": "error" }, - { "type": "error", "name": "BucketBankrupt", "inputs": [] }, - { "type": "error", "name": "BucketIndexOutOfBounds", "inputs": [] }, - { "type": "error", "name": "LiquidityNotRemoved", "inputs": [] }, - { "type": "error", "name": "NoAuth", "inputs": [] }, - { "type": "error", "name": "NotAjnaPool", "inputs": [] }, { - "type": "error", + "inputs": [ + { + "internalType": "int256", + "name": "x", + "type": "int256" + } + ], "name": "PRBMathSD59x18__Exp2InputTooBig", - "inputs": [{ "type": "int256", "name": "x" }] + "type": "error" }, { - "type": "error", + "inputs": [ + { + "internalType": "int256", + "name": "x", + "type": "int256" + } + ], "name": "PRBMathSD59x18__FromIntOverflow", - "inputs": [{ "type": "int256", "name": "x" }] + "type": "error" }, { - "type": "error", + "inputs": [ + { + "internalType": "int256", + "name": "x", + "type": "int256" + } + ], "name": "PRBMathSD59x18__FromIntUnderflow", - "inputs": [{ "type": "int256", "name": "x" }] + "type": "error" }, { - "type": "error", + "inputs": [ + { + "internalType": "int256", + "name": "x", + "type": "int256" + } + ], "name": "PRBMathSD59x18__LogInputTooSmall", - "inputs": [{ "type": "int256", "name": "x" }] + "type": "error" + }, + { + "inputs": [], + "name": "PRBMathSD59x18__MulInputTooSmall", + "type": "error" }, - { "type": "error", "name": "PRBMathSD59x18__MulInputTooSmall", "inputs": [] }, { - "type": "error", + "inputs": [ + { + "internalType": "uint256", + "name": "rAbs", + "type": "uint256" + } + ], "name": "PRBMathSD59x18__MulOverflow", - "inputs": [{ "type": "uint256", "name": "rAbs" }] + "type": "error" }, { - "type": "error", + "inputs": [ + { + "internalType": "uint256", + "name": "prod1", + "type": "uint256" + } + ], "name": "PRBMath__MulDivFixedPointOverflow", - "inputs": [{ "type": "uint256", "name": "prod1" }] + "type": "error" + }, + { + "inputs": [], + "name": "RemovePositionFailed", + "type": "error" + }, + { + "inputs": [], + "name": "WrongPool", + "type": "error" }, - { "type": "error", "name": "RemovePositionFailed", "inputs": [] }, - { "type": "error", "name": "WrongPool", "inputs": [] }, { - "type": "event", "anonymous": false, - "name": "Approval", "inputs": [ - { "type": "address", "name": "owner", "indexed": true }, - { "type": "address", "name": "approved", "indexed": true }, - { "type": "uint256", "name": "tokenId", "indexed": true } - ] + { + "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" }, { - "type": "event", "anonymous": false, - "name": "ApprovalForAll", "inputs": [ - { "type": "address", "name": "owner", "indexed": true }, - { "type": "address", "name": "operator", "indexed": true }, - { "type": "bool", "name": "approved", "indexed": false } - ] + { + "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" }, { - "type": "event", "anonymous": false, - "name": "Burn", "inputs": [ - { "type": "address", "name": "lender", "indexed": true }, - { "type": "uint256", "name": "tokenId", "indexed": true } - ] + { + "indexed": true, + "internalType": "address", + "name": "lender", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Burn", + "type": "event" }, { - "type": "event", "anonymous": false, - "name": "MemorializePosition", "inputs": [ - { "type": "address", "name": "lender", "indexed": true }, - { "type": "uint256", "name": "tokenId", "indexed": false }, - { "type": "uint256[]", "name": "indexes", "indexed": false } - ] + { + "indexed": true, + "internalType": "address", + "name": "lender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "indexes", + "type": "uint256[]" + } + ], + "name": "MemorializePosition", + "type": "event" }, { - "type": "event", "anonymous": false, - "name": "Mint", "inputs": [ - { "type": "address", "name": "lender", "indexed": true }, - { "type": "address", "name": "pool", "indexed": true }, - { "type": "uint256", "name": "tokenId", "indexed": false } - ] + { + "indexed": true, + "internalType": "address", + "name": "lender", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "pool", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Mint", + "type": "event" }, { - "type": "event", "anonymous": false, - "name": "MoveLiquidity", "inputs": [ - { "type": "address", "name": "lender", "indexed": true }, - { "type": "uint256", "name": "tokenId", "indexed": false }, - { "type": "uint256", "name": "fromIndex", "indexed": false }, - { "type": "uint256", "name": "toIndex", "indexed": false } - ] + { + "indexed": true, + "internalType": "address", + "name": "lender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "fromIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "toIndex", + "type": "uint256" + } + ], + "name": "MoveLiquidity", + "type": "event" }, { - "type": "event", "anonymous": false, - "name": "RedeemPosition", "inputs": [ - { "type": "address", "name": "lender", "indexed": true }, - { "type": "uint256", "name": "tokenId", "indexed": false }, - { "type": "uint256[]", "name": "indexes", "indexed": false } - ] + { + "indexed": true, + "internalType": "address", + "name": "lender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "indexes", + "type": "uint256[]" + } + ], + "name": "RedeemPosition", + "type": "event" }, { - "type": "event", "anonymous": false, - "name": "Transfer", "inputs": [ - { "type": "address", "name": "from", "indexed": true }, - { "type": "address", "name": "to", "indexed": true }, - { "type": "uint256", "name": "tokenId", "indexed": true } - ] + { + "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" }, { - "type": "function", + "inputs": [], "name": "DOMAIN_SEPARATOR", - "constant": true, + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [{ "type": "bytes32" }] + "type": "function" }, { - "type": "function", + "inputs": [], "name": "PERMIT_TYPEHASH", - "constant": true, + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [{ "type": "bytes32" }] + "type": "function" }, { - "type": "function", - "name": "approve", - "constant": false, - "payable": false, "inputs": [ - { "type": "address", "name": "to" }, - { "type": "uint256", "name": "tokenId" } + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } ], - "outputs": [] + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], "name": "balanceOf", - "constant": true, + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [{ "type": "address", "name": "owner" }], - "outputs": [{ "type": "uint256" }] + "type": "function" }, { - "type": "function", - "name": "burn", - "constant": false, - "payable": false, "inputs": [ { - "type": "tuple", - "name": "params_", "components": [ - { "type": "uint256", "name": "tokenId" }, - { "type": "address", "name": "pool" } - ] + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "pool", + "type": "address" + } + ], + "internalType": "struct IPositionManagerOwnerActions.BurnParams", + "name": "params_", + "type": "tuple" } ], - "outputs": [] + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], "name": "getApproved", - "constant": true, + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [{ "type": "uint256", "name": "tokenId" }], - "outputs": [{ "type": "address" }] + "type": "function" }, { - "type": "function", - "name": "getLPs", - "constant": true, - "stateMutability": "view", - "payable": false, "inputs": [ - { "type": "uint256", "name": "tokenId_" }, - { "type": "uint256", "name": "index_" } + { + "internalType": "uint256", + "name": "tokenId_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "index_", + "type": "uint256" + } ], - "outputs": [{ "type": "uint256" }] + "name": "getLPs", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId_", + "type": "uint256" + } + ], "name": "getPositionIndexes", - "constant": true, + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [{ "type": "uint256", "name": "tokenId_" }], - "outputs": [{ "type": "uint256[]" }] + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId_", + "type": "uint256" + } + ], "name": "getPositionIndexesFiltered", - "constant": true, + "outputs": [ + { + "internalType": "uint256[]", + "name": "filteredIndexes_", + "type": "uint256[]" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [{ "type": "uint256", "name": "tokenId_" }], - "outputs": [{ "type": "uint256[]", "name": "filteredIndexes_" }] + "type": "function" }, { - "type": "function", - "name": "getPositionInfo", - "constant": true, - "stateMutability": "view", - "payable": false, "inputs": [ - { "type": "uint256", "name": "tokenId_" }, - { "type": "uint256", "name": "index_" } + { + "internalType": "uint256", + "name": "tokenId_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "index_", + "type": "uint256" + } + ], + "name": "getPositionInfo", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], - "outputs": [{ "type": "uint256" }, { "type": "uint256" }] + "stateMutability": "view", + "type": "function" }, { - "type": "function", - "name": "isApprovedForAll", - "constant": true, - "stateMutability": "view", - "payable": false, "inputs": [ - { "type": "address", "name": "owner" }, - { "type": "address", "name": "operator" } + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } ], - "outputs": [{ "type": "bool" }] + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" }, { - "type": "function", - "name": "isIndexInPosition", - "constant": true, - "stateMutability": "view", - "payable": false, "inputs": [ - { "type": "uint256", "name": "tokenId_" }, - { "type": "uint256", "name": "index_" } + { + "internalType": "uint256", + "name": "tokenId_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "index_", + "type": "uint256" + } + ], + "name": "isIndexInPosition", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } ], - "outputs": [{ "type": "bool" }] + "stateMutability": "view", + "type": "function" }, { - "type": "function", - "name": "isPositionBucketBankrupt", - "constant": true, - "stateMutability": "view", - "payable": false, "inputs": [ - { "type": "uint256", "name": "tokenId_" }, - { "type": "uint256", "name": "index_" } + { + "internalType": "uint256", + "name": "tokenId_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "index_", + "type": "uint256" + } + ], + "name": "isPositionBucketBankrupt", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } ], - "outputs": [{ "type": "bool" }] + "stateMutability": "view", + "type": "function" }, { - "type": "function", - "name": "memorializePositions", - "constant": false, - "payable": false, "inputs": [ { - "type": "tuple", - "name": "params_", "components": [ - { "type": "uint256", "name": "tokenId" }, - { "type": "uint256[]", "name": "indexes" } - ] + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "indexes", + "type": "uint256[]" + } + ], + "internalType": "struct IPositionManagerOwnerActions.MemorializePositionsParams", + "name": "params_", + "type": "tuple" } ], - "outputs": [] + "name": "memorializePositions", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", - "name": "mint", - "constant": false, - "payable": false, "inputs": [ { - "type": "tuple", - "name": "params_", "components": [ - { "type": "address", "name": "recipient" }, - { "type": "address", "name": "pool" }, - { "type": "bytes32", "name": "poolSubsetHash" } - ] + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "address", + "name": "pool", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "poolSubsetHash", + "type": "bytes32" + } + ], + "internalType": "struct IPositionManagerOwnerActions.MintParams", + "name": "params_", + "type": "tuple" + } + ], + "name": "mint", + "outputs": [ + { + "internalType": "uint256", + "name": "tokenId_", + "type": "uint256" } ], - "outputs": [{ "type": "uint256", "name": "tokenId_" }] + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", - "name": "moveLiquidity", - "constant": false, - "payable": false, "inputs": [ { - "type": "tuple", - "name": "params_", "components": [ - { "type": "uint256", "name": "tokenId" }, - { "type": "address", "name": "pool" }, - { "type": "uint256", "name": "fromIndex" }, - { "type": "uint256", "name": "toIndex" }, - { "type": "uint256", "name": "expiry" } - ] + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "pool", + "type": "address" + }, + { + "internalType": "uint256", + "name": "fromIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "toIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + } + ], + "internalType": "struct IPositionManagerOwnerActions.MoveLiquidityParams", + "name": "params_", + "type": "tuple" } ], - "outputs": [] + "name": "moveLiquidity", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], "name": "multicall", - "constant": false, - "payable": false, - "inputs": [{ "type": "bytes[]", "name": "data" }], - "outputs": [{ "type": "bytes[]", "name": "results" }] + "outputs": [ + { + "internalType": "bytes[]", + "name": "results", + "type": "bytes[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", + "inputs": [], "name": "name", - "constant": true, + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [{ "type": "string" }] + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], "name": "ownerOf", - "constant": true, + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [{ "type": "uint256", "name": "tokenId" }], - "outputs": [{ "type": "address" }] + "type": "function" }, { - "type": "function", - "name": "permit", - "constant": false, - "payable": false, "inputs": [ - { "type": "address", "name": "spender_" }, - { "type": "uint256", "name": "tokenId_" }, - { "type": "uint256", "name": "deadline_" }, - { "type": "uint8", "name": "v_" }, - { "type": "bytes32", "name": "r_" }, - { "type": "bytes32", "name": "s_" } + { + "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" + } ], - "outputs": [] + "name": "permit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "name": "poolKey", - "constant": true, + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [{ "type": "uint256" }], - "outputs": [{ "type": "address" }] + "type": "function" }, { - "type": "function", - "name": "reedemPositions", - "constant": false, - "payable": false, "inputs": [ { - "type": "tuple", - "name": "params_", "components": [ - { "type": "uint256", "name": "tokenId" }, - { "type": "address", "name": "pool" }, - { "type": "uint256[]", "name": "indexes" } - ] + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "pool", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "indexes", + "type": "uint256[]" + } + ], + "internalType": "struct IPositionManagerOwnerActions.RedeemPositionsParams", + "name": "params_", + "type": "tuple" } ], - "outputs": [] + "name": "reedemPositions", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", - "name": "safeTransferFrom", - "constant": false, - "payable": false, "inputs": [ - { "type": "address", "name": "from" }, - { "type": "address", "name": "to" }, - { "type": "uint256", "name": "tokenId" } + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } ], - "outputs": [] + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", - "name": "safeTransferFrom", - "constant": false, - "payable": false, "inputs": [ - { "type": "address", "name": "from" }, - { "type": "address", "name": "to" }, - { "type": "uint256", "name": "tokenId" }, - { "type": "bytes", "name": "data" } + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } ], - "outputs": [] + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", - "name": "setApprovalForAll", - "constant": false, - "payable": false, "inputs": [ - { "type": "address", "name": "operator" }, - { "type": "bool", "name": "approved" } + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } ], - "outputs": [] + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], "name": "supportsInterface", - "constant": true, + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [{ "type": "bytes4", "name": "interfaceId" }], - "outputs": [{ "type": "bool" }] + "type": "function" }, { - "type": "function", + "inputs": [], "name": "symbol", - "constant": true, + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [{ "type": "string" }] + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId_", + "type": "uint256" + } + ], "name": "tokenURI", - "constant": true, + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [{ "type": "uint256", "name": "tokenId_" }], - "outputs": [{ "type": "string" }] + "type": "function" }, { - "type": "function", - "name": "transferFrom", - "constant": false, - "payable": false, "inputs": [ - { "type": "address", "name": "from" }, - { "type": "address", "name": "to" }, - { "type": "uint256", "name": "tokenId" } + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } ], - "outputs": [] + "name": "transferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" } ] diff --git a/abis/RewardsManager.json b/abis/RewardsManager.json index 1b6ed04..ee18526 100644 --- a/abis/RewardsManager.json +++ b/abis/RewardsManager.json @@ -1,197 +1,452 @@ [ { - "type": "constructor", - "payable": false, "inputs": [ - { "type": "address", "name": "ajnaToken_" }, - { "type": "address", "name": "positionManager_" } - ] + { + "internalType": "address", + "name": "ajnaToken_", + "type": "address" + }, + { + "internalType": "contract IPositionManager", + "name": "positionManager_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "AlreadyClaimed", + "type": "error" + }, + { + "inputs": [], + "name": "EpochNotAvailable", + "type": "error" + }, + { + "inputs": [], + "name": "ExchangeRateUpdateTooLate", + "type": "error" + }, + { + "inputs": [], + "name": "MoveStakedLiquidityInvalid", + "type": "error" + }, + { + "inputs": [], + "name": "NotOwnerOfDeposit", + "type": "error" }, - { "type": "error", "name": "AlreadyClaimed", "inputs": [] }, - { "type": "error", "name": "EpochNotAvailable", "inputs": [] }, - { "type": "error", "name": "ExchangeRateUpdateTooLate", "inputs": [] }, - { "type": "error", "name": "MoveStakedLiquidityInvalid", "inputs": [] }, - { "type": "error", "name": "NotOwnerOfDeposit", "inputs": [] }, { - "type": "event", "anonymous": false, - "name": "ClaimRewards", "inputs": [ - { "type": "address", "name": "owner", "indexed": true }, - { "type": "address", "name": "ajnaPool", "indexed": true }, - { "type": "uint256", "name": "tokenId", "indexed": true }, - { "type": "uint256[]", "name": "epochsClaimed", "indexed": false }, - { "type": "uint256", "name": "amount", "indexed": false } - ] + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "ajnaPool", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "epochsClaimed", + "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "ClaimRewards", + "type": "event" }, { - "type": "event", "anonymous": false, - "name": "MoveStakedLiquidity", "inputs": [ - { "type": "uint256", "name": "tokenId", "indexed": false }, - { "type": "uint256[]", "name": "fromIndexes", "indexed": false }, - { "type": "uint256[]", "name": "toIndexes", "indexed": false } - ] + { + "indexed": false, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "fromIndexes", + "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "toIndexes", + "type": "uint256[]" + } + ], + "name": "MoveStakedLiquidity", + "type": "event" }, { - "type": "event", "anonymous": false, - "name": "Stake", "inputs": [ - { "type": "address", "name": "owner", "indexed": true }, - { "type": "address", "name": "ajnaPool", "indexed": true }, - { "type": "uint256", "name": "tokenId", "indexed": true } - ] + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "ajnaPool", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Stake", + "type": "event" }, { - "type": "event", "anonymous": false, - "name": "Unstake", "inputs": [ - { "type": "address", "name": "owner", "indexed": true }, - { "type": "address", "name": "ajnaPool", "indexed": true }, - { "type": "uint256", "name": "tokenId", "indexed": true } - ] + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "ajnaPool", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Unstake", + "type": "event" }, { - "type": "event", "anonymous": false, - "name": "UpdateExchangeRates", "inputs": [ - { "type": "address", "name": "caller", "indexed": true }, - { "type": "address", "name": "ajnaPool", "indexed": true }, - { "type": "uint256[]", "name": "indexesUpdated", "indexed": false }, - { "type": "uint256", "name": "rewardsClaimed", "indexed": false } - ] + { + "indexed": true, + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "ajnaPool", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "indexesUpdated", + "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "rewardsClaimed", + "type": "uint256" + } + ], + "name": "UpdateExchangeRates", + "type": "event" }, { - "type": "function", + "inputs": [], "name": "ajnaToken", - "constant": true, + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [{ "type": "address" }] + "type": "function" }, { - "type": "function", - "name": "calculateRewards", - "constant": true, - "stateMutability": "view", - "payable": false, "inputs": [ - { "type": "uint256", "name": "tokenId_" }, - { "type": "uint256", "name": "epochToClaim_" } + { + "internalType": "uint256", + "name": "tokenId_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "epochToClaim_", + "type": "uint256" + } + ], + "name": "calculateRewards", + "outputs": [ + { + "internalType": "uint256", + "name": "rewards_", + "type": "uint256" + } ], - "outputs": [{ "type": "uint256", "name": "rewards_" }] + "stateMutability": "view", + "type": "function" }, { - "type": "function", - "name": "claimRewards", - "constant": false, - "payable": false, "inputs": [ - { "type": "uint256", "name": "tokenId_" }, - { "type": "uint256", "name": "epochToClaim_" } + { + "internalType": "uint256", + "name": "tokenId_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "epochToClaim_", + "type": "uint256" + } ], - "outputs": [] + "name": "claimRewards", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", - "name": "getBucketStateStakeInfo", - "constant": true, - "stateMutability": "view", - "payable": false, "inputs": [ - { "type": "uint256", "name": "tokenId_" }, - { "type": "uint256", "name": "bucketId_" } + { + "internalType": "uint256", + "name": "tokenId_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "bucketId_", + "type": "uint256" + } + ], + "name": "getBucketStateStakeInfo", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], - "outputs": [{ "type": "uint256" }, { "type": "uint256" }] + "stateMutability": "view", + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId_", + "type": "uint256" + } + ], "name": "getStakeInfo", - "constant": true, + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [{ "type": "uint256", "name": "tokenId_" }], - "outputs": [{ "type": "address" }, { "type": "address" }, { "type": "uint256" }] + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "name": "isEpochClaimed", - "constant": true, + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [{ "type": "uint256" }, { "type": "uint256" }], - "outputs": [{ "type": "bool" }] + "type": "function" }, { - "type": "function", - "name": "moveStakedLiquidity", - "constant": false, - "payable": false, "inputs": [ - { "type": "uint256", "name": "tokenId_" }, - { "type": "uint256[]", "name": "fromBuckets_" }, - { "type": "uint256[]", "name": "toBuckets_" }, - { "type": "uint256", "name": "expiry_" } + { + "internalType": "uint256", + "name": "tokenId_", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "fromBuckets_", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "toBuckets_", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "expiry_", + "type": "uint256" + } ], - "outputs": [] + "name": "moveStakedLiquidity", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", + "inputs": [], "name": "positionManager", - "constant": true, + "outputs": [ + { + "internalType": "contract IPositionManager", + "name": "", + "type": "address" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [{ "type": "address" }] + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "name": "rewardsClaimed", - "constant": true, + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [{ "type": "uint256" }], - "outputs": [{ "type": "uint256" }] + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId_", + "type": "uint256" + } + ], "name": "stake", - "constant": false, - "payable": false, - "inputs": [{ "type": "uint256", "name": "tokenId_" }], - "outputs": [] + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId_", + "type": "uint256" + } + ], "name": "unstake", - "constant": false, - "payable": false, - "inputs": [{ "type": "uint256", "name": "tokenId_" }], - "outputs": [] + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", - "name": "updateBucketExchangeRatesAndClaim", - "constant": false, - "payable": false, "inputs": [ - { "type": "address", "name": "pool_" }, - { "type": "uint256[]", "name": "indexes_" } + { + "internalType": "address", + "name": "pool_", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "indexes_", + "type": "uint256[]" + } + ], + "name": "updateBucketExchangeRatesAndClaim", + "outputs": [ + { + "internalType": "uint256", + "name": "updateReward", + "type": "uint256" + } ], - "outputs": [{ "type": "uint256", "name": "updateReward" }] + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "name": "updateRewardsClaimed", - "constant": true, + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", - "payable": false, - "inputs": [{ "type": "uint256" }], - "outputs": [{ "type": "uint256" }] + "type": "function" } ] diff --git a/copy-abis.sh b/copy-abis.sh index f31804e..ed5959a 100755 --- a/copy-abis.sh +++ b/copy-abis.sh @@ -1,11 +1,16 @@ #!/bin/bash -ABI_PATH="${1:-../sdk/packages/sdk-api/src/abis}" +ABI_PATH="${1:-../contracts/forge_out}" + +# This script generates ABIs from forge output. +# Before running, ensure forge output in your ABI_PATH has been compiled from the +# appropriate branch and commit. rm abis/* -cp "${ABI_PATH}/ERC20.json" abis/ -cp "${ABI_PATH}/ERC20Pool.json" abis/ -cp "${ABI_PATH}/ERC20PoolFactory.json" abis/ -cp "${ABI_PATH}/ERC721PoolFactory.json" abis/ -cp "${ABI_PATH}/PoolInfoUtils.json" abis/ -cp "${ABI_PATH}/PositionManager.json" abis/ -cp "${ABI_PATH}/RewardsManager.json" abis/ + +jq '.abi' "${ABI_PATH}/ERC20.sol/ERC20.json" > abis/ERC20.json +jq '.abi' "${ABI_PATH}/ERC20Pool.sol/ERC20Pool.json" > abis/ERC20Pool.json +jq '.abi' "${ABI_PATH}/ERC20PoolFactory.sol/ERC20PoolFactory.json" > abis/ERC20PoolFactory.json +jq '.abi' "${ABI_PATH}/ERC721PoolFactory.sol/ERC721PoolFactory.json" > abis/ERC721PoolFactory.json +jq '.abi' "${ABI_PATH}/PoolInfoUtils.sol/PoolInfoUtils.json" > abis/PoolInfoUtils.json +jq '.abi' "${ABI_PATH}/PositionManager.sol/PositionManager.json" > abis/PositionManager.json +jq '.abi' "${ABI_PATH}/RewardsManager.sol/RewardsManager.json" > abis/RewardsManager.json From 8f96cf54c0174f69d38d15934e067260acc0e235 Mon Sep 17 00:00:00 2001 From: Ed Noepel Date: Thu, 23 Mar 2023 11:55:26 -0400 Subject: [PATCH 12/12] allowances and transferors array handling --- src/utils/lp-allowances.ts | 29 +++++++++++++++++++++++++---- src/utils/lp-transferors.ts | 19 +++++++++++++------ 2 files changed, 38 insertions(+), 10 deletions(-) diff --git a/src/utils/lp-allowances.ts b/src/utils/lp-allowances.ts index 12e39e9..bc302d6 100644 --- a/src/utils/lp-allowances.ts +++ b/src/utils/lp-allowances.ts @@ -1,12 +1,16 @@ import { Address, BigDecimal, BigInt, Bytes } from "@graphprotocol/graph-ts" import { LPAllowance, LPAllowances } from "../../generated/schema"; -export function getAllowanceId(poolId: Bytes, lenderId: Bytes, spenderId: Bytes): Bytes { +export function getAllowancesId(poolId: Bytes, lenderId: Bytes, spenderId: Bytes): Bytes { return poolId.concat(Bytes.fromUTF8('|' + lenderId.toString() + '|' + spenderId.toString())) } +export function getAllowanceId(allowancesId: Bytes, index: BigInt): Bytes { + return allowancesId.concat(Bytes.fromUTF8('|' + index.toString())) +} + export function loadOrCreateAllowances(poolId: Bytes, lenderId: Bytes, spenderId: Bytes): LPAllowances { - let id = getAllowanceId(poolId, lenderId, spenderId) + let id = getAllowancesId(poolId, lenderId, spenderId) let entity = LPAllowances.load(id) if (entity == null) { entity = new LPAllowances(id) as LPAllowances @@ -19,9 +23,26 @@ export function loadOrCreateAllowances(poolId: Bytes, lenderId: Bytes, spenderId } export function setAllowances(entity: LPAllowances, indexes: Array, amounts: Array): void { - // TODO: create LPAllowance entities, iterate and add/update array + let id = entity.id; + for (var i=0; i): void { - // TODO: iterate and remove from array + let id = entity.id; + for (var i=0; i