From f5c654c238ff1fce1d5014000a2ad40d2601c483 Mon Sep 17 00:00:00 2001 From: Amrit Jain Date: Tue, 1 Aug 2023 19:55:05 +0530 Subject: [PATCH 1/6] feat: kwenta --- deployment/deployment.json | 2 +- subgraphs/kwenta/README.md | 28 + subgraphs/kwenta/abis/ERC20.json | 222 + subgraphs/kwenta/abis/ERC20NameBytes.json | 17 + subgraphs/kwenta/abis/ERC20SymbolBytes.json | 17 + subgraphs/kwenta/abis/Prices/AaveOracle.json | 159 + .../abis/Prices/Calculations/Curve.json | 143 + .../abis/Prices/Calculations/SushiSwap.json | 137 + subgraphs/kwenta/abis/Prices/ChainLink.json | 530 + subgraphs/kwenta/abis/Prices/Curve/Pool.json | 916 ++ .../kwenta/abis/Prices/Curve/Registry.json | 337 + subgraphs/kwenta/abis/Prices/ERC20.json | 828 ++ .../kwenta/abis/Prices/Uniswap/Factory.json | 125 + .../kwenta/abis/Prices/Uniswap/Pair.json | 461 + .../kwenta/abis/Prices/Uniswap/Router.json | 398 + subgraphs/kwenta/abis/Prices/YearnLens.json | 174 + .../kwenta/abis/kwenta/FuturesMarket.json | 1134 ++ .../abis/kwenta/FuturesMarketManager.json | 467 + .../abis/kwenta/PerpsV2MarketProxyable.json | 1345 +++ .../abis/kwenta/SmartMarginFactory.json | 333 + .../configurations/configurations.ts | 19 + .../configurations/configurations/deploy.ts | 3 + .../configurations/interface.ts | 9 + .../kwenta/configurations/configure.mustache | 6 + subgraphs/kwenta/package-lock.json | 9302 +++++++++++++++++ subgraphs/kwenta/package.json | 15 + .../kwenta-optimism/configurations.json | 32 + .../kwenta-optimism/configurations.ts | 26 + .../config/templates/kwenta.template.yaml | 275 + .../kwenta/protocols/kwenta/src/constants.ts | 1 + .../kwenta/protocols/kwenta/src/mapping.ts | 1 + subgraphs/kwenta/schema.graphql | 1982 ++++ subgraphs/kwenta/src/common/constants.ts | 177 + subgraphs/kwenta/src/common/getters.ts | 88 + subgraphs/kwenta/src/common/metrics.ts | 139 + subgraphs/kwenta/src/common/rewards.ts | 292 + subgraphs/kwenta/src/common/snapshot.ts | 321 + subgraphs/kwenta/src/common/tokens.ts | 188 + subgraphs/kwenta/src/common/utils/arrays.ts | 66 + subgraphs/kwenta/src/common/utils/datetime.ts | 64 + subgraphs/kwenta/src/common/utils/numbers.ts | 92 + subgraphs/kwenta/src/common/utils/strings.ts | 52 + subgraphs/kwenta/src/mappings/handlers.ts | 495 + subgraphs/kwenta/src/mappings/helpers.ts | 34 + subgraphs/kwenta/src/prices/README.md | 240 + .../prices/calculations/CalculationsCurve.ts | 47 + .../calculations/CalculationsSushiswap.ts | 47 + .../kwenta/src/prices/common/constants.ts | 38 + subgraphs/kwenta/src/prices/common/types.ts | 103 + subgraphs/kwenta/src/prices/common/utils.ts | 96 + .../kwenta/src/prices/config/arbitrum.ts | 137 + subgraphs/kwenta/src/prices/config/aurora.ts | 124 + .../kwenta/src/prices/config/avalanche.ts | 131 + subgraphs/kwenta/src/prices/config/bsc.ts | 122 + subgraphs/kwenta/src/prices/config/celo.ts | 123 + subgraphs/kwenta/src/prices/config/cronos.ts | 122 + subgraphs/kwenta/src/prices/config/fantom.ts | 136 + subgraphs/kwenta/src/prices/config/fuse.ts | 123 + subgraphs/kwenta/src/prices/config/gnosis.ts | 125 + subgraphs/kwenta/src/prices/config/harmony.ts | 127 + subgraphs/kwenta/src/prices/config/mainnet.ts | 174 + .../kwenta/src/prices/config/moonbeam.ts | 124 + .../kwenta/src/prices/config/optimism.ts | 136 + subgraphs/kwenta/src/prices/config/polygon.ts | 130 + .../kwenta/src/prices/config/template.ts | 114 + subgraphs/kwenta/src/prices/index.ts | 140 + .../kwenta/src/prices/oracles/AaveOracle.ts | 44 + .../src/prices/oracles/ChainLinkFeed.ts | 53 + .../src/prices/oracles/YearnLensOracle.ts | 44 + .../kwenta/src/prices/routers/CurveRouter.ts | 326 + .../src/prices/routers/UniswapForksRouter.ts | 221 + subgraphs/kwenta/src/sdk/README.md | 24 + subgraphs/kwenta/src/sdk/protocols/config.ts | 45 + .../src/sdk/protocols/perpfutures/README.md | 43 + .../src/sdk/protocols/perpfutures/account.ts | 682 ++ .../src/sdk/protocols/perpfutures/config.ts | 33 + .../src/sdk/protocols/perpfutures/enums.ts | 32 + .../src/sdk/protocols/perpfutures/index.ts | 64 + .../src/sdk/protocols/perpfutures/pool.ts | 998 ++ .../sdk/protocols/perpfutures/poolSnapshot.ts | 546 + .../src/sdk/protocols/perpfutures/position.ts | 385 + .../src/sdk/protocols/perpfutures/protocol.ts | 561 + .../protocols/perpfutures/protocolSnapshot.ts | 388 + .../src/sdk/protocols/perpfutures/tokens.ts | 85 + subgraphs/kwenta/src/sdk/util/arrays.ts | 95 + subgraphs/kwenta/src/sdk/util/constants.ts | 222 + subgraphs/kwenta/src/sdk/util/events.ts | 70 + subgraphs/kwenta/src/sdk/util/numbers.ts | 59 + subgraphs/kwenta/src/sdk/util/rewards.ts | 292 + subgraphs/kwenta/tsconfig.json | 4 + 90 files changed, 29426 insertions(+), 1 deletion(-) create mode 100644 subgraphs/kwenta/README.md create mode 100644 subgraphs/kwenta/abis/ERC20.json create mode 100644 subgraphs/kwenta/abis/ERC20NameBytes.json create mode 100644 subgraphs/kwenta/abis/ERC20SymbolBytes.json create mode 100644 subgraphs/kwenta/abis/Prices/AaveOracle.json create mode 100644 subgraphs/kwenta/abis/Prices/Calculations/Curve.json create mode 100644 subgraphs/kwenta/abis/Prices/Calculations/SushiSwap.json create mode 100644 subgraphs/kwenta/abis/Prices/ChainLink.json create mode 100644 subgraphs/kwenta/abis/Prices/Curve/Pool.json create mode 100644 subgraphs/kwenta/abis/Prices/Curve/Registry.json create mode 100644 subgraphs/kwenta/abis/Prices/ERC20.json create mode 100644 subgraphs/kwenta/abis/Prices/Uniswap/Factory.json create mode 100644 subgraphs/kwenta/abis/Prices/Uniswap/Pair.json create mode 100644 subgraphs/kwenta/abis/Prices/Uniswap/Router.json create mode 100644 subgraphs/kwenta/abis/Prices/YearnLens.json create mode 100644 subgraphs/kwenta/abis/kwenta/FuturesMarket.json create mode 100644 subgraphs/kwenta/abis/kwenta/FuturesMarketManager.json create mode 100644 subgraphs/kwenta/abis/kwenta/PerpsV2MarketProxyable.json create mode 100644 subgraphs/kwenta/abis/kwenta/SmartMarginFactory.json create mode 100644 subgraphs/kwenta/configurations/configurations/configurations.ts create mode 100644 subgraphs/kwenta/configurations/configurations/deploy.ts create mode 100644 subgraphs/kwenta/configurations/configurations/interface.ts create mode 100644 subgraphs/kwenta/configurations/configure.mustache create mode 100644 subgraphs/kwenta/package-lock.json create mode 100644 subgraphs/kwenta/package.json create mode 100644 subgraphs/kwenta/protocols/kwenta/config/deployments/kwenta-optimism/configurations.json create mode 100644 subgraphs/kwenta/protocols/kwenta/config/deployments/kwenta-optimism/configurations.ts create mode 100644 subgraphs/kwenta/protocols/kwenta/config/templates/kwenta.template.yaml create mode 100644 subgraphs/kwenta/protocols/kwenta/src/constants.ts create mode 100644 subgraphs/kwenta/protocols/kwenta/src/mapping.ts create mode 100644 subgraphs/kwenta/schema.graphql create mode 100644 subgraphs/kwenta/src/common/constants.ts create mode 100644 subgraphs/kwenta/src/common/getters.ts create mode 100644 subgraphs/kwenta/src/common/metrics.ts create mode 100644 subgraphs/kwenta/src/common/rewards.ts create mode 100644 subgraphs/kwenta/src/common/snapshot.ts create mode 100644 subgraphs/kwenta/src/common/tokens.ts create mode 100644 subgraphs/kwenta/src/common/utils/arrays.ts create mode 100644 subgraphs/kwenta/src/common/utils/datetime.ts create mode 100644 subgraphs/kwenta/src/common/utils/numbers.ts create mode 100644 subgraphs/kwenta/src/common/utils/strings.ts create mode 100644 subgraphs/kwenta/src/mappings/handlers.ts create mode 100644 subgraphs/kwenta/src/mappings/helpers.ts create mode 100644 subgraphs/kwenta/src/prices/README.md create mode 100644 subgraphs/kwenta/src/prices/calculations/CalculationsCurve.ts create mode 100644 subgraphs/kwenta/src/prices/calculations/CalculationsSushiswap.ts create mode 100644 subgraphs/kwenta/src/prices/common/constants.ts create mode 100644 subgraphs/kwenta/src/prices/common/types.ts create mode 100644 subgraphs/kwenta/src/prices/common/utils.ts create mode 100644 subgraphs/kwenta/src/prices/config/arbitrum.ts create mode 100644 subgraphs/kwenta/src/prices/config/aurora.ts create mode 100644 subgraphs/kwenta/src/prices/config/avalanche.ts create mode 100644 subgraphs/kwenta/src/prices/config/bsc.ts create mode 100644 subgraphs/kwenta/src/prices/config/celo.ts create mode 100644 subgraphs/kwenta/src/prices/config/cronos.ts create mode 100644 subgraphs/kwenta/src/prices/config/fantom.ts create mode 100644 subgraphs/kwenta/src/prices/config/fuse.ts create mode 100644 subgraphs/kwenta/src/prices/config/gnosis.ts create mode 100644 subgraphs/kwenta/src/prices/config/harmony.ts create mode 100644 subgraphs/kwenta/src/prices/config/mainnet.ts create mode 100644 subgraphs/kwenta/src/prices/config/moonbeam.ts create mode 100644 subgraphs/kwenta/src/prices/config/optimism.ts create mode 100644 subgraphs/kwenta/src/prices/config/polygon.ts create mode 100644 subgraphs/kwenta/src/prices/config/template.ts create mode 100644 subgraphs/kwenta/src/prices/index.ts create mode 100644 subgraphs/kwenta/src/prices/oracles/AaveOracle.ts create mode 100644 subgraphs/kwenta/src/prices/oracles/ChainLinkFeed.ts create mode 100644 subgraphs/kwenta/src/prices/oracles/YearnLensOracle.ts create mode 100644 subgraphs/kwenta/src/prices/routers/CurveRouter.ts create mode 100644 subgraphs/kwenta/src/prices/routers/UniswapForksRouter.ts create mode 100644 subgraphs/kwenta/src/sdk/README.md create mode 100644 subgraphs/kwenta/src/sdk/protocols/config.ts create mode 100644 subgraphs/kwenta/src/sdk/protocols/perpfutures/README.md create mode 100644 subgraphs/kwenta/src/sdk/protocols/perpfutures/account.ts create mode 100644 subgraphs/kwenta/src/sdk/protocols/perpfutures/config.ts create mode 100644 subgraphs/kwenta/src/sdk/protocols/perpfutures/enums.ts create mode 100644 subgraphs/kwenta/src/sdk/protocols/perpfutures/index.ts create mode 100644 subgraphs/kwenta/src/sdk/protocols/perpfutures/pool.ts create mode 100644 subgraphs/kwenta/src/sdk/protocols/perpfutures/poolSnapshot.ts create mode 100644 subgraphs/kwenta/src/sdk/protocols/perpfutures/position.ts create mode 100644 subgraphs/kwenta/src/sdk/protocols/perpfutures/protocol.ts create mode 100644 subgraphs/kwenta/src/sdk/protocols/perpfutures/protocolSnapshot.ts create mode 100644 subgraphs/kwenta/src/sdk/protocols/perpfutures/tokens.ts create mode 100644 subgraphs/kwenta/src/sdk/util/arrays.ts create mode 100644 subgraphs/kwenta/src/sdk/util/constants.ts create mode 100644 subgraphs/kwenta/src/sdk/util/events.ts create mode 100644 subgraphs/kwenta/src/sdk/util/numbers.ts create mode 100644 subgraphs/kwenta/src/sdk/util/rewards.ts create mode 100644 subgraphs/kwenta/tsconfig.json diff --git a/deployment/deployment.json b/deployment/deployment.json index 28d9dbb3ba..5fc63f7c76 100644 --- a/deployment/deployment.json +++ b/deployment/deployment.json @@ -8840,7 +8840,7 @@ }, "options": { "prepare:yaml": true, - "prepare:constants": false + "prepare:constants": true } } } diff --git a/subgraphs/kwenta/README.md b/subgraphs/kwenta/README.md new file mode 100644 index 0000000000..f4ce7243a4 --- /dev/null +++ b/subgraphs/kwenta/README.md @@ -0,0 +1,28 @@ +# Template Subgraph + +## Calculation Methodology v1.0.0 + +### TODO + +Explain how the main metrics are calculated for this subgraph. + +See [Compound](../compound-forks/protocols/compound-v2/README.md) or [Uniswap](../uniswap-forks/protocols/uniswap-v2/README.md) for inspiration. + +## Notes + +Any issues, discrepancies, unique logic to report. + +## Links + +Links to the relevant sources to learn about this protocol. + +- Protocol: https://uniswap.org/ +- Analytics: https://v2.info.uniswap.org/ +- Docs: https://docs.uniswap.org/protocol/V2/introduction +- Smart contracts: https://github.com/Uniswap/v2-core +- Deployed addresses: https://docs.uniswap.org/protocol/V2/reference/smart-contracts/factory +- Official subgraph: https://github.com/Uniswap/v2-subgraph + +## Contract Relationship Map (Optional) + +A map of relationships between contracts and interactions diff --git a/subgraphs/kwenta/abis/ERC20.json b/subgraphs/kwenta/abis/ERC20.json new file mode 100644 index 0000000000..405d6b3648 --- /dev/null +++ b/subgraphs/kwenta/abis/ERC20.json @@ -0,0 +1,222 @@ +[ + { + "constant": true, + "inputs": [], + "name": "name", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_spender", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_from", + "type": "address" + }, + { + "name": "_to", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "decimals", + "outputs": [ + { + "name": "", + "type": "uint8" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "name": "balance", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_to", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_owner", + "type": "address" + }, + { + "name": "_spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "from", + "type": "address" + }, + { + "indexed": true, + "name": "to", + "type": "address" + }, + { + "indexed": false, + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + } +] diff --git a/subgraphs/kwenta/abis/ERC20NameBytes.json b/subgraphs/kwenta/abis/ERC20NameBytes.json new file mode 100644 index 0000000000..2d3c877a8c --- /dev/null +++ b/subgraphs/kwenta/abis/ERC20NameBytes.json @@ -0,0 +1,17 @@ +[ + { + "constant": true, + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } +] diff --git a/subgraphs/kwenta/abis/ERC20SymbolBytes.json b/subgraphs/kwenta/abis/ERC20SymbolBytes.json new file mode 100644 index 0000000000..a76d616366 --- /dev/null +++ b/subgraphs/kwenta/abis/ERC20SymbolBytes.json @@ -0,0 +1,17 @@ +[ + { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } +] diff --git a/subgraphs/kwenta/abis/Prices/AaveOracle.json b/subgraphs/kwenta/abis/Prices/AaveOracle.json new file mode 100644 index 0000000000..3149642bb9 --- /dev/null +++ b/subgraphs/kwenta/abis/Prices/AaveOracle.json @@ -0,0 +1,159 @@ +[ + { + "inputs": [ + { + "internalType": "contract IPoolAddressesProvider", + "name": "provider", + "type": "address" + }, + { "internalType": "address[]", "name": "assets", "type": "address[]" }, + { "internalType": "address[]", "name": "sources", "type": "address[]" }, + { + "internalType": "address", + "name": "fallbackOracle", + "type": "address" + }, + { "internalType": "address", "name": "baseCurrency", "type": "address" }, + { + "internalType": "uint256", + "name": "baseCurrencyUnit", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "source", + "type": "address" + } + ], + "name": "AssetSourceUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "baseCurrency", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "baseCurrencyUnit", + "type": "uint256" + } + ], + "name": "BaseCurrencySet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "fallbackOracle", + "type": "address" + } + ], + "name": "FallbackOracleUpdated", + "type": "event" + }, + { + "inputs": [], + "name": "ADDRESSES_PROVIDER", + "outputs": [ + { + "internalType": "contract IPoolAddressesProvider", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "BASE_CURRENCY", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "BASE_CURRENCY_UNIT", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" } + ], + "name": "getAssetPrice", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address[]", "name": "assets", "type": "address[]" } + ], + "name": "getAssetsPrices", + "outputs": [ + { "internalType": "uint256[]", "name": "", "type": "uint256[]" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getFallbackOracle", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" } + ], + "name": "getSourceOfAsset", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address[]", "name": "assets", "type": "address[]" }, + { "internalType": "address[]", "name": "sources", "type": "address[]" } + ], + "name": "setAssetSources", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "fallbackOracle", "type": "address" } + ], + "name": "setFallbackOracle", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/subgraphs/kwenta/abis/Prices/Calculations/Curve.json b/subgraphs/kwenta/abis/Prices/Calculations/Curve.json new file mode 100644 index 0000000000..b1f6da3de4 --- /dev/null +++ b/subgraphs/kwenta/abis/Prices/Calculations/Curve.json @@ -0,0 +1,143 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "_curveAddressProviderAddress", + "type": "address" + }, + { "internalType": "address", "name": "_oracleAddress", "type": "address" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "curveAddressProviderAddress", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "curveMetapoolFactoryAddress", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "curveRegistryAddress", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "curveLpTokenAddress", + "type": "address" + } + ], + "name": "getBasePrice", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "curveLpTokenAddress", + "type": "address" + } + ], + "name": "getCurvePriceUsdc", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "tokenAddress", "type": "address" } + ], + "name": "getPool", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "assetAddress", "type": "address" } + ], + "name": "getPriceUsdc", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "poolAddress", "type": "address" } + ], + "name": "getUnderlyingCoinFromPool", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "curveLpTokenAddress", + "type": "address" + } + ], + "name": "getVirtualPrice", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "tokenAddress", "type": "address" } + ], + "name": "isBasicToken", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "tokenAddress", "type": "address" } + ], + "name": "isCurveLpToken", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "oracleAddress", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ownerAddress", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "slot", "type": "bytes32" }, + { "internalType": "bytes32", "name": "value", "type": "bytes32" } + ], + "name": "updateSlot", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/subgraphs/kwenta/abis/Prices/Calculations/SushiSwap.json b/subgraphs/kwenta/abis/Prices/Calculations/SushiSwap.json new file mode 100644 index 0000000000..8b9718ae78 --- /dev/null +++ b/subgraphs/kwenta/abis/Prices/Calculations/SushiSwap.json @@ -0,0 +1,137 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "_primaryRouterAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "_primaryFactoryAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "_secondaryRouterAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "_secondaryFactoryAddress", + "type": "address" + }, + { "internalType": "address", "name": "_usdcAddress", "type": "address" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { "internalType": "address", "name": "tokenAddress", "type": "address" } + ], + "name": "getLpTokenPriceUsdc", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "tokenAddress", "type": "address" } + ], + "name": "getLpTokenTotalLiquidityUsdc", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "token0Address", "type": "address" }, + { "internalType": "address", "name": "token1Address", "type": "address" } + ], + "name": "getPriceFromRouter", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "tokenAddress", "type": "address" } + ], + "name": "getPriceFromRouterUsdc", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "tokenAddress", "type": "address" } + ], + "name": "getPriceUsdc", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "tokenAddress", "type": "address" } + ], + "name": "getRouterForLpToken", + "outputs": [ + { "internalType": "contract PriceRouter", "name": "", "type": "address" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "tokenAddress", "type": "address" } + ], + "name": "isLpToken", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "primaryFactoryAddress", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "primaryRouterAddress", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "secondaryFactoryAddress", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "secondaryRouterAddress", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "usdcAddress", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "wethAddress", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + } +] diff --git a/subgraphs/kwenta/abis/Prices/ChainLink.json b/subgraphs/kwenta/abis/Prices/ChainLink.json new file mode 100644 index 0000000000..55882931c3 --- /dev/null +++ b/subgraphs/kwenta/abis/Prices/ChainLink.json @@ -0,0 +1,530 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "accessController", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "AccessControllerSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "denomination", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "latestAggregator", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "previousAggregator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "nextPhaseId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "FeedConfirmed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "denomination", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "proposedAggregator", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "currentAggregator", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "FeedProposed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "OwnershipTransferRequested", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "base", "type": "address" }, + { "internalType": "address", "name": "quote", "type": "address" }, + { "internalType": "address", "name": "aggregator", "type": "address" } + ], + "name": "confirmFeed", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "base", "type": "address" }, + { "internalType": "address", "name": "quote", "type": "address" } + ], + "name": "decimals", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "base", "type": "address" }, + { "internalType": "address", "name": "quote", "type": "address" } + ], + "name": "description", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAccessController", + "outputs": [ + { + "internalType": "contract AccessControllerInterface", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "base", "type": "address" }, + { "internalType": "address", "name": "quote", "type": "address" }, + { "internalType": "uint256", "name": "roundId", "type": "uint256" } + ], + "name": "getAnswer", + "outputs": [ + { "internalType": "int256", "name": "answer", "type": "int256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "base", "type": "address" }, + { "internalType": "address", "name": "quote", "type": "address" } + ], + "name": "getCurrentPhaseId", + "outputs": [ + { "internalType": "uint16", "name": "currentPhaseId", "type": "uint16" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "base", "type": "address" }, + { "internalType": "address", "name": "quote", "type": "address" } + ], + "name": "getFeed", + "outputs": [ + { + "internalType": "contract AggregatorV2V3Interface", + "name": "aggregator", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "base", "type": "address" }, + { "internalType": "address", "name": "quote", "type": "address" }, + { "internalType": "uint80", "name": "roundId", "type": "uint80" } + ], + "name": "getNextRoundId", + "outputs": [ + { "internalType": "uint80", "name": "nextRoundId", "type": "uint80" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "base", "type": "address" }, + { "internalType": "address", "name": "quote", "type": "address" }, + { "internalType": "uint16", "name": "phaseId", "type": "uint16" } + ], + "name": "getPhase", + "outputs": [ + { + "components": [ + { "internalType": "uint16", "name": "phaseId", "type": "uint16" }, + { + "internalType": "uint80", + "name": "startingAggregatorRoundId", + "type": "uint80" + }, + { + "internalType": "uint80", + "name": "endingAggregatorRoundId", + "type": "uint80" + } + ], + "internalType": "struct FeedRegistryInterface.Phase", + "name": "phase", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "base", "type": "address" }, + { "internalType": "address", "name": "quote", "type": "address" }, + { "internalType": "uint16", "name": "phaseId", "type": "uint16" } + ], + "name": "getPhaseFeed", + "outputs": [ + { + "internalType": "contract AggregatorV2V3Interface", + "name": "aggregator", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "base", "type": "address" }, + { "internalType": "address", "name": "quote", "type": "address" }, + { "internalType": "uint16", "name": "phaseId", "type": "uint16" } + ], + "name": "getPhaseRange", + "outputs": [ + { "internalType": "uint80", "name": "startingRoundId", "type": "uint80" }, + { "internalType": "uint80", "name": "endingRoundId", "type": "uint80" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "base", "type": "address" }, + { "internalType": "address", "name": "quote", "type": "address" }, + { "internalType": "uint80", "name": "roundId", "type": "uint80" } + ], + "name": "getPreviousRoundId", + "outputs": [ + { "internalType": "uint80", "name": "previousRoundId", "type": "uint80" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "base", "type": "address" }, + { "internalType": "address", "name": "quote", "type": "address" } + ], + "name": "getProposedFeed", + "outputs": [ + { + "internalType": "contract AggregatorV2V3Interface", + "name": "proposedAggregator", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "base", "type": "address" }, + { "internalType": "address", "name": "quote", "type": "address" }, + { "internalType": "uint80", "name": "_roundId", "type": "uint80" } + ], + "name": "getRoundData", + "outputs": [ + { "internalType": "uint80", "name": "roundId", "type": "uint80" }, + { "internalType": "int256", "name": "answer", "type": "int256" }, + { "internalType": "uint256", "name": "startedAt", "type": "uint256" }, + { "internalType": "uint256", "name": "updatedAt", "type": "uint256" }, + { "internalType": "uint80", "name": "answeredInRound", "type": "uint80" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "base", "type": "address" }, + { "internalType": "address", "name": "quote", "type": "address" }, + { "internalType": "uint80", "name": "roundId", "type": "uint80" } + ], + "name": "getRoundFeed", + "outputs": [ + { + "internalType": "contract AggregatorV2V3Interface", + "name": "aggregator", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "base", "type": "address" }, + { "internalType": "address", "name": "quote", "type": "address" }, + { "internalType": "uint256", "name": "roundId", "type": "uint256" } + ], + "name": "getTimestamp", + "outputs": [ + { "internalType": "uint256", "name": "timestamp", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "aggregator", "type": "address" } + ], + "name": "isFeedEnabled", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "base", "type": "address" }, + { "internalType": "address", "name": "quote", "type": "address" } + ], + "name": "latestAnswer", + "outputs": [ + { "internalType": "int256", "name": "answer", "type": "int256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "base", "type": "address" }, + { "internalType": "address", "name": "quote", "type": "address" } + ], + "name": "latestRound", + "outputs": [ + { "internalType": "uint256", "name": "roundId", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "base", "type": "address" }, + { "internalType": "address", "name": "quote", "type": "address" } + ], + "name": "latestRoundData", + "outputs": [ + { "internalType": "uint80", "name": "roundId", "type": "uint80" }, + { "internalType": "int256", "name": "answer", "type": "int256" }, + { "internalType": "uint256", "name": "startedAt", "type": "uint256" }, + { "internalType": "uint256", "name": "updatedAt", "type": "uint256" }, + { "internalType": "uint80", "name": "answeredInRound", "type": "uint80" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "base", "type": "address" }, + { "internalType": "address", "name": "quote", "type": "address" } + ], + "name": "latestTimestamp", + "outputs": [ + { "internalType": "uint256", "name": "timestamp", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "base", "type": "address" }, + { "internalType": "address", "name": "quote", "type": "address" }, + { "internalType": "address", "name": "aggregator", "type": "address" } + ], + "name": "proposeFeed", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "base", "type": "address" }, + { "internalType": "address", "name": "quote", "type": "address" }, + { "internalType": "uint80", "name": "roundId", "type": "uint80" } + ], + "name": "proposedGetRoundData", + "outputs": [ + { "internalType": "uint80", "name": "id", "type": "uint80" }, + { "internalType": "int256", "name": "answer", "type": "int256" }, + { "internalType": "uint256", "name": "startedAt", "type": "uint256" }, + { "internalType": "uint256", "name": "updatedAt", "type": "uint256" }, + { "internalType": "uint80", "name": "answeredInRound", "type": "uint80" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "base", "type": "address" }, + { "internalType": "address", "name": "quote", "type": "address" } + ], + "name": "proposedLatestRoundData", + "outputs": [ + { "internalType": "uint80", "name": "id", "type": "uint80" }, + { "internalType": "int256", "name": "answer", "type": "int256" }, + { "internalType": "uint256", "name": "startedAt", "type": "uint256" }, + { "internalType": "uint256", "name": "updatedAt", "type": "uint256" }, + { "internalType": "uint80", "name": "answeredInRound", "type": "uint80" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract AccessControllerInterface", + "name": "_accessController", + "type": "address" + } + ], + "name": "setAccessController", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "typeAndVersion", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "base", "type": "address" }, + { "internalType": "address", "name": "quote", "type": "address" } + ], + "name": "version", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + } +] diff --git a/subgraphs/kwenta/abis/Prices/Curve/Pool.json b/subgraphs/kwenta/abis/Prices/Curve/Pool.json new file mode 100644 index 0000000000..d4843cae7d --- /dev/null +++ b/subgraphs/kwenta/abis/Prices/Curve/Pool.json @@ -0,0 +1,916 @@ +[ + { + "name": "TokenExchange", + "inputs": [ + { "type": "address", "name": "buyer", "indexed": true }, + { "type": "int128", "name": "sold_id", "indexed": false }, + { "type": "uint256", "name": "tokens_sold", "indexed": false }, + { "type": "int128", "name": "bought_id", "indexed": false }, + { "type": "uint256", "name": "tokens_bought", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "TokenExchange", + "inputs": [ + { "name": "buyer", "type": "address", "indexed": true }, + { "name": "sold_id", "type": "uint256", "indexed": false }, + { "name": "tokens_sold", "type": "uint256", "indexed": false }, + { "name": "bought_id", "type": "uint256", "indexed": false }, + { "name": "tokens_bought", "type": "uint256", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "TokenExchangeUnderlying", + "inputs": [ + { "name": "buyer", "type": "address", "indexed": true }, + { "name": "sold_id", "type": "int128", "indexed": false }, + { "name": "tokens_sold", "type": "uint256", "indexed": false }, + { "name": "bought_id", "type": "int128", "indexed": false }, + { "name": "tokens_bought", "type": "uint256", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "AddLiquidity", + "inputs": [ + { "name": "provider", "type": "address", "indexed": true }, + { "name": "token_amounts", "type": "uint256[2]", "indexed": false }, + { "name": "fee", "type": "uint256", "indexed": false }, + { "name": "token_supply", "type": "uint256", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "AddLiquidity", + "inputs": [ + { "name": "provider", "type": "address", "indexed": true }, + { "name": "token_amounts", "type": "uint256[3]", "indexed": false }, + { "name": "fee", "type": "uint256", "indexed": false }, + { "name": "token_supply", "type": "uint256", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "AddLiquidity", + "inputs": [ + { "name": "provider", "type": "address", "indexed": true }, + { "name": "token_amounts", "type": "uint256[2]", "indexed": false }, + { "name": "fees", "type": "uint256[2]", "indexed": false }, + { "name": "invariant", "type": "uint256", "indexed": false }, + { "name": "token_supply", "type": "uint256", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "AddLiquidity", + "inputs": [ + { "type": "address", "name": "provider", "indexed": true }, + { "type": "uint256[3]", "name": "token_amounts", "indexed": false }, + { "type": "uint256[3]", "name": "fees", "indexed": false }, + { "type": "uint256", "name": "invariant", "indexed": false }, + { "type": "uint256", "name": "token_supply", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "AddLiquidity", + "inputs": [ + { "type": "address", "name": "provider", "indexed": true }, + { "type": "uint256[4]", "name": "token_amounts", "indexed": false }, + { "type": "uint256[4]", "name": "fees", "indexed": false }, + { "type": "uint256", "name": "invariant", "indexed": false }, + { "type": "uint256", "name": "token_supply", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "RemoveLiquidity", + "inputs": [ + { "name": "provider", "type": "address", "indexed": true }, + { "name": "token_amounts", "type": "uint256[2]", "indexed": false }, + { "name": "token_supply", "type": "uint256", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "RemoveLiquidity", + "inputs": [ + { "name": "provider", "type": "address", "indexed": true }, + { "name": "token_amounts", "type": "uint256[3]", "indexed": false }, + { "name": "token_supply", "type": "uint256", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "RemoveLiquidity", + "inputs": [ + { "name": "provider", "type": "address", "indexed": true }, + { "name": "token_amounts", "type": "uint256[2]", "indexed": false }, + { "name": "fees", "type": "uint256[2]", "indexed": false }, + { "name": "token_supply", "type": "uint256", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "RemoveLiquidity", + "inputs": [ + { "type": "address", "name": "provider", "indexed": true }, + { "type": "uint256[3]", "name": "token_amounts", "indexed": false }, + { "type": "uint256[3]", "name": "fees", "indexed": false }, + { "type": "uint256", "name": "token_supply", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "RemoveLiquidity", + "inputs": [ + { "type": "address", "name": "provider", "indexed": true }, + { "type": "uint256[4]", "name": "token_amounts", "indexed": false }, + { "type": "uint256[4]", "name": "fees", "indexed": false }, + { "type": "uint256", "name": "token_supply", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "RemoveLiquidityOne", + "inputs": [ + { "type": "address", "name": "provider", "indexed": true }, + { "type": "uint256", "name": "token_amount", "indexed": false }, + { "type": "uint256", "name": "coin_amount", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "RemoveLiquidityOne", + "inputs": [ + { "name": "provider", "type": "address", "indexed": true }, + { "name": "token_amount", "type": "uint256", "indexed": false }, + { "name": "coin_amount", "type": "uint256", "indexed": false }, + { "name": "token_supply", "type": "uint256", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "RemoveLiquidityImbalance", + "inputs": [ + { "type": "address", "name": "provider", "indexed": true }, + { "type": "uint256[2]", "name": "token_amounts", "indexed": false }, + { "type": "uint256[2]", "name": "fees", "indexed": false }, + { "type": "uint256", "name": "invariant", "indexed": false }, + { "type": "uint256", "name": "token_supply", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "RemoveLiquidityImbalance", + "inputs": [ + { "type": "address", "name": "provider", "indexed": true }, + { "type": "uint256[3]", "name": "token_amounts", "indexed": false }, + { "type": "uint256[3]", "name": "fees", "indexed": false }, + { "type": "uint256", "name": "invariant", "indexed": false }, + { "type": "uint256", "name": "token_supply", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "RemoveLiquidityImbalance", + "inputs": [ + { "type": "address", "name": "provider", "indexed": true }, + { "type": "uint256[4]", "name": "token_amounts", "indexed": false }, + { "type": "uint256[4]", "name": "fees", "indexed": false }, + { "type": "uint256", "name": "invariant", "indexed": false }, + { "type": "uint256", "name": "token_supply", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "NewFee", + "inputs": [ + { "type": "uint256", "name": "fee", "indexed": false }, + { "type": "uint256", "name": "admin_fee", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "NewFee", + "inputs": [ + { "type": "uint256", "name": "fee", "indexed": false }, + { "type": "uint256", "name": "admin_fee", "indexed": false }, + { "type": "uint256", "name": "offpeg_fee_multiplier", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + + { + "name": "CommitNewAdmin", + "inputs": [ + { "name": "deadline", "type": "uint256", "indexed": true }, + { "name": "admin", "type": "address", "indexed": true } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "NewAdmin", + "inputs": [{ "name": "admin", "type": "address", "indexed": true }], + "anonymous": false, + "type": "event" + }, + { + "name": "CommitNewParameters", + "inputs": [ + { "name": "deadline", "type": "uint256", "indexed": true }, + { "name": "admin_fee", "type": "uint256", "indexed": false }, + { "name": "mid_fee", "type": "uint256", "indexed": false }, + { "name": "out_fee", "type": "uint256", "indexed": false }, + { "name": "fee_gamma", "type": "uint256", "indexed": false }, + { "name": "allowed_extra_profit", "type": "uint256", "indexed": false }, + { "name": "adjustment_step", "type": "uint256", "indexed": false }, + { "name": "ma_half_time", "type": "uint256", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "NewParameters", + "inputs": [ + { "name": "admin_fee", "type": "uint256", "indexed": false }, + { "name": "mid_fee", "type": "uint256", "indexed": false }, + { "name": "out_fee", "type": "uint256", "indexed": false }, + { "name": "fee_gamma", "type": "uint256", "indexed": false }, + { "name": "allowed_extra_profit", "type": "uint256", "indexed": false }, + { "name": "adjustment_step", "type": "uint256", "indexed": false }, + { "name": "ma_half_time", "type": "uint256", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "RampAgamma", + "inputs": [ + { "name": "initial_A", "type": "uint256", "indexed": false }, + { "name": "future_A", "type": "uint256", "indexed": false }, + { "name": "initial_gamma", "type": "uint256", "indexed": false }, + { "name": "future_gamma", "type": "uint256", "indexed": false }, + { "name": "initial_time", "type": "uint256", "indexed": false }, + { "name": "future_time", "type": "uint256", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "StopRampA", + "inputs": [ + { "name": "current_A", "type": "uint256", "indexed": false }, + { "name": "current_gamma", "type": "uint256", "indexed": false }, + { "name": "time", "type": "uint256", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "ClaimAdminFee", + "inputs": [ + { "name": "admin", "type": "address", "indexed": true }, + { "name": "tokens", "type": "uint256", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "stateMutability": "nonpayable", + "type": "constructor", + "inputs": [ + { "name": "owner", "type": "address" }, + { "name": "admin_fee_receiver", "type": "address" }, + { "name": "A", "type": "uint256" }, + { "name": "gamma", "type": "uint256" }, + { "name": "mid_fee", "type": "uint256" }, + { "name": "out_fee", "type": "uint256" }, + { "name": "allowed_extra_profit", "type": "uint256" }, + { "name": "fee_gamma", "type": "uint256" }, + { "name": "adjustment_step", "type": "uint256" }, + { "name": "admin_fee", "type": "uint256" }, + { "name": "ma_half_time", "type": "uint256" }, + { "name": "initial_price", "type": "uint256" } + ], + "outputs": [] + }, + { "stateMutability": "payable", "type": "fallback" }, + { + "stateMutability": "view", + "type": "function", + "name": "token", + "inputs": [], + "outputs": [{ "name": "", "type": "address" }], + "gas": 516 + }, + { + "stateMutability": "view", + "type": "function", + "name": "coins", + "inputs": [{ "name": "i", "type": "uint256" }], + "outputs": [{ "name": "", "type": "address" }], + "gas": 648 + }, + { + "stateMutability": "view", + "type": "function", + "name": "A", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 685 + }, + { + "stateMutability": "view", + "type": "function", + "name": "gamma", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 11789 + }, + { + "stateMutability": "view", + "type": "function", + "name": "fee", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 17633 + }, + { + "stateMutability": "view", + "type": "function", + "name": "get_virtual_price", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 364797 + }, + { + "stateMutability": "payable", + "type": "function", + "name": "exchange", + "inputs": [ + { "name": "i", "type": "uint256" }, + { "name": "j", "type": "uint256" }, + { "name": "dx", "type": "uint256" }, + { "name": "min_dy", "type": "uint256" } + ], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 16775598 + }, + { + "stateMutability": "payable", + "type": "function", + "name": "exchange", + "inputs": [ + { "name": "i", "type": "uint256" }, + { "name": "j", "type": "uint256" }, + { "name": "dx", "type": "uint256" }, + { "name": "min_dy", "type": "uint256" }, + { "name": "use_eth", "type": "bool" } + ], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 16775598 + }, + { + "stateMutability": "payable", + "type": "function", + "name": "exchange_underlying", + "inputs": [ + { "name": "i", "type": "uint256" }, + { "name": "j", "type": "uint256" }, + { "name": "dx", "type": "uint256" }, + { "name": "min_dy", "type": "uint256" } + ], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 16775396 + }, + { + "stateMutability": "view", + "type": "function", + "name": "get_dy", + "inputs": [ + { "name": "i", "type": "uint256" }, + { "name": "j", "type": "uint256" }, + { "name": "dx", "type": "uint256" } + ], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 4577515 + }, + { + "stateMutability": "payable", + "type": "function", + "name": "add_liquidity", + "inputs": [ + { "name": "amounts", "type": "uint256[2]" }, + { "name": "min_mint_amount", "type": "uint256" } + ], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 17694821 + }, + { + "stateMutability": "payable", + "type": "function", + "name": "add_liquidity", + "inputs": [ + { "name": "amounts", "type": "uint256[2]" }, + { "name": "min_mint_amount", "type": "uint256" }, + { "name": "use_eth", "type": "bool" } + ], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 17694821 + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "remove_liquidity", + "inputs": [ + { "name": "_amount", "type": "uint256" }, + { "name": "min_amounts", "type": "uint256[2]" } + ], + "outputs": [], + "gas": 263729 + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "remove_liquidity", + "inputs": [ + { "name": "_amount", "type": "uint256" }, + { "name": "min_amounts", "type": "uint256[2]" }, + { "name": "use_eth", "type": "bool" } + ], + "outputs": [], + "gas": 263729 + }, + { + "stateMutability": "view", + "type": "function", + "name": "calc_token_amount", + "inputs": [{ "name": "amounts", "type": "uint256[2]" }], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 5200947 + }, + { + "stateMutability": "view", + "type": "function", + "name": "calc_withdraw_one_coin", + "inputs": [ + { "name": "token_amount", "type": "uint256" }, + { "name": "i", "type": "uint256" } + ], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 12584 + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "remove_liquidity_one_coin", + "inputs": [ + { "name": "token_amount", "type": "uint256" }, + { "name": "i", "type": "uint256" }, + { "name": "min_amount", "type": "uint256" } + ], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 16702178 + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "remove_liquidity_one_coin", + "inputs": [ + { "name": "token_amount", "type": "uint256" }, + { "name": "i", "type": "uint256" }, + { "name": "min_amount", "type": "uint256" }, + { "name": "use_eth", "type": "bool" } + ], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 16702178 + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "claim_admin_fees", + "inputs": [], + "outputs": [], + "gas": 3250985 + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "ramp_A_gamma", + "inputs": [ + { "name": "future_A", "type": "uint256" }, + { "name": "future_gamma", "type": "uint256" }, + { "name": "future_time", "type": "uint256" } + ], + "outputs": [], + "gas": 161698 + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "stop_ramp_A_gamma", + "inputs": [], + "outputs": [], + "gas": 156743 + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "commit_new_parameters", + "inputs": [ + { "name": "_new_mid_fee", "type": "uint256" }, + { "name": "_new_out_fee", "type": "uint256" }, + { "name": "_new_admin_fee", "type": "uint256" }, + { "name": "_new_fee_gamma", "type": "uint256" }, + { "name": "_new_allowed_extra_profit", "type": "uint256" }, + { "name": "_new_adjustment_step", "type": "uint256" }, + { "name": "_new_ma_half_time", "type": "uint256" } + ], + "outputs": [], + "gas": 305084 + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "apply_new_parameters", + "inputs": [], + "outputs": [], + "gas": 3543175 + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "revert_new_parameters", + "inputs": [], + "outputs": [], + "gas": 23142 + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "commit_transfer_ownership", + "inputs": [{ "name": "_owner", "type": "address" }], + "outputs": [], + "gas": 78827 + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "apply_transfer_ownership", + "inputs": [], + "outputs": [], + "gas": 67042 + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "revert_transfer_ownership", + "inputs": [], + "outputs": [], + "gas": 23232 + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "kill_me", + "inputs": [], + "outputs": [], + "gas": 40455 + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "unkill_me", + "inputs": [], + "outputs": [], + "gas": 23292 + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "set_admin_fee_receiver", + "inputs": [{ "name": "_admin_fee_receiver", "type": "address" }], + "outputs": [], + "gas": 38482 + }, + { + "stateMutability": "view", + "type": "function", + "name": "lp_price", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 217046 + }, + { + "stateMutability": "view", + "type": "function", + "name": "price_scale", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 3426 + }, + { + "stateMutability": "view", + "type": "function", + "name": "price_oracle", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 3456 + }, + { + "stateMutability": "view", + "type": "function", + "name": "price_oracle", + "inputs": [{ "name": "", "type": "uint256" }], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 3456 + }, + { + "stateMutability": "view", + "type": "function", + "name": "last_prices", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 3486 + }, + { + "stateMutability": "view", + "type": "function", + "name": "last_prices_timestamp", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 3516 + }, + { + "stateMutability": "view", + "type": "function", + "name": "initial_A_gamma", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 3546 + }, + { + "stateMutability": "view", + "type": "function", + "name": "future_A_gamma", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 3576 + }, + { + "stateMutability": "view", + "type": "function", + "name": "initial_A_gamma_time", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 3606 + }, + { + "stateMutability": "view", + "type": "function", + "name": "future_A_gamma_time", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 3636 + }, + { + "stateMutability": "view", + "type": "function", + "name": "allowed_extra_profit", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 3666 + }, + { + "stateMutability": "view", + "type": "function", + "name": "future_allowed_extra_profit", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 3696 + }, + { + "stateMutability": "view", + "type": "function", + "name": "fee_gamma", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 3726 + }, + { + "stateMutability": "view", + "type": "function", + "name": "future_fee_gamma", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 3756 + }, + { + "stateMutability": "view", + "type": "function", + "name": "adjustment_step", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 3786 + }, + { + "stateMutability": "view", + "type": "function", + "name": "future_adjustment_step", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 3816 + }, + { + "stateMutability": "view", + "type": "function", + "name": "ma_half_time", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 3846 + }, + { + "stateMutability": "view", + "type": "function", + "name": "future_ma_half_time", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 3876 + }, + { + "stateMutability": "view", + "type": "function", + "name": "mid_fee", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 3906 + }, + { + "stateMutability": "view", + "type": "function", + "name": "out_fee", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 3936 + }, + { + "stateMutability": "view", + "type": "function", + "name": "admin_fee", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 3966 + }, + { + "stateMutability": "view", + "type": "function", + "name": "future_mid_fee", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 3996 + }, + { + "stateMutability": "view", + "type": "function", + "name": "future_out_fee", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 4026 + }, + { + "stateMutability": "view", + "type": "function", + "name": "future_admin_fee", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 4056 + }, + { + "stateMutability": "view", + "type": "function", + "name": "balances", + "inputs": [{ "name": "arg0", "type": "uint256" }], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 4131 + }, + { + "stateMutability": "view", + "type": "function", + "name": "D", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 4116 + }, + { + "stateMutability": "view", + "type": "function", + "name": "owner", + "inputs": [], + "outputs": [{ "name": "", "type": "address" }], + "gas": 4146 + }, + { + "stateMutability": "view", + "type": "function", + "name": "future_owner", + "inputs": [], + "outputs": [{ "name": "", "type": "address" }], + "gas": 4176 + }, + { + "stateMutability": "view", + "type": "function", + "name": "xcp_profit", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 4206 + }, + { + "stateMutability": "view", + "type": "function", + "name": "xcp_profit_a", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 4236 + }, + { + "stateMutability": "view", + "type": "function", + "name": "virtual_price", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 4266 + }, + { + "stateMutability": "view", + "type": "function", + "name": "is_killed", + "inputs": [], + "outputs": [{ "name": "", "type": "bool" }], + "gas": 4296 + }, + { + "stateMutability": "view", + "type": "function", + "name": "kill_deadline", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 4326 + }, + { + "stateMutability": "view", + "type": "function", + "name": "transfer_ownership_deadline", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 4356 + }, + { + "stateMutability": "view", + "type": "function", + "name": "admin_actions_deadline", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256" }], + "gas": 4386 + }, + { + "stateMutability": "view", + "type": "function", + "name": "admin_fee_receiver", + "inputs": [], + "outputs": [{ "name": "", "type": "address" }], + "gas": 4416 + }, + { + "name": "lp_token", + "outputs": [{ "type": "address", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 2291 + } +] diff --git a/subgraphs/kwenta/abis/Prices/Curve/Registry.json b/subgraphs/kwenta/abis/Prices/Curve/Registry.json new file mode 100644 index 0000000000..9747624cc9 --- /dev/null +++ b/subgraphs/kwenta/abis/Prices/Curve/Registry.json @@ -0,0 +1,337 @@ +[ + { + "name": "PoolAdded", + "inputs": [ + { "type": "address", "name": "pool", "indexed": true }, + { "type": "bytes", "name": "rate_method_id", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "PoolRemoved", + "inputs": [{ "type": "address", "name": "pool", "indexed": true }], + "anonymous": false, + "type": "event" + }, + { + "outputs": [], + "inputs": [ + { "type": "address", "name": "_address_provider" }, + { "type": "address", "name": "_gauge_controller" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "name": "find_pool_for_coins", + "outputs": [{ "type": "address", "name": "" }], + "inputs": [ + { "type": "address", "name": "_from" }, + { "type": "address", "name": "_to" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "name": "find_pool_for_coins", + "outputs": [{ "type": "address", "name": "" }], + "inputs": [ + { "type": "address", "name": "_from" }, + { "type": "address", "name": "_to" }, + { "type": "uint256", "name": "i" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "name": "get_n_coins", + "outputs": [{ "type": "uint256[2]", "name": "" }], + "inputs": [{ "type": "address", "name": "_pool" }], + "stateMutability": "view", + "type": "function", + "gas": 1704 + }, + { + "name": "get_coins", + "outputs": [{ "type": "address[8]", "name": "" }], + "inputs": [{ "type": "address", "name": "_pool" }], + "stateMutability": "view", + "type": "function", + "gas": 12285 + }, + { + "name": "get_underlying_coins", + "outputs": [{ "type": "address[8]", "name": "" }], + "inputs": [{ "type": "address", "name": "_pool" }], + "stateMutability": "view", + "type": "function", + "gas": 12347 + }, + { + "name": "get_decimals", + "outputs": [{ "type": "uint256[8]", "name": "" }], + "inputs": [{ "type": "address", "name": "_pool" }], + "stateMutability": "view", + "type": "function", + "gas": 8199 + }, + { + "name": "get_underlying_decimals", + "outputs": [{ "type": "uint256[8]", "name": "" }], + "inputs": [{ "type": "address", "name": "_pool" }], + "stateMutability": "view", + "type": "function", + "gas": 8261 + }, + { + "name": "get_rates", + "outputs": [{ "type": "uint256[8]", "name": "" }], + "inputs": [{ "type": "address", "name": "_pool" }], + "stateMutability": "view", + "type": "function", + "gas": 34780 + }, + { + "name": "get_gauges", + "outputs": [ + { "type": "address[10]", "name": "" }, + { "type": "int128[10]", "name": "" } + ], + "inputs": [{ "type": "address", "name": "_pool" }], + "stateMutability": "view", + "type": "function", + "gas": 20310 + }, + { + "name": "get_balances", + "outputs": [{ "type": "uint256[8]", "name": "" }], + "inputs": [{ "type": "address", "name": "_pool" }], + "stateMutability": "view", + "type": "function", + "gas": 16818 + }, + { + "name": "get_underlying_balances", + "outputs": [{ "type": "uint256[8]", "name": "" }], + "inputs": [{ "type": "address", "name": "_pool" }], + "stateMutability": "view", + "type": "function", + "gas": 158953 + }, + { + "name": "get_virtual_price_from_lp_token", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [{ "type": "address", "name": "_token" }], + "stateMutability": "view", + "type": "function", + "gas": 2080 + }, + { + "name": "get_A", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [{ "type": "address", "name": "_pool" }], + "stateMutability": "view", + "type": "function", + "gas": 1198 + }, + { + "name": "get_parameters", + "outputs": [ + { "type": "uint256", "name": "A" }, + { "type": "uint256", "name": "future_A" }, + { "type": "uint256", "name": "fee" }, + { "type": "uint256", "name": "admin_fee" }, + { "type": "uint256", "name": "future_fee" }, + { "type": "uint256", "name": "future_admin_fee" }, + { "type": "address", "name": "future_owner" }, + { "type": "uint256", "name": "initial_A" }, + { "type": "uint256", "name": "initial_A_time" }, + { "type": "uint256", "name": "future_A_time" } + ], + "inputs": [{ "type": "address", "name": "_pool" }], + "stateMutability": "view", + "type": "function", + "gas": 6458 + }, + { + "name": "get_fees", + "outputs": [{ "type": "uint256[2]", "name": "" }], + "inputs": [{ "type": "address", "name": "_pool" }], + "stateMutability": "view", + "type": "function", + "gas": 1603 + }, + { + "name": "get_admin_balances", + "outputs": [{ "type": "uint256[8]", "name": "" }], + "inputs": [{ "type": "address", "name": "_pool" }], + "stateMutability": "view", + "type": "function", + "gas": 36719 + }, + { + "name": "get_coin_indices", + "outputs": [ + { "type": "int128", "name": "" }, + { "type": "int128", "name": "" }, + { "type": "bool", "name": "" } + ], + "inputs": [ + { "type": "address", "name": "_pool" }, + { "type": "address", "name": "_from" }, + { "type": "address", "name": "_to" } + ], + "stateMutability": "view", + "type": "function", + "gas": 27456 + }, + { + "name": "estimate_gas_used", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [ + { "type": "address", "name": "_pool" }, + { "type": "address", "name": "_from" }, + { "type": "address", "name": "_to" } + ], + "stateMutability": "view", + "type": "function", + "gas": 32329 + }, + { + "name": "add_pool", + "outputs": [], + "inputs": [ + { "type": "address", "name": "_pool" }, + { "type": "uint256", "name": "_n_coins" }, + { "type": "address", "name": "_lp_token" }, + { "type": "bytes32", "name": "_rate_method_id" }, + { "type": "uint256", "name": "_decimals" }, + { "type": "uint256", "name": "_underlying_decimals" }, + { "type": "bool", "name": "_has_initial_A" }, + { "type": "bool", "name": "_is_v1" } + ], + "stateMutability": "nonpayable", + "type": "function", + "gas": 10196577 + }, + { + "name": "add_pool_without_underlying", + "outputs": [], + "inputs": [ + { "type": "address", "name": "_pool" }, + { "type": "uint256", "name": "_n_coins" }, + { "type": "address", "name": "_lp_token" }, + { "type": "bytes32", "name": "_rate_method_id" }, + { "type": "uint256", "name": "_decimals" }, + { "type": "uint256", "name": "_use_rates" }, + { "type": "bool", "name": "_has_initial_A" }, + { "type": "bool", "name": "_is_v1" } + ], + "stateMutability": "nonpayable", + "type": "function", + "gas": 5590664 + }, + { + "name": "add_metapool", + "outputs": [], + "inputs": [ + { "type": "address", "name": "_pool" }, + { "type": "uint256", "name": "_n_coins" }, + { "type": "address", "name": "_lp_token" }, + { "type": "uint256", "name": "_decimals" } + ], + "stateMutability": "nonpayable", + "type": "function", + "gas": 10226976 + }, + { + "name": "remove_pool", + "outputs": [], + "inputs": [{ "type": "address", "name": "_pool" }], + "stateMutability": "nonpayable", + "type": "function", + "gas": 779646579509 + }, + { + "name": "set_coin_gas_estimates", + "outputs": [], + "inputs": [ + { "type": "address[10]", "name": "_addr" }, + { "type": "uint256[10]", "name": "_amount" } + ], + "stateMutability": "nonpayable", + "type": "function", + "gas": 357165 + }, + { + "name": "set_gas_estimate_contract", + "outputs": [], + "inputs": [ + { "type": "address", "name": "_pool" }, + { "type": "address", "name": "_estimator" } + ], + "stateMutability": "nonpayable", + "type": "function", + "gas": 37747 + }, + { + "name": "set_liquidity_gauges", + "outputs": [], + "inputs": [ + { "type": "address", "name": "_pool" }, + { "type": "address[10]", "name": "_liquidity_gauges" } + ], + "stateMutability": "nonpayable", + "type": "function", + "gas": 365793 + }, + { + "name": "address_provider", + "outputs": [{ "type": "address", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 2111 + }, + { + "name": "gauge_controller", + "outputs": [{ "type": "address", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 2141 + }, + { + "name": "pool_list", + "outputs": [{ "type": "address", "name": "" }], + "inputs": [{ "type": "uint256", "name": "arg0" }], + "stateMutability": "view", + "type": "function", + "gas": 2280 + }, + { + "name": "pool_count", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 2201 + }, + { + "name": "get_pool_from_lp_token", + "outputs": [{ "type": "address", "name": "" }], + "inputs": [{ "type": "address", "name": "arg0" }], + "stateMutability": "view", + "type": "function", + "gas": 2446 + }, + { + "name": "get_lp_token", + "outputs": [{ "type": "address", "name": "" }], + "inputs": [{ "type": "address", "name": "arg0" }], + "stateMutability": "view", + "type": "function", + "gas": 2476 + } +] diff --git a/subgraphs/kwenta/abis/Prices/ERC20.json b/subgraphs/kwenta/abis/Prices/ERC20.json new file mode 100644 index 0000000000..5c47f76a53 --- /dev/null +++ b/subgraphs/kwenta/abis/Prices/ERC20.json @@ -0,0 +1,828 @@ +[ + { + "name": "Transfer", + "inputs": [ + { "type": "address", "name": "sender", "indexed": true }, + { "type": "address", "name": "receiver", "indexed": true }, + { "type": "uint256", "name": "value", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "Approval", + "inputs": [ + { "type": "address", "name": "owner", "indexed": true }, + { "type": "address", "name": "spender", "indexed": true }, + { "type": "uint256", "name": "value", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "StrategyAdded", + "inputs": [ + { "type": "address", "name": "strategy", "indexed": true }, + { "type": "uint256", "name": "debtRatio", "indexed": false }, + { "type": "uint256", "name": "rateLimit", "indexed": false }, + { "type": "uint256", "name": "performanceFee", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "StrategyReported", + "inputs": [ + { "type": "address", "name": "strategy", "indexed": true }, + { "type": "uint256", "name": "gain", "indexed": false }, + { "type": "uint256", "name": "loss", "indexed": false }, + { "type": "uint256", "name": "totalGain", "indexed": false }, + { "type": "uint256", "name": "totalLoss", "indexed": false }, + { "type": "uint256", "name": "totalDebt", "indexed": false }, + { "type": "uint256", "name": "debtAdded", "indexed": false }, + { "type": "uint256", "name": "debtRatio", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "UpdateGovernance", + "inputs": [{ "type": "address", "name": "governance", "indexed": false }], + "anonymous": false, + "type": "event" + }, + { + "name": "UpdateManagement", + "inputs": [{ "type": "address", "name": "management", "indexed": false }], + "anonymous": false, + "type": "event" + }, + { + "name": "UpdateGuestList", + "inputs": [{ "type": "address", "name": "guestList", "indexed": false }], + "anonymous": false, + "type": "event" + }, + { + "name": "UpdateRewards", + "inputs": [{ "type": "address", "name": "rewards", "indexed": false }], + "anonymous": false, + "type": "event" + }, + { + "name": "UpdateDepositLimit", + "inputs": [{ "type": "uint256", "name": "depositLimit", "indexed": false }], + "anonymous": false, + "type": "event" + }, + { + "name": "UpdatePerformanceFee", + "inputs": [ + { "type": "uint256", "name": "performanceFee", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "UpdateManagementFee", + "inputs": [ + { "type": "uint256", "name": "managementFee", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "UpdateGuardian", + "inputs": [{ "type": "address", "name": "guardian", "indexed": false }], + "anonymous": false, + "type": "event" + }, + { + "name": "EmergencyShutdown", + "inputs": [{ "type": "bool", "name": "active", "indexed": false }], + "anonymous": false, + "type": "event" + }, + { + "name": "UpdateWithdrawalQueue", + "inputs": [{ "type": "address[20]", "name": "queue", "indexed": false }], + "anonymous": false, + "type": "event" + }, + { + "name": "StrategyUpdateDebtRatio", + "inputs": [ + { "type": "address", "name": "strategy", "indexed": true }, + { "type": "uint256", "name": "debtRatio", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "StrategyUpdateRateLimit", + "inputs": [ + { "type": "address", "name": "strategy", "indexed": true }, + { "type": "uint256", "name": "rateLimit", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "StrategyUpdatePerformanceFee", + "inputs": [ + { "type": "address", "name": "strategy", "indexed": true }, + { "type": "uint256", "name": "performanceFee", "indexed": false } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "StrategyMigrated", + "inputs": [ + { "type": "address", "name": "oldVersion", "indexed": true }, + { "type": "address", "name": "newVersion", "indexed": true } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "StrategyRevoked", + "inputs": [{ "type": "address", "name": "strategy", "indexed": true }], + "anonymous": false, + "type": "event" + }, + { + "name": "StrategyRemovedFromQueue", + "inputs": [{ "type": "address", "name": "strategy", "indexed": true }], + "anonymous": false, + "type": "event" + }, + { + "name": "StrategyAddedToQueue", + "inputs": [{ "type": "address", "name": "strategy", "indexed": true }], + "anonymous": false, + "type": "event" + }, + { + "name": "initialize", + "outputs": [], + "inputs": [ + { "type": "address", "name": "token" }, + { "type": "address", "name": "governance" }, + { "type": "address", "name": "rewards" }, + { "type": "string", "name": "nameOverride" }, + { "type": "string", "name": "symbolOverride" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "name": "initialize", + "outputs": [], + "inputs": [ + { "type": "address", "name": "token" }, + { "type": "address", "name": "governance" }, + { "type": "address", "name": "rewards" }, + { "type": "string", "name": "nameOverride" }, + { "type": "string", "name": "symbolOverride" }, + { "type": "address", "name": "guardian" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "name": "apiVersion", + "outputs": [{ "type": "string", "name": "" }], + "inputs": [], + "stateMutability": "pure", + "type": "function", + "gas": 4519 + }, + { + "name": "setName", + "outputs": [], + "inputs": [{ "type": "string", "name": "name" }], + "stateMutability": "nonpayable", + "type": "function", + "gas": 107017 + }, + { + "name": "setSymbol", + "outputs": [], + "inputs": [{ "type": "string", "name": "symbol" }], + "stateMutability": "nonpayable", + "type": "function", + "gas": 71867 + }, + { + "name": "setGovernance", + "outputs": [], + "inputs": [{ "type": "address", "name": "governance" }], + "stateMutability": "nonpayable", + "type": "function", + "gas": 36338 + }, + { + "name": "acceptGovernance", + "outputs": [], + "inputs": [], + "stateMutability": "nonpayable", + "type": "function", + "gas": 37610 + }, + { + "name": "setManagement", + "outputs": [], + "inputs": [{ "type": "address", "name": "management" }], + "stateMutability": "nonpayable", + "type": "function", + "gas": 37748 + }, + { + "name": "setGuestList", + "outputs": [], + "inputs": [{ "type": "address", "name": "guestList" }], + "stateMutability": "nonpayable", + "type": "function", + "gas": 37778 + }, + { + "name": "setRewards", + "outputs": [], + "inputs": [{ "type": "address", "name": "rewards" }], + "stateMutability": "nonpayable", + "type": "function", + "gas": 37808 + }, + { + "name": "setDepositLimit", + "outputs": [], + "inputs": [{ "type": "uint256", "name": "limit" }], + "stateMutability": "nonpayable", + "type": "function", + "gas": 37738 + }, + { + "name": "setPerformanceFee", + "outputs": [], + "inputs": [{ "type": "uint256", "name": "fee" }], + "stateMutability": "nonpayable", + "type": "function", + "gas": 37872 + }, + { + "name": "setManagementFee", + "outputs": [], + "inputs": [{ "type": "uint256", "name": "fee" }], + "stateMutability": "nonpayable", + "type": "function", + "gas": 37902 + }, + { + "name": "setGuardian", + "outputs": [], + "inputs": [{ "type": "address", "name": "guardian" }], + "stateMutability": "nonpayable", + "type": "function", + "gas": 39146 + }, + { + "name": "setEmergencyShutdown", + "outputs": [], + "inputs": [{ "type": "bool", "name": "active" }], + "stateMutability": "nonpayable", + "type": "function", + "gas": 39217 + }, + { + "name": "setWithdrawalQueue", + "outputs": [], + "inputs": [{ "type": "address[20]", "name": "queue" }], + "stateMutability": "nonpayable", + "type": "function", + "gas": 763893 + }, + { + "name": "transfer", + "outputs": [{ "type": "bool", "name": "" }], + "inputs": [ + { "type": "address", "name": "receiver" }, + { "type": "uint256", "name": "amount" } + ], + "stateMutability": "nonpayable", + "type": "function", + "gas": 76733 + }, + { + "name": "transferFrom", + "outputs": [{ "type": "bool", "name": "" }], + "inputs": [ + { "type": "address", "name": "sender" }, + { "type": "address", "name": "receiver" }, + { "type": "uint256", "name": "amount" } + ], + "stateMutability": "nonpayable", + "type": "function", + "gas": 116496 + }, + { + "name": "approve", + "outputs": [{ "type": "bool", "name": "" }], + "inputs": [ + { "type": "address", "name": "spender" }, + { "type": "uint256", "name": "amount" } + ], + "stateMutability": "nonpayable", + "type": "function", + "gas": 38244 + }, + { + "name": "increaseAllowance", + "outputs": [{ "type": "bool", "name": "" }], + "inputs": [ + { "type": "address", "name": "spender" }, + { "type": "uint256", "name": "amount" } + ], + "stateMutability": "nonpayable", + "type": "function", + "gas": 40285 + }, + { + "name": "decreaseAllowance", + "outputs": [{ "type": "bool", "name": "" }], + "inputs": [ + { "type": "address", "name": "spender" }, + { "type": "uint256", "name": "amount" } + ], + "stateMutability": "nonpayable", + "type": "function", + "gas": 40309 + }, + { + "name": "permit", + "outputs": [{ "type": "bool", "name": "" }], + "inputs": [ + { "type": "address", "name": "owner" }, + { "type": "address", "name": "spender" }, + { "type": "uint256", "name": "amount" }, + { "type": "uint256", "name": "expiry" }, + { "type": "bytes", "name": "signature" } + ], + "stateMutability": "nonpayable", + "type": "function", + "gas": 81237 + }, + { + "name": "totalAssets", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 4123 + }, + { + "name": "deposit", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "name": "deposit", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [{ "type": "uint256", "name": "_amount" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "name": "deposit", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [ + { "type": "uint256", "name": "_amount" }, + { "type": "address", "name": "recipient" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "name": "maxAvailableShares", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 364171 + }, + { + "name": "withdraw", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "name": "withdraw", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [{ "type": "uint256", "name": "maxShares" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "name": "withdraw", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [ + { "type": "uint256", "name": "maxShares" }, + { "type": "address", "name": "recipient" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "name": "withdraw", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [ + { "type": "uint256", "name": "maxShares" }, + { "type": "address", "name": "recipient" }, + { "type": "uint256", "name": "maxLoss" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "name": "pricePerShare", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 12412 + }, + { + "name": "addStrategy", + "outputs": [], + "inputs": [ + { "type": "address", "name": "strategy" }, + { "type": "uint256", "name": "debtRatio" }, + { "type": "uint256", "name": "rateLimit" }, + { "type": "uint256", "name": "performanceFee" } + ], + "stateMutability": "nonpayable", + "type": "function", + "gas": 1450351 + }, + { + "name": "updateStrategyDebtRatio", + "outputs": [], + "inputs": [ + { "type": "address", "name": "strategy" }, + { "type": "uint256", "name": "debtRatio" } + ], + "stateMutability": "nonpayable", + "type": "function", + "gas": 115316 + }, + { + "name": "updateStrategyRateLimit", + "outputs": [], + "inputs": [ + { "type": "address", "name": "strategy" }, + { "type": "uint256", "name": "rateLimit" } + ], + "stateMutability": "nonpayable", + "type": "function", + "gas": 41467 + }, + { + "name": "updateStrategyPerformanceFee", + "outputs": [], + "inputs": [ + { "type": "address", "name": "strategy" }, + { "type": "uint256", "name": "performanceFee" } + ], + "stateMutability": "nonpayable", + "type": "function", + "gas": 41344 + }, + { + "name": "migrateStrategy", + "outputs": [], + "inputs": [ + { "type": "address", "name": "oldVersion" }, + { "type": "address", "name": "newVersion" } + ], + "stateMutability": "nonpayable", + "type": "function", + "gas": 1105801 + }, + { + "name": "revokeStrategy", + "outputs": [], + "inputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "name": "revokeStrategy", + "outputs": [], + "inputs": [{ "type": "address", "name": "strategy" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "name": "addStrategyToQueue", + "outputs": [], + "inputs": [{ "type": "address", "name": "strategy" }], + "stateMutability": "nonpayable", + "type": "function", + "gas": 1196920 + }, + { + "name": "removeStrategyFromQueue", + "outputs": [], + "inputs": [{ "type": "address", "name": "strategy" }], + "stateMutability": "nonpayable", + "type": "function", + "gas": 23091666 + }, + { + "name": "debtOutstanding", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function" + }, + { + "name": "debtOutstanding", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [{ "type": "address", "name": "strategy" }], + "stateMutability": "view", + "type": "function" + }, + { + "name": "creditAvailable", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function" + }, + { + "name": "creditAvailable", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [{ "type": "address", "name": "strategy" }], + "stateMutability": "view", + "type": "function" + }, + { + "name": "availableDepositLimit", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 9808 + }, + { + "name": "expectedReturn", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function" + }, + { + "name": "expectedReturn", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [{ "type": "address", "name": "strategy" }], + "stateMutability": "view", + "type": "function" + }, + { + "name": "report", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [ + { "type": "uint256", "name": "gain" }, + { "type": "uint256", "name": "loss" }, + { "type": "uint256", "name": "_debtPayment" } + ], + "stateMutability": "nonpayable", + "type": "function", + "gas": 937520 + }, + { + "name": "sweep", + "outputs": [], + "inputs": [{ "type": "address", "name": "token" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "name": "sweep", + "outputs": [], + "inputs": [ + { "type": "address", "name": "token" }, + { "type": "uint256", "name": "amount" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "name": "name", + "outputs": [{ "type": "string", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 9053 + }, + { + "name": "symbol", + "outputs": [{ "type": "string", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 8106 + }, + { + "name": "decimals", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 2711 + }, + { + "name": "balanceOf", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [{ "type": "address", "name": "arg0" }], + "stateMutability": "view", + "type": "function", + "gas": 2956 + }, + { + "name": "allowance", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [ + { "type": "address", "name": "arg0" }, + { "type": "address", "name": "arg1" } + ], + "stateMutability": "view", + "type": "function", + "gas": 3201 + }, + { + "name": "totalSupply", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 2801 + }, + { + "name": "token", + "outputs": [{ "type": "address", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 2831 + }, + { + "name": "governance", + "outputs": [{ "type": "address", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 2861 + }, + { + "name": "management", + "outputs": [{ "type": "address", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 2891 + }, + { + "name": "guardian", + "outputs": [{ "type": "address", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 2921 + }, + { + "name": "guestList", + "outputs": [{ "type": "address", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 2951 + }, + { + "name": "strategies", + "outputs": [ + { "type": "uint256", "name": "performanceFee" }, + { "type": "uint256", "name": "activation" }, + { "type": "uint256", "name": "debtRatio" }, + { "type": "uint256", "name": "rateLimit" }, + { "type": "uint256", "name": "lastReport" }, + { "type": "uint256", "name": "totalDebt" }, + { "type": "uint256", "name": "totalGain" }, + { "type": "uint256", "name": "totalLoss" } + ], + "inputs": [{ "type": "address", "name": "arg0" }], + "stateMutability": "view", + "type": "function", + "gas": 10322 + }, + { + "name": "withdrawalQueue", + "outputs": [{ "type": "address", "name": "" }], + "inputs": [{ "type": "uint256", "name": "arg0" }], + "stateMutability": "view", + "type": "function", + "gas": 3120 + }, + { + "name": "emergencyShutdown", + "outputs": [{ "type": "bool", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 3041 + }, + { + "name": "depositLimit", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 3071 + }, + { + "name": "debtRatio", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 3101 + }, + { + "name": "totalDebt", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 3131 + }, + { + "name": "lastReport", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 3161 + }, + { + "name": "activation", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 3191 + }, + { + "name": "rewards", + "outputs": [{ "type": "address", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 3221 + }, + { + "name": "managementFee", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 3251 + }, + { + "name": "performanceFee", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 3281 + }, + { + "name": "nonces", + "outputs": [{ "type": "uint256", "name": "" }], + "inputs": [{ "type": "address", "name": "arg0" }], + "stateMutability": "view", + "type": "function", + "gas": 3526 + }, + { + "name": "DOMAIN_SEPARATOR", + "outputs": [{ "type": "bytes32", "name": "" }], + "inputs": [], + "stateMutability": "view", + "type": "function", + "gas": 3341 + } +] diff --git a/subgraphs/kwenta/abis/Prices/Uniswap/Factory.json b/subgraphs/kwenta/abis/Prices/Uniswap/Factory.json new file mode 100644 index 0000000000..1b14599d5d --- /dev/null +++ b/subgraphs/kwenta/abis/Prices/Uniswap/Factory.json @@ -0,0 +1,125 @@ +[ + { + "inputs": [ + { "internalType": "address", "name": "_feeToSetter", "type": "address" } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token0", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "token1", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "pair", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "PairCreated", + "type": "event" + }, + { + "constant": true, + "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "name": "allPairs", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "allPairsLength", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "tokenA", "type": "address" }, + { "internalType": "address", "name": "tokenB", "type": "address" } + ], + "name": "createPair", + "outputs": [ + { "internalType": "address", "name": "pair", "type": "address" } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "feeTo", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "feeToSetter", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "internalType": "address", "name": "", "type": "address" }, + { "internalType": "address", "name": "", "type": "address" } + ], + "name": "getPair", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "_feeTo", "type": "address" } + ], + "name": "setFeeTo", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "_feeToSetter", "type": "address" } + ], + "name": "setFeeToSetter", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/subgraphs/kwenta/abis/Prices/Uniswap/Pair.json b/subgraphs/kwenta/abis/Prices/Uniswap/Pair.json new file mode 100644 index 0000000000..e5efebf418 --- /dev/null +++ b/subgraphs/kwenta/abis/Prices/Uniswap/Pair.json @@ -0,0 +1,461 @@ +[ + { + "inputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "Burn", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + } + ], + "name": "Mint", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount0In", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount1In", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount0Out", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount1Out", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "Swap", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint112", + "name": "reserve0", + "type": "uint112" + }, + { + "indexed": false, + "internalType": "uint112", + "name": "reserve1", + "type": "uint112" + } + ], + "name": "Sync", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "constant": true, + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "MINIMUM_LIQUIDITY", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "PERMIT_TYPEHASH", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "internalType": "address", "name": "", "type": "address" }, + { "internalType": "address", "name": "", "type": "address" } + ], + "name": "allowance", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "approve", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "balanceOf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], + "name": "burn", + "outputs": [ + { "internalType": "uint256", "name": "amount0", "type": "uint256" }, + { "internalType": "uint256", "name": "amount1", "type": "uint256" } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "decimals", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "factory", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getReserves", + "outputs": [ + { "internalType": "uint112", "name": "_reserve0", "type": "uint112" }, + { "internalType": "uint112", "name": "_reserve1", "type": "uint112" }, + { + "internalType": "uint32", + "name": "_blockTimestampLast", + "type": "uint32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "_token0", "type": "address" }, + { "internalType": "address", "name": "_token1", "type": "address" } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "kLast", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], + "name": "mint", + "outputs": [ + { "internalType": "uint256", "name": "liquidity", "type": "uint256" } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "name", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "nonces", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" }, + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "value", "type": "uint256" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "name": "permit", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "price0CumulativeLast", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "price1CumulativeLast", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], + "name": "skim", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "uint256", "name": "amount0Out", "type": "uint256" }, + { "internalType": "uint256", "name": "amount1Out", "type": "uint256" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "bytes", "name": "data", "type": "bytes" } + ], + "name": "swap", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "sync", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "token0", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "token1", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "transfer", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "from", "type": "address" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "transferFrom", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/subgraphs/kwenta/abis/Prices/Uniswap/Router.json b/subgraphs/kwenta/abis/Prices/Uniswap/Router.json new file mode 100644 index 0000000000..efc7f31728 --- /dev/null +++ b/subgraphs/kwenta/abis/Prices/Uniswap/Router.json @@ -0,0 +1,398 @@ +[ + { + "inputs": [ + { "internalType": "address", "name": "_factory", "type": "address" }, + { "internalType": "address", "name": "_WETH", "type": "address" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "WETH", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "tokenA", "type": "address" }, + { "internalType": "address", "name": "tokenB", "type": "address" }, + { + "internalType": "uint256", + "name": "amountADesired", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountBDesired", + "type": "uint256" + }, + { "internalType": "uint256", "name": "amountAMin", "type": "uint256" }, + { "internalType": "uint256", "name": "amountBMin", "type": "uint256" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" } + ], + "name": "addLiquidity", + "outputs": [ + { "internalType": "uint256", "name": "amountA", "type": "uint256" }, + { "internalType": "uint256", "name": "amountB", "type": "uint256" }, + { "internalType": "uint256", "name": "liquidity", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "token", "type": "address" }, + { + "internalType": "uint256", + "name": "amountTokenDesired", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountTokenMin", + "type": "uint256" + }, + { "internalType": "uint256", "name": "amountETHMin", "type": "uint256" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" } + ], + "name": "addLiquidityETH", + "outputs": [ + { "internalType": "uint256", "name": "amountToken", "type": "uint256" }, + { "internalType": "uint256", "name": "amountETH", "type": "uint256" }, + { "internalType": "uint256", "name": "liquidity", "type": "uint256" } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "factory", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "amountOut", "type": "uint256" }, + { "internalType": "uint256", "name": "reserveIn", "type": "uint256" }, + { "internalType": "uint256", "name": "reserveOut", "type": "uint256" } + ], + "name": "getAmountIn", + "outputs": [ + { "internalType": "uint256", "name": "amountIn", "type": "uint256" } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "amountIn", "type": "uint256" }, + { "internalType": "uint256", "name": "reserveIn", "type": "uint256" }, + { "internalType": "uint256", "name": "reserveOut", "type": "uint256" } + ], + "name": "getAmountOut", + "outputs": [ + { "internalType": "uint256", "name": "amountOut", "type": "uint256" } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "amountOut", "type": "uint256" }, + { "internalType": "address[]", "name": "path", "type": "address[]" } + ], + "name": "getAmountsIn", + "outputs": [ + { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "amountIn", "type": "uint256" }, + { "internalType": "address[]", "name": "path", "type": "address[]" } + ], + "name": "getAmountsOut", + "outputs": [ + { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "amountA", "type": "uint256" }, + { "internalType": "uint256", "name": "reserveA", "type": "uint256" }, + { "internalType": "uint256", "name": "reserveB", "type": "uint256" } + ], + "name": "quote", + "outputs": [ + { "internalType": "uint256", "name": "amountB", "type": "uint256" } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "tokenA", "type": "address" }, + { "internalType": "address", "name": "tokenB", "type": "address" }, + { "internalType": "uint256", "name": "liquidity", "type": "uint256" }, + { "internalType": "uint256", "name": "amountAMin", "type": "uint256" }, + { "internalType": "uint256", "name": "amountBMin", "type": "uint256" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" } + ], + "name": "removeLiquidity", + "outputs": [ + { "internalType": "uint256", "name": "amountA", "type": "uint256" }, + { "internalType": "uint256", "name": "amountB", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "token", "type": "address" }, + { "internalType": "uint256", "name": "liquidity", "type": "uint256" }, + { + "internalType": "uint256", + "name": "amountTokenMin", + "type": "uint256" + }, + { "internalType": "uint256", "name": "amountETHMin", "type": "uint256" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" } + ], + "name": "removeLiquidityETH", + "outputs": [ + { "internalType": "uint256", "name": "amountToken", "type": "uint256" }, + { "internalType": "uint256", "name": "amountETH", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "token", "type": "address" }, + { "internalType": "uint256", "name": "liquidity", "type": "uint256" }, + { + "internalType": "uint256", + "name": "amountTokenMin", + "type": "uint256" + }, + { "internalType": "uint256", "name": "amountETHMin", "type": "uint256" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" } + ], + "name": "removeLiquidityETHSupportingFeeOnTransferTokens", + "outputs": [ + { "internalType": "uint256", "name": "amountETH", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "token", "type": "address" }, + { "internalType": "uint256", "name": "liquidity", "type": "uint256" }, + { + "internalType": "uint256", + "name": "amountTokenMin", + "type": "uint256" + }, + { "internalType": "uint256", "name": "amountETHMin", "type": "uint256" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" }, + { "internalType": "bool", "name": "approveMax", "type": "bool" }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "name": "removeLiquidityETHWithPermit", + "outputs": [ + { "internalType": "uint256", "name": "amountToken", "type": "uint256" }, + { "internalType": "uint256", "name": "amountETH", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "token", "type": "address" }, + { "internalType": "uint256", "name": "liquidity", "type": "uint256" }, + { + "internalType": "uint256", + "name": "amountTokenMin", + "type": "uint256" + }, + { "internalType": "uint256", "name": "amountETHMin", "type": "uint256" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" }, + { "internalType": "bool", "name": "approveMax", "type": "bool" }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "name": "removeLiquidityETHWithPermitSupportingFeeOnTransferTokens", + "outputs": [ + { "internalType": "uint256", "name": "amountETH", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "tokenA", "type": "address" }, + { "internalType": "address", "name": "tokenB", "type": "address" }, + { "internalType": "uint256", "name": "liquidity", "type": "uint256" }, + { "internalType": "uint256", "name": "amountAMin", "type": "uint256" }, + { "internalType": "uint256", "name": "amountBMin", "type": "uint256" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" }, + { "internalType": "bool", "name": "approveMax", "type": "bool" }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "name": "removeLiquidityWithPermit", + "outputs": [ + { "internalType": "uint256", "name": "amountA", "type": "uint256" }, + { "internalType": "uint256", "name": "amountB", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "amountOut", "type": "uint256" }, + { "internalType": "address[]", "name": "path", "type": "address[]" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" } + ], + "name": "swapETHForExactTokens", + "outputs": [ + { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "amountOutMin", "type": "uint256" }, + { "internalType": "address[]", "name": "path", "type": "address[]" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" } + ], + "name": "swapExactETHForTokens", + "outputs": [ + { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "amountOutMin", "type": "uint256" }, + { "internalType": "address[]", "name": "path", "type": "address[]" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" } + ], + "name": "swapExactETHForTokensSupportingFeeOnTransferTokens", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "amountIn", "type": "uint256" }, + { "internalType": "uint256", "name": "amountOutMin", "type": "uint256" }, + { "internalType": "address[]", "name": "path", "type": "address[]" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" } + ], + "name": "swapExactTokensForETH", + "outputs": [ + { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "amountIn", "type": "uint256" }, + { "internalType": "uint256", "name": "amountOutMin", "type": "uint256" }, + { "internalType": "address[]", "name": "path", "type": "address[]" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" } + ], + "name": "swapExactTokensForETHSupportingFeeOnTransferTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "amountIn", "type": "uint256" }, + { "internalType": "uint256", "name": "amountOutMin", "type": "uint256" }, + { "internalType": "address[]", "name": "path", "type": "address[]" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" } + ], + "name": "swapExactTokensForTokens", + "outputs": [ + { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "amountIn", "type": "uint256" }, + { "internalType": "uint256", "name": "amountOutMin", "type": "uint256" }, + { "internalType": "address[]", "name": "path", "type": "address[]" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" } + ], + "name": "swapExactTokensForTokensSupportingFeeOnTransferTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "amountOut", "type": "uint256" }, + { "internalType": "uint256", "name": "amountInMax", "type": "uint256" }, + { "internalType": "address[]", "name": "path", "type": "address[]" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" } + ], + "name": "swapTokensForExactETH", + "outputs": [ + { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "amountOut", "type": "uint256" }, + { "internalType": "uint256", "name": "amountInMax", "type": "uint256" }, + { "internalType": "address[]", "name": "path", "type": "address[]" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" } + ], + "name": "swapTokensForExactTokens", + "outputs": [ + { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { "stateMutability": "payable", "type": "receive" } +] diff --git a/subgraphs/kwenta/abis/Prices/YearnLens.json b/subgraphs/kwenta/abis/Prices/YearnLens.json new file mode 100644 index 0000000000..60a45cc87c --- /dev/null +++ b/subgraphs/kwenta/abis/Prices/YearnLens.json @@ -0,0 +1,174 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "_managementListAddress", + "type": "address" + }, + { "internalType": "address", "name": "_usdcAddress", "type": "address" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "tokenAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "tokenAliasAddress", + "type": "address" + } + ], + "name": "TokenAliasAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "tokenAddress", + "type": "address" + } + ], + "name": "TokenAliasRemoved", + "type": "event" + }, + { "stateMutability": "nonpayable", "type": "fallback" }, + { + "inputs": [ + { "internalType": "address", "name": "tokenAddress", "type": "address" }, + { + "internalType": "address", + "name": "tokenAliasAddress", + "type": "address" + } + ], + "name": "addTokenAlias", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "tokenAliasAddress", + "type": "address" + } + ], + "internalType": "struct Oracle.TokenAlias[]", + "name": "_tokenAliases", + "type": "tuple[]" + } + ], + "name": "addTokenAliases", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "calculations", + "outputs": [ + { "internalType": "address[]", "name": "", "type": "address[]" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "tokenAddress", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "getNormalizedValueUsdc", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "tokenAddress", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { "internalType": "uint256", "name": "priceUsdc", "type": "uint256" } + ], + "name": "getNormalizedValueUsdc", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "tokenAddress", "type": "address" } + ], + "name": "getPriceUsdcRecommended", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "managementList", + "outputs": [ + { + "internalType": "contract ManagementList", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "tokenAddress", "type": "address" } + ], + "name": "removeTokenAlias", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "calculationAddresses", + "type": "address[]" + } + ], + "name": "setCalculations", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "tokenAliases", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "usdcAddress", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + } +] diff --git a/subgraphs/kwenta/abis/kwenta/FuturesMarket.json b/subgraphs/kwenta/abis/kwenta/FuturesMarket.json new file mode 100644 index 0000000000..b1516ed217 --- /dev/null +++ b/subgraphs/kwenta/abis/kwenta/FuturesMarket.json @@ -0,0 +1,1134 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "_resolver", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "_baseAsset", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes32", + "name": "name", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "destination", + "type": "address" + } + ], + "name": "CacheUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "int256", + "name": "funding", + "type": "int256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "index", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "name": "FundingRecomputed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "trackingCode", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "baseAsset", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "marketKey", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "int256", + "name": "sizeDelta", + "type": "int256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "fee", + "type": "uint256" + } + ], + "name": "FuturesTracking", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "int256", + "name": "marginDelta", + "type": "int256" + } + ], + "name": "MarginTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "currentRoundId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "int256", + "name": "sizeDelta", + "type": "int256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "targetRoundId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "commitDeposit", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "keeperDeposit", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "trackingCode", + "type": "bytes32" + } + ], + "name": "NextPriceOrderRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "int256", + "name": "sizeDelta", + "type": "int256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "targetRoundId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "commitDeposit", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "keeperDeposit", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "trackingCode", + "type": "bytes32" + } + ], + "name": "NextPriceOrderSubmitted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "liquidator", + "type": "address" + }, + { + "indexed": false, + "internalType": "int256", + "name": "size", + "type": "int256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "price", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "fee", + "type": "uint256" + } + ], + "name": "PositionLiquidated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "margin", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "int256", + "name": "size", + "type": "int256" + }, + { + "indexed": false, + "internalType": "int256", + "name": "tradeSize", + "type": "int256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "lastPrice", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "fundingIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "fee", + "type": "uint256" + } + ], + "name": "PositionModified", + "type": "event" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "accessibleMargin", + "outputs": [ + { + "internalType": "uint256", + "name": "marginAccessible", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "invalid", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "accruedFunding", + "outputs": [ + { + "internalType": "int256", + "name": "funding", + "type": "int256" + }, + { + "internalType": "bool", + "name": "invalid", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "assetPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "price", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "invalid", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "baseAsset", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "canLiquidate", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "cancelNextPriceOrder", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "closePosition", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "trackingCode", + "type": "bytes32" + } + ], + "name": "closePositionWithTracking", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "currentFundingRate", + "outputs": [ + { + "internalType": "int256", + "name": "", + "type": "int256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "executeNextPriceOrder", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "fundingLastRecomputed", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "fundingSequence", + "outputs": [ + { + "internalType": "int128", + "name": "", + "type": "int128" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "fundingSequenceLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isResolverCached", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "liquidatePosition", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "liquidationFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "liquidationPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "price", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "invalid", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "marketDebt", + "outputs": [ + { + "internalType": "uint256", + "name": "debt", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "invalid", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "marketKey", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "marketSize", + "outputs": [ + { + "internalType": "uint128", + "name": "", + "type": "uint128" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "marketSizes", + "outputs": [ + { + "internalType": "uint256", + "name": "long", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "short", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "marketSkew", + "outputs": [ + { + "internalType": "int128", + "name": "", + "type": "int128" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "int256", + "name": "sizeDelta", + "type": "int256" + } + ], + "name": "modifyPosition", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "int256", + "name": "sizeDelta", + "type": "int256" + }, + { + "internalType": "bytes32", + "name": "trackingCode", + "type": "bytes32" + } + ], + "name": "modifyPositionWithTracking", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "nextPriceOrders", + "outputs": [ + { + "internalType": "int128", + "name": "sizeDelta", + "type": "int128" + }, + { + "internalType": "uint128", + "name": "targetRoundId", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "commitDeposit", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "keeperDeposit", + "type": "uint128" + }, + { + "internalType": "bytes32", + "name": "trackingCode", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "notionalValue", + "outputs": [ + { + "internalType": "int256", + "name": "value", + "type": "int256" + }, + { + "internalType": "bool", + "name": "invalid", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "int256", + "name": "sizeDelta", + "type": "int256" + } + ], + "name": "orderFee", + "outputs": [ + { + "internalType": "uint256", + "name": "fee", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "invalid", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "positions", + "outputs": [ + { + "internalType": "uint64", + "name": "id", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "lastFundingIndex", + "type": "uint64" + }, + { + "internalType": "uint128", + "name": "margin", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "lastPrice", + "type": "uint128" + }, + { + "internalType": "int128", + "name": "size", + "type": "int128" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "int256", + "name": "sizeDelta", + "type": "int256" + }, + { + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "postTradeDetails", + "outputs": [ + { + "internalType": "uint256", + "name": "margin", + "type": "uint256" + }, + { + "internalType": "int256", + "name": "size", + "type": "int256" + }, + { + "internalType": "uint256", + "name": "price", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liqPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "fee", + "type": "uint256" + }, + { + "internalType": "enum IFuturesMarketBaseTypes.Status", + "name": "status", + "type": "uint8" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "profitLoss", + "outputs": [ + { + "internalType": "int256", + "name": "pnl", + "type": "int256" + }, + { + "internalType": "bool", + "name": "invalid", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "rebuildCache", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "recomputeFunding", + "outputs": [ + { + "internalType": "uint256", + "name": "lastIndex", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "remainingMargin", + "outputs": [ + { + "internalType": "uint256", + "name": "marginRemaining", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "invalid", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "resolver", + "outputs": [ + { + "internalType": "contract AddressResolver", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "resolverAddressesRequired", + "outputs": [ + { + "internalType": "bytes32[]", + "name": "addresses", + "type": "bytes32[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "int256", + "name": "sizeDelta", + "type": "int256" + } + ], + "name": "submitNextPriceOrder", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "int256", + "name": "sizeDelta", + "type": "int256" + }, + { + "internalType": "bytes32", + "name": "trackingCode", + "type": "bytes32" + } + ], + "name": "submitNextPriceOrderWithTracking", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "int256", + "name": "marginDelta", + "type": "int256" + } + ], + "name": "transferMargin", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "unrecordedFunding", + "outputs": [ + { + "internalType": "int256", + "name": "funding", + "type": "int256" + }, + { + "internalType": "bool", + "name": "invalid", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "withdrawAllMargin", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "marketKey", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "parameter", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "ParameterUpdated", + "type": "event" + } +] diff --git a/subgraphs/kwenta/abis/kwenta/FuturesMarketManager.json b/subgraphs/kwenta/abis/kwenta/FuturesMarketManager.json new file mode 100644 index 0000000000..ee8b31262e --- /dev/null +++ b/subgraphs/kwenta/abis/kwenta/FuturesMarketManager.json @@ -0,0 +1,467 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "address", + "name": "_resolver", + "type": "address" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes32", + "name": "name", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "destination", + "type": "address" + } + ], + "name": "CacheUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "market", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "asset", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "marketKey", + "type": "bytes32" + } + ], + "name": "MarketAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "market", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "asset", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "marketKey", + "type": "bytes32" + } + ], + "name": "MarketRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldOwner", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnerChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnerNominated", + "type": "event" + }, + { + "constant": true, + "inputs": [], + "name": "CONTRACT_NAME", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address[]", + "name": "marketsToAdd", + "type": "address[]" + } + ], + "name": "addMarkets", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "allMarkets", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "burnSUSD", + "outputs": [ + { + "internalType": "uint256", + "name": "postReclamationAmount", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isResolverCached", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "issueSUSD", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "marketForKey", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "pageSize", + "type": "uint256" + } + ], + "name": "markets", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32[]", + "name": "marketKeys", + "type": "bytes32[]" + } + ], + "name": "marketsForKeys", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + } + ], + "name": "nominateNewOwner", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "nominatedOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "numMarkets", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "payFee", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "rebuildCache", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address[]", + "name": "marketsToRemove", + "type": "address[]" + } + ], + "name": "removeMarkets", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32[]", + "name": "marketKeysToRemove", + "type": "bytes32[]" + } + ], + "name": "removeMarketsByKey", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "resolver", + "outputs": [ + { + "internalType": "contract AddressResolver", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "resolverAddressesRequired", + "outputs": [ + { + "internalType": "bytes32[]", + "name": "addresses", + "type": "bytes32[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalDebt", + "outputs": [ + { + "internalType": "uint256", + "name": "debt", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isInvalid", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } +] diff --git a/subgraphs/kwenta/abis/kwenta/PerpsV2MarketProxyable.json b/subgraphs/kwenta/abis/kwenta/PerpsV2MarketProxyable.json new file mode 100644 index 0000000000..cc32f590db --- /dev/null +++ b/subgraphs/kwenta/abis/kwenta/PerpsV2MarketProxyable.json @@ -0,0 +1,1345 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isOffchain", + "type": "bool" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "currentRoundId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "int256", + "name": "sizeDelta", + "type": "int256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "targetRoundId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "commitDeposit", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "keeperDeposit", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "trackingCode", + "type": "bytes32" + } + ], + "name": "DelayedOrderRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isOffchain", + "type": "bool" + }, + { + "indexed": false, + "internalType": "int256", + "name": "sizeDelta", + "type": "int256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "targetRoundId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "intentionTime", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "executableAtTime", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "commitDeposit", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "keeperDeposit", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "trackingCode", + "type": "bytes32" + } + ], + "name": "DelayedOrderSubmitted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "int256", + "name": "funding", + "type": "int256" + }, + { + "indexed": false, + "internalType": "int256", + "name": "fundingRate", + "type": "int256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "index", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "name": "FundingRecomputed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "int256", + "name": "marginDelta", + "type": "int256" + } + ], + "name": "MarginTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "trackingCode", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "baseAsset", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "marketKey", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "int256", + "name": "sizeDelta", + "type": "int256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "fee", + "type": "uint256" + } + ], + "name": "PerpsTracking", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "liquidator", + "type": "address" + }, + { + "indexed": false, + "internalType": "int256", + "name": "size", + "type": "int256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "price", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "fee", + "type": "uint256" + } + ], + "name": "PositionLiquidated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "liquidator", + "type": "address" + }, + { + "indexed": false, + "internalType": "int256", + "name": "size", + "type": "int256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "price", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "flaggerFee", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "liquidatorFee", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "stakersFee", + "type": "uint256" + } + ], + "name": "PositionLiquidated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "margin", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "int256", + "name": "size", + "type": "int256" + }, + { + "indexed": false, + "internalType": "int256", + "name": "tradeSize", + "type": "int256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "lastPrice", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "fundingIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "fee", + "type": "uint256" + } + ], + "name": "PositionModified", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "margin", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "int256", + "name": "size", + "type": "int256" + }, + { + "indexed": false, + "internalType": "int256", + "name": "tradeSize", + "type": "int256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "lastPrice", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "fundingIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "fee", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "int256", + "name": "skew", + "type": "int256" + } + ], + "name": "PositionModified", + "type": "event" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "accessibleMargin", + "outputs": [ + { + "internalType": "uint256", + "name": "marginAccessible", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "invalid", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "accruedFunding", + "outputs": [ + { + "internalType": "int256", + "name": "funding", + "type": "int256" + }, + { + "internalType": "bool", + "name": "invalid", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "assetPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "price", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "invalid", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "baseAsset", + "outputs": [ + { + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "canLiquidate", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "cancelDelayedOrder", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "cancelOffchainDelayedOrder", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "priceImpactDelta", + "type": "uint256" + } + ], + "name": "closePosition", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "priceImpactDelta", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "trackingCode", + "type": "bytes32" + } + ], + "name": "closePositionWithTracking", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "currentFundingRate", + "outputs": [ + { + "internalType": "int256", + "name": "fundingRate", + "type": "int256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "currentFundingVelocity", + "outputs": [ + { + "internalType": "int256", + "name": "fundingVelocity", + "type": "int256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "delayedOrders", + "outputs": [ + { + "components": [ + { + "internalType": "bool", + "name": "isOffchain", + "type": "bool" + }, + { + "internalType": "int128", + "name": "sizeDelta", + "type": "int128" + }, + { + "internalType": "uint128", + "name": "priceImpactDelta", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "targetRoundId", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "commitDeposit", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "keeperDeposit", + "type": "uint128" + }, + { + "internalType": "uint256", + "name": "executableAtTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "intentionTime", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "trackingCode", + "type": "bytes32" + } + ], + "internalType": "struct IPerpsV2MarketConsolidated.DelayedOrder", + "name": "", + "type": "tuple" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "executeDelayedOrder", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "bytes[]", + "name": "priceUpdateData", + "type": "bytes[]" + } + ], + "name": "executeOffchainDelayedOrder", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "fundingLastRecomputed", + "outputs": [ + { + "internalType": "uint32", + "name": "timestamp", + "type": "uint32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "fundingSequence", + "outputs": [ + { + "internalType": "int128", + "name": "netFunding", + "type": "int128" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "fundingSequenceLength", + "outputs": [ + { + "internalType": "uint256", + "name": "length", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "liquidatePosition", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "liquidationFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "liquidationPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "price", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "invalid", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "marketDebt", + "outputs": [ + { + "internalType": "uint256", + "name": "debt", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isInvalid", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "marketKey", + "outputs": [ + { + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "marketSize", + "outputs": [ + { + "internalType": "uint128", + "name": "size", + "type": "uint128" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "marketSizes", + "outputs": [ + { + "internalType": "uint256", + "name": "long", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "short", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "marketSkew", + "outputs": [ + { + "internalType": "int128", + "name": "skew", + "type": "int128" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "int256", + "name": "sizeDelta", + "type": "int256" + }, + { + "internalType": "uint256", + "name": "priceImpactDelta", + "type": "uint256" + } + ], + "name": "modifyPosition", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "int256", + "name": "sizeDelta", + "type": "int256" + }, + { + "internalType": "uint256", + "name": "priceImpactDelta", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "trackingCode", + "type": "bytes32" + } + ], + "name": "modifyPositionWithTracking", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "notionalValue", + "outputs": [ + { + "internalType": "int256", + "name": "value", + "type": "int256" + }, + { + "internalType": "bool", + "name": "invalid", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "int256", + "name": "sizeDelta", + "type": "int256" + }, + { + "internalType": "enum IPerpsV2MarketBaseTypes.OrderType", + "name": "orderType", + "type": "uint8" + } + ], + "name": "orderFee", + "outputs": [ + { + "internalType": "uint256", + "name": "fee", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "invalid", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "positions", + "outputs": [ + { + "components": [ + { + "internalType": "uint64", + "name": "id", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "lastFundingIndex", + "type": "uint64" + }, + { + "internalType": "uint128", + "name": "margin", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "lastPrice", + "type": "uint128" + }, + { + "internalType": "int128", + "name": "size", + "type": "int128" + } + ], + "internalType": "struct IPerpsV2MarketConsolidated.Position", + "name": "", + "type": "tuple" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "int256", + "name": "sizeDelta", + "type": "int256" + }, + { + "internalType": "uint256", + "name": "tradePrice", + "type": "uint256" + }, + { + "internalType": "enum IPerpsV2MarketBaseTypes.OrderType", + "name": "orderType", + "type": "uint8" + }, + { + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "postTradeDetails", + "outputs": [ + { + "internalType": "uint256", + "name": "margin", + "type": "uint256" + }, + { + "internalType": "int256", + "name": "size", + "type": "int256" + }, + { + "internalType": "uint256", + "name": "price", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liqPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "fee", + "type": "uint256" + }, + { + "internalType": "enum IPerpsV2MarketConsolidated.Status", + "name": "status", + "type": "uint8" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "profitLoss", + "outputs": [ + { + "internalType": "int256", + "name": "pnl", + "type": "int256" + }, + { + "internalType": "bool", + "name": "invalid", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "recomputeFunding", + "outputs": [ + { + "internalType": "uint256", + "name": "lastIndex", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "remainingMargin", + "outputs": [ + { + "internalType": "uint256", + "name": "marginRemaining", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "invalid", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "int256", + "name": "sizeDelta", + "type": "int256" + }, + { + "internalType": "uint256", + "name": "priceImpactDelta", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "desiredTimeDelta", + "type": "uint256" + } + ], + "name": "submitDelayedOrder", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "int256", + "name": "sizeDelta", + "type": "int256" + }, + { + "internalType": "uint256", + "name": "priceImpactDelta", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "desiredTimeDelta", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "trackingCode", + "type": "bytes32" + } + ], + "name": "submitDelayedOrderWithTracking", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "int256", + "name": "sizeDelta", + "type": "int256" + }, + { + "internalType": "uint256", + "name": "priceImpactDelta", + "type": "uint256" + } + ], + "name": "submitOffchainDelayedOrder", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "int256", + "name": "sizeDelta", + "type": "int256" + }, + { + "internalType": "uint256", + "name": "priceImpactDelta", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "trackingCode", + "type": "bytes32" + } + ], + "name": "submitOffchainDelayedOrderWithTracking", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "int256", + "name": "marginDelta", + "type": "int256" + } + ], + "name": "transferMargin", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "unrecordedFunding", + "outputs": [ + { + "internalType": "int256", + "name": "funding", + "type": "int256" + }, + { + "internalType": "bool", + "name": "invalid", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "withdrawAllMargin", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/subgraphs/kwenta/abis/kwenta/SmartMarginFactory.json b/subgraphs/kwenta/abis/kwenta/SmartMarginFactory.json new file mode 100644 index 0000000000..531ef32be8 --- /dev/null +++ b/subgraphs/kwenta/abis/kwenta/SmartMarginFactory.json @@ -0,0 +1,333 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "address", + "name": "_settings", + "type": "address" + }, + { + "internalType": "address", + "name": "_events", + "type": "address" + }, + { + "internalType": "address", + "name": "_implementation", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "AccountDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "AccountFailedToFetchVersion", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "AccountFailedToInitialize", + "type": "error" + }, + { + "inputs": [], + "name": "CallerMustBeAccount", + "type": "error" + }, + { + "inputs": [], + "name": "CannotUpgrade", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "OnlyOneAccountPerAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "AccountImplementationUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "events", + "type": "address" + } + ], + "name": "EventsUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "creator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "version", + "type": "bytes32" + } + ], + "name": "NewAccount", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "settings", + "type": "address" + } + ], + "name": "SettingsUpgraded", + "type": "event" + }, + { + "inputs": [], + "name": "canUpgrade", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "events", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "newAccount", + "outputs": [ + { + "internalType": "address payable", + "name": "accountAddress", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "accountOwner", + "type": "address" + } + ], + "name": "ownerToAccount", + "outputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "removeUpgradability", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "settings", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_oldOwner", + "type": "address" + }, + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "updateAccountOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_implementation", + "type": "address" + } + ], + "name": "upgradeAccountImplementation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_events", + "type": "address" + } + ], + "name": "upgradeEvents", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_settings", + "type": "address" + } + ], + "name": "upgradeSettings", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/subgraphs/kwenta/configurations/configurations/configurations.ts b/subgraphs/kwenta/configurations/configurations/configurations.ts new file mode 100644 index 0000000000..7df1cf67e7 --- /dev/null +++ b/subgraphs/kwenta/configurations/configurations/configurations.ts @@ -0,0 +1,19 @@ +import { KwentaOptimismConfigurations } from "../../protocols/kwenta/config/deployments/kwenta-optimism/configurations"; +import { Configurations } from "./interface"; +import { Deploy } from "./deploy"; +import { log } from "@graphprotocol/graph-ts"; + +export function getNetworkConfigurations(deploy: i32): Configurations { + switch (deploy) { + case Deploy.KWENTA_OPTIMISM: { + return new KwentaOptimismConfigurations(); + } + default: { + log.critical( + "No configurations found for deployment protocol/network", + [] + ); + return new KwentaOptimismConfigurations(); + } + } +} diff --git a/subgraphs/kwenta/configurations/configurations/deploy.ts b/subgraphs/kwenta/configurations/configurations/deploy.ts new file mode 100644 index 0000000000..30c94585d5 --- /dev/null +++ b/subgraphs/kwenta/configurations/configurations/deploy.ts @@ -0,0 +1,3 @@ +export namespace Deploy { + export const KWENTA_OPTIMISM = 0; +} diff --git a/subgraphs/kwenta/configurations/configurations/interface.ts b/subgraphs/kwenta/configurations/configurations/interface.ts new file mode 100644 index 0000000000..4b2c0ec7ce --- /dev/null +++ b/subgraphs/kwenta/configurations/configurations/interface.ts @@ -0,0 +1,9 @@ +import { Address } from "@graphprotocol/graph-ts"; + +export interface Configurations { + getNetwork(): string; + getProtocolName(): string; + getProtocolSlug(): string; + getFactoryAddress(): Address; + getSUSDAddress(): Address; +} diff --git a/subgraphs/kwenta/configurations/configure.mustache b/subgraphs/kwenta/configurations/configure.mustache new file mode 100644 index 0000000000..971ba89573 --- /dev/null +++ b/subgraphs/kwenta/configurations/configure.mustache @@ -0,0 +1,6 @@ +import { getNetworkConfigurations } from "./configurations/configurations"; +import { Deploy } from "./configurations/deploy"; + +let deployment = Deploy.{{ deployment }}; + +export const NetworkConfigs = getNetworkConfigurations(deployment); diff --git a/subgraphs/kwenta/package-lock.json b/subgraphs/kwenta/package-lock.json new file mode 100644 index 0000000000..c67d76f3e2 --- /dev/null +++ b/subgraphs/kwenta/package-lock.json @@ -0,0 +1,9302 @@ +{ + "name": "kwenta", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "license": "MIT", + "dependencies": { + "@graphprotocol/graph-cli": "0.37.0", + "@graphprotocol/graph-ts": "0.29.0" + }, + "devDependencies": { + "prettier": "2.7.1", + "typescript": "^4.8.3" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz", + "integrity": "sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==", + "dependencies": { + "@babel/highlight": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz", + "integrity": "sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw==", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight": { + "version": "7.16.10", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.16.10.tgz", + "integrity": "sha512-5FnTQLSLswEj6IkgVw5KusNUUFY9ZGqe/TRFnP/BKYHYgfh7tc+C7mwiy95/yNP7Dh9x580Vv8r7u7ZfTBFxdw==", + "dependencies": { + "@babel/helper-validator-identifier": "^7.16.7", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/@babel/highlight/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" + }, + "node_modules/@babel/highlight/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0= sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/runtime": { + "version": "7.20.1", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.1.tgz", + "integrity": "sha512-mrzLkl6U9YLF8qpqI7TB82PESyEGjm/0Ly91jG575eVxMMlb8fYfOXFZIJ8XfLrJZQbm7dlKry2bJmXBUEkdFg==", + "dependencies": { + "regenerator-runtime": "^0.13.10" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@ethersproject/abi": { + "version": "5.0.7", + "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.0.7.tgz", + "integrity": "sha512-Cqktk+hSIckwP/W8O47Eef60VwmoSC/L3lY0+dIBhQPCNn9E4V7rwmm2aFrNRRDJfFlGuZ1khkQUOc3oBX+niw==", + "dependencies": { + "@ethersproject/address": "^5.0.4", + "@ethersproject/bignumber": "^5.0.7", + "@ethersproject/bytes": "^5.0.4", + "@ethersproject/constants": "^5.0.4", + "@ethersproject/hash": "^5.0.4", + "@ethersproject/keccak256": "^5.0.3", + "@ethersproject/logger": "^5.0.5", + "@ethersproject/properties": "^5.0.3", + "@ethersproject/strings": "^5.0.4" + } + }, + "node_modules/@ethersproject/abstract-provider": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.7.0.tgz", + "integrity": "sha512-R41c9UkchKCpAqStMYUpdunjo3pkEvZC3FAwZn5S5MGbXoMQOHIdHItezTETxAO5bevtMApSyEhn9+CHcDsWBw==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/networks": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/transactions": "^5.7.0", + "@ethersproject/web": "^5.7.0" + } + }, + "node_modules/@ethersproject/abstract-signer": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.7.0.tgz", + "integrity": "sha512-a16V8bq1/Cz+TGCkE2OPMTOUDLS3grCpdjoJCYNnVBbdYEMSgKrU0+B90s8b6H+ByYTBZN7a3g76jdIJi7UfKQ==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/abstract-provider": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0" + } + }, + "node_modules/@ethersproject/address": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.7.0.tgz", + "integrity": "sha512-9wYhYt7aghVGo758POM5nqcOMaE168Q6aRLJZwUmiqSrAungkG74gSSeKEIR7ukixesdRZGPgVqme6vmxs1fkA==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/rlp": "^5.7.0" + } + }, + "node_modules/@ethersproject/base64": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.7.0.tgz", + "integrity": "sha512-Dr8tcHt2mEbsZr/mwTPIQAf3Ai0Bks/7gTw9dSqk1mQvhW3XvRlmDJr/4n+wg1JmCl16NZue17CDh8xb/vZ0sQ==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0" + } + }, + "node_modules/@ethersproject/bignumber": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.7.0.tgz", + "integrity": "sha512-n1CAdIHRWjSucQO3MC1zPSVgV/6dy/fjL9pMrPP9peL+QxEg9wOsVqwD4+818B6LUEtaXzVHQiuivzRoxPxUGw==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "bn.js": "^5.2.1" + } + }, + "node_modules/@ethersproject/bignumber/node_modules/bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + }, + "node_modules/@ethersproject/bytes": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.7.0.tgz", + "integrity": "sha512-nsbxwgFXWh9NyYWo+U8atvmMsSdKJprTcICAkvbBffT75qDocbuggBU0SJiVK2MuTrp0q+xvLkTnGMPK1+uA9A==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/logger": "^5.7.0" + } + }, + "node_modules/@ethersproject/constants": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.7.0.tgz", + "integrity": "sha512-DHI+y5dBNvkpYUMiRQyxRBYBefZkJfo70VUkUAsRjcPs47muV9evftfZ0PJVCXYbAiCgght0DtcF9srFQmIgWA==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bignumber": "^5.7.0" + } + }, + "node_modules/@ethersproject/hash": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.7.0.tgz", + "integrity": "sha512-qX5WrQfnah1EFnO5zJv1v46a8HW0+E5xuBBDTwMFZLuVTx0tbU2kkx15NqdjxecrLGatQN9FGQKpb1FKdHCt+g==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/address": "^5.7.0", + "@ethersproject/base64": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/strings": "^5.7.0" + } + }, + "node_modules/@ethersproject/keccak256": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.7.0.tgz", + "integrity": "sha512-2UcPboeL/iW+pSg6vZ6ydF8tCnv3Iu/8tUmLLzWWGzxWKFFqOBQFLo6uLUv6BDrLgCDfN28RJ/wtByx+jZ4KBg==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "js-sha3": "0.8.0" + } + }, + "node_modules/@ethersproject/logger": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.7.0.tgz", + "integrity": "sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ] + }, + "node_modules/@ethersproject/networks": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.7.1.tgz", + "integrity": "sha512-n/MufjFYv3yFcUyfhnXotyDlNdFb7onmkSy8aQERi2PjNcnWQ66xXxa3XlS8nCcA8aJKJjIIMNJTC7tu80GwpQ==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/logger": "^5.7.0" + } + }, + "node_modules/@ethersproject/properties": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.7.0.tgz", + "integrity": "sha512-J87jy8suntrAkIZtecpxEPxY//szqr1mlBaYlQ0r4RCaiD2hjheqF9s1LVE8vVuJCXisjIP+JgtK/Do54ej4Sw==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/logger": "^5.7.0" + } + }, + "node_modules/@ethersproject/rlp": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.7.0.tgz", + "integrity": "sha512-rBxzX2vK8mVF7b0Tol44t5Tb8gomOHkj5guL+HhzQ1yBh/ydjGnpw6at+X6Iw0Kp3OzzzkcKp8N9r0W4kYSs9w==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0" + } + }, + "node_modules/@ethersproject/signing-key": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.7.0.tgz", + "integrity": "sha512-MZdy2nL3wO0u7gkB4nA/pEf8lu1TlFswPNmy8AiYkfKTdO6eXBJyUdmHO/ehm/htHw9K/qF8ujnTyUAD+Ry54Q==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "bn.js": "^5.2.1", + "elliptic": "6.5.4", + "hash.js": "1.1.7" + } + }, + "node_modules/@ethersproject/signing-key/node_modules/bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + }, + "node_modules/@ethersproject/strings": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.7.0.tgz", + "integrity": "sha512-/9nu+lj0YswRNSH0NXYqrh8775XNyEdUQAuf3f+SmOrnVewcJ5SBNAjF7lpgehKi4abvNNXyf+HX86czCdJ8Mg==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/logger": "^5.7.0" + } + }, + "node_modules/@ethersproject/transactions": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.7.0.tgz", + "integrity": "sha512-kmcNicCp1lp8qanMTC3RIikGgoJ80ztTyvtsFvCYpSCfkjhD0jZ2LOrnbcuxuToLIUYYf+4XwD1rP+B/erDIhQ==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/address": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/rlp": "^5.7.0", + "@ethersproject/signing-key": "^5.7.0" + } + }, + "node_modules/@ethersproject/web": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.7.1.tgz", + "integrity": "sha512-Gueu8lSvyjBWL4cYsWsjh6MtMwM0+H4HvqFPZfB6dV8ctbP9zFAO73VG1cMWae0FLPCtz0peKPpZY8/ugJJX2w==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/base64": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/strings": "^5.7.0" + } + }, + "node_modules/@float-capital/float-subgraph-uncrashable": { + "version": "0.0.0-alpha.4", + "resolved": "https://registry.npmjs.org/@float-capital/float-subgraph-uncrashable/-/float-subgraph-uncrashable-0.0.0-alpha.4.tgz", + "integrity": "sha512-3DPy66rMvGAFDDv7craf/Vgz1fLfuU0QSJ16HB1CRZyFQFqICFHbDL7h04zqG8i255z8cfBcgYq+zSxVzeEyLw==", + "dependencies": { + "graphql": "^16.6.0", + "graphql-import-node": "^0.0.5", + "js-yaml": "^4.1.0", + "rescript": "^9.1.4" + }, + "bin": { + "uncrashable": "bin/uncrashable" + } + }, + "node_modules/@float-capital/float-subgraph-uncrashable/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + }, + "node_modules/@float-capital/float-subgraph-uncrashable/node_modules/graphql": { + "version": "16.6.0", + "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.6.0.tgz", + "integrity": "sha512-KPIBPDlW7NxrbT/eh4qPXz5FiFdL5UbaA0XUNz2Rp3Z3hqBSkbj0GVjwFDztsWVauZUWsbKHgMg++sk8UX0bkw==", + "engines": { + "node": "^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0" + } + }, + "node_modules/@float-capital/float-subgraph-uncrashable/node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/@graphprotocol/graph-cli": { + "version": "0.37.0", + "resolved": "https://registry.npmjs.org/@graphprotocol/graph-cli/-/graph-cli-0.37.0.tgz", + "integrity": "sha512-p//lNNxDTFO05LntKHeDt1sCwRxJHsdcIN2P9/FPnxE5Z2N3n3z0jHEifRhxrPpfkjKyydStT7TM5QMCqxf1kQ==", + "dependencies": { + "@float-capital/float-subgraph-uncrashable": "^0.0.0-alpha.4", + "assemblyscript": "0.19.10", + "binary-install-raw": "0.0.13", + "chalk": "3.0.0", + "chokidar": "3.5.1", + "debug": "4.3.1", + "docker-compose": "0.23.4", + "dockerode": "2.5.8", + "fs-extra": "9.0.0", + "glob": "7.1.6", + "gluegun": "git+https://github.com/edgeandnode/gluegun.git#v4.3.1-pin-colors-dep", + "graphql": "15.5.0", + "immutable": "3.8.2", + "ipfs-http-client": "34.0.0", + "jayson": "3.6.6", + "js-yaml": "3.13.1", + "node-fetch": "2.6.0", + "pkginfo": "0.4.1", + "prettier": "1.19.1", + "request": "2.88.2", + "semver": "7.3.5", + "sync-request": "6.1.0", + "tmp-promise": "3.0.2", + "web3-eth-abi": "1.7.0", + "which": "2.0.2", + "yaml": "1.9.2" + }, + "bin": { + "graph": "bin/graph" + } + }, + "node_modules/@graphprotocol/graph-cli/node_modules/prettier": { + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz", + "integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==", + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@graphprotocol/graph-ts": { + "version": "0.29.0", + "resolved": "https://registry.npmjs.org/@graphprotocol/graph-ts/-/graph-ts-0.29.0.tgz", + "integrity": "sha512-9rCouklL2CjlqtywcwSw++MzjBWlmm6274j4s5HokjOTxr64ER7SCKx+2iCqVV0/S7ivc63MzIHlCLSCjPjbiA==", + "dependencies": { + "assemblyscript": "0.19.10" + } + }, + "node_modules/@types/bn.js": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.1.tgz", + "integrity": "sha512-qNrYbZqMx0uJAfKnKclPh+dTwK33KfLHYqtyODwd5HnXOjnkhc4qgn3BrK6RWyGZm5+sIFE7Q7Vz6QQtJB7w7g==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/concat-stream": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@types/concat-stream/-/concat-stream-1.6.1.tgz", + "integrity": "sha512-eHE4cQPoj6ngxBZMvVf6Hw7Mh4jMW4U9lpGmS5GBPB9RYxlFg+CHaVN7ErNY4W9XfLIEn20b4VDYaIrbq0q4uA==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/connect": { + "version": "3.4.35", + "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz", + "integrity": "sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/express-serve-static-core": { + "version": "4.17.28", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.28.tgz", + "integrity": "sha512-P1BJAEAW3E2DJUlkgq4tOL3RyMunoWXqbSCygWo5ZIWTjUgN1YnaXWW4VWl/oc8vs/XoYibEGBKP0uZyF4AHig==", + "dependencies": { + "@types/node": "*", + "@types/qs": "*", + "@types/range-parser": "*" + } + }, + "node_modules/@types/form-data": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/@types/form-data/-/form-data-0.0.33.tgz", + "integrity": "sha512-8BSvG1kGm83cyJITQMZSulnl6QV8jqAGreJsc5tPu1Jq0vTSOiY/k24Wx82JRpWwZSqrala6sd5rWi6aNXvqcw==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/lodash": { + "version": "4.14.180", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.180.tgz", + "integrity": "sha512-XOKXa1KIxtNXgASAnwj7cnttJxS4fksBRywK/9LzRV5YxrF80BXZIGeQSuoESQ/VkUj30Ae0+YcuHc15wJCB2g==" + }, + "node_modules/@types/node": { + "version": "12.20.47", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.47.tgz", + "integrity": "sha512-BzcaRsnFuznzOItW1WpQrDHM7plAa7GIDMZ6b5pnMbkqEtM/6WCOhvZar39oeMQP79gwvFUWjjptE7/KGcNqFg==" + }, + "node_modules/@types/parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==" + }, + "node_modules/@types/pbkdf2": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@types/pbkdf2/-/pbkdf2-3.1.0.tgz", + "integrity": "sha512-Cf63Rv7jCQ0LaL8tNXmEyqTHuIJxRdlS5vMh1mj5voN4+QFhVZnlZruezqpWYDiJ8UTzhP0VmeLXCmBk66YrMQ==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/qs": { + "version": "6.9.7", + "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz", + "integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==" + }, + "node_modules/@types/range-parser": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.4.tgz", + "integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==" + }, + "node_modules/@types/secp256k1": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@types/secp256k1/-/secp256k1-4.0.3.tgz", + "integrity": "sha512-Da66lEIFeIz9ltsdMZcpQvmrmmoqrfju8pm1BH8WbYjZSwUgCwXLb9C+9XYogwBITnbsSaMdVPb2ekf7TV+03w==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/ws": { + "version": "7.4.7", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-7.4.7.tgz", + "integrity": "sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "dependencies": { + "event-target-shim": "^5.0.0" + }, + "engines": { + "node": ">=6.5" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-colors": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.4.tgz", + "integrity": "sha512-hHUXGagefjN2iRrID63xckIvotOXOojhQKWIPUZ4mNUZ9nLZW+7FMNoE1lOkEhNWYsx/7ysGIuJYCiMAA9FnrA==", + "engines": { + "node": ">=6" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/anymatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", + "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/apisauce": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/apisauce/-/apisauce-1.1.5.tgz", + "integrity": "sha512-gKC8qb/bDJsPsnEXLZnXJ7gVx7dh87CEVNeIwv1dvaffnXoh5GHwac5pWR1P2broLiVj/fqFMQvLDDt/RhjiqA==", + "dependencies": { + "axios": "^0.21.2", + "ramda": "^0.25.0" + } + }, + "node_modules/app-module-path": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/app-module-path/-/app-module-path-2.2.0.tgz", + "integrity": "sha1-ZBqlXft9am8KgUHEucCqULbCTdU= sha512-gkco+qxENJV+8vFcDiiFhuoSvRXb2a/QPqpSoWhVz829VNJfOTnELbBmPmNKFxf3xdNnw4DWCkzkDaavcX/1YQ==" + }, + "node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/asap": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", + "integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==" + }, + "node_modules/asmcrypto.js": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/asmcrypto.js/-/asmcrypto.js-2.3.2.tgz", + "integrity": "sha512-3FgFARf7RupsZETQ1nHnhLUUvpcttcCq1iZCaVAbJZbCZ5VNRrNyvpDyHTOb0KC3llFcsyOT/a99NZcCbeiEsA==" + }, + "node_modules/asn1": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz", + "integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==", + "dependencies": { + "safer-buffer": "~2.1.0" + } + }, + "node_modules/asn1.js": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz", + "integrity": "sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA==", + "dependencies": { + "bn.js": "^4.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "safer-buffer": "^2.1.0" + } + }, + "node_modules/assemblyscript": { + "version": "0.19.10", + "resolved": "https://registry.npmjs.org/assemblyscript/-/assemblyscript-0.19.10.tgz", + "integrity": "sha512-HavcUBXB3mBTRGJcpvaQjmnmaqKHBGREjSPNsIvnAk2f9dj78y4BkMaSSdvBQYWcDDzsHQjyUC8stICFkD1Odg==", + "dependencies": { + "binaryen": "101.0.0-nightly.20210723", + "long": "^4.0.0" + }, + "bin": { + "asc": "bin/asc", + "asinit": "bin/asinit" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/assemblyscript" + } + }, + "node_modules/assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU= sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==", + "engines": { + "node": ">=0.8" + } + }, + "node_modules/async": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", + "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==", + "dependencies": { + "lodash": "^4.17.14" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k= sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, + "node_modules/at-least-node": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", + "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg= sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==", + "engines": { + "node": "*" + } + }, + "node_modules/aws4": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz", + "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==" + }, + "node_modules/axios": { + "version": "0.21.4", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", + "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", + "dependencies": { + "follow-redirects": "^1.14.0" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "node_modules/base-x": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz", + "integrity": "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==", + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4= sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==", + "dependencies": { + "tweetnacl": "^0.14.3" + } + }, + "node_modules/bcrypt-pbkdf/node_modules/tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q= sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==" + }, + "node_modules/bignumber.js": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.2.tgz", + "integrity": "sha512-GAcQvbpsM0pUb0zw1EI0KhQEZ+lRwR5fYaAp3vPOYuP7aDvGy6cVN6XHLauvF8SOga2y0dcLcjt3iQDTSEliyw==", + "engines": { + "node": "*" + } + }, + "node_modules/binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "engines": { + "node": ">=8" + } + }, + "node_modules/binary-install-raw": { + "version": "0.0.13", + "resolved": "https://registry.npmjs.org/binary-install-raw/-/binary-install-raw-0.0.13.tgz", + "integrity": "sha512-v7ms6N/H7iciuk6QInon3/n2mu7oRX+6knJ9xFPsJ3rQePgAqcR3CRTwUheFd8SLbiq4LL7Z4G/44L9zscdt9A==", + "dependencies": { + "axios": "^0.21.1", + "rimraf": "^3.0.2", + "tar": "^6.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/binaryen": { + "version": "101.0.0-nightly.20210723", + "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-101.0.0-nightly.20210723.tgz", + "integrity": "sha512-eioJNqhHlkguVSbblHOtLqlhtC882SOEPKmNFZaDuz1hzQjolxZ+eu3/kaS10n3sGPONsIZsO7R9fR00UyhEUA==", + "bin": { + "wasm-opt": "bin/wasm-opt" + } + }, + "node_modules/bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "dependencies": { + "file-uri-to-path": "1.0.0" + } + }, + "node_modules/bip66": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/bip66/-/bip66-1.1.5.tgz", + "integrity": "sha1-AfqHSHhcpwlV1QESF9GzE5lpyiI= sha512-nemMHz95EmS38a26XbbdxIYj5csHd3RMP3H5bwQknX0WYHF01qhpufP42mLOwVICuH2JmhIhXiWs89MfUGL7Xw==", + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, + "node_modules/bl": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/bl/-/bl-3.0.1.tgz", + "integrity": "sha512-jrCW5ZhfQ/Vt07WX1Ngs+yn9BDqPL/gw28S7s9H6QK/gupnizNzJAss5akW20ISgOrbLTlXOOCTJeNUQqruAWQ==", + "dependencies": { + "readable-stream": "^3.0.1" + } + }, + "node_modules/bl/node_modules/readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/blakejs": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.2.1.tgz", + "integrity": "sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ==" + }, + "node_modules/bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" + }, + "node_modules/borc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/borc/-/borc-2.1.2.tgz", + "integrity": "sha512-Sy9eoUi4OiKzq7VovMn246iTo17kzuyHJKomCfpWMlI6RpfN1gk95w7d7gH264nApVLg0HZfcpz62/g4VH1Y4w==", + "dependencies": { + "bignumber.js": "^9.0.0", + "buffer": "^5.5.0", + "commander": "^2.15.0", + "ieee754": "^1.1.13", + "iso-url": "~0.4.7", + "json-text-sequence": "~0.1.0", + "readable-stream": "^3.6.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/borc/node_modules/readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8= sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==" + }, + "node_modules/browserify-aes": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", + "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", + "dependencies": { + "buffer-xor": "^1.0.3", + "cipher-base": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.3", + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/bs58": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", + "integrity": "sha1-vhYedsNU9veIrkBx9j806MTwpCo= sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==", + "dependencies": { + "base-x": "^3.0.2" + } + }, + "node_modules/bs58check": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/bs58check/-/bs58check-2.1.2.tgz", + "integrity": "sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA==", + "dependencies": { + "bs58": "^4.0.0", + "create-hash": "^1.1.0", + "safe-buffer": "^5.1.2" + } + }, + "node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "node_modules/buffer-alloc": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", + "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==", + "dependencies": { + "buffer-alloc-unsafe": "^1.1.0", + "buffer-fill": "^1.0.0" + } + }, + "node_modules/buffer-alloc-unsafe": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz", + "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==" + }, + "node_modules/buffer-fill": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", + "integrity": "sha1-+PeLdniYiO858gXNY39o5wISKyw= sha512-T7zexNBwiiaCOGDg9xNX9PBmjrubblRkENuptryuI64URkXDFum9il/JGL8Lm8wYfAXpredVXXZz7eMHilimiQ==" + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==" + }, + "node_modules/buffer-xor": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", + "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk= sha512-571s0T7nZWK6vB67HI5dyUF7wXiNcfaPPPTl6zYCNApANjIvYJTg7hlud/+cJpdAhS7dVzqMLmfhfHR3rAcOjQ==" + }, + "node_modules/builtin-status-codes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", + "integrity": "sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug= sha512-HpGFw18DgFWlncDfjTa2rcQ4W88O1mC8e8yZ2AvQY5KDaktSTwo+KRf6nHK6FRI5FyRyb/5T6+TSxfP7QyGsmQ==" + }, + "node_modules/call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dependencies": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "engines": { + "node": ">=6" + } + }, + "node_modules/camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "engines": { + "node": ">=6" + } + }, + "node_modules/caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw= sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==" + }, + "node_modules/chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/chokidar": { + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.1.tgz", + "integrity": "sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw==", + "dependencies": { + "anymatch": "~3.1.1", + "braces": "~3.0.2", + "glob-parent": "~5.1.0", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.5.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.1" + } + }, + "node_modules/chownr": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", + "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", + "engines": { + "node": ">=10" + } + }, + "node_modules/cids": { + "version": "0.7.5", + "resolved": "https://registry.npmjs.org/cids/-/cids-0.7.5.tgz", + "integrity": "sha512-zT7mPeghoWAu+ppn8+BS1tQ5qGmbMfB4AregnQjA/qHY3GC1m1ptI9GkWNlgeu38r7CuRdXB47uY2XgAYt6QVA==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "buffer": "^5.5.0", + "class-is": "^1.1.0", + "multibase": "~0.6.0", + "multicodec": "^1.0.0", + "multihashes": "~0.4.15" + }, + "engines": { + "node": ">=4.0.0", + "npm": ">=3.0.0" + } + }, + "node_modules/cids/node_modules/multicodec": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/multicodec/-/multicodec-1.0.4.tgz", + "integrity": "sha512-NDd7FeS3QamVtbgfvu5h7fd1IlbaC4EQ0/pgU4zqE2vdHCmBGsUa0TiM8/TdSeG6BMPC92OOCf8F1ocE/Wkrrg==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "buffer": "^5.6.0", + "varint": "^5.0.0" + } + }, + "node_modules/cipher-base": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", + "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", + "dependencies": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/class-is": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/class-is/-/class-is-1.1.0.tgz", + "integrity": "sha512-rhjH9AG1fvabIDoGRVH587413LPjTZgmDF9fOFCbFJQV4yuocX1mHxxvXI4g3cGwbVY9wAYIoKlg1N79frJKQw==" + }, + "node_modules/cli-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", + "dependencies": { + "restore-cursor": "^3.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cli-spinners": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.6.1.tgz", + "integrity": "sha512-x/5fWmGMnbKQAaNwN+UZlV79qBLM9JFnJuJ03gIi5whrob0xV0ofNVHy9DhwGdsMJQc2OKv0oGmLzvaqvAVv+g==", + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-table3": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.5.1.tgz", + "integrity": "sha512-7Qg2Jrep1S/+Q3EceiZtQcDPWxhAvBw+ERf1162v4sikJrvojMHFqXt8QIVha8UlH9rgU0BeWPytZ9/TzYqlUw==", + "dependencies": { + "object-assign": "^4.1.0", + "string-width": "^2.1.1" + }, + "engines": { + "node": ">=6" + }, + "optionalDependencies": { + "colors": "^1.1.2" + } + }, + "node_modules/clone": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", + "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4= sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==", + "engines": { + "node": ">=0.8" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "node_modules/colors": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.3.3.tgz", + "integrity": "sha512-mmGt/1pZqYRjMxB1axhTo16/snVZ5krrKkcmMeVKxzECMMXoCgnvTPp10QgHfcbQZw8Dq2jMNG6je4JlWU0gWg==", + "engines": { + "node": ">=0.1.90" + } + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + }, + "node_modules/concat-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", + "engines": [ + "node >= 0.8" + ], + "dependencies": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" + } + }, + "node_modules/core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" + }, + "node_modules/cosmiconfig": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-6.0.0.tgz", + "integrity": "sha512-xb3ZL6+L8b9JLLCx3ZdoZy4+2ECphCMo2PwqgP1tlfVq6M6YReyzBJtvWWtbDSpNr9hn96pkCiZqUcFEc+54Qg==", + "dependencies": { + "@types/parse-json": "^4.0.0", + "import-fresh": "^3.1.0", + "parse-json": "^5.0.0", + "path-type": "^4.0.0", + "yaml": "^1.7.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/create-hash": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", + "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", + "dependencies": { + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "md5.js": "^1.3.4", + "ripemd160": "^2.0.1", + "sha.js": "^2.4.0" + } + }, + "node_modules/create-hmac": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", + "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", + "dependencies": { + "cipher-base": "^1.0.3", + "create-hash": "^1.1.0", + "inherits": "^2.0.1", + "ripemd160": "^2.0.0", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA= sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==", + "dependencies": { + "assert-plus": "^1.0.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/defaults": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", + "integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730= sha512-s82itHOnYrN0Ib8r+z7laQz3sdE+4FP3d9Q7VLO7U+KRT+CR0GsWuyHxzdAY82I7cXv0G/twrqomTJLOssO5HA==", + "dependencies": { + "clone": "^1.0.2" + } + }, + "node_modules/delay": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/delay/-/delay-5.0.0.tgz", + "integrity": "sha512-ReEBKkIfe4ya47wlPYf/gu5ib6yUG0/Aez0JQZQz94kiWtRQvZIQbTiehsnwHvLSWJnQdhVeqYue7Id1dKr0qw==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk= sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/delimit-stream": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/delimit-stream/-/delimit-stream-0.1.0.tgz", + "integrity": "sha1-m4MZR3wOX4rrPONXrjBfwl6hzSs= sha512-a02fiQ7poS5CnjiJBAsjGLPp5EwVoGHNeu9sziBd9huppRfsAFIpv5zNLv0V1gbop53ilngAf5Kf331AwcoRBQ==" + }, + "node_modules/detect-node": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.1.0.tgz", + "integrity": "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==" + }, + "node_modules/docker-compose": { + "version": "0.23.4", + "resolved": "https://registry.npmjs.org/docker-compose/-/docker-compose-0.23.4.tgz", + "integrity": "sha512-yWdXby9uQ8o4syOfvoSJ9ZlTnLipvUmDn59uaYY5VGIUSUAfMPPGqE1DE3pOCnfSg9Tl9UOOFO0PCSAzuIHmuA==", + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/docker-modem": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/docker-modem/-/docker-modem-1.0.9.tgz", + "integrity": "sha512-lVjqCSCIAUDZPAZIeyM125HXfNvOmYYInciphNrLrylUtKyW66meAjSPXWchKVzoIYZx69TPnAepVSSkeawoIw==", + "dependencies": { + "debug": "^3.2.6", + "JSONStream": "1.3.2", + "readable-stream": "~1.0.26-4", + "split-ca": "^1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/docker-modem/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/docker-modem/node_modules/isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8= sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==" + }, + "node_modules/docker-modem/node_modules/readable-stream": { + "version": "1.0.34", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", + "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw= sha512-ok1qVCJuRkNmvebYikljxJA/UEsKwLl2nI1OmaqAu4/UE+h0wKCHok4XkL/gvi39OacXvw59RJUOFUkDib2rHg==", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "node_modules/docker-modem/node_modules/string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ= sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==" + }, + "node_modules/dockerode": { + "version": "2.5.8", + "resolved": "https://registry.npmjs.org/dockerode/-/dockerode-2.5.8.tgz", + "integrity": "sha512-+7iOUYBeDTScmOmQqpUYQaE7F4vvIt6+gIZNHWhqAQEI887tiPFB9OvXI/HzQYqfUNvukMK+9myLW63oTJPZpw==", + "dependencies": { + "concat-stream": "~1.6.2", + "docker-modem": "^1.0.8", + "tar-fs": "~1.16.3" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/drbg.js": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/drbg.js/-/drbg.js-1.0.1.tgz", + "integrity": "sha1-Pja2xCs3BDgjzbwzLVjzHiRFSAs= sha512-F4wZ06PvqxYLFEZKkFxTDcns9oFNk34hvmJSEwdzsxVQ8YI5YaxtACgQatkYgv2VI2CFkUd2Y+xosPQnHv809g==", + "dependencies": { + "browserify-aes": "^1.0.6", + "create-hash": "^1.1.2", + "create-hmac": "^1.1.4" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk= sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==", + "dependencies": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "node_modules/ejs": { + "version": "2.7.4", + "resolved": "https://registry.npmjs.org/ejs/-/ejs-2.7.4.tgz", + "integrity": "sha512-7vmuyh5+kuUyJKePhQfRQBhXV5Ce+RnaeeQArKu1EAMpL3WbgMt5WG6uQZpEVvYSSsxMXRKOewtDk9RaTKXRlA==", + "hasInstallScript": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/elliptic": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", + "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", + "dependencies": { + "bn.js": "^4.11.9", + "brorand": "^1.1.0", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "node_modules/end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dependencies": { + "once": "^1.4.0" + } + }, + "node_modules/enquirer": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.4.tgz", + "integrity": "sha512-pkYrrDZumL2VS6VBGDhqbajCM2xpkUNLuKfGPjfKaSIBKYopQbqEFyrOkRMIb2HDR/rO1kGhEt/5twBwtzKBXw==", + "dependencies": { + "ansi-colors": "^3.2.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/err-code": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/err-code/-/err-code-2.0.3.tgz", + "integrity": "sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==" + }, + "node_modules/error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, + "node_modules/es6-promise": { + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", + "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==" + }, + "node_modules/es6-promisify": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", + "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM= sha512-C+d6UdsYDk0lMebHNR4S2NybQMMngAOnOwYBQjTOiv0MkoJMP0Myw2mgpDLBcpfCmRLxyFqYhS/CfOENq4SJhQ==", + "dependencies": { + "es6-promise": "^4.0.3" + } + }, + "node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/ethereum-bloom-filters": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/ethereum-bloom-filters/-/ethereum-bloom-filters-1.0.10.tgz", + "integrity": "sha512-rxJ5OFN3RwjQxDcFP2Z5+Q9ho4eIdEmSc2ht0fCu8Se9nbXjZ7/031uXoUYJ87KHCOdVeiUuwSnoS7hmYAGVHA==", + "dependencies": { + "js-sha3": "^0.8.0" + } + }, + "node_modules/ethereum-cryptography": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz", + "integrity": "sha512-w8/4x1SGGzc+tO97TASLja6SLd3fRIK2tLVcV2Gx4IB21hE19atll5Cq9o3d0ZmAYC/8aw0ipieTSiekAea4SQ==", + "dependencies": { + "@types/pbkdf2": "^3.0.0", + "@types/secp256k1": "^4.0.1", + "blakejs": "^1.1.0", + "browserify-aes": "^1.2.0", + "bs58check": "^2.1.2", + "create-hash": "^1.2.0", + "create-hmac": "^1.1.7", + "hash.js": "^1.1.7", + "keccak": "^3.0.0", + "pbkdf2": "^3.0.17", + "randombytes": "^2.1.0", + "safe-buffer": "^5.1.2", + "scrypt-js": "^3.0.0", + "secp256k1": "^4.0.1", + "setimmediate": "^1.0.5" + } + }, + "node_modules/ethereum-cryptography/node_modules/secp256k1": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.3.tgz", + "integrity": "sha512-NLZVf+ROMxwtEj3Xa562qgv2BK5e2WNmXPiOdVIPLgs6lyTzMvBq0aWTYMI5XCP9jZMVKOcqZLw/Wc4vDkuxhA==", + "hasInstallScript": true, + "dependencies": { + "elliptic": "^6.5.4", + "node-addon-api": "^2.0.0", + "node-gyp-build": "^4.2.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/ethereumjs-util": { + "version": "7.1.5", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.1.5.tgz", + "integrity": "sha512-SDl5kKrQAudFBUe5OJM9Ac6WmMyYmXX/6sTmLZ3ffG2eY6ZIGBes3pEDxNN6V72WyOw4CPD5RomKdsa8DAAwLg==", + "dependencies": { + "@types/bn.js": "^5.1.0", + "bn.js": "^5.1.2", + "create-hash": "^1.1.2", + "ethereum-cryptography": "^0.1.3", + "rlp": "^2.2.4" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/ethereumjs-util/node_modules/bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + }, + "node_modules/ethjs-unit": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/ethjs-unit/-/ethjs-unit-0.1.6.tgz", + "integrity": "sha512-/Sn9Y0oKl0uqQuvgFk/zQgR7aw1g36qX/jzSQ5lSwlO0GigPymk4eGQfeNTD03w1dPOqfz8V77Cy43jH56pagw==", + "dependencies": { + "bn.js": "4.11.6", + "number-to-bn": "1.7.0" + }, + "engines": { + "node": ">=6.5.0", + "npm": ">=3" + } + }, + "node_modules/ethjs-unit/node_modules/bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha512-XWwnNNFCuuSQ0m3r3C4LE3EiORltHd9M05pq6FOlVeiophzRbMo50Sbz1ehl8K3Z+jw9+vmgnXefY1hz8X+2wA==" + }, + "node_modules/event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", + "engines": { + "node": ">=6" + } + }, + "node_modules/evp_bytestokey": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", + "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", + "dependencies": { + "md5.js": "^1.3.4", + "safe-buffer": "^5.1.1" + } + }, + "node_modules/execa": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-3.4.0.tgz", + "integrity": "sha512-r9vdGQk4bmCuK1yKQu1KTwcT2zwfWdbdaXfCtAh+5nU/4fSX+JAb7vZGvI5naJrQlvONrEB20jeruESI69530g==", + "dependencies": { + "cross-spawn": "^7.0.0", + "get-stream": "^5.0.0", + "human-signals": "^1.1.1", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.0", + "onetime": "^5.1.0", + "p-finally": "^2.0.0", + "signal-exit": "^3.0.2", + "strip-final-newline": "^2.0.0" + }, + "engines": { + "node": "^8.12.0 || >=9.7.0" + } + }, + "node_modules/explain-error": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/explain-error/-/explain-error-1.0.4.tgz", + "integrity": "sha1-p5PTrAytTGq1cemWj7urbLJTKSk= sha512-/wSgNMxFusiYRy1rd19LT2SQlIXDppHpumpWo06wxjflD1OYxDLbl6rMVw+U3bxD5Nuhex4TKqv9Aem4D0lVzQ==" + }, + "node_modules/extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, + "node_modules/extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU= sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g==", + "engines": [ + "node >=0.6.0" + ] + }, + "node_modules/eyes": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz", + "integrity": "sha1-Ys8SAjTGg3hdkCNIqADvPgzCC8A= sha512-GipyPsXO1anza0AOZdy69Im7hGFCNB7Y/NGjDlZGJ3GJJLtwNSb2vrzYrTYJRrRloVx7pl+bhUaTB8yiccPvFQ==", + "engines": { + "node": "> 0.1.90" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + }, + "node_modules/file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==" + }, + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/flatmap": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/flatmap/-/flatmap-0.0.3.tgz", + "integrity": "sha1-Hxik2TgVLUlZZfnJWNkjqy3WabQ= sha512-OuR+o7kHVe+x9RtIujPay7Uw3bvDZBZFSBXClEphZuSDLmZTqMdclasf4vFSsogC8baDz0eaC2NdO/2dlXHBKQ==" + }, + "node_modules/follow-redirects": { + "version": "1.14.9", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.9.tgz", + "integrity": "sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE= sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==", + "engines": { + "node": "*" + } + }, + "node_modules/form-data": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 0.12" + } + }, + "node_modules/fs-constants": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==" + }, + "node_modules/fs-extra": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.0.0.tgz", + "integrity": "sha512-pmEYSk3vYsG/bF651KPUXZ+hvjpgWYw/Gc7W9NFUe3ZVLczKKWIij3IKpOrQcdw4TILtibFslZ0UmR8Vvzig4g==", + "dependencies": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^1.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/fs-jetpack": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/fs-jetpack/-/fs-jetpack-2.4.0.tgz", + "integrity": "sha512-S/o9Dd7K9A7gicVU32eT8G0kHcmSu0rCVdP79P0MWInKFb8XpTc8Syhoo66k9no+HDshtlh4pUJTws8X+8fdFQ==", + "dependencies": { + "minimatch": "^3.0.2", + "rimraf": "^2.6.3" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/fs-jetpack/node_modules/rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + } + }, + "node_modules/fs-minipass": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", + "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8= sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "node_modules/get-intrinsic": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", + "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", + "dependencies": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-port": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/get-port/-/get-port-3.2.0.tgz", + "integrity": "sha512-x5UJKlgeUiNT8nyo/AcnwLnZuZNcSjSw0kogRB+Whd1fjjFq4B1hySFxSFWWSn4mIBzg3sRNUDFYc4g5gjPoLg==", + "engines": { + "node": ">=4" + } + }, + "node_modules/get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo= sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==", + "dependencies": { + "assert-plus": "^1.0.0" + } + }, + "node_modules/glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/gluegun": { + "version": "4.3.1", + "resolved": "git+ssh://git@github.com/edgeandnode/gluegun.git#b34b9003d7bf556836da41b57ef36eb21570620a", + "license": "MIT", + "dependencies": { + "apisauce": "^1.0.1", + "app-module-path": "^2.2.0", + "cli-table3": "~0.5.0", + "colors": "1.3.3", + "cosmiconfig": "6.0.0", + "cross-spawn": "^7.0.0", + "ejs": "^2.6.1", + "enquirer": "2.3.4", + "execa": "^3.0.0", + "fs-jetpack": "^2.2.2", + "lodash.camelcase": "^4.3.0", + "lodash.kebabcase": "^4.1.1", + "lodash.lowercase": "^4.3.0", + "lodash.lowerfirst": "^4.3.1", + "lodash.pad": "^4.5.1", + "lodash.padend": "^4.6.1", + "lodash.padstart": "^4.6.1", + "lodash.repeat": "^4.1.0", + "lodash.snakecase": "^4.1.1", + "lodash.startcase": "^4.4.0", + "lodash.trim": "^4.5.1", + "lodash.trimend": "^4.5.1", + "lodash.trimstart": "^4.5.1", + "lodash.uppercase": "^4.3.0", + "lodash.upperfirst": "^4.3.1", + "ora": "^4.0.0", + "pluralize": "^8.0.0", + "ramdasauce": "^2.1.0", + "semver": "^7.0.0", + "which": "^2.0.0", + "yargs-parser": "^16.1.0" + }, + "bin": { + "gluegun": "bin/gluegun" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.9", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz", + "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==" + }, + "node_modules/graphql": { + "version": "15.5.0", + "resolved": "https://registry.npmjs.org/graphql/-/graphql-15.5.0.tgz", + "integrity": "sha512-OmaM7y0kaK31NKG31q4YbD2beNYa6jBBKtMFT6gLYJljHLJr42IqJ8KX08u3Li/0ifzTU5HjmoOOrwa5BRLeDA==", + "engines": { + "node": ">= 10.x" + } + }, + "node_modules/graphql-import-node": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/graphql-import-node/-/graphql-import-node-0.0.5.tgz", + "integrity": "sha512-OXbou9fqh9/Lm7vwXT0XoRN9J5+WCYKnbiTalgFDvkQERITRmcfncZs6aVABedd5B85yQU5EULS4a5pnbpuI0Q==", + "peerDependencies": { + "graphql": "*" + } + }, + "node_modules/har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI= sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q==", + "engines": { + "node": ">=4" + } + }, + "node_modules/har-validator": { + "version": "5.1.5", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz", + "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==", + "deprecated": "this library is no longer supported", + "dependencies": { + "ajv": "^6.12.3", + "har-schema": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hash-base": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", + "integrity": "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==", + "dependencies": { + "inherits": "^2.0.4", + "readable-stream": "^3.6.0", + "safe-buffer": "^5.2.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/hash-base/node_modules/readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/hash.js": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", + "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", + "dependencies": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "node_modules/hi-base32": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/hi-base32/-/hi-base32-0.5.1.tgz", + "integrity": "sha512-EmBBpvdYh/4XxsnUybsPag6VikPYnN30td+vQk+GI3qpahVEG9+gTkG0aXVxTjBqQ5T6ijbWIu77O+C5WFWsnA==" + }, + "node_modules/hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE= sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==", + "dependencies": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "node_modules/http-basic": { + "version": "8.1.3", + "resolved": "https://registry.npmjs.org/http-basic/-/http-basic-8.1.3.tgz", + "integrity": "sha512-/EcDMwJZh3mABI2NhGfHOGOeOZITqfkEO4p/xK+l3NpyncIHUQBoMvCSF/b5GqvKtySC2srL/GGG3+EtlqlmCw==", + "dependencies": { + "caseless": "^0.12.0", + "concat-stream": "^1.6.2", + "http-response-object": "^3.0.1", + "parse-cache-control": "^1.0.1" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/http-response-object": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/http-response-object/-/http-response-object-3.0.2.tgz", + "integrity": "sha512-bqX0XTF6fnXSQcEJ2Iuyr75yVakyjIDCqroJQ/aHfSdlM743Cwqoi2nDYMzLGWUcuTWGWy8AAvOKXTfiv6q9RA==", + "dependencies": { + "@types/node": "^10.0.3" + } + }, + "node_modules/http-response-object/node_modules/@types/node": { + "version": "10.17.60", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.60.tgz", + "integrity": "sha512-F0KIgDJfy2nA3zMLmWGKxcH2ZVEtCZXHHdOQs2gSaQ27+lNeEfGxzkIw90aXswATX7AZ33tahPbzy6KAfUreVw==" + }, + "node_modules/http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE= sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ==", + "dependencies": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + }, + "engines": { + "node": ">=0.8", + "npm": ">=1.3.7" + } + }, + "node_modules/human-signals": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz", + "integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==", + "engines": { + "node": ">=8.12.0" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/immutable": { + "version": "3.8.2", + "resolved": "https://registry.npmjs.org/immutable/-/immutable-3.8.2.tgz", + "integrity": "sha512-15gZoQ38eYjEjxkorfbcgBKBL6R7T459OuK+CpcWt7O3KF4uPCx2tD0uFETlUDIyo+1789crbMhTvQBSR5yBMg==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/ip": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", + "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo= sha512-rBtCAQAJm8A110nbwn6YdveUnuZH3WrC36IwkRXxDnq53JvXA2NVQvB7IHyKomxK1MJ4VDNw3UtFDdXQ+AvLYA==" + }, + "node_modules/ip-regex": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-2.1.0.tgz", + "integrity": "sha1-+ni/XS5pE8kRzp+BnuUUa7bYROk= sha512-58yWmlHpp7VYfcdTwMTvwMmqx/Elfxjd9RXTDyMsbL7lLWmhMylLEqiYVLKuLzOZqVgiWXD9MfR62Vv89VRxkw==", + "engines": { + "node": ">=4" + } + }, + "node_modules/ipfs-block": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/ipfs-block/-/ipfs-block-0.8.1.tgz", + "integrity": "sha512-0FaCpmij+jZBoUYhjoB5ptjdl9QzvrdRIoBmUU5JiBnK2GA+4YM/ifklaB8ePRhA/rRzhd+KYBjvMFMAL4NrVQ==", + "dependencies": { + "cids": "~0.7.0", + "class-is": "^1.1.0" + }, + "engines": { + "node": ">=6.0.0", + "npm": ">=3.0.0" + } + }, + "node_modules/ipfs-http-client": { + "version": "34.0.0", + "resolved": "https://registry.npmjs.org/ipfs-http-client/-/ipfs-http-client-34.0.0.tgz", + "integrity": "sha512-4RCkk8ix4Dqn6sxqFVwuXWCZ1eLFPsVaj6Ijvu1fs9VYgxgVudsW9PWwarlr4mw1xUCmPWYyXnEbGgzBrfMy0Q==", + "dependencies": { + "abort-controller": "^3.0.0", + "async": "^2.6.1", + "bignumber.js": "^9.0.0", + "bl": "^3.0.0", + "bs58": "^4.0.1", + "buffer": "^5.4.2", + "cids": "~0.7.1", + "concat-stream": "github:hugomrdias/concat-stream#feat/smaller", + "debug": "^4.1.0", + "detect-node": "^2.0.4", + "end-of-stream": "^1.4.1", + "err-code": "^2.0.0", + "explain-error": "^1.0.4", + "flatmap": "0.0.3", + "glob": "^7.1.3", + "ipfs-block": "~0.8.1", + "ipfs-utils": "~0.0.3", + "ipld-dag-cbor": "~0.15.0", + "ipld-dag-pb": "~0.17.3", + "ipld-raw": "^4.0.0", + "is-ipfs": "~0.6.1", + "is-pull-stream": "0.0.0", + "is-stream": "^2.0.0", + "iso-stream-http": "~0.1.2", + "iso-url": "~0.4.6", + "iterable-ndjson": "^1.1.0", + "just-kebab-case": "^1.1.0", + "just-map-keys": "^1.1.0", + "kind-of": "^6.0.2", + "ky": "^0.11.2", + "ky-universal": "^0.2.2", + "lru-cache": "^5.1.1", + "multiaddr": "^6.0.6", + "multibase": "~0.6.0", + "multicodec": "~0.5.1", + "multihashes": "~0.4.14", + "ndjson": "github:hugomrdias/ndjson#feat/readable-stream3", + "once": "^1.4.0", + "peer-id": "~0.12.3", + "peer-info": "~0.15.1", + "promise-nodeify": "^3.0.1", + "promisify-es6": "^1.0.3", + "pull-defer": "~0.2.3", + "pull-stream": "^3.6.9", + "pull-to-stream": "~0.1.1", + "pump": "^3.0.0", + "qs": "^6.5.2", + "readable-stream": "^3.1.1", + "stream-to-pull-stream": "^1.7.2", + "tar-stream": "^2.0.1", + "through2": "^3.0.1" + }, + "engines": { + "node": ">=8.3.0", + "npm": ">=3.0.0" + } + }, + "node_modules/ipfs-http-client/node_modules/concat-stream": { + "version": "2.0.0", + "resolved": "git+ssh://git@github.com/hugomrdias/concat-stream.git#057bc7b5d6d8df26c8cf00a3f151b6721a0a8034", + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "readable-stream": "^3.0.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/ipfs-http-client/node_modules/readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/ipfs-utils": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/ipfs-utils/-/ipfs-utils-0.0.4.tgz", + "integrity": "sha512-7cZf6aGj2FG3XJWhCNwn4mS93Q0GEWjtBZvEHqzgI43U2qzNDCyzfS1pei1Y5F+tw/zDJ5U4XG0G9reJxR53Ig==", + "dependencies": { + "buffer": "^5.2.1", + "is-buffer": "^2.0.3", + "is-electron": "^2.2.0", + "is-pull-stream": "0.0.0", + "is-stream": "^2.0.0", + "kind-of": "^6.0.2", + "readable-stream": "^3.4.0" + } + }, + "node_modules/ipfs-utils/node_modules/readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/ipld-dag-cbor": { + "version": "0.15.3", + "resolved": "https://registry.npmjs.org/ipld-dag-cbor/-/ipld-dag-cbor-0.15.3.tgz", + "integrity": "sha512-m23nG7ZyoVFnkK55/bLAErc7EfiMgaEQlqHWDTGzPI+O5r6bPfp+qbL5zTVSIT8tpbHmu174dwerVtLoVgeVyA==", + "deprecated": "This module has been superseded by @ipld/dag-cbor and multiformats", + "dependencies": { + "borc": "^2.1.2", + "buffer": "^5.5.0", + "cids": "~0.8.0", + "is-circular": "^1.0.2", + "multicodec": "^1.0.0", + "multihashing-async": "~0.8.0" + }, + "engines": { + "node": ">=6.0.0", + "npm": ">=3.0.0" + } + }, + "node_modules/ipld-dag-cbor/node_modules/cids": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/cids/-/cids-0.8.3.tgz", + "integrity": "sha512-yoXTbV3llpm+EBGWKeL9xKtksPE/s6DPoDSY4fn8I8TEW1zehWXPSB0pwAXVDlLaOlrw+sNynj995uD9abmPhA==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "buffer": "^5.6.0", + "class-is": "^1.1.0", + "multibase": "^1.0.0", + "multicodec": "^1.0.1", + "multihashes": "^1.0.1" + }, + "engines": { + "node": ">=4.0.0", + "npm": ">=3.0.0" + } + }, + "node_modules/ipld-dag-cbor/node_modules/multibase": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/multibase/-/multibase-1.0.1.tgz", + "integrity": "sha512-KcCxpBVY8fdVKu4dJMAahq4F/2Z/9xqEjIiR7PiMe7LRGeorFn2NLmicN6nLBCqQvft6MG2Lc9X5P0IdyvnxEw==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "base-x": "^3.0.8", + "buffer": "^5.5.0" + }, + "engines": { + "node": ">=10.0.0", + "npm": ">=6.0.0" + } + }, + "node_modules/ipld-dag-cbor/node_modules/multicodec": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/multicodec/-/multicodec-1.0.4.tgz", + "integrity": "sha512-NDd7FeS3QamVtbgfvu5h7fd1IlbaC4EQ0/pgU4zqE2vdHCmBGsUa0TiM8/TdSeG6BMPC92OOCf8F1ocE/Wkrrg==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "buffer": "^5.6.0", + "varint": "^5.0.0" + } + }, + "node_modules/ipld-dag-cbor/node_modules/multihashes": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/multihashes/-/multihashes-1.0.1.tgz", + "integrity": "sha512-S27Tepg4i8atNiFaU5ZOm3+gl3KQlUanLs/jWcBxQHFttgq+5x1OgbQmf2d8axJ/48zYGBd/wT9d723USMFduw==", + "dependencies": { + "buffer": "^5.6.0", + "multibase": "^1.0.1", + "varint": "^5.0.0" + }, + "engines": { + "node": ">=10.0.0", + "npm": ">=6.0.0" + } + }, + "node_modules/ipld-dag-pb": { + "version": "0.17.4", + "resolved": "https://registry.npmjs.org/ipld-dag-pb/-/ipld-dag-pb-0.17.4.tgz", + "integrity": "sha512-YwCxETEMuXVspOKOhjIOHJvKvB/OZfCDkpSFiYBQN2/JQjM9y/RFCYzIQGm0wg7dCFLrhvfjAZLTSaKs65jzWA==", + "deprecated": "This module has been superseded by @ipld/dag-pb and multiformats", + "dependencies": { + "cids": "~0.7.0", + "class-is": "^1.1.0", + "multicodec": "~0.5.1", + "multihashing-async": "~0.7.0", + "protons": "^1.0.1", + "stable": "~0.1.8" + }, + "engines": { + "node": ">=6.0.0", + "npm": ">=3.0.0" + } + }, + "node_modules/ipld-dag-pb/node_modules/err-code": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/err-code/-/err-code-1.1.2.tgz", + "integrity": "sha1-BuARbTAo9q70gGhJ6w6mp0iuaWA= sha512-CJAN+O0/yA1CKfRn9SXOGctSpEM7DCon/r/5r2eXFMY2zCCJBasFhcM5I+1kh3Ap11FsQCX+vGHceNPvpWKhoA==" + }, + "node_modules/ipld-dag-pb/node_modules/multihashing-async": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/multihashing-async/-/multihashing-async-0.7.0.tgz", + "integrity": "sha512-SCbfl3f+DzJh+/5piukga9ofIOxwfT05t8R4jfzZIJ88YE9zU9+l3K2X+XB19MYyxqvyK9UJRNWbmQpZqQlbRA==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "blakejs": "^1.1.0", + "buffer": "^5.2.1", + "err-code": "^1.1.2", + "js-sha3": "~0.8.0", + "multihashes": "~0.4.13", + "murmurhash3js-revisited": "^3.0.0" + }, + "engines": { + "node": ">=6.0.0", + "npm": ">=3.0.0" + } + }, + "node_modules/ipld-raw": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/ipld-raw/-/ipld-raw-4.0.1.tgz", + "integrity": "sha512-WjIdtZ06jJEar8zh+BHB84tE6ZdbS/XNa7+XCArOYfmeJ/c01T9VQpeMwdJQYn5c3s5UvvCu7y4VIi3vk2g1bA==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "cids": "~0.7.0", + "multicodec": "^1.0.0", + "multihashing-async": "~0.8.0" + } + }, + "node_modules/ipld-raw/node_modules/multicodec": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/multicodec/-/multicodec-1.0.4.tgz", + "integrity": "sha512-NDd7FeS3QamVtbgfvu5h7fd1IlbaC4EQ0/pgU4zqE2vdHCmBGsUa0TiM8/TdSeG6BMPC92OOCf8F1ocE/Wkrrg==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "buffer": "^5.6.0", + "varint": "^5.0.0" + } + }, + "node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0= sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==" + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-buffer": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", + "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "engines": { + "node": ">=4" + } + }, + "node_modules/is-circular": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-circular/-/is-circular-1.0.2.tgz", + "integrity": "sha512-YttjnrswnUYRVJvxCvu8z+PGMUSzC2JttP0OEXezlAEdp3EXzhf7IZ3j0gRAybJBQupedIZFhY61Tga6E0qASA==" + }, + "node_modules/is-electron": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/is-electron/-/is-electron-2.2.1.tgz", + "integrity": "sha512-r8EEQQsqT+Gn0aXFx7lTFygYQhILLCB+wn0WCDL5LZRINeLH/Rvw1j2oKodELLXYNImQ3CRlVsY8wW4cGOsyuw==" + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w==", + "engines": { + "node": ">=4" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-hex-prefixed": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz", + "integrity": "sha512-WvtOiug1VFrE9v1Cydwm+FnXd3+w9GaeVUss5W4v/SLy3UW00vP+6iNF2SdnfiBoLy4bTqVdkftNGTUeOFVsbA==", + "engines": { + "node": ">=6.5.0", + "npm": ">=3" + } + }, + "node_modules/is-interactive": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz", + "integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-ip": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-ip/-/is-ip-2.0.0.tgz", + "integrity": "sha1-aO6gfooKCpTC0IDdZ0xzGrKkYas= sha512-9MTn0dteHETtyUx8pxqMwg5hMBi3pvlyglJ+b79KOCca0po23337LbVV2Hl4xmMvfw++ljnO0/+5G6G+0Szh6g==", + "dependencies": { + "ip-regex": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/is-ipfs": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/is-ipfs/-/is-ipfs-0.6.3.tgz", + "integrity": "sha512-HyRot1dvLcxImtDqPxAaY1miO6WsiP/z7Yxpg2qpaLWv5UdhAPtLvHJ4kMLM0w8GSl8AFsVF23PHe1LzuWrUlQ==", + "dependencies": { + "bs58": "^4.0.1", + "cids": "~0.7.0", + "mafmt": "^7.0.0", + "multiaddr": "^7.2.1", + "multibase": "~0.6.0", + "multihashes": "~0.4.13" + } + }, + "node_modules/is-ipfs/node_modules/ip-regex": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.3.0.tgz", + "integrity": "sha512-B9ZWJxHHOHUhUjCPrMpLD4xEq35bUTClHM1S6CBU5ixQnkZmwipwgc96vAd7AAGM9TGHvJR+Uss+/Ak6UphK+Q==", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-ipfs/node_modules/is-ip": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-ip/-/is-ip-3.1.0.tgz", + "integrity": "sha512-35vd5necO7IitFPjd/YBeqwWnyDWbuLH9ZXQdMfDA8TEo7pv5X8yfrvVO3xbJbLUlERCMvf6X0hTUamQxCYJ9Q==", + "dependencies": { + "ip-regex": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-ipfs/node_modules/multiaddr": { + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/multiaddr/-/multiaddr-7.5.0.tgz", + "integrity": "sha512-GvhHsIGDULh06jyb6ev+VfREH9evJCFIRnh3jUt9iEZ6XDbyoisZRFEI9bMvK/AiR6y66y6P+eoBw9mBYMhMvw==", + "dependencies": { + "buffer": "^5.5.0", + "cids": "~0.8.0", + "class-is": "^1.1.0", + "is-ip": "^3.1.0", + "multibase": "^0.7.0", + "varint": "^5.0.0" + } + }, + "node_modules/is-ipfs/node_modules/multiaddr/node_modules/cids": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/cids/-/cids-0.8.3.tgz", + "integrity": "sha512-yoXTbV3llpm+EBGWKeL9xKtksPE/s6DPoDSY4fn8I8TEW1zehWXPSB0pwAXVDlLaOlrw+sNynj995uD9abmPhA==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "buffer": "^5.6.0", + "class-is": "^1.1.0", + "multibase": "^1.0.0", + "multicodec": "^1.0.1", + "multihashes": "^1.0.1" + }, + "engines": { + "node": ">=4.0.0", + "npm": ">=3.0.0" + } + }, + "node_modules/is-ipfs/node_modules/multiaddr/node_modules/cids/node_modules/multibase": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/multibase/-/multibase-1.0.1.tgz", + "integrity": "sha512-KcCxpBVY8fdVKu4dJMAahq4F/2Z/9xqEjIiR7PiMe7LRGeorFn2NLmicN6nLBCqQvft6MG2Lc9X5P0IdyvnxEw==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "base-x": "^3.0.8", + "buffer": "^5.5.0" + }, + "engines": { + "node": ">=10.0.0", + "npm": ">=6.0.0" + } + }, + "node_modules/is-ipfs/node_modules/multiaddr/node_modules/multibase": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/multibase/-/multibase-0.7.0.tgz", + "integrity": "sha512-TW8q03O0f6PNFTQDvh3xxH03c8CjGaaYrjkl9UQPG6rz53TQzzxJVCIWVjzcbN/Q5Y53Zd0IBQBMVktVgNx4Fg==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "base-x": "^3.0.8", + "buffer": "^5.5.0" + } + }, + "node_modules/is-ipfs/node_modules/multiaddr/node_modules/multihashes": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/multihashes/-/multihashes-1.0.1.tgz", + "integrity": "sha512-S27Tepg4i8atNiFaU5ZOm3+gl3KQlUanLs/jWcBxQHFttgq+5x1OgbQmf2d8axJ/48zYGBd/wT9d723USMFduw==", + "dependencies": { + "buffer": "^5.6.0", + "multibase": "^1.0.1", + "varint": "^5.0.0" + }, + "engines": { + "node": ">=10.0.0", + "npm": ">=6.0.0" + } + }, + "node_modules/is-ipfs/node_modules/multiaddr/node_modules/multihashes/node_modules/multibase": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/multibase/-/multibase-1.0.1.tgz", + "integrity": "sha512-KcCxpBVY8fdVKu4dJMAahq4F/2Z/9xqEjIiR7PiMe7LRGeorFn2NLmicN6nLBCqQvft6MG2Lc9X5P0IdyvnxEw==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "base-x": "^3.0.8", + "buffer": "^5.5.0" + }, + "engines": { + "node": ">=10.0.0", + "npm": ">=6.0.0" + } + }, + "node_modules/is-ipfs/node_modules/multicodec": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/multicodec/-/multicodec-1.0.4.tgz", + "integrity": "sha512-NDd7FeS3QamVtbgfvu5h7fd1IlbaC4EQ0/pgU4zqE2vdHCmBGsUa0TiM8/TdSeG6BMPC92OOCf8F1ocE/Wkrrg==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "buffer": "^5.6.0", + "varint": "^5.0.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-promise": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-1.0.1.tgz", + "integrity": "sha1-MVc3YcBX4zwukaq56W2gjO++duU= sha512-mjWH5XxnhMA8cFnDchr6qRP9S/kLntKuEfIYku+PaN1CnS8v+OG9O/BKpRCVRJvpIkgAZm0Pf5Is3iSSOILlcg==" + }, + "node_modules/is-pull-stream": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/is-pull-stream/-/is-pull-stream-0.0.0.tgz", + "integrity": "sha1-o7w9HG0wVRUcRr3m85nv7SFEDKk= sha512-NWLwqCc95I6m8FZDYLAmVJc9Xgk8O+8pPOoDKFTC293FH4S7FBcbLCw3WWPCdiT8uUSdzPy47VM08WPDMJJrag==" + }, + "node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==" + }, + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" + }, + "node_modules/iso-random-stream": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/iso-random-stream/-/iso-random-stream-1.1.2.tgz", + "integrity": "sha512-7y0tsBBgQs544iTYjyrMp5xvgrbYR8b+plQq1Bryp+03p0LssrxC9C1M0oHv4QESDt7d95c74XvMk/yawKqX+A==", + "dependencies": { + "buffer": "^6.0.3", + "readable-stream": "^3.4.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/iso-random-stream/node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/iso-random-stream/node_modules/readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/iso-stream-http": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/iso-stream-http/-/iso-stream-http-0.1.2.tgz", + "integrity": "sha512-oHEDNOysIMTNypbg2f1SlydqRBvjl4ZbSE9+0awVxnkx3K2stGTFwB/kpVqnB6UEfF8QD36kAjDwZvqyXBLMnQ==", + "dependencies": { + "builtin-status-codes": "^3.0.0", + "inherits": "^2.0.1", + "readable-stream": "^3.1.1" + } + }, + "node_modules/iso-stream-http/node_modules/readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/iso-url": { + "version": "0.4.7", + "resolved": "https://registry.npmjs.org/iso-url/-/iso-url-0.4.7.tgz", + "integrity": "sha512-27fFRDnPAMnHGLq36bWTpKET+eiXct3ENlCcdcMdk+mjXrb2kw3mhBUg1B7ewAC0kVzlOPhADzQgz1SE6Tglog==", + "engines": { + "node": ">=10" + } + }, + "node_modules/isomorphic-ws": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz", + "integrity": "sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==", + "peerDependencies": { + "ws": "*" + } + }, + "node_modules/isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo= sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==" + }, + "node_modules/iterable-ndjson": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/iterable-ndjson/-/iterable-ndjson-1.1.0.tgz", + "integrity": "sha512-OOp1Lb0o3k5MkXHx1YaIY5Z0ELosZfTnBaas9f8opJVcZGBIONA2zY/6CYE+LKkqrSDooIneZbrBGgOZnHPkrg==", + "dependencies": { + "string_decoder": "^1.2.0" + } + }, + "node_modules/jayson": { + "version": "3.6.6", + "resolved": "https://registry.npmjs.org/jayson/-/jayson-3.6.6.tgz", + "integrity": "sha512-f71uvrAWTtrwoww6MKcl9phQTC+56AopLyEenWvKVAIMz+q0oVGj6tenLZ7Z6UiPBkJtKLj4kt0tACllFQruGQ==", + "dependencies": { + "@types/connect": "^3.4.33", + "@types/express-serve-static-core": "^4.17.9", + "@types/lodash": "^4.14.159", + "@types/node": "^12.12.54", + "@types/ws": "^7.4.4", + "commander": "^2.20.3", + "delay": "^5.0.0", + "es6-promisify": "^5.0.0", + "eyes": "^0.1.8", + "isomorphic-ws": "^4.0.1", + "json-stringify-safe": "^5.0.1", + "JSONStream": "^1.3.5", + "lodash": "^4.17.20", + "uuid": "^8.3.2", + "ws": "^7.4.5" + }, + "bin": { + "jayson": "bin/jayson.js" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jayson/node_modules/JSONStream": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz", + "integrity": "sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==", + "dependencies": { + "jsonparse": "^1.2.0", + "through": ">=2.2.7 <3" + }, + "bin": { + "JSONStream": "bin.js" + }, + "engines": { + "node": "*" + } + }, + "node_modules/js-sha3": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", + "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + }, + "node_modules/js-yaml": { + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", + "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM= sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==" + }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==" + }, + "node_modules/json-schema": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", + "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==" + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + }, + "node_modules/json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus= sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==" + }, + "node_modules/json-text-sequence": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/json-text-sequence/-/json-text-sequence-0.1.1.tgz", + "integrity": "sha1-py8hfcSvxGKf/1/rME3BvVGi89I= sha512-L3mEegEWHRekSHjc7+sc8eJhba9Clq1PZ8kMkzf8OxElhXc8O4TS5MwcVlj9aEbm5dr81N90WHC5nAz3UO971w==", + "dependencies": { + "delimit-stream": "0.1.0" + } + }, + "node_modules/jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/jsonfile/node_modules/universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/jsonparse": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", + "integrity": "sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA= sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==", + "engines": [ + "node >= 0.2.0" + ] + }, + "node_modules/JSONStream": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.2.tgz", + "integrity": "sha1-wQI3G27Dp887hHygDCC7D85Mbeo= sha512-mn0KSip7N4e0UDPZHnqDsHECo5uGQrixQKnAskOM1BIB8hd7QKbd6il8IPRPudPHOeHiECoCFqhyMaRO9+nWyA==", + "dependencies": { + "jsonparse": "^1.2.0", + "through": ">=2.2.7 <3" + }, + "bin": { + "JSONStream": "bin.js" + }, + "engines": { + "node": "*" + } + }, + "node_modules/jsprim": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz", + "integrity": "sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==", + "dependencies": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.4.0", + "verror": "1.10.0" + }, + "engines": { + "node": ">=0.6.0" + } + }, + "node_modules/just-kebab-case": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/just-kebab-case/-/just-kebab-case-1.1.0.tgz", + "integrity": "sha512-QkuwuBMQ9BQHMUEkAtIA4INLrkmnnveqlFB1oFi09gbU0wBdZo6tTnyxNWMR84zHxBuwK7GLAwqN8nrvVxOLTA==" + }, + "node_modules/just-map-keys": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/just-map-keys/-/just-map-keys-1.2.1.tgz", + "integrity": "sha512-Dmyz1Cy2SWM+PpqDPB1kdDglyexdzMthnAsvOIE9w4OPj8NDRuY1mh20x/JfG5w6fCGw9F0WmcofJhYZ4MiuyA==" + }, + "node_modules/keccak": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/keccak/-/keccak-3.0.2.tgz", + "integrity": "sha512-PyKKjkH53wDMLGrvmRGSNWgmSxZOUqbnXwKL9tmgbFYA1iAYqW21kfR7mZXV0MlESiefxQQE9X9fTa3X+2MPDQ==", + "hasInstallScript": true, + "dependencies": { + "node-addon-api": "^2.0.0", + "node-gyp-build": "^4.2.0", + "readable-stream": "^3.6.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/keccak/node_modules/readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/keypair": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/keypair/-/keypair-1.0.4.tgz", + "integrity": "sha512-zwhgOhhniaL7oxMgUMKKw5219PWWABMO+dgMnzJOQ2/5L3XJtTJGhW2PEXlxXj9zaccdReZJZ83+4NPhVfNVDg==" + }, + "node_modules/kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ky": { + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/ky/-/ky-0.11.2.tgz", + "integrity": "sha512-5Aou5BWue5/mkPqIRqzSWW+0Hkl403pr/2AIrCKYw7cVl/Xoe8Xe4KLBO0PRjbz7GnRe1/8wW1KhqQNFFE7/GQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/ky-universal": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/ky-universal/-/ky-universal-0.2.2.tgz", + "integrity": "sha512-fb32o/fKy/ux2ALWa9HU2hvGtfOq7/vn2nH0FpVE+jwNzyTeORlAbj3Fiw+WLMbUlmVqZIWupnLZ2USHvqwZHw==", + "dependencies": { + "abort-controller": "^3.0.0", + "node-fetch": "^2.3.0" + }, + "engines": { + "node": ">=8" + }, + "peerDependencies": { + "ky": ">=0.10.0" + } + }, + "node_modules/libp2p-crypto": { + "version": "0.16.4", + "resolved": "https://registry.npmjs.org/libp2p-crypto/-/libp2p-crypto-0.16.4.tgz", + "integrity": "sha512-II8HxKc9jbmQp34pprlluNxsBCWJDjHRPYJzuRy7ragztNip9Zb7uJ4lCje6gGzz4DNAcHkAUn+GqCIK1592iA==", + "dependencies": { + "asmcrypto.js": "^2.3.2", + "asn1.js": "^5.0.1", + "async": "^2.6.1", + "bn.js": "^4.11.8", + "browserify-aes": "^1.2.0", + "bs58": "^4.0.1", + "iso-random-stream": "^1.1.0", + "keypair": "^1.0.1", + "libp2p-crypto-secp256k1": "~0.3.0", + "multihashing-async": "~0.5.1", + "node-forge": "^0.10.0", + "pem-jwk": "^2.0.0", + "protons": "^1.0.1", + "rsa-pem-to-jwk": "^1.1.3", + "tweetnacl": "^1.0.0", + "ursa-optional": "~0.10.0" + }, + "engines": { + "node": ">=10.0.0", + "npm": ">=6.0.0" + } + }, + "node_modules/libp2p-crypto-secp256k1": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/libp2p-crypto-secp256k1/-/libp2p-crypto-secp256k1-0.3.1.tgz", + "integrity": "sha512-evrfK/CeUSd/lcELUdDruyPBvxDmLairth75S32OLl3H+++2m2fV24JEtxzdFS9JH3xEFw0h6JFO8DBa1bP9dA==", + "deprecated": "Included in libp2p-crypto, use it instead. https://github.com/libp2p/js-libp2p-crypto", + "dependencies": { + "async": "^2.6.2", + "bs58": "^4.0.1", + "multihashing-async": "~0.6.0", + "nodeify": "^1.0.1", + "safe-buffer": "^5.1.2", + "secp256k1": "^3.6.2" + }, + "engines": { + "node": ">=6.0.0", + "npm": ">=3.0.0" + } + }, + "node_modules/libp2p-crypto-secp256k1/node_modules/multihashing-async": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/multihashing-async/-/multihashing-async-0.6.0.tgz", + "integrity": "sha512-Qv8pgg99Lewc191A5nlXy0bSd2amfqlafNJZmarU6Sj7MZVjpR94SCxQjf4DwPtgWZkiLqsjUQBXA2RSq+hYyA==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "blakejs": "^1.1.0", + "js-sha3": "~0.8.0", + "multihashes": "~0.4.13", + "murmurhash3js": "^3.0.1", + "nodeify": "^1.0.1" + }, + "engines": { + "node": ">=6.0.0", + "npm": ">=3.0.0" + } + }, + "node_modules/libp2p-crypto/node_modules/multihashing-async": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/multihashing-async/-/multihashing-async-0.5.2.tgz", + "integrity": "sha512-mmyG6M/FKxrpBh9xQDUvuJ7BbqT93ZeEeH5X6LeMYKoYshYLr9BDdCsvDtZvn+Egf+/Xi+aOznrWL4vp3s+p0Q==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "blakejs": "^1.1.0", + "js-sha3": "~0.8.0", + "multihashes": "~0.4.13", + "murmurhash3js": "^3.0.1", + "nodeify": "^1.0.1" + }, + "engines": { + "node": ">=6.0.0", + "npm": ">=3.0.0" + } + }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==" + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "node_modules/lodash.camelcase": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", + "integrity": "sha1-soqmKIorn8ZRA1x3EfZathkDMaY= sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==" + }, + "node_modules/lodash.kebabcase": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.kebabcase/-/lodash.kebabcase-4.1.1.tgz", + "integrity": "sha1-hImxyw0p/4gZXM7KRI/21swpXDY= sha512-N8XRTIMMqqDgSy4VLKPnJ/+hpGZN+PHQiJnSenYqPaVV/NCqEogTnAdZLQiGKhxX+JCs8waWq2t1XHWKOmlY8g==" + }, + "node_modules/lodash.lowercase": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.lowercase/-/lodash.lowercase-4.3.0.tgz", + "integrity": "sha1-RlFaztSssLcJMTMzOvBo5MOxTp0= sha512-UcvP1IZYyDKyEL64mmrwoA1AbFu5ahojhTtkOUr1K9dbuxzS9ev8i4TxMMGCqRC9TE8uDaSoufNAXxRPNTseVA==" + }, + "node_modules/lodash.lowerfirst": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/lodash.lowerfirst/-/lodash.lowerfirst-4.3.1.tgz", + "integrity": "sha1-3jx7EuAsZSSgBZwvbLfFxSZVoT0= sha512-UUKX7VhP1/JL54NXg2aq/E1Sfnjjes8fNYTNkPU8ZmsaVeBvPHKdbNaN79Re5XRL01u6wbq3j0cbYZj71Fcu5w==" + }, + "node_modules/lodash.pad": { + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/lodash.pad/-/lodash.pad-4.5.1.tgz", + "integrity": "sha1-QzCUmoM6fI2iLMIPaibE1Z3runA= sha512-mvUHifnLqM+03YNzeTBS1/Gr6JRFjd3rRx88FHWUvamVaT9k2O/kXha3yBSOwB9/DTQrSTLJNHvLBBt2FdX7Mg==" + }, + "node_modules/lodash.padend": { + "version": "4.6.1", + "resolved": "https://registry.npmjs.org/lodash.padend/-/lodash.padend-4.6.1.tgz", + "integrity": "sha1-U8y6BH0G4VjTEfRdpiX05J5vFm4= sha512-sOQs2aqGpbl27tmCS1QNZA09Uqp01ZzWfDUoD+xzTii0E7dSQfRKcRetFwa+uXaxaqL+TKm7CgD2JdKP7aZBSw==" + }, + "node_modules/lodash.padstart": { + "version": "4.6.1", + "resolved": "https://registry.npmjs.org/lodash.padstart/-/lodash.padstart-4.6.1.tgz", + "integrity": "sha1-0uPuv/DZ05rVD1y9G1KnvOa7YRs= sha512-sW73O6S8+Tg66eY56DBk85aQzzUJDtpoXFBgELMd5P/SotAguo+1kYO6RuYgXxA4HJH3LFTFPASX6ET6bjfriw==" + }, + "node_modules/lodash.repeat": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/lodash.repeat/-/lodash.repeat-4.1.0.tgz", + "integrity": "sha1-/H3oEx2MisB+S0n3T/6CnR8r7EQ= sha512-eWsgQW89IewS95ZOcr15HHCX6FVDxq3f2PNUIng3fyzsPev9imFQxIYdFZ6crl8L56UR6ZlGDLcEb3RZsCSSqw==" + }, + "node_modules/lodash.snakecase": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.snakecase/-/lodash.snakecase-4.1.1.tgz", + "integrity": "sha1-OdcUo1NXFHg3rv1ktdy7Fr7Nj40= sha512-QZ1d4xoBHYUeuouhEq3lk3Uq7ldgyFXGBhg04+oRLnIz8o9T65Eh+8YdroUwn846zchkA9yDsDl5CVVaV2nqYw==" + }, + "node_modules/lodash.startcase": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.startcase/-/lodash.startcase-4.4.0.tgz", + "integrity": "sha1-lDbjTtJgk+1/+uGTYUQ1CRXZrdg= sha512-+WKqsK294HMSc2jEbNgpHpd0JfIBhp7rEV4aqXWqFr6AlXov+SlcgB1Fv01y2kGe3Gc8nMW7VA0SrGuSkRfIEg==" + }, + "node_modules/lodash.trim": { + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/lodash.trim/-/lodash.trim-4.5.1.tgz", + "integrity": "sha1-NkJefukL5KpeJ7zruFt9EepHqlc= sha512-nJAlRl/K+eiOehWKDzoBVrSMhK0K3A3YQsUNXHQa5yIrKBAhsZgSu3KoAFoFT+mEgiyBHddZ0pRk1ITpIp90Wg==" + }, + "node_modules/lodash.trimend": { + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/lodash.trimend/-/lodash.trimend-4.5.1.tgz", + "integrity": "sha1-EoBENyhrmMrYmWt5QU4RMAEUCC8= sha512-lsD+k73XztDsMBKPKvzHXRKFNMohTjoTKIIo4ADLn5dA65LZ1BqlAvSXhR2rPEC3BgAUQnzMnorqDtqn2z4IHA==" + }, + "node_modules/lodash.trimstart": { + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/lodash.trimstart/-/lodash.trimstart-4.5.1.tgz", + "integrity": "sha1-j/TexTLYJIavWVc8OURZFOlEp/E= sha512-b/+D6La8tU76L/61/aN0jULWHkT0EeJCmVstPBn/K9MtD2qBW83AsBNrr63dKuWYwVMO7ucv13QNO/Ek/2RKaQ==" + }, + "node_modules/lodash.uppercase": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.uppercase/-/lodash.uppercase-4.3.0.tgz", + "integrity": "sha1-xASr/RRp+Tkx+bskz2zH1XBZvHM= sha512-+Nbnxkj7s8K5U8z6KnEYPGUOGp3woZbB7Ecs7v3LkkjLQSm2kP9SKIILitN1ktn2mB/tmM9oSlku06I+/lH7QA==" + }, + "node_modules/lodash.upperfirst": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/lodash.upperfirst/-/lodash.upperfirst-4.3.1.tgz", + "integrity": "sha1-E2Xt9DFIBIHvDRxolXpe2Z1J984= sha512-sReKOYJIJf74dhJONhU4e0/shzi1trVbSWDOhKYE5XV2O+H7Sb2Dihwuc7xWxVl+DgFPyTqIN3zMfT9cq5iWDg==" + }, + "node_modules/log-symbols": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-3.0.0.tgz", + "integrity": "sha512-dSkNGuI7iG3mfvDzUuYZyvk5dD9ocYCYzNU6CYDE6+Xqd+gwme6Z00NS3dUh8mq/73HaEtT7m6W+yUPtU6BZnQ==", + "dependencies": { + "chalk": "^2.4.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/log-symbols/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/log-symbols/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/log-symbols/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/log-symbols/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" + }, + "node_modules/log-symbols/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0= sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "engines": { + "node": ">=4" + } + }, + "node_modules/log-symbols/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/long": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", + "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" + }, + "node_modules/looper": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/looper/-/looper-3.0.0.tgz", + "integrity": "sha1-LvpUw7HLq6m5Su4uWRSwvlf7t0k= sha512-LJ9wplN/uSn72oJRsXTx+snxPet5c8XiZmOKCm906NVYu+ag6SB6vUcnJcWxgnl2NfbIyeobAn7Bwv6xRj2XJg==" + }, + "node_modules/lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dependencies": { + "yallist": "^3.0.2" + } + }, + "node_modules/mafmt": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/mafmt/-/mafmt-7.1.0.tgz", + "integrity": "sha512-vpeo9S+hepT3k2h5iFxzEHvvR0GPBx9uKaErmnRzYNcaKb03DgOArjEMlgG4a9LcuZZ89a3I8xbeto487n26eA==", + "dependencies": { + "multiaddr": "^7.3.0" + } + }, + "node_modules/mafmt/node_modules/cids": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/cids/-/cids-0.8.3.tgz", + "integrity": "sha512-yoXTbV3llpm+EBGWKeL9xKtksPE/s6DPoDSY4fn8I8TEW1zehWXPSB0pwAXVDlLaOlrw+sNynj995uD9abmPhA==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "buffer": "^5.6.0", + "class-is": "^1.1.0", + "multibase": "^1.0.0", + "multicodec": "^1.0.1", + "multihashes": "^1.0.1" + }, + "engines": { + "node": ">=4.0.0", + "npm": ">=3.0.0" + } + }, + "node_modules/mafmt/node_modules/cids/node_modules/multibase": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/multibase/-/multibase-1.0.1.tgz", + "integrity": "sha512-KcCxpBVY8fdVKu4dJMAahq4F/2Z/9xqEjIiR7PiMe7LRGeorFn2NLmicN6nLBCqQvft6MG2Lc9X5P0IdyvnxEw==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "base-x": "^3.0.8", + "buffer": "^5.5.0" + }, + "engines": { + "node": ">=10.0.0", + "npm": ">=6.0.0" + } + }, + "node_modules/mafmt/node_modules/ip-regex": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.3.0.tgz", + "integrity": "sha512-B9ZWJxHHOHUhUjCPrMpLD4xEq35bUTClHM1S6CBU5ixQnkZmwipwgc96vAd7AAGM9TGHvJR+Uss+/Ak6UphK+Q==", + "engines": { + "node": ">=8" + } + }, + "node_modules/mafmt/node_modules/is-ip": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-ip/-/is-ip-3.1.0.tgz", + "integrity": "sha512-35vd5necO7IitFPjd/YBeqwWnyDWbuLH9ZXQdMfDA8TEo7pv5X8yfrvVO3xbJbLUlERCMvf6X0hTUamQxCYJ9Q==", + "dependencies": { + "ip-regex": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/mafmt/node_modules/multiaddr": { + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/multiaddr/-/multiaddr-7.5.0.tgz", + "integrity": "sha512-GvhHsIGDULh06jyb6ev+VfREH9evJCFIRnh3jUt9iEZ6XDbyoisZRFEI9bMvK/AiR6y66y6P+eoBw9mBYMhMvw==", + "dependencies": { + "buffer": "^5.5.0", + "cids": "~0.8.0", + "class-is": "^1.1.0", + "is-ip": "^3.1.0", + "multibase": "^0.7.0", + "varint": "^5.0.0" + } + }, + "node_modules/mafmt/node_modules/multibase": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/multibase/-/multibase-0.7.0.tgz", + "integrity": "sha512-TW8q03O0f6PNFTQDvh3xxH03c8CjGaaYrjkl9UQPG6rz53TQzzxJVCIWVjzcbN/Q5Y53Zd0IBQBMVktVgNx4Fg==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "base-x": "^3.0.8", + "buffer": "^5.5.0" + } + }, + "node_modules/mafmt/node_modules/multicodec": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/multicodec/-/multicodec-1.0.4.tgz", + "integrity": "sha512-NDd7FeS3QamVtbgfvu5h7fd1IlbaC4EQ0/pgU4zqE2vdHCmBGsUa0TiM8/TdSeG6BMPC92OOCf8F1ocE/Wkrrg==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "buffer": "^5.6.0", + "varint": "^5.0.0" + } + }, + "node_modules/mafmt/node_modules/multihashes": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/multihashes/-/multihashes-1.0.1.tgz", + "integrity": "sha512-S27Tepg4i8atNiFaU5ZOm3+gl3KQlUanLs/jWcBxQHFttgq+5x1OgbQmf2d8axJ/48zYGBd/wT9d723USMFduw==", + "dependencies": { + "buffer": "^5.6.0", + "multibase": "^1.0.1", + "varint": "^5.0.0" + }, + "engines": { + "node": ">=10.0.0", + "npm": ">=6.0.0" + } + }, + "node_modules/mafmt/node_modules/multihashes/node_modules/multibase": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/multibase/-/multibase-1.0.1.tgz", + "integrity": "sha512-KcCxpBVY8fdVKu4dJMAahq4F/2Z/9xqEjIiR7PiMe7LRGeorFn2NLmicN6nLBCqQvft6MG2Lc9X5P0IdyvnxEw==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "base-x": "^3.0.8", + "buffer": "^5.5.0" + }, + "engines": { + "node": ">=10.0.0", + "npm": ">=6.0.0" + } + }, + "node_modules/md5.js": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", + "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", + "dependencies": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==" + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "engines": { + "node": ">=6" + } + }, + "node_modules/minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" + }, + "node_modules/minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo= sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==" + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==" + }, + "node_modules/minipass": { + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.1.6.tgz", + "integrity": "sha512-rty5kpw9/z8SX9dmxblFA6edItUmwJgMeYDZRrwlIVN27i8gysGbznJwUggw2V/FVqFSDdWy040ZPS811DYAqQ==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/minipass/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + }, + "node_modules/minizlib": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz", + "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", + "dependencies": { + "minipass": "^3.0.0", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/minizlib/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + }, + "node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node_modules/multiaddr": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/multiaddr/-/multiaddr-6.1.1.tgz", + "integrity": "sha512-Q1Ika0F9MNhMtCs62Ue+GWIJtRFEhZ3Xz8wH7/MZDVZTWhil1/H2bEGN02kUees3hkI3q1oHSjmXYDM0gxaFjQ==", + "dependencies": { + "bs58": "^4.0.1", + "class-is": "^1.1.0", + "hi-base32": "~0.5.0", + "ip": "^1.1.5", + "is-ip": "^2.0.0", + "varint": "^5.0.0" + } + }, + "node_modules/multibase": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/multibase/-/multibase-0.6.1.tgz", + "integrity": "sha512-pFfAwyTjbbQgNc3G7D48JkJxWtoJoBMaR4xQUOuB8RnCgRqaYmWNFeJTTvrJ2w51bjLq2zTby6Rqj9TQ9elSUw==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "base-x": "^3.0.8", + "buffer": "^5.5.0" + } + }, + "node_modules/multicodec": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/multicodec/-/multicodec-0.5.7.tgz", + "integrity": "sha512-PscoRxm3f+88fAtELwUnZxGDkduE2HD9Q6GHUOywQLjOGT/HAdhjLDYNZ1e7VR0s0TP0EwZ16LNUTFpoBGivOA==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "varint": "^5.0.0" + } + }, + "node_modules/multihashes": { + "version": "0.4.21", + "resolved": "https://registry.npmjs.org/multihashes/-/multihashes-0.4.21.tgz", + "integrity": "sha512-uVSvmeCWf36pU2nB4/1kzYZjsXD9vofZKpgudqkceYY5g2aZZXJ5r9lxuzoRLl1OAp28XljXsEJ/X/85ZsKmKw==", + "dependencies": { + "buffer": "^5.5.0", + "multibase": "^0.7.0", + "varint": "^5.0.0" + } + }, + "node_modules/multihashes/node_modules/multibase": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/multibase/-/multibase-0.7.0.tgz", + "integrity": "sha512-TW8q03O0f6PNFTQDvh3xxH03c8CjGaaYrjkl9UQPG6rz53TQzzxJVCIWVjzcbN/Q5Y53Zd0IBQBMVktVgNx4Fg==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "base-x": "^3.0.8", + "buffer": "^5.5.0" + } + }, + "node_modules/multihashing-async": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/multihashing-async/-/multihashing-async-0.8.2.tgz", + "integrity": "sha512-2lKa1autuCy8x7KIEj9aVNbAb3aIMRFYIwN7mq/zD4pxgNIVgGlm+f6GKY4880EOF2Y3GktHYssRy7TAJQ2DyQ==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "blakejs": "^1.1.0", + "buffer": "^5.4.3", + "err-code": "^2.0.0", + "js-sha3": "^0.8.0", + "multihashes": "^1.0.1", + "murmurhash3js-revisited": "^3.0.0" + }, + "engines": { + "node": ">=10.0.0", + "npm": ">=6.0.0" + } + }, + "node_modules/multihashing-async/node_modules/multibase": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/multibase/-/multibase-1.0.1.tgz", + "integrity": "sha512-KcCxpBVY8fdVKu4dJMAahq4F/2Z/9xqEjIiR7PiMe7LRGeorFn2NLmicN6nLBCqQvft6MG2Lc9X5P0IdyvnxEw==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "base-x": "^3.0.8", + "buffer": "^5.5.0" + }, + "engines": { + "node": ">=10.0.0", + "npm": ">=6.0.0" + } + }, + "node_modules/multihashing-async/node_modules/multihashes": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/multihashes/-/multihashes-1.0.1.tgz", + "integrity": "sha512-S27Tepg4i8atNiFaU5ZOm3+gl3KQlUanLs/jWcBxQHFttgq+5x1OgbQmf2d8axJ/48zYGBd/wT9d723USMFduw==", + "dependencies": { + "buffer": "^5.6.0", + "multibase": "^1.0.1", + "varint": "^5.0.0" + }, + "engines": { + "node": ">=10.0.0", + "npm": ">=6.0.0" + } + }, + "node_modules/murmurhash3js": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/murmurhash3js/-/murmurhash3js-3.0.1.tgz", + "integrity": "sha1-Ppg+W0fCoG9DpxMXTn5DXKBEuZg= sha512-KL8QYUaxq7kUbcl0Yto51rMcYt7E/4N4BG3/c96Iqw1PQrTRspu8Cpx4TZ4Nunib1d4bEkIH3gjCYlP2RLBdow==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/murmurhash3js-revisited": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/murmurhash3js-revisited/-/murmurhash3js-revisited-3.0.0.tgz", + "integrity": "sha512-/sF3ee6zvScXMb1XFJ8gDsSnY+X8PbOyjIuBhtgis10W2Jx4ZjIhikUCIF9c4gpJxVnQIsPAFrSwTCuAjicP6g==", + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/mute-stream": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", + "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==" + }, + "node_modules/nan": { + "version": "2.15.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.15.0.tgz", + "integrity": "sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ==" + }, + "node_modules/ndjson": { + "version": "1.5.0", + "resolved": "git+ssh://git@github.com/hugomrdias/ndjson.git#4db16da6b42e5b39bf300c3a7cde62abb3fa3a11", + "license": "BSD-3-Clause", + "dependencies": { + "json-stringify-safe": "^5.0.1", + "minimist": "^1.2.0", + "split2": "^3.1.0", + "through2": "^3.0.0" + }, + "bin": { + "ndjson": "cli.js" + } + }, + "node_modules/node-addon-api": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", + "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==" + }, + "node_modules/node-fetch": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", + "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==", + "engines": { + "node": "4.x || >=6.0.0" + } + }, + "node_modules/node-forge": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz", + "integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==", + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/node-gyp-build": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.5.0.tgz", + "integrity": "sha512-2iGbaQBV+ITgCz76ZEjmhUKAKVf7xfY1sRl4UiKQspfZMH2h06SyhNsnSVy50cwkFQDGLyif6m/6uFXHkOZ6rg==", + "bin": { + "node-gyp-build": "bin.js", + "node-gyp-build-optional": "optional.js", + "node-gyp-build-test": "build-test.js" + } + }, + "node_modules/nodeify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/nodeify/-/nodeify-1.0.1.tgz", + "integrity": "sha1-ZKtpp7268DzhB7TwM1yHwLnpGx0= sha512-n7C2NyEze8GCo/z73KdbjRsBiLbv6eBn1FxwYKQ23IqGo7pQY3mhQan61Sv7eEDJCiyUjTVrVkXTzJCo1dW7Aw==", + "dependencies": { + "is-promise": "~1.0.0", + "promise": "~1.3.0" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dependencies": { + "path-key": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/number-to-bn": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/number-to-bn/-/number-to-bn-1.7.0.tgz", + "integrity": "sha512-wsJ9gfSz1/s4ZsJN01lyonwuxA1tml6X1yBDnfpMglypcBRFZZkus26EdPSlqS5GJfYddVZa22p3VNb3z5m5Ig==", + "dependencies": { + "bn.js": "4.11.6", + "strip-hex-prefix": "1.0.0" + }, + "engines": { + "node": ">=6.5.0", + "npm": ">=3" + } + }, + "node_modules/number-to-bn/node_modules/bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha512-XWwnNNFCuuSQ0m3r3C4LE3EiORltHd9M05pq6FOlVeiophzRbMo50Sbz1ehl8K3Z+jw9+vmgnXefY1hz8X+2wA==" + }, + "node_modules/oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", + "engines": { + "node": "*" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.0.tgz", + "integrity": "sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E= sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/optimist": { + "version": "0.3.7", + "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.3.7.tgz", + "integrity": "sha1-yQlBrVnkJzMokjB00s8ufLxuwNk= sha512-TCx0dXQzVtSCg2OgY/bO9hjM9cV4XYx09TVK+s3+FhkjT6LovsLe+pPMzpWf+6yXK/hUizs2gUoTw3jHM0VaTQ==", + "dependencies": { + "wordwrap": "~0.0.2" + } + }, + "node_modules/ora": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ora/-/ora-4.1.1.tgz", + "integrity": "sha512-sjYP8QyVWBpBZWD6Vr1M/KwknSw6kJOz41tvGMlwWeClHBtYKTbHMki1PsLZnxKpXMPbTKv9b3pjQu3REib96A==", + "dependencies": { + "chalk": "^3.0.0", + "cli-cursor": "^3.1.0", + "cli-spinners": "^2.2.0", + "is-interactive": "^1.0.0", + "log-symbols": "^3.0.0", + "mute-stream": "0.0.8", + "strip-ansi": "^6.0.0", + "wcwidth": "^1.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-finally": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-2.0.1.tgz", + "integrity": "sha512-vpm09aKwq6H9phqRQzecoDpD8TmVyGw70qmWlyq5onxY7tqyTTFVvxMykxQSQKILBSFlbXpypIw2T1Ml7+DDtw==", + "engines": { + "node": ">=8" + } + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/parse-cache-control": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parse-cache-control/-/parse-cache-control-1.0.1.tgz", + "integrity": "sha512-60zvsJReQPX5/QP0Kzfd/VrpjScIQ7SHBW6bFCYfEP+fp0Eppr1SHhIO5nd1PjZtvclzSzES9D/p5nFJurwfWg==" + }, + "node_modules/parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "dependencies": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18= sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "engines": { + "node": ">=8" + } + }, + "node_modules/pbkdf2": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.2.tgz", + "integrity": "sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA==", + "dependencies": { + "create-hash": "^1.1.2", + "create-hmac": "^1.1.4", + "ripemd160": "^2.0.1", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + }, + "engines": { + "node": ">=0.12" + } + }, + "node_modules/peer-id": { + "version": "0.12.5", + "resolved": "https://registry.npmjs.org/peer-id/-/peer-id-0.12.5.tgz", + "integrity": "sha512-3xVWrtIvNm9/OPzaQBgXDrfWNx63AftgFQkvqO6YSZy7sP3Fuadwwbn54F/VO9AnpyW/26i0WRQz9FScivXrmw==", + "dependencies": { + "async": "^2.6.3", + "class-is": "^1.1.0", + "libp2p-crypto": "~0.16.1", + "multihashes": "~0.4.15" + }, + "bin": { + "peer-id": "src/bin.js" + }, + "engines": { + "node": ">=10.0.0", + "npm": ">=6.0.0" + } + }, + "node_modules/peer-info": { + "version": "0.15.1", + "resolved": "https://registry.npmjs.org/peer-info/-/peer-info-0.15.1.tgz", + "integrity": "sha512-Y91Q2tZRC0CpSTPd1UebhGqniOrOAk/aj60uYUcWJXCoLTAnGu+4LJGoiay8ayudS6ice7l3SKhgL/cS62QacA==", + "deprecated": "No longer supported for js-libp2p0.28.0 or later", + "dependencies": { + "mafmt": "^6.0.2", + "multiaddr": "^6.0.3", + "peer-id": "~0.12.2", + "unique-by": "^1.0.0" + }, + "engines": { + "node": ">=10.0.0", + "npm": ">=6.0.0" + } + }, + "node_modules/peer-info/node_modules/mafmt": { + "version": "6.0.10", + "resolved": "https://registry.npmjs.org/mafmt/-/mafmt-6.0.10.tgz", + "integrity": "sha512-FjHDnew6dW9lUu3eYwP0FvvJl9uvNbqfoJM+c1WJcSyutNEIlyu6v3f/rlPnD1cnmue38IjuHlhBdIh3btAiyw==", + "dependencies": { + "multiaddr": "^6.1.0" + } + }, + "node_modules/pem-jwk": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pem-jwk/-/pem-jwk-2.0.0.tgz", + "integrity": "sha512-rFxu7rVoHgQ5H9YsP50dDWf0rHjreVA2z0yPiWr5WdH/UHb29hKtF7h6l8vNd1cbYR1t0QL+JKhW55a2ZV4KtA==", + "dependencies": { + "asn1.js": "^5.0.1" + }, + "bin": { + "pem-jwk": "bin/pem-jwk.js" + }, + "engines": { + "node": ">=5.10.0" + } + }, + "node_modules/performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==" + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pkginfo": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.4.1.tgz", + "integrity": "sha512-8xCNE/aT/EXKenuMDZ+xTVwkT8gsoHN2z/Q29l80u0ppGEXVvsKRzNMbtKhg8LS8k1tJLAHHylf6p4VFmP6XUQ==", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/pluralize": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz", + "integrity": "sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==", + "engines": { + "node": ">=4" + } + }, + "node_modules/prettier": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz", + "integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==", + "dev": true, + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" + }, + "node_modules/promise": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/promise/-/promise-1.3.0.tgz", + "integrity": "sha1-5cyaTIJ45GZP/twBx9qEhCsEAXU= sha512-R9WrbTF3EPkVtWjp7B7umQGVndpsi+rsDAfrR4xAALQpFLa/+2OriecLhawxzvii2gd9+DZFwROWDuUUaqS5yA==", + "dependencies": { + "is-promise": "~1" + } + }, + "node_modules/promise-nodeify": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/promise-nodeify/-/promise-nodeify-3.0.1.tgz", + "integrity": "sha512-ghsSuzZXJX8iO7WVec2z7GI+Xk/EyiD+JZK7AZKhUqYfpLa/Zs4ylUD+CwwnKlG6G3HnkUPMAi6PO7zeqGKssg==", + "engines": { + "node": ">=6", + "npm": ">=1.3.7" + } + }, + "node_modules/promisify-es6": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/promisify-es6/-/promisify-es6-1.0.3.tgz", + "integrity": "sha512-N9iVG+CGJsI4b4ZGazjwLnxErD2d9Pe4DPvvXSxYA9tFNu8ymXME4Qs5HIQ0LMJpNM7zj+m0NlNnNeqFpKzqnA==", + "deprecated": "Unmaintained" + }, + "node_modules/protocol-buffers-schema": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/protocol-buffers-schema/-/protocol-buffers-schema-3.6.0.tgz", + "integrity": "sha512-TdDRD+/QNdrCGCE7v8340QyuXd4kIWIgapsE2+n/SaGiSSbomYl4TjHlvIoCWRpE7wFt02EpB35VVA2ImcBVqw==" + }, + "node_modules/protons": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/protons/-/protons-1.2.1.tgz", + "integrity": "sha512-2oqDyc/SN+tNcJf8XxrXhYL7sQn2/OMl8mSdD7NVGsWjMEmAbks4eDVnCyf0vAoRbBWyWTEXWk4D8XfuKVl3zg==", + "deprecated": "This module is no longer maintained", + "dependencies": { + "buffer": "^5.5.0", + "protocol-buffers-schema": "^3.3.1", + "signed-varint": "^2.0.1", + "varint": "^5.0.0" + } + }, + "node_modules/psl": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", + "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==" + }, + "node_modules/pull-defer": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/pull-defer/-/pull-defer-0.2.3.tgz", + "integrity": "sha512-/An3KE7mVjZCqNhZsr22k1Tx8MACnUnHZZNPSJ0S62td8JtYr/AiRG42Vz7Syu31SoTLUzVIe61jtT/pNdjVYA==" + }, + "node_modules/pull-stream": { + "version": "3.6.14", + "resolved": "https://registry.npmjs.org/pull-stream/-/pull-stream-3.6.14.tgz", + "integrity": "sha512-KIqdvpqHHaTUA2mCYcLG1ibEbu/LCKoJZsBWyv9lSYtPkJPBq8m3Hxa103xHi6D2thj5YXa0TqK3L3GUkwgnew==" + }, + "node_modules/pull-to-stream": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/pull-to-stream/-/pull-to-stream-0.1.1.tgz", + "integrity": "sha512-thZkMv6F9PILt9zdvpI2gxs19mkDrlixYKX6cOBxAW16i1NZH+yLAmF4r8QfJ69zuQh27e01JZP9y27tsH021w==", + "dependencies": { + "readable-stream": "^3.1.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/pull-to-stream/node_modules/readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "engines": { + "node": ">=6" + } + }, + "node_modules/qs": { + "version": "6.10.3", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz", + "integrity": "sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==", + "dependencies": { + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/ramda": { + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/ramda/-/ramda-0.25.0.tgz", + "integrity": "sha512-GXpfrYVPwx3K7RQ6aYT8KPS8XViSXUVJT1ONhoKPE9VAleW42YE+U+8VEyGWt41EnEQW7gwecYJriTI0pKoecQ==" + }, + "node_modules/ramdasauce": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ramdasauce/-/ramdasauce-2.1.3.tgz", + "integrity": "sha512-Ml3CPim4SKwmg5g9UI77lnRSeKr/kQw7YhQ6rfdMcBYy6DMlwmkEwQqjygJ3OhxPR+NfFfpjKl3Tf8GXckaqqg==", + "dependencies": { + "ramda": "^0.24.1" + } + }, + "node_modules/ramdasauce/node_modules/ramda": { + "version": "0.24.1", + "resolved": "https://registry.npmjs.org/ramda/-/ramda-0.24.1.tgz", + "integrity": "sha1-w7d1UZfzW43DUCIoJixMkd22uFc= sha512-HEm619G8PaZMfkqCa23qiOe7r3R0brPu7ZgOsgKUsnvLhd0qhc/vTjkUovomgPWa5ECBa08fJZixth9LaoBo5w==" + }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, + "node_modules/readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/readable-stream/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "node_modules/readable-stream/node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/readdirp": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz", + "integrity": "sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/regenerator-runtime": { + "version": "0.13.10", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.10.tgz", + "integrity": "sha512-KepLsg4dU12hryUO7bp/axHAKvwGOCV0sGloQtpagJ12ai+ojVDqkeGSiRX1zlq+kjIMZ1t7gpze+26QqtdGqw==" + }, + "node_modules/request": { + "version": "2.88.2", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", + "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", + "deprecated": "request has been deprecated, see https://github.com/request/request/issues/3142", + "dependencies": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.3", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.5.0", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/request/node_modules/qs": { + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz", + "integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/request/node_modules/uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", + "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", + "bin": { + "uuid": "bin/uuid" + } + }, + "node_modules/rescript": { + "version": "9.1.4", + "resolved": "https://registry.npmjs.org/rescript/-/rescript-9.1.4.tgz", + "integrity": "sha512-aXANK4IqecJzdnDpJUsU6pxMViCR5ogAxzuqS0mOr8TloMnzAjJFu63fjD6LCkWrKAhlMkFFzQvVQYaAaVkFXw==", + "hasInstallScript": true, + "bin": { + "bsc": "bsc", + "bsrefmt": "bsrefmt", + "bstracing": "lib/bstracing", + "rescript": "rescript" + } + }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "engines": { + "node": ">=4" + } + }, + "node_modules/restore-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", + "dependencies": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/ripemd160": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", + "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", + "dependencies": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1" + } + }, + "node_modules/rlp": { + "version": "2.2.7", + "resolved": "https://registry.npmjs.org/rlp/-/rlp-2.2.7.tgz", + "integrity": "sha512-d5gdPmgQ0Z+AklL2NVXr/IoSjNZFfTVvQWzL/AM2AOcSzYP2xjlb0AC8YyCLc41MSNf6P6QVtjgPdmVtzb+4lQ==", + "dependencies": { + "bn.js": "^5.2.0" + }, + "bin": { + "rlp": "bin/rlp" + } + }, + "node_modules/rlp/node_modules/bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + }, + "node_modules/rsa-pem-to-jwk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/rsa-pem-to-jwk/-/rsa-pem-to-jwk-1.1.3.tgz", + "integrity": "sha1-JF52vbfnI0z+58oDLTG1TDj6uY4= sha512-ZlVavEvTnD8Rzh/pdB8NH4VF5GNEtF6biGQcTtC4GKFMsbZR08oHtOYefbhCN+JnJIuMItiCDCMycdcMrw6blA==", + "dependencies": { + "object-assign": "^2.0.0", + "rsa-unpack": "0.0.6" + } + }, + "node_modules/rsa-pem-to-jwk/node_modules/object-assign": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-2.1.1.tgz", + "integrity": "sha1-Q8NuXVaf+OSBbE76i+AtJpZ8GKo= sha512-CdsOUYIh5wIiozhJ3rLQgmUTgcyzFwZZrqhkKhODMoGtPKM+wt0h0CNIoauJWMsS9822EdzPsF/6mb4nLvPN5g==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/rsa-unpack": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/rsa-unpack/-/rsa-unpack-0.0.6.tgz", + "integrity": "sha1-9Q69VqYoN45jHylxYQJs6atO3bo= sha512-HRrl8GHjjPziPFRDJPq/v5OxZ3IPdksV5h3cime/oHgcgM1k1toO5OdtzClgBqRf5dF6IgptOB0g/zFb0w5zQw==", + "dependencies": { + "optimist": "~0.3.5" + }, + "bin": { + "rsa-unpack": "bin/cmd.js" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "node_modules/scrypt-js": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-3.0.1.tgz", + "integrity": "sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==" + }, + "node_modules/secp256k1": { + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-3.8.0.tgz", + "integrity": "sha512-k5ke5avRZbtl9Tqx/SA7CbY3NF6Ro+Sj9cZxezFzuBlLDmyqPiL8hJJ+EmzD8Ig4LUDByHJ3/iPOVoRixs/hmw==", + "hasInstallScript": true, + "dependencies": { + "bindings": "^1.5.0", + "bip66": "^1.1.5", + "bn.js": "^4.11.8", + "create-hash": "^1.2.0", + "drbg.js": "^1.0.1", + "elliptic": "^6.5.2", + "nan": "^2.14.0", + "safe-buffer": "^5.1.2" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/semver/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/semver/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + }, + "node_modules/setimmediate": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", + "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==" + }, + "node_modules/sha.js": { + "version": "2.4.11", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", + "dependencies": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + }, + "bin": { + "sha.js": "bin.js" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "engines": { + "node": ">=8" + } + }, + "node_modules/side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dependencies": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" + }, + "node_modules/signed-varint": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/signed-varint/-/signed-varint-2.0.1.tgz", + "integrity": "sha1-UKmYnafJjCxh2tEZvJdHDvhSgSk= sha512-abgDPg1106vuZZOvw7cFwdCABddfJRz5akcCcchzTbhyhYnsG31y4AlZEgp315T7W3nQq5P4xeOm186ZiPVFzw==", + "dependencies": { + "varint": "~5.0.0" + } + }, + "node_modules/split-ca": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/split-ca/-/split-ca-1.0.1.tgz", + "integrity": "sha1-bIOv82kvphJW4M0ZfgXp3hV2kaY= sha512-Q5thBSxp5t8WPTTJQS59LrGqOZqOsrhDGDVm8azCqIBjSBd7nd9o2PM+mDulQQkh8h//4U6hFZnc/mul8t5pWQ==" + }, + "node_modules/split2": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/split2/-/split2-3.2.2.tgz", + "integrity": "sha512-9NThjpgZnifTkJpzTZ7Eue85S49QwpNhZTq6GRJwObb6jnLFNGB7Qm73V5HewTROPyxD0C29xqmaI68bQtV+hg==", + "dependencies": { + "readable-stream": "^3.0.0" + } + }, + "node_modules/split2/node_modules/readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==" + }, + "node_modules/sshpk": { + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.17.0.tgz", + "integrity": "sha512-/9HIEs1ZXGhSPE8X6Ccm7Nam1z8KcoCqPdI7ecm1N33EzAetWahvQWVqLZtaZQ+IDKX4IyA2o0gBzqIMkAagHQ==", + "dependencies": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + }, + "bin": { + "sshpk-conv": "bin/sshpk-conv", + "sshpk-sign": "bin/sshpk-sign", + "sshpk-verify": "bin/sshpk-verify" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sshpk/node_modules/tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q= sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==" + }, + "node_modules/stable": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/stable/-/stable-0.1.8.tgz", + "integrity": "sha512-ji9qxRnOVfcuLDySj9qzhGSEFVobyt1kIOSkj1qZzYLzq7Tos/oUUWvotUPQLlrsidqsK6tBH89Bc9kL5zHA6w==", + "deprecated": "Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility" + }, + "node_modules/stream-to-pull-stream": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/stream-to-pull-stream/-/stream-to-pull-stream-1.7.3.tgz", + "integrity": "sha512-6sNyqJpr5dIOQdgNy/xcDWwDuzAsAwVzhzrWlAPAQ7Lkjx/rv0wgvxEyKwTq6FmNd5rjTrELt/CLmaSw7crMGg==", + "dependencies": { + "looper": "^3.0.0", + "pull-stream": "^3.2.3" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dependencies": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/string-width/node_modules/ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg= sha512-wFUFA5bg5dviipbQQ32yOQhl6gcJaJXiHE7dvR8VYPG97+J/GNC5FKGepKdEDUFeXRzDxPF1X/Btc8L+v7oqIQ==", + "engines": { + "node": ">=4" + } + }, + "node_modules/string-width/node_modules/strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8= sha512-4XaJ2zQdCzROZDivEVIDPkcQn8LMFSa8kj8Gxb/Lnwzv9A8VctNZ+lfivC/sV3ivW8ElJTERXZoPBRrZKkNKow==", + "dependencies": { + "ansi-regex": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "engines": { + "node": ">=6" + } + }, + "node_modules/strip-hex-prefix": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz", + "integrity": "sha512-q8d4ue7JGEiVcypji1bALTos+0pWtyGlivAWyPuTkHzuTCJqrK9sWxYQZUq6Nq3cuyv3bm734IhHvHtGGURU6A==", + "dependencies": { + "is-hex-prefixed": "1.0.0" + }, + "engines": { + "node": ">=6.5.0", + "npm": ">=3" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/sync-request": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/sync-request/-/sync-request-6.1.0.tgz", + "integrity": "sha512-8fjNkrNlNCrVc/av+Jn+xxqfCjYaBoHqCsDz6mt030UMxJGr+GSfCV1dQt2gRtlL63+VPidwDVLr7V2OcTSdRw==", + "dependencies": { + "http-response-object": "^3.0.1", + "sync-rpc": "^1.2.1", + "then-request": "^6.0.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/sync-rpc": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/sync-rpc/-/sync-rpc-1.3.6.tgz", + "integrity": "sha512-J8jTXuZzRlvU7HemDgHi3pGnh/rkoqR/OZSjhTyyZrEkkYQbk7Z33AXp37mkPfPpfdOuj7Ex3H/TJM1z48uPQw==", + "dependencies": { + "get-port": "^3.1.0" + } + }, + "node_modules/tar": { + "version": "6.1.11", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.11.tgz", + "integrity": "sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA==", + "dependencies": { + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "minipass": "^3.0.0", + "minizlib": "^2.1.1", + "mkdirp": "^1.0.3", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/tar-fs": { + "version": "1.16.3", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-1.16.3.tgz", + "integrity": "sha512-NvCeXpYx7OsmOh8zIOP/ebG55zZmxLE0etfWRbWok+q2Qo8x/vOR/IJT1taADXPe+jsiu9axDb3X4B+iIgNlKw==", + "dependencies": { + "chownr": "^1.0.1", + "mkdirp": "^0.5.1", + "pump": "^1.0.0", + "tar-stream": "^1.1.2" + } + }, + "node_modules/tar-fs/node_modules/bl": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.3.tgz", + "integrity": "sha512-pvcNpa0UU69UT341rO6AYy4FVAIkUHuZXRIWbq+zHnsVcRzDDjIAhGuuYoi0d//cwIwtt4pkpKycWEfjdV+vww==", + "dependencies": { + "readable-stream": "^2.3.5", + "safe-buffer": "^5.1.1" + } + }, + "node_modules/tar-fs/node_modules/chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==" + }, + "node_modules/tar-fs/node_modules/mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "dependencies": { + "minimist": "^1.2.6" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/tar-fs/node_modules/pump": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/pump/-/pump-1.0.3.tgz", + "integrity": "sha512-8k0JupWme55+9tCVE+FS5ULT3K6AbgqrGa58lTT49RpyfwwcGedHqaC5LlQNdEAumn/wFsu6aPwkuPMioy8kqw==", + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/tar-fs/node_modules/tar-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-1.6.2.tgz", + "integrity": "sha512-rzS0heiNf8Xn7/mpdSVVSMAWAoy9bfb1WOTYC78Z0UQKeKa/CWS8FOq0lKGNa8DWKAn9gxjCvMLYc5PGXYlK2A==", + "dependencies": { + "bl": "^1.0.0", + "buffer-alloc": "^1.2.0", + "end-of-stream": "^1.0.0", + "fs-constants": "^1.0.0", + "readable-stream": "^2.3.0", + "to-buffer": "^1.1.1", + "xtend": "^4.0.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/tar-stream": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", + "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", + "dependencies": { + "bl": "^4.0.3", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/tar-stream/node_modules/bl": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "dependencies": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "node_modules/tar-stream/node_modules/readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/tar/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + }, + "node_modules/then-request": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/then-request/-/then-request-6.0.2.tgz", + "integrity": "sha512-3ZBiG7JvP3wbDzA9iNY5zJQcHL4jn/0BWtXIkagfz7QgOL/LqjCEOBQuJNZfu0XYnv5JhKh+cDxCPM4ILrqruA==", + "dependencies": { + "@types/concat-stream": "^1.6.0", + "@types/form-data": "0.0.33", + "@types/node": "^8.0.0", + "@types/qs": "^6.2.31", + "caseless": "~0.12.0", + "concat-stream": "^1.6.0", + "form-data": "^2.2.0", + "http-basic": "^8.1.1", + "http-response-object": "^3.0.1", + "promise": "^8.0.0", + "qs": "^6.4.0" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/then-request/node_modules/@types/node": { + "version": "8.10.66", + "resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.66.tgz", + "integrity": "sha512-tktOkFUA4kXx2hhhrB8bIFb5TbwzS4uOhKEmwiD+NoiL0qtP2OQ9mFldbgD4dV1djrlBYP6eBuQZiWjuHUpqFw==" + }, + "node_modules/then-request/node_modules/promise": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/promise/-/promise-8.3.0.tgz", + "integrity": "sha512-rZPNPKTOYVNEEKFaq1HqTgOwZD+4/YHS5ukLzQCypkj+OkYx7iv0mA91lJlpPPZ8vMau3IIGj5Qlwrx+8iiSmg==", + "dependencies": { + "asap": "~2.0.6" + } + }, + "node_modules/through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU= sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==" + }, + "node_modules/through2": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/through2/-/through2-3.0.2.tgz", + "integrity": "sha512-enaDQ4MUyP2W6ZyT6EsMzqBPZaM/avg8iuo+l2d3QCs0J+6RaqkHV/2/lOwDTueBHeJ/2LG9lrLW3d5rWPucuQ==", + "dependencies": { + "inherits": "^2.0.4", + "readable-stream": "2 || 3" + } + }, + "node_modules/tmp": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", + "integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==", + "dependencies": { + "rimraf": "^3.0.0" + }, + "engines": { + "node": ">=8.17.0" + } + }, + "node_modules/tmp-promise": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/tmp-promise/-/tmp-promise-3.0.2.tgz", + "integrity": "sha512-OyCLAKU1HzBjL6Ev3gxUeraJNlbNingmi8IrHHEsYH8LTmEuhvYfqvhn2F/je+mjf4N58UmZ96OMEy1JanSCpA==", + "dependencies": { + "tmp": "^0.2.0" + } + }, + "node_modules/to-buffer": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/to-buffer/-/to-buffer-1.1.1.tgz", + "integrity": "sha512-lx9B5iv7msuFYE3dytT+KE5tap+rNYw+K4jVkb9R/asAb+pbBSM17jtunHplhBe6RRJdZx3Pn2Jph24O32mOVg==" + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/tough-cookie": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", + "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "dependencies": { + "psl": "^1.1.28", + "punycode": "^2.1.1" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0= sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", + "dependencies": { + "safe-buffer": "^5.0.1" + }, + "engines": { + "node": "*" + } + }, + "node_modules/tweetnacl": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", + "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==" + }, + "node_modules/typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==" + }, + "node_modules/typescript": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/unique-by": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unique-by/-/unique-by-1.0.0.tgz", + "integrity": "sha1-UiDIa6e8Vy+3E610ZRRwy2RCEr0= sha512-rJRXK5V0zL6TiSzhoGNpJp5dr+TZBLoPJFC06rLn17Ug++7Aa0Qnve5v+skXeQxx6/sI7rBsSesa6MAcmFi8Ew==", + "engines": { + "node": ">= 0.10.x" + } + }, + "node_modules/universalify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-1.0.0.tgz", + "integrity": "sha512-rb6X1W158d7pRQBg5gkR8uPaSfiids68LTJQYOtEUhoJUWBdaQHsuT/EUduxXYxcrt4r5PJ4fuHW1MHT6p0qug==", + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/ursa-optional": { + "version": "0.10.2", + "resolved": "https://registry.npmjs.org/ursa-optional/-/ursa-optional-0.10.2.tgz", + "integrity": "sha512-TKdwuLboBn7M34RcvVTuQyhvrA8gYKapuVdm0nBP0mnBc7oECOfUQZrY91cefL3/nm64ZyrejSRrhTVdX7NG/A==", + "hasInstallScript": true, + "dependencies": { + "bindings": "^1.5.0", + "nan": "^2.14.2" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/utf8": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/utf8/-/utf8-3.0.0.tgz", + "integrity": "sha512-E8VjFIQ/TyQgp+TZfS6l8yp/xWppSAHzidGiRrqe4bK4XP9pTRyKFgGJpO3SN7zdX4DeomTrwaseCHovfpFcqQ==" + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, + "node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/varint": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/varint/-/varint-5.0.2.tgz", + "integrity": "sha512-lKxKYG6H03yCZUpAGOPOsMcGxd1RHCu1iKvEHYDPmTyq2HueGhD73ssNBqqQWfvYs04G9iUFRvmAVLW20Jw6ow==" + }, + "node_modules/verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA= sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==", + "engines": [ + "node >=0.6.0" + ], + "dependencies": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "node_modules/verror/node_modules/core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==" + }, + "node_modules/wcwidth": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", + "integrity": "sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g= sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==", + "dependencies": { + "defaults": "^1.0.3" + } + }, + "node_modules/web3-eth-abi": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.7.0.tgz", + "integrity": "sha512-heqR0bWxgCJwjWIhq2sGyNj9bwun5+Xox/LdZKe+WMyTSy0cXDXEAgv3XKNkXC4JqdDt/ZlbTEx4TWak4TRMSg==", + "dependencies": { + "@ethersproject/abi": "5.0.7", + "web3-utils": "1.7.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/web3-utils": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.7.0.tgz", + "integrity": "sha512-O8Tl4Ky40Sp6pe89Olk2FsaUkgHyb5QAXuaKo38ms3CxZZ4d3rPGfjP9DNKGm5+IUgAZBNpF1VmlSmNCqfDI1w==", + "dependencies": { + "bn.js": "^4.11.9", + "ethereum-bloom-filters": "^1.0.6", + "ethereumjs-util": "^7.1.0", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randombytes": "^2.1.0", + "utf8": "3.0.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/wordwrap": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", + "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc= sha512-1tMA907+V4QmxV7dbRvb4/8MaRALK6q9Abid3ndMYnbyo8piisCmeONVqVSXqQA3KaP4SLt5b7ud6E2sqP8TFw==", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + }, + "node_modules/ws": { + "version": "7.5.7", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.7.tgz", + "integrity": "sha512-KMvVuFzpKBuiIXW3E4u3mySRO2/mCHSyZDJQM5NQ9Q9KHWHWh0NHgfbRMLLrceUK5qAL4ytALJbpRMjixFZh8A==", + "engines": { + "node": ">=8.3.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "engines": { + "node": ">=0.4" + } + }, + "node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" + }, + "node_modules/yaml": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.9.2.tgz", + "integrity": "sha512-HPT7cGGI0DuRcsO51qC1j9O16Dh1mZ2bnXwsi0jrSpsLz0WxOLSLXfkABVl6bZO629py3CU+OMJtpNHDLB97kg==", + "dependencies": { + "@babel/runtime": "^7.9.2" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/yargs-parser": { + "version": "16.1.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-16.1.0.tgz", + "integrity": "sha512-H/V41UNZQPkUMIT5h5hiwg4QKIY1RPvoBV4XcjUbRM8Bk2oKqqyZ0DIEbTFZB0XjbtSPG8SAa/0DxCQmiRgzKg==", + "dependencies": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + } + }, + "dependencies": { + "@babel/code-frame": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz", + "integrity": "sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==", + "requires": { + "@babel/highlight": "^7.16.7" + } + }, + "@babel/helper-validator-identifier": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz", + "integrity": "sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw==" + }, + "@babel/highlight": { + "version": "7.16.10", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.16.10.tgz", + "integrity": "sha512-5FnTQLSLswEj6IkgVw5KusNUUFY9ZGqe/TRFnP/BKYHYgfh7tc+C7mwiy95/yNP7Dh9x580Vv8r7u7ZfTBFxdw==", + "requires": { + "@babel/helper-validator-identifier": "^7.16.7", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0= sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==" + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "@babel/runtime": { + "version": "7.20.1", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.1.tgz", + "integrity": "sha512-mrzLkl6U9YLF8qpqI7TB82PESyEGjm/0Ly91jG575eVxMMlb8fYfOXFZIJ8XfLrJZQbm7dlKry2bJmXBUEkdFg==", + "requires": { + "regenerator-runtime": "^0.13.10" + } + }, + "@ethersproject/abi": { + "version": "5.0.7", + "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.0.7.tgz", + "integrity": "sha512-Cqktk+hSIckwP/W8O47Eef60VwmoSC/L3lY0+dIBhQPCNn9E4V7rwmm2aFrNRRDJfFlGuZ1khkQUOc3oBX+niw==", + "requires": { + "@ethersproject/address": "^5.0.4", + "@ethersproject/bignumber": "^5.0.7", + "@ethersproject/bytes": "^5.0.4", + "@ethersproject/constants": "^5.0.4", + "@ethersproject/hash": "^5.0.4", + "@ethersproject/keccak256": "^5.0.3", + "@ethersproject/logger": "^5.0.5", + "@ethersproject/properties": "^5.0.3", + "@ethersproject/strings": "^5.0.4" + } + }, + "@ethersproject/abstract-provider": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.7.0.tgz", + "integrity": "sha512-R41c9UkchKCpAqStMYUpdunjo3pkEvZC3FAwZn5S5MGbXoMQOHIdHItezTETxAO5bevtMApSyEhn9+CHcDsWBw==", + "requires": { + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/networks": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/transactions": "^5.7.0", + "@ethersproject/web": "^5.7.0" + } + }, + "@ethersproject/abstract-signer": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.7.0.tgz", + "integrity": "sha512-a16V8bq1/Cz+TGCkE2OPMTOUDLS3grCpdjoJCYNnVBbdYEMSgKrU0+B90s8b6H+ByYTBZN7a3g76jdIJi7UfKQ==", + "requires": { + "@ethersproject/abstract-provider": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0" + } + }, + "@ethersproject/address": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.7.0.tgz", + "integrity": "sha512-9wYhYt7aghVGo758POM5nqcOMaE168Q6aRLJZwUmiqSrAungkG74gSSeKEIR7ukixesdRZGPgVqme6vmxs1fkA==", + "requires": { + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/rlp": "^5.7.0" + } + }, + "@ethersproject/base64": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.7.0.tgz", + "integrity": "sha512-Dr8tcHt2mEbsZr/mwTPIQAf3Ai0Bks/7gTw9dSqk1mQvhW3XvRlmDJr/4n+wg1JmCl16NZue17CDh8xb/vZ0sQ==", + "requires": { + "@ethersproject/bytes": "^5.7.0" + } + }, + "@ethersproject/bignumber": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.7.0.tgz", + "integrity": "sha512-n1CAdIHRWjSucQO3MC1zPSVgV/6dy/fjL9pMrPP9peL+QxEg9wOsVqwD4+818B6LUEtaXzVHQiuivzRoxPxUGw==", + "requires": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "bn.js": "^5.2.1" + }, + "dependencies": { + "bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + } + } + }, + "@ethersproject/bytes": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.7.0.tgz", + "integrity": "sha512-nsbxwgFXWh9NyYWo+U8atvmMsSdKJprTcICAkvbBffT75qDocbuggBU0SJiVK2MuTrp0q+xvLkTnGMPK1+uA9A==", + "requires": { + "@ethersproject/logger": "^5.7.0" + } + }, + "@ethersproject/constants": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.7.0.tgz", + "integrity": "sha512-DHI+y5dBNvkpYUMiRQyxRBYBefZkJfo70VUkUAsRjcPs47muV9evftfZ0PJVCXYbAiCgght0DtcF9srFQmIgWA==", + "requires": { + "@ethersproject/bignumber": "^5.7.0" + } + }, + "@ethersproject/hash": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.7.0.tgz", + "integrity": "sha512-qX5WrQfnah1EFnO5zJv1v46a8HW0+E5xuBBDTwMFZLuVTx0tbU2kkx15NqdjxecrLGatQN9FGQKpb1FKdHCt+g==", + "requires": { + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/address": "^5.7.0", + "@ethersproject/base64": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/strings": "^5.7.0" + } + }, + "@ethersproject/keccak256": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.7.0.tgz", + "integrity": "sha512-2UcPboeL/iW+pSg6vZ6ydF8tCnv3Iu/8tUmLLzWWGzxWKFFqOBQFLo6uLUv6BDrLgCDfN28RJ/wtByx+jZ4KBg==", + "requires": { + "@ethersproject/bytes": "^5.7.0", + "js-sha3": "0.8.0" + } + }, + "@ethersproject/logger": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.7.0.tgz", + "integrity": "sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig==" + }, + "@ethersproject/networks": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.7.1.tgz", + "integrity": "sha512-n/MufjFYv3yFcUyfhnXotyDlNdFb7onmkSy8aQERi2PjNcnWQ66xXxa3XlS8nCcA8aJKJjIIMNJTC7tu80GwpQ==", + "requires": { + "@ethersproject/logger": "^5.7.0" + } + }, + "@ethersproject/properties": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.7.0.tgz", + "integrity": "sha512-J87jy8suntrAkIZtecpxEPxY//szqr1mlBaYlQ0r4RCaiD2hjheqF9s1LVE8vVuJCXisjIP+JgtK/Do54ej4Sw==", + "requires": { + "@ethersproject/logger": "^5.7.0" + } + }, + "@ethersproject/rlp": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.7.0.tgz", + "integrity": "sha512-rBxzX2vK8mVF7b0Tol44t5Tb8gomOHkj5guL+HhzQ1yBh/ydjGnpw6at+X6Iw0Kp3OzzzkcKp8N9r0W4kYSs9w==", + "requires": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0" + } + }, + "@ethersproject/signing-key": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.7.0.tgz", + "integrity": "sha512-MZdy2nL3wO0u7gkB4nA/pEf8lu1TlFswPNmy8AiYkfKTdO6eXBJyUdmHO/ehm/htHw9K/qF8ujnTyUAD+Ry54Q==", + "requires": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "bn.js": "^5.2.1", + "elliptic": "6.5.4", + "hash.js": "1.1.7" + }, + "dependencies": { + "bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + } + } + }, + "@ethersproject/strings": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.7.0.tgz", + "integrity": "sha512-/9nu+lj0YswRNSH0NXYqrh8775XNyEdUQAuf3f+SmOrnVewcJ5SBNAjF7lpgehKi4abvNNXyf+HX86czCdJ8Mg==", + "requires": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/logger": "^5.7.0" + } + }, + "@ethersproject/transactions": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.7.0.tgz", + "integrity": "sha512-kmcNicCp1lp8qanMTC3RIikGgoJ80ztTyvtsFvCYpSCfkjhD0jZ2LOrnbcuxuToLIUYYf+4XwD1rP+B/erDIhQ==", + "requires": { + "@ethersproject/address": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/rlp": "^5.7.0", + "@ethersproject/signing-key": "^5.7.0" + } + }, + "@ethersproject/web": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.7.1.tgz", + "integrity": "sha512-Gueu8lSvyjBWL4cYsWsjh6MtMwM0+H4HvqFPZfB6dV8ctbP9zFAO73VG1cMWae0FLPCtz0peKPpZY8/ugJJX2w==", + "requires": { + "@ethersproject/base64": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/strings": "^5.7.0" + } + }, + "@float-capital/float-subgraph-uncrashable": { + "version": "0.0.0-alpha.4", + "resolved": "https://registry.npmjs.org/@float-capital/float-subgraph-uncrashable/-/float-subgraph-uncrashable-0.0.0-alpha.4.tgz", + "integrity": "sha512-3DPy66rMvGAFDDv7craf/Vgz1fLfuU0QSJ16HB1CRZyFQFqICFHbDL7h04zqG8i255z8cfBcgYq+zSxVzeEyLw==", + "requires": { + "graphql": "^16.6.0", + "graphql-import-node": "^0.0.5", + "js-yaml": "^4.1.0", + "rescript": "^9.1.4" + }, + "dependencies": { + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + }, + "graphql": { + "version": "16.6.0", + "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.6.0.tgz", + "integrity": "sha512-KPIBPDlW7NxrbT/eh4qPXz5FiFdL5UbaA0XUNz2Rp3Z3hqBSkbj0GVjwFDztsWVauZUWsbKHgMg++sk8UX0bkw==" + }, + "js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "requires": { + "argparse": "^2.0.1" + } + } + } + }, + "@graphprotocol/graph-cli": { + "version": "0.37.0", + "resolved": "https://registry.npmjs.org/@graphprotocol/graph-cli/-/graph-cli-0.37.0.tgz", + "integrity": "sha512-p//lNNxDTFO05LntKHeDt1sCwRxJHsdcIN2P9/FPnxE5Z2N3n3z0jHEifRhxrPpfkjKyydStT7TM5QMCqxf1kQ==", + "requires": { + "@float-capital/float-subgraph-uncrashable": "^0.0.0-alpha.4", + "assemblyscript": "0.19.10", + "binary-install-raw": "0.0.13", + "chalk": "3.0.0", + "chokidar": "3.5.1", + "debug": "4.3.1", + "docker-compose": "0.23.4", + "dockerode": "2.5.8", + "fs-extra": "9.0.0", + "glob": "7.1.6", + "gluegun": "git+https://github.com/edgeandnode/gluegun.git#v4.3.1-pin-colors-dep", + "graphql": "15.5.0", + "immutable": "3.8.2", + "ipfs-http-client": "34.0.0", + "jayson": "3.6.6", + "js-yaml": "3.13.1", + "node-fetch": "2.6.0", + "pkginfo": "0.4.1", + "prettier": "1.19.1", + "request": "2.88.2", + "semver": "7.3.5", + "sync-request": "6.1.0", + "tmp-promise": "3.0.2", + "web3-eth-abi": "1.7.0", + "which": "2.0.2", + "yaml": "1.9.2" + }, + "dependencies": { + "prettier": { + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz", + "integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==" + } + } + }, + "@graphprotocol/graph-ts": { + "version": "0.29.0", + "resolved": "https://registry.npmjs.org/@graphprotocol/graph-ts/-/graph-ts-0.29.0.tgz", + "integrity": "sha512-9rCouklL2CjlqtywcwSw++MzjBWlmm6274j4s5HokjOTxr64ER7SCKx+2iCqVV0/S7ivc63MzIHlCLSCjPjbiA==", + "requires": { + "assemblyscript": "0.19.10" + } + }, + "@types/bn.js": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.1.tgz", + "integrity": "sha512-qNrYbZqMx0uJAfKnKclPh+dTwK33KfLHYqtyODwd5HnXOjnkhc4qgn3BrK6RWyGZm5+sIFE7Q7Vz6QQtJB7w7g==", + "requires": { + "@types/node": "*" + } + }, + "@types/concat-stream": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@types/concat-stream/-/concat-stream-1.6.1.tgz", + "integrity": "sha512-eHE4cQPoj6ngxBZMvVf6Hw7Mh4jMW4U9lpGmS5GBPB9RYxlFg+CHaVN7ErNY4W9XfLIEn20b4VDYaIrbq0q4uA==", + "requires": { + "@types/node": "*" + } + }, + "@types/connect": { + "version": "3.4.35", + "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz", + "integrity": "sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==", + "requires": { + "@types/node": "*" + } + }, + "@types/express-serve-static-core": { + "version": "4.17.28", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.28.tgz", + "integrity": "sha512-P1BJAEAW3E2DJUlkgq4tOL3RyMunoWXqbSCygWo5ZIWTjUgN1YnaXWW4VWl/oc8vs/XoYibEGBKP0uZyF4AHig==", + "requires": { + "@types/node": "*", + "@types/qs": "*", + "@types/range-parser": "*" + } + }, + "@types/form-data": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/@types/form-data/-/form-data-0.0.33.tgz", + "integrity": "sha512-8BSvG1kGm83cyJITQMZSulnl6QV8jqAGreJsc5tPu1Jq0vTSOiY/k24Wx82JRpWwZSqrala6sd5rWi6aNXvqcw==", + "requires": { + "@types/node": "*" + } + }, + "@types/lodash": { + "version": "4.14.180", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.180.tgz", + "integrity": "sha512-XOKXa1KIxtNXgASAnwj7cnttJxS4fksBRywK/9LzRV5YxrF80BXZIGeQSuoESQ/VkUj30Ae0+YcuHc15wJCB2g==" + }, + "@types/node": { + "version": "12.20.47", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.47.tgz", + "integrity": "sha512-BzcaRsnFuznzOItW1WpQrDHM7plAa7GIDMZ6b5pnMbkqEtM/6WCOhvZar39oeMQP79gwvFUWjjptE7/KGcNqFg==" + }, + "@types/parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==" + }, + "@types/pbkdf2": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@types/pbkdf2/-/pbkdf2-3.1.0.tgz", + "integrity": "sha512-Cf63Rv7jCQ0LaL8tNXmEyqTHuIJxRdlS5vMh1mj5voN4+QFhVZnlZruezqpWYDiJ8UTzhP0VmeLXCmBk66YrMQ==", + "requires": { + "@types/node": "*" + } + }, + "@types/qs": { + "version": "6.9.7", + "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz", + "integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==" + }, + "@types/range-parser": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.4.tgz", + "integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==" + }, + "@types/secp256k1": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@types/secp256k1/-/secp256k1-4.0.3.tgz", + "integrity": "sha512-Da66lEIFeIz9ltsdMZcpQvmrmmoqrfju8pm1BH8WbYjZSwUgCwXLb9C+9XYogwBITnbsSaMdVPb2ekf7TV+03w==", + "requires": { + "@types/node": "*" + } + }, + "@types/ws": { + "version": "7.4.7", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-7.4.7.tgz", + "integrity": "sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==", + "requires": { + "@types/node": "*" + } + }, + "abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "requires": { + "event-target-shim": "^5.0.0" + } + }, + "ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ansi-colors": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.4.tgz", + "integrity": "sha512-hHUXGagefjN2iRrID63xckIvotOXOojhQKWIPUZ4mNUZ9nLZW+7FMNoE1lOkEhNWYsx/7ysGIuJYCiMAA9FnrA==" + }, + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "requires": { + "color-convert": "^2.0.1" + } + }, + "anymatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", + "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, + "apisauce": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/apisauce/-/apisauce-1.1.5.tgz", + "integrity": "sha512-gKC8qb/bDJsPsnEXLZnXJ7gVx7dh87CEVNeIwv1dvaffnXoh5GHwac5pWR1P2broLiVj/fqFMQvLDDt/RhjiqA==", + "requires": { + "axios": "^0.21.2", + "ramda": "^0.25.0" + } + }, + "app-module-path": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/app-module-path/-/app-module-path-2.2.0.tgz", + "integrity": "sha1-ZBqlXft9am8KgUHEucCqULbCTdU= sha512-gkco+qxENJV+8vFcDiiFhuoSvRXb2a/QPqpSoWhVz829VNJfOTnELbBmPmNKFxf3xdNnw4DWCkzkDaavcX/1YQ==" + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "asap": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", + "integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==" + }, + "asmcrypto.js": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/asmcrypto.js/-/asmcrypto.js-2.3.2.tgz", + "integrity": "sha512-3FgFARf7RupsZETQ1nHnhLUUvpcttcCq1iZCaVAbJZbCZ5VNRrNyvpDyHTOb0KC3llFcsyOT/a99NZcCbeiEsA==" + }, + "asn1": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz", + "integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==", + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "asn1.js": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz", + "integrity": "sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA==", + "requires": { + "bn.js": "^4.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "safer-buffer": "^2.1.0" + } + }, + "assemblyscript": { + "version": "0.19.10", + "resolved": "https://registry.npmjs.org/assemblyscript/-/assemblyscript-0.19.10.tgz", + "integrity": "sha512-HavcUBXB3mBTRGJcpvaQjmnmaqKHBGREjSPNsIvnAk2f9dj78y4BkMaSSdvBQYWcDDzsHQjyUC8stICFkD1Odg==", + "requires": { + "binaryen": "101.0.0-nightly.20210723", + "long": "^4.0.0" + } + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU= sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==" + }, + "async": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", + "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==", + "requires": { + "lodash": "^4.17.14" + } + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k= sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, + "at-least-node": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", + "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==" + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg= sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==" + }, + "aws4": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz", + "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==" + }, + "axios": { + "version": "0.21.4", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", + "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", + "requires": { + "follow-redirects": "^1.14.0" + } + }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "base-x": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz", + "integrity": "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4= sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==", + "requires": { + "tweetnacl": "^0.14.3" + }, + "dependencies": { + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q= sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==" + } + } + }, + "bignumber.js": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.2.tgz", + "integrity": "sha512-GAcQvbpsM0pUb0zw1EI0KhQEZ+lRwR5fYaAp3vPOYuP7aDvGy6cVN6XHLauvF8SOga2y0dcLcjt3iQDTSEliyw==" + }, + "binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==" + }, + "binary-install-raw": { + "version": "0.0.13", + "resolved": "https://registry.npmjs.org/binary-install-raw/-/binary-install-raw-0.0.13.tgz", + "integrity": "sha512-v7ms6N/H7iciuk6QInon3/n2mu7oRX+6knJ9xFPsJ3rQePgAqcR3CRTwUheFd8SLbiq4LL7Z4G/44L9zscdt9A==", + "requires": { + "axios": "^0.21.1", + "rimraf": "^3.0.2", + "tar": "^6.1.0" + } + }, + "binaryen": { + "version": "101.0.0-nightly.20210723", + "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-101.0.0-nightly.20210723.tgz", + "integrity": "sha512-eioJNqhHlkguVSbblHOtLqlhtC882SOEPKmNFZaDuz1hzQjolxZ+eu3/kaS10n3sGPONsIZsO7R9fR00UyhEUA==" + }, + "bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "requires": { + "file-uri-to-path": "1.0.0" + } + }, + "bip66": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/bip66/-/bip66-1.1.5.tgz", + "integrity": "sha1-AfqHSHhcpwlV1QESF9GzE5lpyiI= sha512-nemMHz95EmS38a26XbbdxIYj5csHd3RMP3H5bwQknX0WYHF01qhpufP42mLOwVICuH2JmhIhXiWs89MfUGL7Xw==", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "bl": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/bl/-/bl-3.0.1.tgz", + "integrity": "sha512-jrCW5ZhfQ/Vt07WX1Ngs+yn9BDqPL/gw28S7s9H6QK/gupnizNzJAss5akW20ISgOrbLTlXOOCTJeNUQqruAWQ==", + "requires": { + "readable-stream": "^3.0.1" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, + "blakejs": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.2.1.tgz", + "integrity": "sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ==" + }, + "bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" + }, + "borc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/borc/-/borc-2.1.2.tgz", + "integrity": "sha512-Sy9eoUi4OiKzq7VovMn246iTo17kzuyHJKomCfpWMlI6RpfN1gk95w7d7gH264nApVLg0HZfcpz62/g4VH1Y4w==", + "requires": { + "bignumber.js": "^9.0.0", + "buffer": "^5.5.0", + "commander": "^2.15.0", + "ieee754": "^1.1.13", + "iso-url": "~0.4.7", + "json-text-sequence": "~0.1.0", + "readable-stream": "^3.6.0" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "requires": { + "fill-range": "^7.0.1" + } + }, + "brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8= sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==" + }, + "browserify-aes": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", + "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", + "requires": { + "buffer-xor": "^1.0.3", + "cipher-base": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.3", + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "bs58": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", + "integrity": "sha1-vhYedsNU9veIrkBx9j806MTwpCo= sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==", + "requires": { + "base-x": "^3.0.2" + } + }, + "bs58check": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/bs58check/-/bs58check-2.1.2.tgz", + "integrity": "sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA==", + "requires": { + "bs58": "^4.0.0", + "create-hash": "^1.1.0", + "safe-buffer": "^5.1.2" + } + }, + "buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "requires": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "buffer-alloc": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", + "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==", + "requires": { + "buffer-alloc-unsafe": "^1.1.0", + "buffer-fill": "^1.0.0" + } + }, + "buffer-alloc-unsafe": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz", + "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==" + }, + "buffer-fill": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", + "integrity": "sha1-+PeLdniYiO858gXNY39o5wISKyw= sha512-T7zexNBwiiaCOGDg9xNX9PBmjrubblRkENuptryuI64URkXDFum9il/JGL8Lm8wYfAXpredVXXZz7eMHilimiQ==" + }, + "buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==" + }, + "buffer-xor": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", + "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk= sha512-571s0T7nZWK6vB67HI5dyUF7wXiNcfaPPPTl6zYCNApANjIvYJTg7hlud/+cJpdAhS7dVzqMLmfhfHR3rAcOjQ==" + }, + "builtin-status-codes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", + "integrity": "sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug= sha512-HpGFw18DgFWlncDfjTa2rcQ4W88O1mC8e8yZ2AvQY5KDaktSTwo+KRf6nHK6FRI5FyRyb/5T6+TSxfP7QyGsmQ==" + }, + "call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "requires": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + } + }, + "callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==" + }, + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw= sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==" + }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "chokidar": { + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.1.tgz", + "integrity": "sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw==", + "requires": { + "anymatch": "~3.1.1", + "braces": "~3.0.2", + "fsevents": "~2.3.1", + "glob-parent": "~5.1.0", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.5.0" + } + }, + "chownr": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", + "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==" + }, + "cids": { + "version": "0.7.5", + "resolved": "https://registry.npmjs.org/cids/-/cids-0.7.5.tgz", + "integrity": "sha512-zT7mPeghoWAu+ppn8+BS1tQ5qGmbMfB4AregnQjA/qHY3GC1m1ptI9GkWNlgeu38r7CuRdXB47uY2XgAYt6QVA==", + "requires": { + "buffer": "^5.5.0", + "class-is": "^1.1.0", + "multibase": "~0.6.0", + "multicodec": "^1.0.0", + "multihashes": "~0.4.15" + }, + "dependencies": { + "multicodec": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/multicodec/-/multicodec-1.0.4.tgz", + "integrity": "sha512-NDd7FeS3QamVtbgfvu5h7fd1IlbaC4EQ0/pgU4zqE2vdHCmBGsUa0TiM8/TdSeG6BMPC92OOCf8F1ocE/Wkrrg==", + "requires": { + "buffer": "^5.6.0", + "varint": "^5.0.0" + } + } + } + }, + "cipher-base": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", + "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "class-is": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/class-is/-/class-is-1.1.0.tgz", + "integrity": "sha512-rhjH9AG1fvabIDoGRVH587413LPjTZgmDF9fOFCbFJQV4yuocX1mHxxvXI4g3cGwbVY9wAYIoKlg1N79frJKQw==" + }, + "cli-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", + "requires": { + "restore-cursor": "^3.1.0" + } + }, + "cli-spinners": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.6.1.tgz", + "integrity": "sha512-x/5fWmGMnbKQAaNwN+UZlV79qBLM9JFnJuJ03gIi5whrob0xV0ofNVHy9DhwGdsMJQc2OKv0oGmLzvaqvAVv+g==" + }, + "cli-table3": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.5.1.tgz", + "integrity": "sha512-7Qg2Jrep1S/+Q3EceiZtQcDPWxhAvBw+ERf1162v4sikJrvojMHFqXt8QIVha8UlH9rgU0BeWPytZ9/TzYqlUw==", + "requires": { + "colors": "^1.1.2", + "object-assign": "^4.1.0", + "string-width": "^2.1.1" + } + }, + "clone": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", + "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4= sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==" + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "colors": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.3.3.tgz", + "integrity": "sha512-mmGt/1pZqYRjMxB1axhTo16/snVZ5krrKkcmMeVKxzECMMXoCgnvTPp10QgHfcbQZw8Dq2jMNG6je4JlWU0gWg==" + }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + }, + "concat-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", + "requires": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" + } + }, + "core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" + }, + "cosmiconfig": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-6.0.0.tgz", + "integrity": "sha512-xb3ZL6+L8b9JLLCx3ZdoZy4+2ECphCMo2PwqgP1tlfVq6M6YReyzBJtvWWtbDSpNr9hn96pkCiZqUcFEc+54Qg==", + "requires": { + "@types/parse-json": "^4.0.0", + "import-fresh": "^3.1.0", + "parse-json": "^5.0.0", + "path-type": "^4.0.0", + "yaml": "^1.7.2" + } + }, + "create-hash": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", + "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", + "requires": { + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "md5.js": "^1.3.4", + "ripemd160": "^2.0.1", + "sha.js": "^2.4.0" + } + }, + "create-hmac": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", + "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", + "requires": { + "cipher-base": "^1.0.3", + "create-hash": "^1.1.0", + "inherits": "^2.0.1", + "ripemd160": "^2.0.0", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA= sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "requires": { + "ms": "2.1.2" + } + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==" + }, + "defaults": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", + "integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730= sha512-s82itHOnYrN0Ib8r+z7laQz3sdE+4FP3d9Q7VLO7U+KRT+CR0GsWuyHxzdAY82I7cXv0G/twrqomTJLOssO5HA==", + "requires": { + "clone": "^1.0.2" + } + }, + "delay": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/delay/-/delay-5.0.0.tgz", + "integrity": "sha512-ReEBKkIfe4ya47wlPYf/gu5ib6yUG0/Aez0JQZQz94kiWtRQvZIQbTiehsnwHvLSWJnQdhVeqYue7Id1dKr0qw==" + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk= sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==" + }, + "delimit-stream": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/delimit-stream/-/delimit-stream-0.1.0.tgz", + "integrity": "sha1-m4MZR3wOX4rrPONXrjBfwl6hzSs= sha512-a02fiQ7poS5CnjiJBAsjGLPp5EwVoGHNeu9sziBd9huppRfsAFIpv5zNLv0V1gbop53ilngAf5Kf331AwcoRBQ==" + }, + "detect-node": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.1.0.tgz", + "integrity": "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==" + }, + "docker-compose": { + "version": "0.23.4", + "resolved": "https://registry.npmjs.org/docker-compose/-/docker-compose-0.23.4.tgz", + "integrity": "sha512-yWdXby9uQ8o4syOfvoSJ9ZlTnLipvUmDn59uaYY5VGIUSUAfMPPGqE1DE3pOCnfSg9Tl9UOOFO0PCSAzuIHmuA==" + }, + "docker-modem": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/docker-modem/-/docker-modem-1.0.9.tgz", + "integrity": "sha512-lVjqCSCIAUDZPAZIeyM125HXfNvOmYYInciphNrLrylUtKyW66meAjSPXWchKVzoIYZx69TPnAepVSSkeawoIw==", + "requires": { + "debug": "^3.2.6", + "JSONStream": "1.3.2", + "readable-stream": "~1.0.26-4", + "split-ca": "^1.0.0" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "requires": { + "ms": "^2.1.1" + } + }, + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8= sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==" + }, + "readable-stream": { + "version": "1.0.34", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", + "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw= sha512-ok1qVCJuRkNmvebYikljxJA/UEsKwLl2nI1OmaqAu4/UE+h0wKCHok4XkL/gvi39OacXvw59RJUOFUkDib2rHg==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ= sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==" + } + } + }, + "dockerode": { + "version": "2.5.8", + "resolved": "https://registry.npmjs.org/dockerode/-/dockerode-2.5.8.tgz", + "integrity": "sha512-+7iOUYBeDTScmOmQqpUYQaE7F4vvIt6+gIZNHWhqAQEI887tiPFB9OvXI/HzQYqfUNvukMK+9myLW63oTJPZpw==", + "requires": { + "concat-stream": "~1.6.2", + "docker-modem": "^1.0.8", + "tar-fs": "~1.16.3" + } + }, + "drbg.js": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/drbg.js/-/drbg.js-1.0.1.tgz", + "integrity": "sha1-Pja2xCs3BDgjzbwzLVjzHiRFSAs= sha512-F4wZ06PvqxYLFEZKkFxTDcns9oFNk34hvmJSEwdzsxVQ8YI5YaxtACgQatkYgv2VI2CFkUd2Y+xosPQnHv809g==", + "requires": { + "browserify-aes": "^1.0.6", + "create-hash": "^1.1.2", + "create-hmac": "^1.1.4" + } + }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk= sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==", + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "ejs": { + "version": "2.7.4", + "resolved": "https://registry.npmjs.org/ejs/-/ejs-2.7.4.tgz", + "integrity": "sha512-7vmuyh5+kuUyJKePhQfRQBhXV5Ce+RnaeeQArKu1EAMpL3WbgMt5WG6uQZpEVvYSSsxMXRKOewtDk9RaTKXRlA==" + }, + "elliptic": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", + "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", + "requires": { + "bn.js": "^4.11.9", + "brorand": "^1.1.0", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "requires": { + "once": "^1.4.0" + } + }, + "enquirer": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.4.tgz", + "integrity": "sha512-pkYrrDZumL2VS6VBGDhqbajCM2xpkUNLuKfGPjfKaSIBKYopQbqEFyrOkRMIb2HDR/rO1kGhEt/5twBwtzKBXw==", + "requires": { + "ansi-colors": "^3.2.1" + } + }, + "err-code": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/err-code/-/err-code-2.0.3.tgz", + "integrity": "sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==" + }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "requires": { + "is-arrayish": "^0.2.1" + } + }, + "es6-promise": { + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", + "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==" + }, + "es6-promisify": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", + "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM= sha512-C+d6UdsYDk0lMebHNR4S2NybQMMngAOnOwYBQjTOiv0MkoJMP0Myw2mgpDLBcpfCmRLxyFqYhS/CfOENq4SJhQ==", + "requires": { + "es6-promise": "^4.0.3" + } + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==" + }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" + }, + "ethereum-bloom-filters": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/ethereum-bloom-filters/-/ethereum-bloom-filters-1.0.10.tgz", + "integrity": "sha512-rxJ5OFN3RwjQxDcFP2Z5+Q9ho4eIdEmSc2ht0fCu8Se9nbXjZ7/031uXoUYJ87KHCOdVeiUuwSnoS7hmYAGVHA==", + "requires": { + "js-sha3": "^0.8.0" + } + }, + "ethereum-cryptography": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz", + "integrity": "sha512-w8/4x1SGGzc+tO97TASLja6SLd3fRIK2tLVcV2Gx4IB21hE19atll5Cq9o3d0ZmAYC/8aw0ipieTSiekAea4SQ==", + "requires": { + "@types/pbkdf2": "^3.0.0", + "@types/secp256k1": "^4.0.1", + "blakejs": "^1.1.0", + "browserify-aes": "^1.2.0", + "bs58check": "^2.1.2", + "create-hash": "^1.2.0", + "create-hmac": "^1.1.7", + "hash.js": "^1.1.7", + "keccak": "^3.0.0", + "pbkdf2": "^3.0.17", + "randombytes": "^2.1.0", + "safe-buffer": "^5.1.2", + "scrypt-js": "^3.0.0", + "secp256k1": "^4.0.1", + "setimmediate": "^1.0.5" + }, + "dependencies": { + "secp256k1": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.3.tgz", + "integrity": "sha512-NLZVf+ROMxwtEj3Xa562qgv2BK5e2WNmXPiOdVIPLgs6lyTzMvBq0aWTYMI5XCP9jZMVKOcqZLw/Wc4vDkuxhA==", + "requires": { + "elliptic": "^6.5.4", + "node-addon-api": "^2.0.0", + "node-gyp-build": "^4.2.0" + } + } + } + }, + "ethereumjs-util": { + "version": "7.1.5", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.1.5.tgz", + "integrity": "sha512-SDl5kKrQAudFBUe5OJM9Ac6WmMyYmXX/6sTmLZ3ffG2eY6ZIGBes3pEDxNN6V72WyOw4CPD5RomKdsa8DAAwLg==", + "requires": { + "@types/bn.js": "^5.1.0", + "bn.js": "^5.1.2", + "create-hash": "^1.1.2", + "ethereum-cryptography": "^0.1.3", + "rlp": "^2.2.4" + }, + "dependencies": { + "bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + } + } + }, + "ethjs-unit": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/ethjs-unit/-/ethjs-unit-0.1.6.tgz", + "integrity": "sha512-/Sn9Y0oKl0uqQuvgFk/zQgR7aw1g36qX/jzSQ5lSwlO0GigPymk4eGQfeNTD03w1dPOqfz8V77Cy43jH56pagw==", + "requires": { + "bn.js": "4.11.6", + "number-to-bn": "1.7.0" + }, + "dependencies": { + "bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha512-XWwnNNFCuuSQ0m3r3C4LE3EiORltHd9M05pq6FOlVeiophzRbMo50Sbz1ehl8K3Z+jw9+vmgnXefY1hz8X+2wA==" + } + } + }, + "event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==" + }, + "evp_bytestokey": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", + "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", + "requires": { + "md5.js": "^1.3.4", + "safe-buffer": "^5.1.1" + } + }, + "execa": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-3.4.0.tgz", + "integrity": "sha512-r9vdGQk4bmCuK1yKQu1KTwcT2zwfWdbdaXfCtAh+5nU/4fSX+JAb7vZGvI5naJrQlvONrEB20jeruESI69530g==", + "requires": { + "cross-spawn": "^7.0.0", + "get-stream": "^5.0.0", + "human-signals": "^1.1.1", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.0", + "onetime": "^5.1.0", + "p-finally": "^2.0.0", + "signal-exit": "^3.0.2", + "strip-final-newline": "^2.0.0" + } + }, + "explain-error": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/explain-error/-/explain-error-1.0.4.tgz", + "integrity": "sha1-p5PTrAytTGq1cemWj7urbLJTKSk= sha512-/wSgNMxFusiYRy1rd19LT2SQlIXDppHpumpWo06wxjflD1OYxDLbl6rMVw+U3bxD5Nuhex4TKqv9Aem4D0lVzQ==" + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU= sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g==" + }, + "eyes": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz", + "integrity": "sha1-Ys8SAjTGg3hdkCNIqADvPgzCC8A= sha512-GipyPsXO1anza0AOZdy69Im7hGFCNB7Y/NGjDlZGJ3GJJLtwNSb2vrzYrTYJRrRloVx7pl+bhUaTB8yiccPvFQ==" + }, + "fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + }, + "file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==" + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "flatmap": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/flatmap/-/flatmap-0.0.3.tgz", + "integrity": "sha1-Hxik2TgVLUlZZfnJWNkjqy3WabQ= sha512-OuR+o7kHVe+x9RtIujPay7Uw3bvDZBZFSBXClEphZuSDLmZTqMdclasf4vFSsogC8baDz0eaC2NdO/2dlXHBKQ==" + }, + "follow-redirects": { + "version": "1.14.9", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.9.tgz", + "integrity": "sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w==" + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE= sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==" + }, + "form-data": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + }, + "fs-constants": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==" + }, + "fs-extra": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.0.0.tgz", + "integrity": "sha512-pmEYSk3vYsG/bF651KPUXZ+hvjpgWYw/Gc7W9NFUe3ZVLczKKWIij3IKpOrQcdw4TILtibFslZ0UmR8Vvzig4g==", + "requires": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^1.0.0" + } + }, + "fs-jetpack": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/fs-jetpack/-/fs-jetpack-2.4.0.tgz", + "integrity": "sha512-S/o9Dd7K9A7gicVU32eT8G0kHcmSu0rCVdP79P0MWInKFb8XpTc8Syhoo66k9no+HDshtlh4pUJTws8X+8fdFQ==", + "requires": { + "minimatch": "^3.0.2", + "rimraf": "^2.6.3" + }, + "dependencies": { + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "requires": { + "glob": "^7.1.3" + } + } + } + }, + "fs-minipass": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", + "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "requires": { + "minipass": "^3.0.0" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8= sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + }, + "fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "optional": true + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "get-intrinsic": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", + "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", + "requires": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1" + } + }, + "get-port": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/get-port/-/get-port-3.2.0.tgz", + "integrity": "sha512-x5UJKlgeUiNT8nyo/AcnwLnZuZNcSjSw0kogRB+Whd1fjjFq4B1hySFxSFWWSn4mIBzg3sRNUDFYc4g5gjPoLg==" + }, + "get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "requires": { + "pump": "^3.0.0" + } + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo= sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "requires": { + "is-glob": "^4.0.1" + } + }, + "gluegun": { + "version": "git+ssh://git@github.com/edgeandnode/gluegun.git#b34b9003d7bf556836da41b57ef36eb21570620a", + "from": "gluegun@git+https://github.com/edgeandnode/gluegun.git#v4.3.1-pin-colors-dep", + "requires": { + "apisauce": "^1.0.1", + "app-module-path": "^2.2.0", + "cli-table3": "~0.5.0", + "colors": "1.3.3", + "cosmiconfig": "6.0.0", + "cross-spawn": "^7.0.0", + "ejs": "^2.6.1", + "enquirer": "2.3.4", + "execa": "^3.0.0", + "fs-jetpack": "^2.2.2", + "lodash.camelcase": "^4.3.0", + "lodash.kebabcase": "^4.1.1", + "lodash.lowercase": "^4.3.0", + "lodash.lowerfirst": "^4.3.1", + "lodash.pad": "^4.5.1", + "lodash.padend": "^4.6.1", + "lodash.padstart": "^4.6.1", + "lodash.repeat": "^4.1.0", + "lodash.snakecase": "^4.1.1", + "lodash.startcase": "^4.4.0", + "lodash.trim": "^4.5.1", + "lodash.trimend": "^4.5.1", + "lodash.trimstart": "^4.5.1", + "lodash.uppercase": "^4.3.0", + "lodash.upperfirst": "^4.3.1", + "ora": "^4.0.0", + "pluralize": "^8.0.0", + "ramdasauce": "^2.1.0", + "semver": "^7.0.0", + "which": "^2.0.0", + "yargs-parser": "^16.1.0" + } + }, + "graceful-fs": { + "version": "4.2.9", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz", + "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==" + }, + "graphql": { + "version": "15.5.0", + "resolved": "https://registry.npmjs.org/graphql/-/graphql-15.5.0.tgz", + "integrity": "sha512-OmaM7y0kaK31NKG31q4YbD2beNYa6jBBKtMFT6gLYJljHLJr42IqJ8KX08u3Li/0ifzTU5HjmoOOrwa5BRLeDA==" + }, + "graphql-import-node": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/graphql-import-node/-/graphql-import-node-0.0.5.tgz", + "integrity": "sha512-OXbou9fqh9/Lm7vwXT0XoRN9J5+WCYKnbiTalgFDvkQERITRmcfncZs6aVABedd5B85yQU5EULS4a5pnbpuI0Q==", + "requires": {} + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI= sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q==" + }, + "har-validator": { + "version": "5.1.5", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz", + "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==", + "requires": { + "ajv": "^6.12.3", + "har-schema": "^2.0.0" + } + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" + }, + "has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==" + }, + "hash-base": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", + "integrity": "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==", + "requires": { + "inherits": "^2.0.4", + "readable-stream": "^3.6.0", + "safe-buffer": "^5.2.0" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, + "hash.js": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", + "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "hi-base32": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/hi-base32/-/hi-base32-0.5.1.tgz", + "integrity": "sha512-EmBBpvdYh/4XxsnUybsPag6VikPYnN30td+vQk+GI3qpahVEG9+gTkG0aXVxTjBqQ5T6ijbWIu77O+C5WFWsnA==" + }, + "hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE= sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==", + "requires": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "http-basic": { + "version": "8.1.3", + "resolved": "https://registry.npmjs.org/http-basic/-/http-basic-8.1.3.tgz", + "integrity": "sha512-/EcDMwJZh3mABI2NhGfHOGOeOZITqfkEO4p/xK+l3NpyncIHUQBoMvCSF/b5GqvKtySC2srL/GGG3+EtlqlmCw==", + "requires": { + "caseless": "^0.12.0", + "concat-stream": "^1.6.2", + "http-response-object": "^3.0.1", + "parse-cache-control": "^1.0.1" + } + }, + "http-response-object": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/http-response-object/-/http-response-object-3.0.2.tgz", + "integrity": "sha512-bqX0XTF6fnXSQcEJ2Iuyr75yVakyjIDCqroJQ/aHfSdlM743Cwqoi2nDYMzLGWUcuTWGWy8AAvOKXTfiv6q9RA==", + "requires": { + "@types/node": "^10.0.3" + }, + "dependencies": { + "@types/node": { + "version": "10.17.60", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.60.tgz", + "integrity": "sha512-F0KIgDJfy2nA3zMLmWGKxcH2ZVEtCZXHHdOQs2gSaQ27+lNeEfGxzkIw90aXswATX7AZ33tahPbzy6KAfUreVw==" + } + } + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE= sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ==", + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "human-signals": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz", + "integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==" + }, + "ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" + }, + "immutable": { + "version": "3.8.2", + "resolved": "https://registry.npmjs.org/immutable/-/immutable-3.8.2.tgz", + "integrity": "sha512-15gZoQ38eYjEjxkorfbcgBKBL6R7T459OuK+CpcWt7O3KF4uPCx2tD0uFETlUDIyo+1789crbMhTvQBSR5yBMg==" + }, + "import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + } + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "ip": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", + "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo= sha512-rBtCAQAJm8A110nbwn6YdveUnuZH3WrC36IwkRXxDnq53JvXA2NVQvB7IHyKomxK1MJ4VDNw3UtFDdXQ+AvLYA==" + }, + "ip-regex": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-2.1.0.tgz", + "integrity": "sha1-+ni/XS5pE8kRzp+BnuUUa7bYROk= sha512-58yWmlHpp7VYfcdTwMTvwMmqx/Elfxjd9RXTDyMsbL7lLWmhMylLEqiYVLKuLzOZqVgiWXD9MfR62Vv89VRxkw==" + }, + "ipfs-block": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/ipfs-block/-/ipfs-block-0.8.1.tgz", + "integrity": "sha512-0FaCpmij+jZBoUYhjoB5ptjdl9QzvrdRIoBmUU5JiBnK2GA+4YM/ifklaB8ePRhA/rRzhd+KYBjvMFMAL4NrVQ==", + "requires": { + "cids": "~0.7.0", + "class-is": "^1.1.0" + } + }, + "ipfs-http-client": { + "version": "34.0.0", + "resolved": "https://registry.npmjs.org/ipfs-http-client/-/ipfs-http-client-34.0.0.tgz", + "integrity": "sha512-4RCkk8ix4Dqn6sxqFVwuXWCZ1eLFPsVaj6Ijvu1fs9VYgxgVudsW9PWwarlr4mw1xUCmPWYyXnEbGgzBrfMy0Q==", + "requires": { + "abort-controller": "^3.0.0", + "async": "^2.6.1", + "bignumber.js": "^9.0.0", + "bl": "^3.0.0", + "bs58": "^4.0.1", + "buffer": "^5.4.2", + "cids": "~0.7.1", + "concat-stream": "github:hugomrdias/concat-stream#feat/smaller", + "debug": "^4.1.0", + "detect-node": "^2.0.4", + "end-of-stream": "^1.4.1", + "err-code": "^2.0.0", + "explain-error": "^1.0.4", + "flatmap": "0.0.3", + "glob": "^7.1.3", + "ipfs-block": "~0.8.1", + "ipfs-utils": "~0.0.3", + "ipld-dag-cbor": "~0.15.0", + "ipld-dag-pb": "~0.17.3", + "ipld-raw": "^4.0.0", + "is-ipfs": "~0.6.1", + "is-pull-stream": "0.0.0", + "is-stream": "^2.0.0", + "iso-stream-http": "~0.1.2", + "iso-url": "~0.4.6", + "iterable-ndjson": "^1.1.0", + "just-kebab-case": "^1.1.0", + "just-map-keys": "^1.1.0", + "kind-of": "^6.0.2", + "ky": "^0.11.2", + "ky-universal": "^0.2.2", + "lru-cache": "^5.1.1", + "multiaddr": "^6.0.6", + "multibase": "~0.6.0", + "multicodec": "~0.5.1", + "multihashes": "~0.4.14", + "ndjson": "github:hugomrdias/ndjson#feat/readable-stream3", + "once": "^1.4.0", + "peer-id": "~0.12.3", + "peer-info": "~0.15.1", + "promise-nodeify": "^3.0.1", + "promisify-es6": "^1.0.3", + "pull-defer": "~0.2.3", + "pull-stream": "^3.6.9", + "pull-to-stream": "~0.1.1", + "pump": "^3.0.0", + "qs": "^6.5.2", + "readable-stream": "^3.1.1", + "stream-to-pull-stream": "^1.7.2", + "tar-stream": "^2.0.1", + "through2": "^3.0.1" + }, + "dependencies": { + "concat-stream": { + "version": "git+ssh://git@github.com/hugomrdias/concat-stream.git#057bc7b5d6d8df26c8cf00a3f151b6721a0a8034", + "from": "concat-stream@github:hugomrdias/concat-stream#feat/smaller", + "requires": { + "inherits": "^2.0.3", + "readable-stream": "^3.0.2" + } + }, + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, + "ipfs-utils": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/ipfs-utils/-/ipfs-utils-0.0.4.tgz", + "integrity": "sha512-7cZf6aGj2FG3XJWhCNwn4mS93Q0GEWjtBZvEHqzgI43U2qzNDCyzfS1pei1Y5F+tw/zDJ5U4XG0G9reJxR53Ig==", + "requires": { + "buffer": "^5.2.1", + "is-buffer": "^2.0.3", + "is-electron": "^2.2.0", + "is-pull-stream": "0.0.0", + "is-stream": "^2.0.0", + "kind-of": "^6.0.2", + "readable-stream": "^3.4.0" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, + "ipld-dag-cbor": { + "version": "0.15.3", + "resolved": "https://registry.npmjs.org/ipld-dag-cbor/-/ipld-dag-cbor-0.15.3.tgz", + "integrity": "sha512-m23nG7ZyoVFnkK55/bLAErc7EfiMgaEQlqHWDTGzPI+O5r6bPfp+qbL5zTVSIT8tpbHmu174dwerVtLoVgeVyA==", + "requires": { + "borc": "^2.1.2", + "buffer": "^5.5.0", + "cids": "~0.8.0", + "is-circular": "^1.0.2", + "multicodec": "^1.0.0", + "multihashing-async": "~0.8.0" + }, + "dependencies": { + "cids": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/cids/-/cids-0.8.3.tgz", + "integrity": "sha512-yoXTbV3llpm+EBGWKeL9xKtksPE/s6DPoDSY4fn8I8TEW1zehWXPSB0pwAXVDlLaOlrw+sNynj995uD9abmPhA==", + "requires": { + "buffer": "^5.6.0", + "class-is": "^1.1.0", + "multibase": "^1.0.0", + "multicodec": "^1.0.1", + "multihashes": "^1.0.1" + } + }, + "multibase": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/multibase/-/multibase-1.0.1.tgz", + "integrity": "sha512-KcCxpBVY8fdVKu4dJMAahq4F/2Z/9xqEjIiR7PiMe7LRGeorFn2NLmicN6nLBCqQvft6MG2Lc9X5P0IdyvnxEw==", + "requires": { + "base-x": "^3.0.8", + "buffer": "^5.5.0" + } + }, + "multicodec": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/multicodec/-/multicodec-1.0.4.tgz", + "integrity": "sha512-NDd7FeS3QamVtbgfvu5h7fd1IlbaC4EQ0/pgU4zqE2vdHCmBGsUa0TiM8/TdSeG6BMPC92OOCf8F1ocE/Wkrrg==", + "requires": { + "buffer": "^5.6.0", + "varint": "^5.0.0" + } + }, + "multihashes": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/multihashes/-/multihashes-1.0.1.tgz", + "integrity": "sha512-S27Tepg4i8atNiFaU5ZOm3+gl3KQlUanLs/jWcBxQHFttgq+5x1OgbQmf2d8axJ/48zYGBd/wT9d723USMFduw==", + "requires": { + "buffer": "^5.6.0", + "multibase": "^1.0.1", + "varint": "^5.0.0" + } + } + } + }, + "ipld-dag-pb": { + "version": "0.17.4", + "resolved": "https://registry.npmjs.org/ipld-dag-pb/-/ipld-dag-pb-0.17.4.tgz", + "integrity": "sha512-YwCxETEMuXVspOKOhjIOHJvKvB/OZfCDkpSFiYBQN2/JQjM9y/RFCYzIQGm0wg7dCFLrhvfjAZLTSaKs65jzWA==", + "requires": { + "cids": "~0.7.0", + "class-is": "^1.1.0", + "multicodec": "~0.5.1", + "multihashing-async": "~0.7.0", + "protons": "^1.0.1", + "stable": "~0.1.8" + }, + "dependencies": { + "err-code": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/err-code/-/err-code-1.1.2.tgz", + "integrity": "sha1-BuARbTAo9q70gGhJ6w6mp0iuaWA= sha512-CJAN+O0/yA1CKfRn9SXOGctSpEM7DCon/r/5r2eXFMY2zCCJBasFhcM5I+1kh3Ap11FsQCX+vGHceNPvpWKhoA==" + }, + "multihashing-async": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/multihashing-async/-/multihashing-async-0.7.0.tgz", + "integrity": "sha512-SCbfl3f+DzJh+/5piukga9ofIOxwfT05t8R4jfzZIJ88YE9zU9+l3K2X+XB19MYyxqvyK9UJRNWbmQpZqQlbRA==", + "requires": { + "blakejs": "^1.1.0", + "buffer": "^5.2.1", + "err-code": "^1.1.2", + "js-sha3": "~0.8.0", + "multihashes": "~0.4.13", + "murmurhash3js-revisited": "^3.0.0" + } + } + } + }, + "ipld-raw": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/ipld-raw/-/ipld-raw-4.0.1.tgz", + "integrity": "sha512-WjIdtZ06jJEar8zh+BHB84tE6ZdbS/XNa7+XCArOYfmeJ/c01T9VQpeMwdJQYn5c3s5UvvCu7y4VIi3vk2g1bA==", + "requires": { + "cids": "~0.7.0", + "multicodec": "^1.0.0", + "multihashing-async": "~0.8.0" + }, + "dependencies": { + "multicodec": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/multicodec/-/multicodec-1.0.4.tgz", + "integrity": "sha512-NDd7FeS3QamVtbgfvu5h7fd1IlbaC4EQ0/pgU4zqE2vdHCmBGsUa0TiM8/TdSeG6BMPC92OOCf8F1ocE/Wkrrg==", + "requires": { + "buffer": "^5.6.0", + "varint": "^5.0.0" + } + } + } + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0= sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==" + }, + "is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "requires": { + "binary-extensions": "^2.0.0" + } + }, + "is-buffer": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", + "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==" + }, + "is-circular": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-circular/-/is-circular-1.0.2.tgz", + "integrity": "sha512-YttjnrswnUYRVJvxCvu8z+PGMUSzC2JttP0OEXezlAEdp3EXzhf7IZ3j0gRAybJBQupedIZFhY61Tga6E0qASA==" + }, + "is-electron": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/is-electron/-/is-electron-2.2.1.tgz", + "integrity": "sha512-r8EEQQsqT+Gn0aXFx7lTFygYQhILLCB+wn0WCDL5LZRINeLH/Rvw1j2oKodELLXYNImQ3CRlVsY8wW4cGOsyuw==" + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==" + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w==" + }, + "is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-hex-prefixed": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz", + "integrity": "sha512-WvtOiug1VFrE9v1Cydwm+FnXd3+w9GaeVUss5W4v/SLy3UW00vP+6iNF2SdnfiBoLy4bTqVdkftNGTUeOFVsbA==" + }, + "is-interactive": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz", + "integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==" + }, + "is-ip": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-ip/-/is-ip-2.0.0.tgz", + "integrity": "sha1-aO6gfooKCpTC0IDdZ0xzGrKkYas= sha512-9MTn0dteHETtyUx8pxqMwg5hMBi3pvlyglJ+b79KOCca0po23337LbVV2Hl4xmMvfw++ljnO0/+5G6G+0Szh6g==", + "requires": { + "ip-regex": "^2.0.0" + } + }, + "is-ipfs": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/is-ipfs/-/is-ipfs-0.6.3.tgz", + "integrity": "sha512-HyRot1dvLcxImtDqPxAaY1miO6WsiP/z7Yxpg2qpaLWv5UdhAPtLvHJ4kMLM0w8GSl8AFsVF23PHe1LzuWrUlQ==", + "requires": { + "bs58": "^4.0.1", + "cids": "~0.7.0", + "mafmt": "^7.0.0", + "multiaddr": "^7.2.1", + "multibase": "~0.6.0", + "multihashes": "~0.4.13" + }, + "dependencies": { + "ip-regex": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.3.0.tgz", + "integrity": "sha512-B9ZWJxHHOHUhUjCPrMpLD4xEq35bUTClHM1S6CBU5ixQnkZmwipwgc96vAd7AAGM9TGHvJR+Uss+/Ak6UphK+Q==" + }, + "is-ip": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-ip/-/is-ip-3.1.0.tgz", + "integrity": "sha512-35vd5necO7IitFPjd/YBeqwWnyDWbuLH9ZXQdMfDA8TEo7pv5X8yfrvVO3xbJbLUlERCMvf6X0hTUamQxCYJ9Q==", + "requires": { + "ip-regex": "^4.0.0" + } + }, + "multiaddr": { + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/multiaddr/-/multiaddr-7.5.0.tgz", + "integrity": "sha512-GvhHsIGDULh06jyb6ev+VfREH9evJCFIRnh3jUt9iEZ6XDbyoisZRFEI9bMvK/AiR6y66y6P+eoBw9mBYMhMvw==", + "requires": { + "buffer": "^5.5.0", + "cids": "~0.8.0", + "class-is": "^1.1.0", + "is-ip": "^3.1.0", + "multibase": "^0.7.0", + "varint": "^5.0.0" + }, + "dependencies": { + "cids": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/cids/-/cids-0.8.3.tgz", + "integrity": "sha512-yoXTbV3llpm+EBGWKeL9xKtksPE/s6DPoDSY4fn8I8TEW1zehWXPSB0pwAXVDlLaOlrw+sNynj995uD9abmPhA==", + "requires": { + "buffer": "^5.6.0", + "class-is": "^1.1.0", + "multibase": "^1.0.0", + "multicodec": "^1.0.1", + "multihashes": "^1.0.1" + }, + "dependencies": { + "multibase": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/multibase/-/multibase-1.0.1.tgz", + "integrity": "sha512-KcCxpBVY8fdVKu4dJMAahq4F/2Z/9xqEjIiR7PiMe7LRGeorFn2NLmicN6nLBCqQvft6MG2Lc9X5P0IdyvnxEw==", + "requires": { + "base-x": "^3.0.8", + "buffer": "^5.5.0" + } + } + } + }, + "multibase": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/multibase/-/multibase-0.7.0.tgz", + "integrity": "sha512-TW8q03O0f6PNFTQDvh3xxH03c8CjGaaYrjkl9UQPG6rz53TQzzxJVCIWVjzcbN/Q5Y53Zd0IBQBMVktVgNx4Fg==", + "requires": { + "base-x": "^3.0.8", + "buffer": "^5.5.0" + } + }, + "multihashes": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/multihashes/-/multihashes-1.0.1.tgz", + "integrity": "sha512-S27Tepg4i8atNiFaU5ZOm3+gl3KQlUanLs/jWcBxQHFttgq+5x1OgbQmf2d8axJ/48zYGBd/wT9d723USMFduw==", + "requires": { + "buffer": "^5.6.0", + "multibase": "^1.0.1", + "varint": "^5.0.0" + }, + "dependencies": { + "multibase": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/multibase/-/multibase-1.0.1.tgz", + "integrity": "sha512-KcCxpBVY8fdVKu4dJMAahq4F/2Z/9xqEjIiR7PiMe7LRGeorFn2NLmicN6nLBCqQvft6MG2Lc9X5P0IdyvnxEw==", + "requires": { + "base-x": "^3.0.8", + "buffer": "^5.5.0" + } + } + } + } + } + }, + "multicodec": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/multicodec/-/multicodec-1.0.4.tgz", + "integrity": "sha512-NDd7FeS3QamVtbgfvu5h7fd1IlbaC4EQ0/pgU4zqE2vdHCmBGsUa0TiM8/TdSeG6BMPC92OOCf8F1ocE/Wkrrg==", + "requires": { + "buffer": "^5.6.0", + "varint": "^5.0.0" + } + } + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" + }, + "is-promise": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-1.0.1.tgz", + "integrity": "sha1-MVc3YcBX4zwukaq56W2gjO++duU= sha512-mjWH5XxnhMA8cFnDchr6qRP9S/kLntKuEfIYku+PaN1CnS8v+OG9O/BKpRCVRJvpIkgAZm0Pf5Is3iSSOILlcg==" + }, + "is-pull-stream": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/is-pull-stream/-/is-pull-stream-0.0.0.tgz", + "integrity": "sha1-o7w9HG0wVRUcRr3m85nv7SFEDKk= sha512-NWLwqCc95I6m8FZDYLAmVJc9Xgk8O+8pPOoDKFTC293FH4S7FBcbLCw3WWPCdiT8uUSdzPy47VM08WPDMJJrag==" + }, + "is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==" + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==" + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" + }, + "iso-random-stream": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/iso-random-stream/-/iso-random-stream-1.1.2.tgz", + "integrity": "sha512-7y0tsBBgQs544iTYjyrMp5xvgrbYR8b+plQq1Bryp+03p0LssrxC9C1M0oHv4QESDt7d95c74XvMk/yawKqX+A==", + "requires": { + "buffer": "^6.0.3", + "readable-stream": "^3.4.0" + }, + "dependencies": { + "buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "requires": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, + "iso-stream-http": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/iso-stream-http/-/iso-stream-http-0.1.2.tgz", + "integrity": "sha512-oHEDNOysIMTNypbg2f1SlydqRBvjl4ZbSE9+0awVxnkx3K2stGTFwB/kpVqnB6UEfF8QD36kAjDwZvqyXBLMnQ==", + "requires": { + "builtin-status-codes": "^3.0.0", + "inherits": "^2.0.1", + "readable-stream": "^3.1.1" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, + "iso-url": { + "version": "0.4.7", + "resolved": "https://registry.npmjs.org/iso-url/-/iso-url-0.4.7.tgz", + "integrity": "sha512-27fFRDnPAMnHGLq36bWTpKET+eiXct3ENlCcdcMdk+mjXrb2kw3mhBUg1B7ewAC0kVzlOPhADzQgz1SE6Tglog==" + }, + "isomorphic-ws": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz", + "integrity": "sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==", + "requires": {} + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo= sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==" + }, + "iterable-ndjson": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/iterable-ndjson/-/iterable-ndjson-1.1.0.tgz", + "integrity": "sha512-OOp1Lb0o3k5MkXHx1YaIY5Z0ELosZfTnBaas9f8opJVcZGBIONA2zY/6CYE+LKkqrSDooIneZbrBGgOZnHPkrg==", + "requires": { + "string_decoder": "^1.2.0" + } + }, + "jayson": { + "version": "3.6.6", + "resolved": "https://registry.npmjs.org/jayson/-/jayson-3.6.6.tgz", + "integrity": "sha512-f71uvrAWTtrwoww6MKcl9phQTC+56AopLyEenWvKVAIMz+q0oVGj6tenLZ7Z6UiPBkJtKLj4kt0tACllFQruGQ==", + "requires": { + "@types/connect": "^3.4.33", + "@types/express-serve-static-core": "^4.17.9", + "@types/lodash": "^4.14.159", + "@types/node": "^12.12.54", + "@types/ws": "^7.4.4", + "commander": "^2.20.3", + "delay": "^5.0.0", + "es6-promisify": "^5.0.0", + "eyes": "^0.1.8", + "isomorphic-ws": "^4.0.1", + "json-stringify-safe": "^5.0.1", + "JSONStream": "^1.3.5", + "lodash": "^4.17.20", + "uuid": "^8.3.2", + "ws": "^7.4.5" + }, + "dependencies": { + "JSONStream": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz", + "integrity": "sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==", + "requires": { + "jsonparse": "^1.2.0", + "through": ">=2.2.7 <3" + } + } + } + }, + "js-sha3": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", + "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + }, + "js-yaml": { + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", + "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM= sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==" + }, + "json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==" + }, + "json-schema": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", + "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==" + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus= sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==" + }, + "json-text-sequence": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/json-text-sequence/-/json-text-sequence-0.1.1.tgz", + "integrity": "sha1-py8hfcSvxGKf/1/rME3BvVGi89I= sha512-L3mEegEWHRekSHjc7+sc8eJhba9Clq1PZ8kMkzf8OxElhXc8O4TS5MwcVlj9aEbm5dr81N90WHC5nAz3UO971w==", + "requires": { + "delimit-stream": "0.1.0" + } + }, + "jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "requires": { + "graceful-fs": "^4.1.6", + "universalify": "^2.0.0" + }, + "dependencies": { + "universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==" + } + } + }, + "jsonparse": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", + "integrity": "sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA= sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==" + }, + "JSONStream": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.2.tgz", + "integrity": "sha1-wQI3G27Dp887hHygDCC7D85Mbeo= sha512-mn0KSip7N4e0UDPZHnqDsHECo5uGQrixQKnAskOM1BIB8hd7QKbd6il8IPRPudPHOeHiECoCFqhyMaRO9+nWyA==", + "requires": { + "jsonparse": "^1.2.0", + "through": ">=2.2.7 <3" + } + }, + "jsprim": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz", + "integrity": "sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.4.0", + "verror": "1.10.0" + } + }, + "just-kebab-case": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/just-kebab-case/-/just-kebab-case-1.1.0.tgz", + "integrity": "sha512-QkuwuBMQ9BQHMUEkAtIA4INLrkmnnveqlFB1oFi09gbU0wBdZo6tTnyxNWMR84zHxBuwK7GLAwqN8nrvVxOLTA==" + }, + "just-map-keys": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/just-map-keys/-/just-map-keys-1.2.1.tgz", + "integrity": "sha512-Dmyz1Cy2SWM+PpqDPB1kdDglyexdzMthnAsvOIE9w4OPj8NDRuY1mh20x/JfG5w6fCGw9F0WmcofJhYZ4MiuyA==" + }, + "keccak": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/keccak/-/keccak-3.0.2.tgz", + "integrity": "sha512-PyKKjkH53wDMLGrvmRGSNWgmSxZOUqbnXwKL9tmgbFYA1iAYqW21kfR7mZXV0MlESiefxQQE9X9fTa3X+2MPDQ==", + "requires": { + "node-addon-api": "^2.0.0", + "node-gyp-build": "^4.2.0", + "readable-stream": "^3.6.0" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, + "keypair": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/keypair/-/keypair-1.0.4.tgz", + "integrity": "sha512-zwhgOhhniaL7oxMgUMKKw5219PWWABMO+dgMnzJOQ2/5L3XJtTJGhW2PEXlxXj9zaccdReZJZ83+4NPhVfNVDg==" + }, + "kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==" + }, + "ky": { + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/ky/-/ky-0.11.2.tgz", + "integrity": "sha512-5Aou5BWue5/mkPqIRqzSWW+0Hkl403pr/2AIrCKYw7cVl/Xoe8Xe4KLBO0PRjbz7GnRe1/8wW1KhqQNFFE7/GQ==" + }, + "ky-universal": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/ky-universal/-/ky-universal-0.2.2.tgz", + "integrity": "sha512-fb32o/fKy/ux2ALWa9HU2hvGtfOq7/vn2nH0FpVE+jwNzyTeORlAbj3Fiw+WLMbUlmVqZIWupnLZ2USHvqwZHw==", + "requires": { + "abort-controller": "^3.0.0", + "node-fetch": "^2.3.0" + } + }, + "libp2p-crypto": { + "version": "0.16.4", + "resolved": "https://registry.npmjs.org/libp2p-crypto/-/libp2p-crypto-0.16.4.tgz", + "integrity": "sha512-II8HxKc9jbmQp34pprlluNxsBCWJDjHRPYJzuRy7ragztNip9Zb7uJ4lCje6gGzz4DNAcHkAUn+GqCIK1592iA==", + "requires": { + "asmcrypto.js": "^2.3.2", + "asn1.js": "^5.0.1", + "async": "^2.6.1", + "bn.js": "^4.11.8", + "browserify-aes": "^1.2.0", + "bs58": "^4.0.1", + "iso-random-stream": "^1.1.0", + "keypair": "^1.0.1", + "libp2p-crypto-secp256k1": "~0.3.0", + "multihashing-async": "~0.5.1", + "node-forge": "^0.10.0", + "pem-jwk": "^2.0.0", + "protons": "^1.0.1", + "rsa-pem-to-jwk": "^1.1.3", + "tweetnacl": "^1.0.0", + "ursa-optional": "~0.10.0" + }, + "dependencies": { + "multihashing-async": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/multihashing-async/-/multihashing-async-0.5.2.tgz", + "integrity": "sha512-mmyG6M/FKxrpBh9xQDUvuJ7BbqT93ZeEeH5X6LeMYKoYshYLr9BDdCsvDtZvn+Egf+/Xi+aOznrWL4vp3s+p0Q==", + "requires": { + "blakejs": "^1.1.0", + "js-sha3": "~0.8.0", + "multihashes": "~0.4.13", + "murmurhash3js": "^3.0.1", + "nodeify": "^1.0.1" + } + } + } + }, + "libp2p-crypto-secp256k1": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/libp2p-crypto-secp256k1/-/libp2p-crypto-secp256k1-0.3.1.tgz", + "integrity": "sha512-evrfK/CeUSd/lcELUdDruyPBvxDmLairth75S32OLl3H+++2m2fV24JEtxzdFS9JH3xEFw0h6JFO8DBa1bP9dA==", + "requires": { + "async": "^2.6.2", + "bs58": "^4.0.1", + "multihashing-async": "~0.6.0", + "nodeify": "^1.0.1", + "safe-buffer": "^5.1.2", + "secp256k1": "^3.6.2" + }, + "dependencies": { + "multihashing-async": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/multihashing-async/-/multihashing-async-0.6.0.tgz", + "integrity": "sha512-Qv8pgg99Lewc191A5nlXy0bSd2amfqlafNJZmarU6Sj7MZVjpR94SCxQjf4DwPtgWZkiLqsjUQBXA2RSq+hYyA==", + "requires": { + "blakejs": "^1.1.0", + "js-sha3": "~0.8.0", + "multihashes": "~0.4.13", + "murmurhash3js": "^3.0.1", + "nodeify": "^1.0.1" + } + } + } + }, + "lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==" + }, + "lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "lodash.camelcase": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", + "integrity": "sha1-soqmKIorn8ZRA1x3EfZathkDMaY= sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==" + }, + "lodash.kebabcase": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.kebabcase/-/lodash.kebabcase-4.1.1.tgz", + "integrity": "sha1-hImxyw0p/4gZXM7KRI/21swpXDY= sha512-N8XRTIMMqqDgSy4VLKPnJ/+hpGZN+PHQiJnSenYqPaVV/NCqEogTnAdZLQiGKhxX+JCs8waWq2t1XHWKOmlY8g==" + }, + "lodash.lowercase": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.lowercase/-/lodash.lowercase-4.3.0.tgz", + "integrity": "sha1-RlFaztSssLcJMTMzOvBo5MOxTp0= sha512-UcvP1IZYyDKyEL64mmrwoA1AbFu5ahojhTtkOUr1K9dbuxzS9ev8i4TxMMGCqRC9TE8uDaSoufNAXxRPNTseVA==" + }, + "lodash.lowerfirst": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/lodash.lowerfirst/-/lodash.lowerfirst-4.3.1.tgz", + "integrity": "sha1-3jx7EuAsZSSgBZwvbLfFxSZVoT0= sha512-UUKX7VhP1/JL54NXg2aq/E1Sfnjjes8fNYTNkPU8ZmsaVeBvPHKdbNaN79Re5XRL01u6wbq3j0cbYZj71Fcu5w==" + }, + "lodash.pad": { + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/lodash.pad/-/lodash.pad-4.5.1.tgz", + "integrity": "sha1-QzCUmoM6fI2iLMIPaibE1Z3runA= sha512-mvUHifnLqM+03YNzeTBS1/Gr6JRFjd3rRx88FHWUvamVaT9k2O/kXha3yBSOwB9/DTQrSTLJNHvLBBt2FdX7Mg==" + }, + "lodash.padend": { + "version": "4.6.1", + "resolved": "https://registry.npmjs.org/lodash.padend/-/lodash.padend-4.6.1.tgz", + "integrity": "sha1-U8y6BH0G4VjTEfRdpiX05J5vFm4= sha512-sOQs2aqGpbl27tmCS1QNZA09Uqp01ZzWfDUoD+xzTii0E7dSQfRKcRetFwa+uXaxaqL+TKm7CgD2JdKP7aZBSw==" + }, + "lodash.padstart": { + "version": "4.6.1", + "resolved": "https://registry.npmjs.org/lodash.padstart/-/lodash.padstart-4.6.1.tgz", + "integrity": "sha1-0uPuv/DZ05rVD1y9G1KnvOa7YRs= sha512-sW73O6S8+Tg66eY56DBk85aQzzUJDtpoXFBgELMd5P/SotAguo+1kYO6RuYgXxA4HJH3LFTFPASX6ET6bjfriw==" + }, + "lodash.repeat": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/lodash.repeat/-/lodash.repeat-4.1.0.tgz", + "integrity": "sha1-/H3oEx2MisB+S0n3T/6CnR8r7EQ= sha512-eWsgQW89IewS95ZOcr15HHCX6FVDxq3f2PNUIng3fyzsPev9imFQxIYdFZ6crl8L56UR6ZlGDLcEb3RZsCSSqw==" + }, + "lodash.snakecase": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.snakecase/-/lodash.snakecase-4.1.1.tgz", + "integrity": "sha1-OdcUo1NXFHg3rv1ktdy7Fr7Nj40= sha512-QZ1d4xoBHYUeuouhEq3lk3Uq7ldgyFXGBhg04+oRLnIz8o9T65Eh+8YdroUwn846zchkA9yDsDl5CVVaV2nqYw==" + }, + "lodash.startcase": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.startcase/-/lodash.startcase-4.4.0.tgz", + "integrity": "sha1-lDbjTtJgk+1/+uGTYUQ1CRXZrdg= sha512-+WKqsK294HMSc2jEbNgpHpd0JfIBhp7rEV4aqXWqFr6AlXov+SlcgB1Fv01y2kGe3Gc8nMW7VA0SrGuSkRfIEg==" + }, + "lodash.trim": { + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/lodash.trim/-/lodash.trim-4.5.1.tgz", + "integrity": "sha1-NkJefukL5KpeJ7zruFt9EepHqlc= sha512-nJAlRl/K+eiOehWKDzoBVrSMhK0K3A3YQsUNXHQa5yIrKBAhsZgSu3KoAFoFT+mEgiyBHddZ0pRk1ITpIp90Wg==" + }, + "lodash.trimend": { + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/lodash.trimend/-/lodash.trimend-4.5.1.tgz", + "integrity": "sha1-EoBENyhrmMrYmWt5QU4RMAEUCC8= sha512-lsD+k73XztDsMBKPKvzHXRKFNMohTjoTKIIo4ADLn5dA65LZ1BqlAvSXhR2rPEC3BgAUQnzMnorqDtqn2z4IHA==" + }, + "lodash.trimstart": { + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/lodash.trimstart/-/lodash.trimstart-4.5.1.tgz", + "integrity": "sha1-j/TexTLYJIavWVc8OURZFOlEp/E= sha512-b/+D6La8tU76L/61/aN0jULWHkT0EeJCmVstPBn/K9MtD2qBW83AsBNrr63dKuWYwVMO7ucv13QNO/Ek/2RKaQ==" + }, + "lodash.uppercase": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.uppercase/-/lodash.uppercase-4.3.0.tgz", + "integrity": "sha1-xASr/RRp+Tkx+bskz2zH1XBZvHM= sha512-+Nbnxkj7s8K5U8z6KnEYPGUOGp3woZbB7Ecs7v3LkkjLQSm2kP9SKIILitN1ktn2mB/tmM9oSlku06I+/lH7QA==" + }, + "lodash.upperfirst": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/lodash.upperfirst/-/lodash.upperfirst-4.3.1.tgz", + "integrity": "sha1-E2Xt9DFIBIHvDRxolXpe2Z1J984= sha512-sReKOYJIJf74dhJONhU4e0/shzi1trVbSWDOhKYE5XV2O+H7Sb2Dihwuc7xWxVl+DgFPyTqIN3zMfT9cq5iWDg==" + }, + "log-symbols": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-3.0.0.tgz", + "integrity": "sha512-dSkNGuI7iG3mfvDzUuYZyvk5dD9ocYCYzNU6CYDE6+Xqd+gwme6Z00NS3dUh8mq/73HaEtT7m6W+yUPtU6BZnQ==", + "requires": { + "chalk": "^2.4.2" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0= sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==" + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "long": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", + "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" + }, + "looper": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/looper/-/looper-3.0.0.tgz", + "integrity": "sha1-LvpUw7HLq6m5Su4uWRSwvlf7t0k= sha512-LJ9wplN/uSn72oJRsXTx+snxPet5c8XiZmOKCm906NVYu+ag6SB6vUcnJcWxgnl2NfbIyeobAn7Bwv6xRj2XJg==" + }, + "lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "requires": { + "yallist": "^3.0.2" + } + }, + "mafmt": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/mafmt/-/mafmt-7.1.0.tgz", + "integrity": "sha512-vpeo9S+hepT3k2h5iFxzEHvvR0GPBx9uKaErmnRzYNcaKb03DgOArjEMlgG4a9LcuZZ89a3I8xbeto487n26eA==", + "requires": { + "multiaddr": "^7.3.0" + }, + "dependencies": { + "cids": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/cids/-/cids-0.8.3.tgz", + "integrity": "sha512-yoXTbV3llpm+EBGWKeL9xKtksPE/s6DPoDSY4fn8I8TEW1zehWXPSB0pwAXVDlLaOlrw+sNynj995uD9abmPhA==", + "requires": { + "buffer": "^5.6.0", + "class-is": "^1.1.0", + "multibase": "^1.0.0", + "multicodec": "^1.0.1", + "multihashes": "^1.0.1" + }, + "dependencies": { + "multibase": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/multibase/-/multibase-1.0.1.tgz", + "integrity": "sha512-KcCxpBVY8fdVKu4dJMAahq4F/2Z/9xqEjIiR7PiMe7LRGeorFn2NLmicN6nLBCqQvft6MG2Lc9X5P0IdyvnxEw==", + "requires": { + "base-x": "^3.0.8", + "buffer": "^5.5.0" + } + } + } + }, + "ip-regex": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.3.0.tgz", + "integrity": "sha512-B9ZWJxHHOHUhUjCPrMpLD4xEq35bUTClHM1S6CBU5ixQnkZmwipwgc96vAd7AAGM9TGHvJR+Uss+/Ak6UphK+Q==" + }, + "is-ip": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-ip/-/is-ip-3.1.0.tgz", + "integrity": "sha512-35vd5necO7IitFPjd/YBeqwWnyDWbuLH9ZXQdMfDA8TEo7pv5X8yfrvVO3xbJbLUlERCMvf6X0hTUamQxCYJ9Q==", + "requires": { + "ip-regex": "^4.0.0" + } + }, + "multiaddr": { + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/multiaddr/-/multiaddr-7.5.0.tgz", + "integrity": "sha512-GvhHsIGDULh06jyb6ev+VfREH9evJCFIRnh3jUt9iEZ6XDbyoisZRFEI9bMvK/AiR6y66y6P+eoBw9mBYMhMvw==", + "requires": { + "buffer": "^5.5.0", + "cids": "~0.8.0", + "class-is": "^1.1.0", + "is-ip": "^3.1.0", + "multibase": "^0.7.0", + "varint": "^5.0.0" + } + }, + "multibase": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/multibase/-/multibase-0.7.0.tgz", + "integrity": "sha512-TW8q03O0f6PNFTQDvh3xxH03c8CjGaaYrjkl9UQPG6rz53TQzzxJVCIWVjzcbN/Q5Y53Zd0IBQBMVktVgNx4Fg==", + "requires": { + "base-x": "^3.0.8", + "buffer": "^5.5.0" + } + }, + "multicodec": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/multicodec/-/multicodec-1.0.4.tgz", + "integrity": "sha512-NDd7FeS3QamVtbgfvu5h7fd1IlbaC4EQ0/pgU4zqE2vdHCmBGsUa0TiM8/TdSeG6BMPC92OOCf8F1ocE/Wkrrg==", + "requires": { + "buffer": "^5.6.0", + "varint": "^5.0.0" + } + }, + "multihashes": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/multihashes/-/multihashes-1.0.1.tgz", + "integrity": "sha512-S27Tepg4i8atNiFaU5ZOm3+gl3KQlUanLs/jWcBxQHFttgq+5x1OgbQmf2d8axJ/48zYGBd/wT9d723USMFduw==", + "requires": { + "buffer": "^5.6.0", + "multibase": "^1.0.1", + "varint": "^5.0.0" + }, + "dependencies": { + "multibase": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/multibase/-/multibase-1.0.1.tgz", + "integrity": "sha512-KcCxpBVY8fdVKu4dJMAahq4F/2Z/9xqEjIiR7PiMe7LRGeorFn2NLmicN6nLBCqQvft6MG2Lc9X5P0IdyvnxEw==", + "requires": { + "base-x": "^3.0.8", + "buffer": "^5.5.0" + } + } + } + } + } + }, + "md5.js": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", + "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", + "requires": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==" + }, + "mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==" + }, + "mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "requires": { + "mime-db": "1.52.0" + } + }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==" + }, + "minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" + }, + "minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo= sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==" + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==" + }, + "minipass": { + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.1.6.tgz", + "integrity": "sha512-rty5kpw9/z8SX9dmxblFA6edItUmwJgMeYDZRrwlIVN27i8gysGbznJwUggw2V/FVqFSDdWy040ZPS811DYAqQ==", + "requires": { + "yallist": "^4.0.0" + }, + "dependencies": { + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + } + } + }, + "minizlib": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz", + "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", + "requires": { + "minipass": "^3.0.0", + "yallist": "^4.0.0" + }, + "dependencies": { + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + } + } + }, + "mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==" + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "multiaddr": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/multiaddr/-/multiaddr-6.1.1.tgz", + "integrity": "sha512-Q1Ika0F9MNhMtCs62Ue+GWIJtRFEhZ3Xz8wH7/MZDVZTWhil1/H2bEGN02kUees3hkI3q1oHSjmXYDM0gxaFjQ==", + "requires": { + "bs58": "^4.0.1", + "class-is": "^1.1.0", + "hi-base32": "~0.5.0", + "ip": "^1.1.5", + "is-ip": "^2.0.0", + "varint": "^5.0.0" + } + }, + "multibase": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/multibase/-/multibase-0.6.1.tgz", + "integrity": "sha512-pFfAwyTjbbQgNc3G7D48JkJxWtoJoBMaR4xQUOuB8RnCgRqaYmWNFeJTTvrJ2w51bjLq2zTby6Rqj9TQ9elSUw==", + "requires": { + "base-x": "^3.0.8", + "buffer": "^5.5.0" + } + }, + "multicodec": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/multicodec/-/multicodec-0.5.7.tgz", + "integrity": "sha512-PscoRxm3f+88fAtELwUnZxGDkduE2HD9Q6GHUOywQLjOGT/HAdhjLDYNZ1e7VR0s0TP0EwZ16LNUTFpoBGivOA==", + "requires": { + "varint": "^5.0.0" + } + }, + "multihashes": { + "version": "0.4.21", + "resolved": "https://registry.npmjs.org/multihashes/-/multihashes-0.4.21.tgz", + "integrity": "sha512-uVSvmeCWf36pU2nB4/1kzYZjsXD9vofZKpgudqkceYY5g2aZZXJ5r9lxuzoRLl1OAp28XljXsEJ/X/85ZsKmKw==", + "requires": { + "buffer": "^5.5.0", + "multibase": "^0.7.0", + "varint": "^5.0.0" + }, + "dependencies": { + "multibase": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/multibase/-/multibase-0.7.0.tgz", + "integrity": "sha512-TW8q03O0f6PNFTQDvh3xxH03c8CjGaaYrjkl9UQPG6rz53TQzzxJVCIWVjzcbN/Q5Y53Zd0IBQBMVktVgNx4Fg==", + "requires": { + "base-x": "^3.0.8", + "buffer": "^5.5.0" + } + } + } + }, + "multihashing-async": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/multihashing-async/-/multihashing-async-0.8.2.tgz", + "integrity": "sha512-2lKa1autuCy8x7KIEj9aVNbAb3aIMRFYIwN7mq/zD4pxgNIVgGlm+f6GKY4880EOF2Y3GktHYssRy7TAJQ2DyQ==", + "requires": { + "blakejs": "^1.1.0", + "buffer": "^5.4.3", + "err-code": "^2.0.0", + "js-sha3": "^0.8.0", + "multihashes": "^1.0.1", + "murmurhash3js-revisited": "^3.0.0" + }, + "dependencies": { + "multibase": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/multibase/-/multibase-1.0.1.tgz", + "integrity": "sha512-KcCxpBVY8fdVKu4dJMAahq4F/2Z/9xqEjIiR7PiMe7LRGeorFn2NLmicN6nLBCqQvft6MG2Lc9X5P0IdyvnxEw==", + "requires": { + "base-x": "^3.0.8", + "buffer": "^5.5.0" + } + }, + "multihashes": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/multihashes/-/multihashes-1.0.1.tgz", + "integrity": "sha512-S27Tepg4i8atNiFaU5ZOm3+gl3KQlUanLs/jWcBxQHFttgq+5x1OgbQmf2d8axJ/48zYGBd/wT9d723USMFduw==", + "requires": { + "buffer": "^5.6.0", + "multibase": "^1.0.1", + "varint": "^5.0.0" + } + } + } + }, + "murmurhash3js": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/murmurhash3js/-/murmurhash3js-3.0.1.tgz", + "integrity": "sha1-Ppg+W0fCoG9DpxMXTn5DXKBEuZg= sha512-KL8QYUaxq7kUbcl0Yto51rMcYt7E/4N4BG3/c96Iqw1PQrTRspu8Cpx4TZ4Nunib1d4bEkIH3gjCYlP2RLBdow==" + }, + "murmurhash3js-revisited": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/murmurhash3js-revisited/-/murmurhash3js-revisited-3.0.0.tgz", + "integrity": "sha512-/sF3ee6zvScXMb1XFJ8gDsSnY+X8PbOyjIuBhtgis10W2Jx4ZjIhikUCIF9c4gpJxVnQIsPAFrSwTCuAjicP6g==" + }, + "mute-stream": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", + "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==" + }, + "nan": { + "version": "2.15.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.15.0.tgz", + "integrity": "sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ==" + }, + "ndjson": { + "version": "git+ssh://git@github.com/hugomrdias/ndjson.git#4db16da6b42e5b39bf300c3a7cde62abb3fa3a11", + "from": "ndjson@github:hugomrdias/ndjson#feat/readable-stream3", + "requires": { + "json-stringify-safe": "^5.0.1", + "minimist": "^1.2.0", + "split2": "^3.1.0", + "through2": "^3.0.0" + } + }, + "node-addon-api": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", + "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==" + }, + "node-fetch": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", + "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==" + }, + "node-forge": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz", + "integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==" + }, + "node-gyp-build": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.5.0.tgz", + "integrity": "sha512-2iGbaQBV+ITgCz76ZEjmhUKAKVf7xfY1sRl4UiKQspfZMH2h06SyhNsnSVy50cwkFQDGLyif6m/6uFXHkOZ6rg==" + }, + "nodeify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/nodeify/-/nodeify-1.0.1.tgz", + "integrity": "sha1-ZKtpp7268DzhB7TwM1yHwLnpGx0= sha512-n7C2NyEze8GCo/z73KdbjRsBiLbv6eBn1FxwYKQ23IqGo7pQY3mhQan61Sv7eEDJCiyUjTVrVkXTzJCo1dW7Aw==", + "requires": { + "is-promise": "~1.0.0", + "promise": "~1.3.0" + } + }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==" + }, + "npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "requires": { + "path-key": "^3.0.0" + } + }, + "number-to-bn": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/number-to-bn/-/number-to-bn-1.7.0.tgz", + "integrity": "sha512-wsJ9gfSz1/s4ZsJN01lyonwuxA1tml6X1yBDnfpMglypcBRFZZkus26EdPSlqS5GJfYddVZa22p3VNb3z5m5Ig==", + "requires": { + "bn.js": "4.11.6", + "strip-hex-prefix": "1.0.0" + }, + "dependencies": { + "bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha512-XWwnNNFCuuSQ0m3r3C4LE3EiORltHd9M05pq6FOlVeiophzRbMo50Sbz1ehl8K3Z+jw9+vmgnXefY1hz8X+2wA==" + } + } + }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==" + }, + "object-inspect": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.0.tgz", + "integrity": "sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g==" + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E= sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "requires": { + "wrappy": "1" + } + }, + "onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "requires": { + "mimic-fn": "^2.1.0" + } + }, + "optimist": { + "version": "0.3.7", + "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.3.7.tgz", + "integrity": "sha1-yQlBrVnkJzMokjB00s8ufLxuwNk= sha512-TCx0dXQzVtSCg2OgY/bO9hjM9cV4XYx09TVK+s3+FhkjT6LovsLe+pPMzpWf+6yXK/hUizs2gUoTw3jHM0VaTQ==", + "requires": { + "wordwrap": "~0.0.2" + } + }, + "ora": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ora/-/ora-4.1.1.tgz", + "integrity": "sha512-sjYP8QyVWBpBZWD6Vr1M/KwknSw6kJOz41tvGMlwWeClHBtYKTbHMki1PsLZnxKpXMPbTKv9b3pjQu3REib96A==", + "requires": { + "chalk": "^3.0.0", + "cli-cursor": "^3.1.0", + "cli-spinners": "^2.2.0", + "is-interactive": "^1.0.0", + "log-symbols": "^3.0.0", + "mute-stream": "0.0.8", + "strip-ansi": "^6.0.0", + "wcwidth": "^1.0.1" + } + }, + "p-finally": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-2.0.1.tgz", + "integrity": "sha512-vpm09aKwq6H9phqRQzecoDpD8TmVyGw70qmWlyq5onxY7tqyTTFVvxMykxQSQKILBSFlbXpypIw2T1Ml7+DDtw==" + }, + "parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "requires": { + "callsites": "^3.0.0" + } + }, + "parse-cache-control": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parse-cache-control/-/parse-cache-control-1.0.1.tgz", + "integrity": "sha512-60zvsJReQPX5/QP0Kzfd/VrpjScIQ7SHBW6bFCYfEP+fp0Eppr1SHhIO5nd1PjZtvclzSzES9D/p5nFJurwfWg==" + }, + "parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "requires": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18= sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==" + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==" + }, + "path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==" + }, + "pbkdf2": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.2.tgz", + "integrity": "sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA==", + "requires": { + "create-hash": "^1.1.2", + "create-hmac": "^1.1.4", + "ripemd160": "^2.0.1", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, + "peer-id": { + "version": "0.12.5", + "resolved": "https://registry.npmjs.org/peer-id/-/peer-id-0.12.5.tgz", + "integrity": "sha512-3xVWrtIvNm9/OPzaQBgXDrfWNx63AftgFQkvqO6YSZy7sP3Fuadwwbn54F/VO9AnpyW/26i0WRQz9FScivXrmw==", + "requires": { + "async": "^2.6.3", + "class-is": "^1.1.0", + "libp2p-crypto": "~0.16.1", + "multihashes": "~0.4.15" + } + }, + "peer-info": { + "version": "0.15.1", + "resolved": "https://registry.npmjs.org/peer-info/-/peer-info-0.15.1.tgz", + "integrity": "sha512-Y91Q2tZRC0CpSTPd1UebhGqniOrOAk/aj60uYUcWJXCoLTAnGu+4LJGoiay8ayudS6ice7l3SKhgL/cS62QacA==", + "requires": { + "mafmt": "^6.0.2", + "multiaddr": "^6.0.3", + "peer-id": "~0.12.2", + "unique-by": "^1.0.0" + }, + "dependencies": { + "mafmt": { + "version": "6.0.10", + "resolved": "https://registry.npmjs.org/mafmt/-/mafmt-6.0.10.tgz", + "integrity": "sha512-FjHDnew6dW9lUu3eYwP0FvvJl9uvNbqfoJM+c1WJcSyutNEIlyu6v3f/rlPnD1cnmue38IjuHlhBdIh3btAiyw==", + "requires": { + "multiaddr": "^6.1.0" + } + } + } + }, + "pem-jwk": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pem-jwk/-/pem-jwk-2.0.0.tgz", + "integrity": "sha512-rFxu7rVoHgQ5H9YsP50dDWf0rHjreVA2z0yPiWr5WdH/UHb29hKtF7h6l8vNd1cbYR1t0QL+JKhW55a2ZV4KtA==", + "requires": { + "asn1.js": "^5.0.1" + } + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==" + }, + "picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==" + }, + "pkginfo": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.4.1.tgz", + "integrity": "sha512-8xCNE/aT/EXKenuMDZ+xTVwkT8gsoHN2z/Q29l80u0ppGEXVvsKRzNMbtKhg8LS8k1tJLAHHylf6p4VFmP6XUQ==" + }, + "pluralize": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz", + "integrity": "sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==" + }, + "prettier": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz", + "integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==", + "dev": true + }, + "process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" + }, + "promise": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/promise/-/promise-1.3.0.tgz", + "integrity": "sha1-5cyaTIJ45GZP/twBx9qEhCsEAXU= sha512-R9WrbTF3EPkVtWjp7B7umQGVndpsi+rsDAfrR4xAALQpFLa/+2OriecLhawxzvii2gd9+DZFwROWDuUUaqS5yA==", + "requires": { + "is-promise": "~1" + } + }, + "promise-nodeify": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/promise-nodeify/-/promise-nodeify-3.0.1.tgz", + "integrity": "sha512-ghsSuzZXJX8iO7WVec2z7GI+Xk/EyiD+JZK7AZKhUqYfpLa/Zs4ylUD+CwwnKlG6G3HnkUPMAi6PO7zeqGKssg==" + }, + "promisify-es6": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/promisify-es6/-/promisify-es6-1.0.3.tgz", + "integrity": "sha512-N9iVG+CGJsI4b4ZGazjwLnxErD2d9Pe4DPvvXSxYA9tFNu8ymXME4Qs5HIQ0LMJpNM7zj+m0NlNnNeqFpKzqnA==" + }, + "protocol-buffers-schema": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/protocol-buffers-schema/-/protocol-buffers-schema-3.6.0.tgz", + "integrity": "sha512-TdDRD+/QNdrCGCE7v8340QyuXd4kIWIgapsE2+n/SaGiSSbomYl4TjHlvIoCWRpE7wFt02EpB35VVA2ImcBVqw==" + }, + "protons": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/protons/-/protons-1.2.1.tgz", + "integrity": "sha512-2oqDyc/SN+tNcJf8XxrXhYL7sQn2/OMl8mSdD7NVGsWjMEmAbks4eDVnCyf0vAoRbBWyWTEXWk4D8XfuKVl3zg==", + "requires": { + "buffer": "^5.5.0", + "protocol-buffers-schema": "^3.3.1", + "signed-varint": "^2.0.1", + "varint": "^5.0.0" + } + }, + "psl": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", + "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==" + }, + "pull-defer": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/pull-defer/-/pull-defer-0.2.3.tgz", + "integrity": "sha512-/An3KE7mVjZCqNhZsr22k1Tx8MACnUnHZZNPSJ0S62td8JtYr/AiRG42Vz7Syu31SoTLUzVIe61jtT/pNdjVYA==" + }, + "pull-stream": { + "version": "3.6.14", + "resolved": "https://registry.npmjs.org/pull-stream/-/pull-stream-3.6.14.tgz", + "integrity": "sha512-KIqdvpqHHaTUA2mCYcLG1ibEbu/LCKoJZsBWyv9lSYtPkJPBq8m3Hxa103xHi6D2thj5YXa0TqK3L3GUkwgnew==" + }, + "pull-to-stream": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/pull-to-stream/-/pull-to-stream-0.1.1.tgz", + "integrity": "sha512-thZkMv6F9PILt9zdvpI2gxs19mkDrlixYKX6cOBxAW16i1NZH+yLAmF4r8QfJ69zuQh27e01JZP9y27tsH021w==", + "requires": { + "readable-stream": "^3.1.1" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" + }, + "qs": { + "version": "6.10.3", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz", + "integrity": "sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==", + "requires": { + "side-channel": "^1.0.4" + } + }, + "ramda": { + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/ramda/-/ramda-0.25.0.tgz", + "integrity": "sha512-GXpfrYVPwx3K7RQ6aYT8KPS8XViSXUVJT1ONhoKPE9VAleW42YE+U+8VEyGWt41EnEQW7gwecYJriTI0pKoecQ==" + }, + "ramdasauce": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ramdasauce/-/ramdasauce-2.1.3.tgz", + "integrity": "sha512-Ml3CPim4SKwmg5g9UI77lnRSeKr/kQw7YhQ6rfdMcBYy6DMlwmkEwQqjygJ3OhxPR+NfFfpjKl3Tf8GXckaqqg==", + "requires": { + "ramda": "^0.24.1" + }, + "dependencies": { + "ramda": { + "version": "0.24.1", + "resolved": "https://registry.npmjs.org/ramda/-/ramda-0.24.1.tgz", + "integrity": "sha1-w7d1UZfzW43DUCIoJixMkd22uFc= sha512-HEm619G8PaZMfkqCa23qiOe7r3R0brPu7ZgOsgKUsnvLhd0qhc/vTjkUovomgPWa5ECBa08fJZixth9LaoBo5w==" + } + } + }, + "randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "requires": { + "safe-buffer": "^5.1.0" + } + }, + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "readdirp": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz", + "integrity": "sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==", + "requires": { + "picomatch": "^2.2.1" + } + }, + "regenerator-runtime": { + "version": "0.13.10", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.10.tgz", + "integrity": "sha512-KepLsg4dU12hryUO7bp/axHAKvwGOCV0sGloQtpagJ12ai+ojVDqkeGSiRX1zlq+kjIMZ1t7gpze+26QqtdGqw==" + }, + "request": { + "version": "2.88.2", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", + "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.3", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.5.0", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + }, + "dependencies": { + "qs": { + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz", + "integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==" + }, + "uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" + } + } + }, + "rescript": { + "version": "9.1.4", + "resolved": "https://registry.npmjs.org/rescript/-/rescript-9.1.4.tgz", + "integrity": "sha512-aXANK4IqecJzdnDpJUsU6pxMViCR5ogAxzuqS0mOr8TloMnzAjJFu63fjD6LCkWrKAhlMkFFzQvVQYaAaVkFXw==" + }, + "resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==" + }, + "restore-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", + "requires": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + } + }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "requires": { + "glob": "^7.1.3" + } + }, + "ripemd160": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", + "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", + "requires": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1" + } + }, + "rlp": { + "version": "2.2.7", + "resolved": "https://registry.npmjs.org/rlp/-/rlp-2.2.7.tgz", + "integrity": "sha512-d5gdPmgQ0Z+AklL2NVXr/IoSjNZFfTVvQWzL/AM2AOcSzYP2xjlb0AC8YyCLc41MSNf6P6QVtjgPdmVtzb+4lQ==", + "requires": { + "bn.js": "^5.2.0" + }, + "dependencies": { + "bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + } + } + }, + "rsa-pem-to-jwk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/rsa-pem-to-jwk/-/rsa-pem-to-jwk-1.1.3.tgz", + "integrity": "sha1-JF52vbfnI0z+58oDLTG1TDj6uY4= sha512-ZlVavEvTnD8Rzh/pdB8NH4VF5GNEtF6biGQcTtC4GKFMsbZR08oHtOYefbhCN+JnJIuMItiCDCMycdcMrw6blA==", + "requires": { + "object-assign": "^2.0.0", + "rsa-unpack": "0.0.6" + }, + "dependencies": { + "object-assign": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-2.1.1.tgz", + "integrity": "sha1-Q8NuXVaf+OSBbE76i+AtJpZ8GKo= sha512-CdsOUYIh5wIiozhJ3rLQgmUTgcyzFwZZrqhkKhODMoGtPKM+wt0h0CNIoauJWMsS9822EdzPsF/6mb4nLvPN5g==" + } + } + }, + "rsa-unpack": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/rsa-unpack/-/rsa-unpack-0.0.6.tgz", + "integrity": "sha1-9Q69VqYoN45jHylxYQJs6atO3bo= sha512-HRrl8GHjjPziPFRDJPq/v5OxZ3IPdksV5h3cime/oHgcgM1k1toO5OdtzClgBqRf5dF6IgptOB0g/zFb0w5zQw==", + "requires": { + "optimist": "~0.3.5" + } + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "scrypt-js": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-3.0.1.tgz", + "integrity": "sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==" + }, + "secp256k1": { + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-3.8.0.tgz", + "integrity": "sha512-k5ke5avRZbtl9Tqx/SA7CbY3NF6Ro+Sj9cZxezFzuBlLDmyqPiL8hJJ+EmzD8Ig4LUDByHJ3/iPOVoRixs/hmw==", + "requires": { + "bindings": "^1.5.0", + "bip66": "^1.1.5", + "bn.js": "^4.11.8", + "create-hash": "^1.2.0", + "drbg.js": "^1.0.1", + "elliptic": "^6.5.2", + "nan": "^2.14.0", + "safe-buffer": "^5.1.2" + } + }, + "semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "requires": { + "lru-cache": "^6.0.0" + }, + "dependencies": { + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "requires": { + "yallist": "^4.0.0" + } + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + } + } + }, + "setimmediate": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", + "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==" + }, + "sha.js": { + "version": "2.4.11", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" + }, + "side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "requires": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + } + }, + "signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" + }, + "signed-varint": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/signed-varint/-/signed-varint-2.0.1.tgz", + "integrity": "sha1-UKmYnafJjCxh2tEZvJdHDvhSgSk= sha512-abgDPg1106vuZZOvw7cFwdCABddfJRz5akcCcchzTbhyhYnsG31y4AlZEgp315T7W3nQq5P4xeOm186ZiPVFzw==", + "requires": { + "varint": "~5.0.0" + } + }, + "split-ca": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/split-ca/-/split-ca-1.0.1.tgz", + "integrity": "sha1-bIOv82kvphJW4M0ZfgXp3hV2kaY= sha512-Q5thBSxp5t8WPTTJQS59LrGqOZqOsrhDGDVm8azCqIBjSBd7nd9o2PM+mDulQQkh8h//4U6hFZnc/mul8t5pWQ==" + }, + "split2": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/split2/-/split2-3.2.2.tgz", + "integrity": "sha512-9NThjpgZnifTkJpzTZ7Eue85S49QwpNhZTq6GRJwObb6jnLFNGB7Qm73V5HewTROPyxD0C29xqmaI68bQtV+hg==", + "requires": { + "readable-stream": "^3.0.0" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==" + }, + "sshpk": { + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.17.0.tgz", + "integrity": "sha512-/9HIEs1ZXGhSPE8X6Ccm7Nam1z8KcoCqPdI7ecm1N33EzAetWahvQWVqLZtaZQ+IDKX4IyA2o0gBzqIMkAagHQ==", + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + }, + "dependencies": { + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q= sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==" + } + } + }, + "stable": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/stable/-/stable-0.1.8.tgz", + "integrity": "sha512-ji9qxRnOVfcuLDySj9qzhGSEFVobyt1kIOSkj1qZzYLzq7Tos/oUUWvotUPQLlrsidqsK6tBH89Bc9kL5zHA6w==" + }, + "stream-to-pull-stream": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/stream-to-pull-stream/-/stream-to-pull-stream-1.7.3.tgz", + "integrity": "sha512-6sNyqJpr5dIOQdgNy/xcDWwDuzAsAwVzhzrWlAPAQ7Lkjx/rv0wgvxEyKwTq6FmNd5rjTrELt/CLmaSw7crMGg==", + "requires": { + "looper": "^3.0.0", + "pull-stream": "^3.2.3" + } + }, + "string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "requires": { + "safe-buffer": "~5.2.0" + } + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg= sha512-wFUFA5bg5dviipbQQ32yOQhl6gcJaJXiHE7dvR8VYPG97+J/GNC5FKGepKdEDUFeXRzDxPF1X/Btc8L+v7oqIQ==" + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8= sha512-4XaJ2zQdCzROZDivEVIDPkcQn8LMFSa8kj8Gxb/Lnwzv9A8VctNZ+lfivC/sV3ivW8ElJTERXZoPBRrZKkNKow==", + "requires": { + "ansi-regex": "^3.0.0" + } + } + } + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "requires": { + "ansi-regex": "^5.0.1" + } + }, + "strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==" + }, + "strip-hex-prefix": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz", + "integrity": "sha512-q8d4ue7JGEiVcypji1bALTos+0pWtyGlivAWyPuTkHzuTCJqrK9sWxYQZUq6Nq3cuyv3bm734IhHvHtGGURU6A==", + "requires": { + "is-hex-prefixed": "1.0.0" + } + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "requires": { + "has-flag": "^4.0.0" + } + }, + "sync-request": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/sync-request/-/sync-request-6.1.0.tgz", + "integrity": "sha512-8fjNkrNlNCrVc/av+Jn+xxqfCjYaBoHqCsDz6mt030UMxJGr+GSfCV1dQt2gRtlL63+VPidwDVLr7V2OcTSdRw==", + "requires": { + "http-response-object": "^3.0.1", + "sync-rpc": "^1.2.1", + "then-request": "^6.0.0" + } + }, + "sync-rpc": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/sync-rpc/-/sync-rpc-1.3.6.tgz", + "integrity": "sha512-J8jTXuZzRlvU7HemDgHi3pGnh/rkoqR/OZSjhTyyZrEkkYQbk7Z33AXp37mkPfPpfdOuj7Ex3H/TJM1z48uPQw==", + "requires": { + "get-port": "^3.1.0" + } + }, + "tar": { + "version": "6.1.11", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.11.tgz", + "integrity": "sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA==", + "requires": { + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "minipass": "^3.0.0", + "minizlib": "^2.1.1", + "mkdirp": "^1.0.3", + "yallist": "^4.0.0" + }, + "dependencies": { + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + } + } + }, + "tar-fs": { + "version": "1.16.3", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-1.16.3.tgz", + "integrity": "sha512-NvCeXpYx7OsmOh8zIOP/ebG55zZmxLE0etfWRbWok+q2Qo8x/vOR/IJT1taADXPe+jsiu9axDb3X4B+iIgNlKw==", + "requires": { + "chownr": "^1.0.1", + "mkdirp": "^0.5.1", + "pump": "^1.0.0", + "tar-stream": "^1.1.2" + }, + "dependencies": { + "bl": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.3.tgz", + "integrity": "sha512-pvcNpa0UU69UT341rO6AYy4FVAIkUHuZXRIWbq+zHnsVcRzDDjIAhGuuYoi0d//cwIwtt4pkpKycWEfjdV+vww==", + "requires": { + "readable-stream": "^2.3.5", + "safe-buffer": "^5.1.1" + } + }, + "chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==" + }, + "mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "requires": { + "minimist": "^1.2.6" + } + }, + "pump": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/pump/-/pump-1.0.3.tgz", + "integrity": "sha512-8k0JupWme55+9tCVE+FS5ULT3K6AbgqrGa58lTT49RpyfwwcGedHqaC5LlQNdEAumn/wFsu6aPwkuPMioy8kqw==", + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "tar-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-1.6.2.tgz", + "integrity": "sha512-rzS0heiNf8Xn7/mpdSVVSMAWAoy9bfb1WOTYC78Z0UQKeKa/CWS8FOq0lKGNa8DWKAn9gxjCvMLYc5PGXYlK2A==", + "requires": { + "bl": "^1.0.0", + "buffer-alloc": "^1.2.0", + "end-of-stream": "^1.0.0", + "fs-constants": "^1.0.0", + "readable-stream": "^2.3.0", + "to-buffer": "^1.1.1", + "xtend": "^4.0.0" + } + } + } + }, + "tar-stream": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", + "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", + "requires": { + "bl": "^4.0.3", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + }, + "dependencies": { + "bl": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "requires": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, + "then-request": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/then-request/-/then-request-6.0.2.tgz", + "integrity": "sha512-3ZBiG7JvP3wbDzA9iNY5zJQcHL4jn/0BWtXIkagfz7QgOL/LqjCEOBQuJNZfu0XYnv5JhKh+cDxCPM4ILrqruA==", + "requires": { + "@types/concat-stream": "^1.6.0", + "@types/form-data": "0.0.33", + "@types/node": "^8.0.0", + "@types/qs": "^6.2.31", + "caseless": "~0.12.0", + "concat-stream": "^1.6.0", + "form-data": "^2.2.0", + "http-basic": "^8.1.1", + "http-response-object": "^3.0.1", + "promise": "^8.0.0", + "qs": "^6.4.0" + }, + "dependencies": { + "@types/node": { + "version": "8.10.66", + "resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.66.tgz", + "integrity": "sha512-tktOkFUA4kXx2hhhrB8bIFb5TbwzS4uOhKEmwiD+NoiL0qtP2OQ9mFldbgD4dV1djrlBYP6eBuQZiWjuHUpqFw==" + }, + "promise": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/promise/-/promise-8.3.0.tgz", + "integrity": "sha512-rZPNPKTOYVNEEKFaq1HqTgOwZD+4/YHS5ukLzQCypkj+OkYx7iv0mA91lJlpPPZ8vMau3IIGj5Qlwrx+8iiSmg==", + "requires": { + "asap": "~2.0.6" + } + } + } + }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU= sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==" + }, + "through2": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/through2/-/through2-3.0.2.tgz", + "integrity": "sha512-enaDQ4MUyP2W6ZyT6EsMzqBPZaM/avg8iuo+l2d3QCs0J+6RaqkHV/2/lOwDTueBHeJ/2LG9lrLW3d5rWPucuQ==", + "requires": { + "inherits": "^2.0.4", + "readable-stream": "2 || 3" + } + }, + "tmp": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", + "integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==", + "requires": { + "rimraf": "^3.0.0" + } + }, + "tmp-promise": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/tmp-promise/-/tmp-promise-3.0.2.tgz", + "integrity": "sha512-OyCLAKU1HzBjL6Ev3gxUeraJNlbNingmi8IrHHEsYH8LTmEuhvYfqvhn2F/je+mjf4N58UmZ96OMEy1JanSCpA==", + "requires": { + "tmp": "^0.2.0" + } + }, + "to-buffer": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/to-buffer/-/to-buffer-1.1.1.tgz", + "integrity": "sha512-lx9B5iv7msuFYE3dytT+KE5tap+rNYw+K4jVkb9R/asAb+pbBSM17jtunHplhBe6RRJdZx3Pn2Jph24O32mOVg==" + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "requires": { + "is-number": "^7.0.0" + } + }, + "tough-cookie": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", + "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "requires": { + "psl": "^1.1.28", + "punycode": "^2.1.1" + } + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0= sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", + "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==" + }, + "typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==" + }, + "typescript": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "dev": true + }, + "unique-by": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unique-by/-/unique-by-1.0.0.tgz", + "integrity": "sha1-UiDIa6e8Vy+3E610ZRRwy2RCEr0= sha512-rJRXK5V0zL6TiSzhoGNpJp5dr+TZBLoPJFC06rLn17Ug++7Aa0Qnve5v+skXeQxx6/sI7rBsSesa6MAcmFi8Ew==" + }, + "universalify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-1.0.0.tgz", + "integrity": "sha512-rb6X1W158d7pRQBg5gkR8uPaSfiids68LTJQYOtEUhoJUWBdaQHsuT/EUduxXYxcrt4r5PJ4fuHW1MHT6p0qug==" + }, + "uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "requires": { + "punycode": "^2.1.0" + } + }, + "ursa-optional": { + "version": "0.10.2", + "resolved": "https://registry.npmjs.org/ursa-optional/-/ursa-optional-0.10.2.tgz", + "integrity": "sha512-TKdwuLboBn7M34RcvVTuQyhvrA8gYKapuVdm0nBP0mnBc7oECOfUQZrY91cefL3/nm64ZyrejSRrhTVdX7NG/A==", + "requires": { + "bindings": "^1.5.0", + "nan": "^2.14.2" + } + }, + "utf8": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/utf8/-/utf8-3.0.0.tgz", + "integrity": "sha512-E8VjFIQ/TyQgp+TZfS6l8yp/xWppSAHzidGiRrqe4bK4XP9pTRyKFgGJpO3SN7zdX4DeomTrwaseCHovfpFcqQ==" + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, + "uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==" + }, + "varint": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/varint/-/varint-5.0.2.tgz", + "integrity": "sha512-lKxKYG6H03yCZUpAGOPOsMcGxd1RHCu1iKvEHYDPmTyq2HueGhD73ssNBqqQWfvYs04G9iUFRvmAVLW20Jw6ow==" + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA= sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==", + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + }, + "dependencies": { + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==" + } + } + }, + "wcwidth": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", + "integrity": "sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g= sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==", + "requires": { + "defaults": "^1.0.3" + } + }, + "web3-eth-abi": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.7.0.tgz", + "integrity": "sha512-heqR0bWxgCJwjWIhq2sGyNj9bwun5+Xox/LdZKe+WMyTSy0cXDXEAgv3XKNkXC4JqdDt/ZlbTEx4TWak4TRMSg==", + "requires": { + "@ethersproject/abi": "5.0.7", + "web3-utils": "1.7.0" + } + }, + "web3-utils": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.7.0.tgz", + "integrity": "sha512-O8Tl4Ky40Sp6pe89Olk2FsaUkgHyb5QAXuaKo38ms3CxZZ4d3rPGfjP9DNKGm5+IUgAZBNpF1VmlSmNCqfDI1w==", + "requires": { + "bn.js": "^4.11.9", + "ethereum-bloom-filters": "^1.0.6", + "ethereumjs-util": "^7.1.0", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randombytes": "^2.1.0", + "utf8": "3.0.0" + } + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "requires": { + "isexe": "^2.0.0" + } + }, + "wordwrap": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", + "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc= sha512-1tMA907+V4QmxV7dbRvb4/8MaRALK6q9Abid3ndMYnbyo8piisCmeONVqVSXqQA3KaP4SLt5b7ud6E2sqP8TFw==" + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + }, + "ws": { + "version": "7.5.7", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.7.tgz", + "integrity": "sha512-KMvVuFzpKBuiIXW3E4u3mySRO2/mCHSyZDJQM5NQ9Q9KHWHWh0NHgfbRMLLrceUK5qAL4ytALJbpRMjixFZh8A==", + "requires": {} + }, + "xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==" + }, + "yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" + }, + "yaml": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.9.2.tgz", + "integrity": "sha512-HPT7cGGI0DuRcsO51qC1j9O16Dh1mZ2bnXwsi0jrSpsLz0WxOLSLXfkABVl6bZO629py3CU+OMJtpNHDLB97kg==", + "requires": { + "@babel/runtime": "^7.9.2" + } + }, + "yargs-parser": { + "version": "16.1.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-16.1.0.tgz", + "integrity": "sha512-H/V41UNZQPkUMIT5h5hiwg4QKIY1RPvoBV4XcjUbRM8Bk2oKqqyZ0DIEbTFZB0XjbtSPG8SAa/0DxCQmiRgzKg==", + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + } + } +} diff --git a/subgraphs/kwenta/package.json b/subgraphs/kwenta/package.json new file mode 100644 index 0000000000..61abae4e90 --- /dev/null +++ b/subgraphs/kwenta/package.json @@ -0,0 +1,15 @@ +{ + "license": "MIT", + "scripts": { + "format": "npx prettier --write .", + "prepare:constants": "mustache protocols/${npm_config_protocol}/config/deployments/${npm_config_id}/configurations.json configurations/configure.mustache > configurations/configure.ts" + }, + "dependencies": { + "@graphprotocol/graph-cli": "0.37.0", + "@graphprotocol/graph-ts": "0.29.0" + }, + "devDependencies": { + "prettier": "2.7.1", + "typescript": "^4.8.3" + } +} diff --git a/subgraphs/kwenta/protocols/kwenta/config/deployments/kwenta-optimism/configurations.json b/subgraphs/kwenta/protocols/kwenta/config/deployments/kwenta-optimism/configurations.json new file mode 100644 index 0000000000..a6a9ddbdd6 --- /dev/null +++ b/subgraphs/kwenta/protocols/kwenta/config/deployments/kwenta-optimism/configurations.json @@ -0,0 +1,32 @@ +{ + "deployment": "KWENTA_OPTIMISM", + "network": "optimism", + "marketManagerV1": [], + "marketManagerV2": [ + { + "name": "FuturesMarketManager2", + "address": "0xdb89f3fc45A707Dd49781495f77f8ae69bF5cA6e", + "startBlock": 52456507 + }, + { + "name": "FuturesMarketManager3", + "address": "0xd30bdfd7e7a65fe109d5de1d4e95f3b800fb7463", + "startBlock": 86524190 + } + ], + "smartMarginFactory": [ + { + "name": "SmartMarginFactory1", + "address": "0xf1BC9852e89e0b6ABa81548A10c0afF9ACa95CaA", + "startBlock": 89109827 + }, + { + "name": "SmartMarginFactory2", + "address": "0x8234F990b149Ae59416dc260305E565e5DAfEb54", + "startBlock": 92005505 + } + ], + "graftEnabled": false, + "subgraphId": "QmfHRGh3tC4yb2bBRn5A6ctytG32Jwfi9eNo76EFjiWyrf", + "graftStartBlock": 15217959 +} diff --git a/subgraphs/kwenta/protocols/kwenta/config/deployments/kwenta-optimism/configurations.ts b/subgraphs/kwenta/protocols/kwenta/config/deployments/kwenta-optimism/configurations.ts new file mode 100644 index 0000000000..4abeaf9b15 --- /dev/null +++ b/subgraphs/kwenta/protocols/kwenta/config/deployments/kwenta-optimism/configurations.ts @@ -0,0 +1,26 @@ +import { Address } from "@graphprotocol/graph-ts"; + +import { Configurations } from "../../../../../configurations/configurations/interface"; +import { + PROTOCOL_NAME, + PROTOCOL_SLUG, +} from "../../../../../src/common/constants"; +import { Network } from "../../../../../src/sdk/util/constants"; + +export class KwentaOptimismConfigurations implements Configurations { + getNetwork(): string { + return Network.OPTIMISM; + } + getProtocolName(): string { + return PROTOCOL_NAME; + } + getProtocolSlug(): string { + return PROTOCOL_SLUG; + } + getFactoryAddress(): Address { + return Address.fromString("0x920cf626a271321c151d027030d5d08af699456b"); + } + getSUSDAddress(): Address { + return Address.fromString("0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9"); + } +} diff --git a/subgraphs/kwenta/protocols/kwenta/config/templates/kwenta.template.yaml b/subgraphs/kwenta/protocols/kwenta/config/templates/kwenta.template.yaml new file mode 100644 index 0000000000..5d3572ece3 --- /dev/null +++ b/subgraphs/kwenta/protocols/kwenta/config/templates/kwenta.template.yaml @@ -0,0 +1,275 @@ +specVersion: 0.0.6 +schema: + file: ./schema.graphql +{{#graftEnabled}} +description: ... +features: + - grafting +graft: + base: {{subgraphId}} # Subgraph ID of base subgraph + block: {{graftStartBlock}} # Block number +{{/graftEnabled}} +dataSources: + {{#marketManagerV1}} + - kind: ethereum/contract + name: {{ name }} + network: {{ network }} + source: + address: "{{ address }}" + abi: FuturesMarketManager + startBlock: {{ startBlock }} + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + entities: + - DerivPerpProtocol + abis: + - name: FuturesMarket + file: ./abis/kwenta/FuturesMarket.json + - name: FuturesMarketManager + file: ./abis/kwenta/FuturesMarketManager.json + + + ########################################### + ############## Price Oracle ############### + ########################################### + # ERC20 + - name: _ERC20 + file: ./abis/Prices/ERC20.json + # Curve Contracts + - name: CurvePool + file: ./abis/Prices/Curve/Pool.json + - name: CurveRegistry + file: ./abis/Prices/Curve/Registry.json + - name: CalculationsCurve + file: ./abis/Prices/Calculations/Curve.json + # YearnLens Contracts + - name: YearnLensContract + file: ./abis/Prices/YearnLens.json + # Aave Oracle Contract + - name: AaveOracleContract + file: ./abis/Prices/AaveOracle.json + # SushiSwap Contracts + - name: CalculationsSushiSwap + file: ./abis/Prices/Calculations/SushiSwap.json + # ChainLink Contracts + - name: ChainLinkContract + file: ./abis/Prices/ChainLink.json + # Uniswap Contracts + - name: UniswapRouter + file: ./abis/Prices/Uniswap/Router.json + - name: UniswapFactory + file: ./abis/Prices/Uniswap/Factory.json + - name: UniswapPair + file: ./abis/Prices/Uniswap/Pair.json + eventHandlers: + - event: 'MarketAdded(address,indexed bytes32,indexed bytes32)' + handler: 'handleV1MarketAdded' + file: ./src/mappings/handlers.ts + {{/marketManagerV1}} + {{#marketManagerV2}} + - kind: ethereum/contract + name: {{ name }} + network: {{ network }} + source: + address: "{{ address }}" + abi: FuturesMarketManager + startBlock: {{ startBlock }} + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + entities: + - DerivPerpProtocol + abis: + - name: FuturesMarket + file: ./abis/kwenta/FuturesMarket.json + - name: FuturesMarketManager + file: ./abis/kwenta/FuturesMarketManager.json + + + ########################################### + ############## Price Oracle ############### + ########################################### + # ERC20 + - name: _ERC20 + file: ./abis/Prices/ERC20.json + # Curve Contracts + - name: CurvePool + file: ./abis/Prices/Curve/Pool.json + - name: CurveRegistry + file: ./abis/Prices/Curve/Registry.json + - name: CalculationsCurve + file: ./abis/Prices/Calculations/Curve.json + # YearnLens Contracts + - name: YearnLensContract + file: ./abis/Prices/YearnLens.json + # Aave Oracle Contract + - name: AaveOracleContract + file: ./abis/Prices/AaveOracle.json + # SushiSwap Contracts + - name: CalculationsSushiSwap + file: ./abis/Prices/Calculations/SushiSwap.json + # ChainLink Contracts + - name: ChainLinkContract + file: ./abis/Prices/ChainLink.json + # Uniswap Contracts + - name: UniswapRouter + file: ./abis/Prices/Uniswap/Router.json + - name: UniswapFactory + file: ./abis/Prices/Uniswap/Factory.json + - name: UniswapPair + file: ./abis/Prices/Uniswap/Pair.json + eventHandlers: + - event: 'MarketAdded(address,indexed bytes32,indexed bytes32)' + handler: 'handleV2MarketAdded' + file: ./src/mappings/handlers.ts + {{/marketManagerV2}} + {{#smartMarginFactory}} + - kind: ethereum/contract + name: {{ name }} + network: {{ network }} + source: + address: "{{ address }}" + abi: SmartMarginFactory + startBlock: {{ startBlock }} + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + entities: + - DerivPerpProtocol + abis: + - name: SmartMarginFactory + file: ./abis/kwenta/SmartMarginFactory.json + eventHandlers: + - event: 'NewAccount(indexed address,indexed address,bytes32)' + handler: 'handleNewAccountSmartMargin' + file: ./src/mappings/handlers.ts + {{/smartMarginFactory}} + + +templates: + - kind: ethereum/contract + name: FuturesV1Market + network: {{ network }} + source: + abi: FuturesMarket + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + entities: + - LiquidityPool + abis: + - name: FuturesMarket + file: ./abis/kwenta/FuturesMarket.json + + + + ########################################### + ############## Price Oracle ############### + ########################################### + # ERC20 + - name: _ERC20 + file: ./abis/Prices/ERC20.json + # Curve Contracts + - name: CurvePool + file: ./abis/Prices/Curve/Pool.json + - name: CurveRegistry + file: ./abis/Prices/Curve/Registry.json + - name: CalculationsCurve + file: ./abis/Prices/Calculations/Curve.json + # YearnLens Contracts + - name: YearnLensContract + file: ./abis/Prices/YearnLens.json + # Aave Oracle Contract + - name: AaveOracleContract + file: ./abis/Prices/AaveOracle.json + # SushiSwap Contracts + - name: CalculationsSushiSwap + file: ./abis/Prices/Calculations/SushiSwap.json + # ChainLink Contracts + - name: ChainLinkContract + file: ./abis/Prices/ChainLink.json + # Uniswap Contracts + - name: UniswapRouter + file: ./abis/Prices/Uniswap/Router.json + - name: UniswapFactory + file: ./abis/Prices/Uniswap/Factory.json + - name: UniswapPair + file: ./abis/Prices/Uniswap/Pair.json + eventHandlers: + - event: 'MarginTransferred(indexed address,int256)' + handler: 'handleMarginTransferred' + - event: 'PositionModified(indexed uint256,indexed address,uint256,int256,int256,uint256,uint256,uint256)' + handler: 'handlePositionModified' + - event: 'PositionLiquidated(indexed uint256,indexed address,indexed address,int256,uint256,uint256)' + handler: 'handlePositionLiquidated' + - event: 'FundingRecomputed(int256,uint256,uint256)' + handler: 'handleFundingRecomputed' + # - event: 'ParameterUpdated(bytes32,bytes32,uint256)' + # handler: handleParameterUpdated + file: ./src/mappings/handlers.ts + - kind: ethereum/contract + name: PerpsV2Market + network: {{ network }} + source: + abi: PerpsV2MarketProxyable + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + entities: + - LiquidityPool + abis: + - name: PerpsV2MarketProxyable + file: ./abis/kwenta/PerpsV2MarketProxyable.json + + ########################################### + ############## Price Oracle ############### + ########################################### + # ERC20 + - name: _ERC20 + file: ./abis/Prices/ERC20.json + # Curve Contracts + - name: CurvePool + file: ./abis/Prices/Curve/Pool.json + - name: CurveRegistry + file: ./abis/Prices/Curve/Registry.json + - name: CalculationsCurve + file: ./abis/Prices/Calculations/Curve.json + # YearnLens Contracts + - name: YearnLensContract + file: ./abis/Prices/YearnLens.json + # Aave Oracle Contract + - name: AaveOracleContract + file: ./abis/Prices/AaveOracle.json + # SushiSwap Contracts + - name: CalculationsSushiSwap + file: ./abis/Prices/Calculations/SushiSwap.json + # ChainLink Contracts + - name: ChainLinkContract + file: ./abis/Prices/ChainLink.json + # Uniswap Contracts + - name: UniswapRouter + file: ./abis/Prices/Uniswap/Router.json + - name: UniswapFactory + file: ./abis/Prices/Uniswap/Factory.json + - name: UniswapPair + file: ./abis/Prices/Uniswap/Pair.json + eventHandlers: + - event: 'MarginTransferred(indexed address,int256)' + handler: 'handleMarginTransferred' + - event: 'PositionModified(indexed uint256,indexed address,uint256,int256,int256,uint256,uint256,uint256)' + handler: 'handlePositionModified' + - event: 'PositionModified(indexed uint256,indexed address,uint256,int256,int256,uint256,uint256,uint256,int256)' + handler: 'handlePositionModifiedV2' + - event: 'PositionLiquidated(uint256,address,address,int256,uint256,uint256)' + handler: 'handlePositionLiquidated' + - event: 'PositionLiquidated(uint256,address,address,int256,uint256,uint256,uint256,uint256)' + handler: 'handlePositionLiquidatedV2' + - event: 'FundingRecomputed(int256,int256,uint256,uint256)' + handler: 'handleFundingRecomputed' + file: ./src/mappings/handlers.ts \ No newline at end of file diff --git a/subgraphs/kwenta/protocols/kwenta/src/constants.ts b/subgraphs/kwenta/protocols/kwenta/src/constants.ts new file mode 100644 index 0000000000..153af33628 --- /dev/null +++ b/subgraphs/kwenta/protocols/kwenta/src/constants.ts @@ -0,0 +1 @@ +// protocol specific constants diff --git a/subgraphs/kwenta/protocols/kwenta/src/mapping.ts b/subgraphs/kwenta/protocols/kwenta/src/mapping.ts new file mode 100644 index 0000000000..52d123338a --- /dev/null +++ b/subgraphs/kwenta/protocols/kwenta/src/mapping.ts @@ -0,0 +1 @@ +// protocol handlers and protocol specific mappings diff --git a/subgraphs/kwenta/schema.graphql b/subgraphs/kwenta/schema.graphql new file mode 100644 index 0000000000..2595daa89c --- /dev/null +++ b/subgraphs/kwenta/schema.graphql @@ -0,0 +1,1982 @@ +# Subgraph Schema: Derivatives Perpetual Futures +# Version: 1.3.0 +# See https://github.com/messari/subgraphs/blob/master/docs/SCHEMA.md for details + +enum Network { + ARBITRUM_ONE + ARWEAVE_MAINNET + AURORA + AVALANCHE + BOBA + BSC # aka BNB Chain + CELO + COSMOS + CRONOS + MAINNET # Ethereum Mainnet + FANTOM + FUSE + HARMONY + JUNO + MOONBEAM + MOONRIVER + NEAR_MAINNET + OPTIMISM + OSMOSIS + MATIC # aka Polygon + XDAI # aka Gnosis Chain +} + +enum ProtocolType { + EXCHANGE + LENDING + YIELD + BRIDGE + OPTION + PERPETUAL + GENERIC + # Will add more +} + +type Token @entity { + " Smart contract address of the token " + id: Bytes! + + " Name of the token, mirrored from the smart contract " + name: String! + + " Symbol of the token, mirrored from the smart contract " + symbol: String! + + " The number of decimal places this token uses, default to 18 " + decimals: Int! + + " Optional field to track the price of a token, mostly for caching purposes " + lastPriceUSD: BigDecimal + + " Optional field to track the block number of the last token price " + lastPriceBlockNumber: BigInt +} + +enum RewardTokenType { + " For reward tokens awarded to LPs/lenders " + DEPOSIT + + " For reward tokens awarded to borrowers " + BORROW + + " For reward tokens awarded to stakers of native token (e.g. GMX stakers) " + STAKE +} + +type RewardToken @entity(immutable: true) { + " Bytes.fromI32(0|1).concat(rewardTokenAddress), where 0 is for deposit and 1 is for borrow " + id: Bytes! + + " Reference to the actual token " + token: Token! + + " The type of the reward token " + type: RewardTokenType! +} + +# Note that trading fee is the premium paid *by* the users, whereas LP fee, stake fee and +# protocol fee are fees paid *to* the corresponding parties. +# Most of the time, trading fee = liquidity provider fee + protocol fee+stake fee, +# but not always. Thus we explicitly specify all different fee types. +enum LiquidityPoolFeeType { + " Total fixed fee paid by the user per trade, as a percentage of the traded amount. e.g. 0.3% for Uniswap v2, 0.3% for Sushiswap, 0.04% for Curve v1. " + FIXED_TRADING_FEE + + " Some protocols use tiered fees instead of fixed fee (e.g. DYDX). Set `feePercentage` as 0 but handle the tiered fees in the mapping code. " + TIERED_TRADING_FEE + + " Some protocols use dynamic fees instead of fixed fee (e.g. Balancer v2). Set `feePercentage` as 0 but handle the dynamic fees in the mapping code. " + DYNAMIC_TRADING_FEE + + " Fixed fee that's paid to the LP, as a percentage of the traded amount. e.g. 10% of fees to GMX LP providers (GLP holders). " + FIXED_LP_FEE + + " Some protocols use dynamic LP fees . Set `feePercentage` as 0 but handle the dynamic fees in the mapping code. " + DYNAMIC_LP_FEE + + " Fixed fee that's paid to the protocol, as a percentage of the traded amount. e.g. 10% of GMX fees to protocol. " + FIXED_PROTOCOL_FEE + + " Some protocols use dynamic protocol fees. Set `feePercentage` as 0 but handle the dynamic fees in the mapping code. " + DYNAMIC_PROTOCOL_FEE + + " Fixed fee that's paid to the stakers, as a percentage of the traded amount. e.g. 30% of all fees on GMX to stakers. " + FIXED_STAKE_FEE + + " Some protocols use dynamic stakers fees (e.g., GMX). Set `feePercentage` as 0 but handle the dynamic fees in the mapping code. " + DYNAMIC_STAKE_FEE + + " One-time fee charged by the protocol during deposit, in percentages of the deposit token (e.g. dynamic fee collected for LP providers in GMX)" + DEPOSIT_FEE + + " One-time fee charged by the protocol (e.g. GMX charges a fee from certain pools with withdrawing) during withdrawal, in percentages of the withdrawal token " + WITHDRAWAL_FEE +} + +type LiquidityPoolFee @entity { + " { Fee type }-{ Pool address } " + id: Bytes! + + " Fee as a percentage of the trade (swap) amount. Does not always apply " + feePercentage: BigDecimal + + " Type of fee this pool uses " + feeType: LiquidityPoolFeeType! +} + +############################# +##### Protocol Metadata ##### +############################# + +interface Protocol { + " Smart contract address of the protocol's main contract (Factory, Registry, etc) " + id: Bytes! + + " Name of the protocol, including version. e.g. Uniswap v3 " + name: String! + + " Slug of protocol, including version. e.g. uniswap-v3 " + slug: String! + + " Version of the subgraph schema, in SemVer format (e.g. 1.0.0) " + schemaVersion: String! + + " Version of the subgraph implementation, in SemVer format (e.g. 1.0.0) " + subgraphVersion: String! + + " Version of the methodology used to compute metrics, loosely based on SemVer format (e.g. 1.0.0) " + methodologyVersion: String! + + " The blockchain network this subgraph is indexing on " + network: Network! + + " The type of protocol (e.g. DEX, Lending, Yield, etc) " + type: ProtocolType! + + ##### Quantitative Data ##### + + " Current TVL (Total Value Locked) of the entire protocol " + totalValueLockedUSD: BigDecimal! + + " Revenue claimed by suppliers to the protocol. LPs on DEXs (e.g. 70% of fees on GMX). Depositors on Lending Protocols. NFT sellers on OpenSea. " + cumulativeSupplySideRevenueUSD: BigDecimal! + + " Gross revenue for the protocol (revenue claimed by protocol). Examples: 15% on GMX goes to protocol . OpenSea 10% sell fee. " + cumulativeProtocolSideRevenueUSD: BigDecimal! + + " Gross revenue for the stakers (this is defined as recieving a share of revenue or tokens equal to share e.g. buying eth with DAI revenue). Examples: GMX 30% of trade fees goes to stakers of native token (e.g. GMX stakers) " + cumulativeStakeSideRevenueUSD: BigDecimal! + + " All revenue generated by the protocol. e.g. 0.30% of swap fee in Sushiswap, all yield generated by Yearn. " + cumulativeTotalRevenueUSD: BigDecimal! + + " All premium paid to enter a position. " + cumulativeEntryPremiumUSD: BigDecimal! + + " All premium paid to exit a position. " + cumulativeExitPremiumUSD: BigDecimal! + + " All premium paid. " + cumulativeTotalPremiumUSD: BigDecimal! + + " All premium paid to deposit in liquidity pools. " + cumulativeDepositPremiumUSD: BigDecimal! + + " All premium paid to withdraw from liquidity pools. " + cumulativeWithdrawPremiumUSD: BigDecimal! + + " All premium paid to enter and exit liquidity pool. " + cumulativeTotalLiquidityPremiumUSD: BigDecimal! + + " Number of cumulative unique users " + cumulativeUniqueUsers: Int! + + " Number of cumulative borrowers " + cumulativeUniqueBorrowers: Int! + + " Number of cumulative liquidators (accounts that performed liquidation) " + cumulativeUniqueLiquidators: Int! + + " Number of cumulative liquidatees (accounts that got liquidated) " + cumulativeUniqueLiquidatees: Int! + + " Notional value of all open long positions " + longOpenInterestUSD: BigDecimal! + + " Notional value of all open short positions " + shortOpenInterestUSD: BigDecimal! + + " Notional value of all open positions " + totalOpenInterestUSD: BigDecimal! + + " Total number of long positions (not cumulative) " + longPositionCount: Int! + + " Total number of short positions (not cumulative) " + shortPositionCount: Int! + + " Total number of open positions (not cumulative) " + openPositionCount: Int! + + " Total number of closed positions " + closedPositionCount: Int! + + " Total number of positions (open and closed) " + cumulativePositionCount: Int! + + " Total number of transactions " + transactionCount: Int! + + " Total number of deposits " + depositCount: Int! + + " Total number of withdrawals " + withdrawCount: Int! + + " Total number of borrows " + borrowCount: Int! + + " Total number of pools " + totalPoolCount: Int! + + ##### Snapshots ##### + + " Daily usage metrics for this protocol " + dailyUsageMetrics: [UsageMetricsDailySnapshot!]! + @derivedFrom(field: "protocol") + + " Hourly usage metrics for this protocol " + hourlyUsageMetrics: [UsageMetricsHourlySnapshot!]! + @derivedFrom(field: "protocol") + + " Daily financial metrics for this protocol " + financialMetrics: [FinancialsDailySnapshot!]! @derivedFrom(field: "protocol") +} + +type DerivPerpProtocol implements Protocol @entity { + " Smart contract address of the protocol's main contract (Factory, Registry, etc) " + id: Bytes! + + " Name of the protocol, including version. e.g. Uniswap v3 " + name: String! + + " Slug of protocol, including version. e.g. uniswap-v3 " + slug: String! + + " Version of the subgraph schema, in SemVer format (e.g. 1.0.0) " + schemaVersion: String! + + " Version of the subgraph implementation, in SemVer format (e.g. 1.0.0) " + subgraphVersion: String! + + " Version of the methodology used to compute metrics, loosely based on SemVer format (e.g. 1.0.0) " + methodologyVersion: String! + + " The blockchain network this subgraph is indexing on " + network: Network! + + " The type of protocol (e.g. DEX, Lending, Yield, etc) " + type: ProtocolType! + + ##### Quantitative Data ##### + + " Current TVL (Total Value Locked) of the entire protocol " + totalValueLockedUSD: BigDecimal! + + " All historical Notional volume in USD " + cumulativeVolumeUSD: BigDecimal! + + " Inflow historical trade notional volume occurred in this protocol, in USD, based on value of underlying assets coming into protocol from trade, at the time of position opened. " + cumulativeInflowVolumeUSD: BigDecimal! + + " Inflow historical trade notional volume occurred in this protocol, in USD, based on value of underlying assets coming into protocol from trade, at the time of position closed. " + cumulativeClosedInflowVolumeUSD: BigDecimal! + + " Outflow historical trade notional volume occurred in this protocol, in USD, based on value of underlying assets coming out of protocol from trade. " + cumulativeOutflowVolumeUSD: BigDecimal! + + " Revenue claimed by suppliers to the protocol. LPs on DEXs (e.g. 0.25% of the swap fee in Sushiswap). Depositors on Lending Protocols. NFT sellers on OpenSea. " + cumulativeSupplySideRevenueUSD: BigDecimal! + + " Gross revenue for the protocol (revenue claimed by protocol). Examples: AMM protocol fee (Sushi’s 0.05%). OpenSea 10% sell fee. " + cumulativeProtocolSideRevenueUSD: BigDecimal! + + " Gross revenue for the stakers (this is defined as receiving a share of revenue or tokens equal to share e.g. buying eth with DAI revenue). Examples: GMX 30% of trade fees goes to stakers of native token (e.g. GMX stakers) " + cumulativeStakeSideRevenueUSD: BigDecimal! + + " All revenue generated by the protocol. e.g. 0.30% of swap fee in Sushiswap, all yield generated by Yearn. " + cumulativeTotalRevenueUSD: BigDecimal! + + " All premium paid to enter a position. " + cumulativeEntryPremiumUSD: BigDecimal! + + " All premium paid to exit a position. " + cumulativeExitPremiumUSD: BigDecimal! + + " All premium paid. " + cumulativeTotalPremiumUSD: BigDecimal! + + " All premium paid to deposit in the protocol. " + cumulativeDepositPremiumUSD: BigDecimal! + + " All premium paid to withdraw from the protocol. " + cumulativeWithdrawPremiumUSD: BigDecimal! + + " All premium paid to enter and exit the protocol. " + cumulativeTotalLiquidityPremiumUSD: BigDecimal! + + " Number of cumulative unique users " + cumulativeUniqueUsers: Int! + + " Number of cumulative depositors " + cumulativeUniqueDepositors: Int! + + " Number of cumulative borrowers " + cumulativeUniqueBorrowers: Int! + + " Number of cumulative liquidators (accounts that performed liquidation) " + cumulativeUniqueLiquidators: Int! + + " Number of cumulative liquidatees (accounts that got liquidated) " + cumulativeUniqueLiquidatees: Int! + + " Notional value of all open long positions " + longOpenInterestUSD: BigDecimal! + + " Notional value of all open short positions " + shortOpenInterestUSD: BigDecimal! + + " Notional value of all open positions " + totalOpenInterestUSD: BigDecimal! + + " Total number of long positions (not cumulative) " + longPositionCount: Int! + + " Total number of short positions (not cumulative) " + shortPositionCount: Int! + + " Total number of open positions (not cumulative) " + openPositionCount: Int! + + " Total number of closed positions " + closedPositionCount: Int! + + " Total number of positions (open and closed) " + cumulativePositionCount: Int! + + " Total number of transactions " + transactionCount: Int! + + " Total number of deposits " + depositCount: Int! + + " Total number of withdrawals " + withdrawCount: Int! + + " Total number of borrows " + borrowCount: Int! + + " Total number of swaps " + swapCount: Int! + + " Total number of collateral In from traders " + collateralInCount: Int! + + " Total number of collateral Out from traders " + collateralOutCount: Int! + + " Total number of pools " + totalPoolCount: Int! + + ##### Snapshots ##### + + " Daily usage metrics for this protocol " + dailyUsageMetrics: [UsageMetricsDailySnapshot!]! + @derivedFrom(field: "protocol") + + " Hourly usage metrics for this protocol " + hourlyUsageMetrics: [UsageMetricsHourlySnapshot!]! + @derivedFrom(field: "protocol") + + " Daily financial metrics for this protocol " + financialMetrics: [FinancialsDailySnapshot!]! @derivedFrom(field: "protocol") + + ##### Pools ##### + + " All pools that belong to this protocol " + pools: [LiquidityPool!]! @derivedFrom(field: "protocol") + + " Day ID of the most recent daily snapshot " + _lastSnapshotDayID: BigInt + + " Hour ID of the most recent hourly snapshot " + _lastSnapshotHourID: BigInt + + " Timestamp of the last time this entity was updated " + _lastUpdateTimestamp: BigInt +} + +############################### +##### Protocol Timeseries ##### +############################### + +type UsageMetricsDailySnapshot @entity(immutable: true) { + " ID is # of days since Unix epoch time " + id: Bytes! + + " Number of days since Unix epoch time " + days: Int! + + " Protocol this snapshot is associated with " + protocol: DerivPerpProtocol! + + " Number of unique daily active users " + dailyActiveUsers: Int! + + " Number of cumulative unique users " + cumulativeUniqueUsers: Int! + + " Daily number of long positions " + dailyLongPositionCount: Int! + + " Total number of long positions (not cumulative) " + longPositionCount: Int! + + " Daily number of short positions " + dailyShortPositionCount: Int! + + " Total number of short positions (not cumulative) " + shortPositionCount: Int! + + " Daily number of open positions " + dailyOpenPositionCount: Int! + + " Total number of open positions (not cumulative) " + openPositionCount: Int! + + " Daily number of closed positions " + dailyClosedPositionCount: Int! + + " Total number of closed positions " + closedPositionCount: Int! + + " Daily number of positions (open and closed) " + dailyCumulativePositionCount: Int! + + " Total number of positions (open and closed) " + cumulativePositionCount: Int! + + " Daily number of transactions. Transactions include all entities that implement the Event interface. " + dailyTransactionCount: Int! + + " Daily number of deposits (add liquidity) " + dailyDepositCount: Int! + + " Daily number of withdrawals (remove liquidity) " + dailyWithdrawCount: Int! + + " Daily number of borrows for leverage " + dailyBorrowCount: Int! + + " Daily number of trades (swaps) " + dailySwapCount: Int! + + " Number of unique daily depositors " + dailyActiveDepositors: Int! + + " Number of cumulative depositors " + cumulativeUniqueDepositors: Int! + + " Number of unique daily borrowers " + dailyActiveBorrowers: Int! + + " Number of cumulative borrowers " + cumulativeUniqueBorrowers: Int! + + " Number of unique daily liquidators (accounts that performed liquidation) " + dailyActiveLiquidators: Int! + + " Number of cumulative liquidators (accounts that performed liquidation) " + cumulativeUniqueLiquidators: Int! + + " Number of unique daily liquidatees (accounts that got liquidated) " + dailyActiveLiquidatees: Int! + + " Number of cumulative liquidatees (accounts that got liquidated) " + cumulativeUniqueLiquidatees: Int! + + " Daily number of collateral In from traders " + dailyCollateralIn: Int! + + " Cumulative number of collateral In from traders " + cumulativeCollateralIn: Int! + + " Daily number of collateral Out from traders " + dailyCollateralOut: Int! + + " Cumulative number of collateral Out from traders " + cumulativeCollateralOut: Int! + + " Total number of pools " + totalPoolCount: Int! +} + +type UsageMetricsHourlySnapshot @entity(immutable: true) { + " { # of hours since Unix epoch time } " + id: Bytes! + + " Number of hours since Unix epoch time " + hours: Int! + + " Protocol this snapshot is associated with " + protocol: DerivPerpProtocol! + + " Number of unique hourly active users " + hourlyActiveUsers: Int! + + " Number of cumulative unique users " + cumulativeUniqueUsers: Int! + + " Total number of transactions occurred in an hour. Transactions include all entities that implement the Event interface. " + hourlyTransactionCount: Int! + + " Total number of deposits (add liquidity) in an hour " + hourlyDepositCount: Int! + + " Total number of withdrawals (remove liquidity) in an hour " + hourlyWithdrawCount: Int! + + " Total number of borrows (for additional leverage) in an hour " + hourlyBorrowCount: Int! + + " Total number of trades (swaps) in an hour " + hourlySwapCount: Int! +} + +type FinancialsDailySnapshot @entity(immutable: true) { + " ID is # of days since Unix epoch time " + id: Bytes! + + " Number of days since Unix epoch time " + days: Int! + + " Protocol this snapshot is associated with " + protocol: DerivPerpProtocol! + + " Current TVL (Total Value Locked) of the entire protocol " + totalValueLockedUSD: BigDecimal! + + " Daily trade Notional volume, in USD " + dailyVolumeUSD: BigDecimal! + + " All historical trade Notional volume in USD " + cumulativeVolumeUSD: BigDecimal! + + " Daily Inflow trade Notional volume, in USD, based on value of underlying assets coming into protocol at the time of position open " + dailyInflowVolumeUSD: BigDecimal! + + " Inflow historical trade Notional volume in USD, based on value of underlying assets coming into protocol from trade at the time of position open " + cumulativeInflowVolumeUSD: BigDecimal! + + " Daily Inflow trade Notional volume, in USD, based on value of underlying assets coming into protocol at the time of position Closed " + dailyClosedInflowVolumeUSD: BigDecimal! + + " Inflow historical trade Notional volume in USD, based on value of underlying assets coming into protocol from trade at the time of position closed " + cumulativeClosedInflowVolumeUSD: BigDecimal! + + " Daily Outflow trade Notional volume, in USD, based on value of underlying assets coming out of protocol from trade " + dailyOutflowVolumeUSD: BigDecimal! + + " Outflow historical trade Notional volume in USD, based on value of underlying assets coming out of protocol from trade " + cumulativeOutflowVolumeUSD: BigDecimal! + + " Daily Notional value of all open long positions " + dailyLongOpenInterestUSD: BigDecimal! + + " Daily Notional value of all open short positions " + dailyShortOpenInterestUSD: BigDecimal! + + " Daily Notional value of all open positions " + dailyTotalOpenInterestUSD: BigDecimal! + + " Daily revenue claimed by suppliers to the protocol. LPs on DEXs (e.g. 0.25% of the swap fee in Sushiswap). Depositors on Lending Protocols. NFT sellers on OpenSea. " + dailySupplySideRevenueUSD: BigDecimal! + + " Revenue claimed by suppliers to the protocol. LPs on DEXs (e.g. 0.25% of the swap fee in Sushiswap). Depositors on Lending Protocols. NFT sellers on OpenSea. " + cumulativeSupplySideRevenueUSD: BigDecimal! + + " Daily revenue for the protocol (revenue claimed by protocol). Examples: AMM protocol fee (Sushi’s 0.05%). OpenSea 10% sell fee. " + dailyProtocolSideRevenueUSD: BigDecimal! + + " Gross revenue for the protocol (revenue claimed by protocol). Examples: AMM protocol fee (Sushi’s 0.05%). OpenSea 10% sell fee. " + cumulativeProtocolSideRevenueUSD: BigDecimal! + + " Daily revenue for the stakers (this is defined as recieving a share of revenue or tokens equal to share e.g. buying eth with DAI revenue). Examples: GMX 30% of trade fees goes to stakers of native token (e.g. GMX stakers) " + dailyStakeSideRevenueUSD: BigDecimal! + + " Gross revenue for the stakers (this is defined as recieving a share of revenue or tokens equal to share e.g. buying eth with DAI revenue). Examples: GMX 30% of trade fees goes to stakers of native token (e.g. GMX stakers) " + cumulativeStakeSideRevenueUSD: BigDecimal! + + " Daily revenue generated by the protocol. e.g. 0.30% of swap fee in Sushiswap, all yield generated by Yearn. " + dailyTotalRevenueUSD: BigDecimal! + + " All revenue generated by the protocol. e.g. 0.30% of swap fee in Sushiswap, all yield generated by Yearn. " + cumulativeTotalRevenueUSD: BigDecimal! + + " Daily premium paid to enter a position. " + dailyEntryPremiumUSD: BigDecimal! + + " All premium paid to enter a position. " + cumulativeEntryPremiumUSD: BigDecimal! + + " Daily premium paid to exit a position. " + dailyExitPremiumUSD: BigDecimal! + + " All premium paid to exit a position. " + cumulativeExitPremiumUSD: BigDecimal! + + " Daily premium paid. " + dailyTotalPremiumUSD: BigDecimal! + + " All premium paid. " + cumulativeTotalPremiumUSD: BigDecimal! + + " Daily premium paid to deposit in liquidity pools. " + dailyDepositPremiumUSD: BigDecimal! + + " All premium paid to deposit in liquidity pools. " + cumulativeDepositPremiumUSD: BigDecimal! + + " Daily premium paid to withdraw from liquidity pools. " + dailyWithdrawPremiumUSD: BigDecimal! + + " All premium paid to withdraw from liquidity pools. " + cumulativeWithdrawPremiumUSD: BigDecimal! + + " Daily premium paid to enter and exit liquidity pool. " + dailyTotalLiquidityPremiumUSD: BigDecimal! + + " All premium paid to enter and exit liquidity pool. " + cumulativeTotalLiquidityPremiumUSD: BigDecimal! +} + +############################### +##### Pool-Level Metadata ##### +############################### + +type LiquidityPool @entity { + " Smart contract address of the pool " + id: Bytes! + + " The protocol this pool belongs to " + protocol: DerivPerpProtocol! + + " Name of liquidity pool (e.g. Curve.fi DAI/USDC/USDT) " + name: String + + " Symbol of liquidity pool (e.g. 3CRV) " + symbol: String + + " Tokens that need to be deposited to take a position in protocol. e.g. WETH and USDC to deposit into the WETH-USDC pool. Array to account for multi-asset pools like Curve and Balancer " + inputTokens: [Token!]! + + " Token that is minted to track ownership of position in protocol " + outputToken: Token + + " Additional tokens that are given as reward for position in a protocol, usually in liquidity mining programs. e.g. SUSHI in the Onsen program, MATIC for Aave Polygon, usually in liquidity mining programs. e.g. SUSHI in the Onsen program, MATIC for Aave Polygon " + rewardTokens: [RewardToken!] + + " Fees per trade incurred to the user. Should include all fees that apply to a pool (e.g. Curve has a trading fee AND an admin fee, which is a portion of the trading fee. Uniswap only has a trading fee and no protocol fee. ) " + fees: [LiquidityPoolFee!]! + + " Name of oracle source (e.g. chainlink, uniswap, pyth) " + oracle: String + + " Creation timestamp " + createdTimestamp: BigInt! + + " Creation block number " + createdBlockNumber: BigInt! + + ##### Quantitative Data ##### + + " Current TVL (Total Value Locked) of this pool in USD " + totalValueLockedUSD: BigDecimal! + + " All funding rates for this liquidity pool. (Should be in APR format and the same order as inputTokens) " + fundingrate: [BigDecimal!]! + + " All revenue generated by the liquidity pool, accrued to the supply side. " + cumulativeSupplySideRevenueUSD: BigDecimal! + + " All revenue generated by the liquidity pool, accrued to the protocol. " + cumulativeProtocolSideRevenueUSD: BigDecimal! + + " All revenue generated by the liquidity pool. " + cumulativeTotalRevenueUSD: BigDecimal! + + " All premium paid to enter a position. " + cumulativeEntryPremiumUSD: BigDecimal! + + " All premium paid to exit a position. " + cumulativeExitPremiumUSD: BigDecimal! + + " All premium paid. " + cumulativeTotalPremiumUSD: BigDecimal! + + " All premium paid to deposit in liquidity pools. " + cumulativeDepositPremiumUSD: BigDecimal! + + " All premium paid to withdraw from liquidity pools. " + cumulativeWithdrawPremiumUSD: BigDecimal! + + " All premium paid to enter and exit liquidity pool. " + cumulativeTotalLiquidityPremiumUSD: BigDecimal! + + " Number of cumulative unique users in this pool " + cumulativeUniqueUsers: Int! + + " Number of cumulative depositors in this pool " + cumulativeUniqueDepositors: Int! + + " Number of cumulative borrowers " + cumulativeUniqueBorrowers: Int! + + " Number of cumulative liquidators (accounts that performed liquidation) " + cumulativeUniqueLiquidators: Int! + + " Number of cumulative liquidatees (accounts that got liquidated) " + cumulativeUniqueLiquidatees: Int! + + " Notional value of all open long positions " + longOpenInterestUSD: BigDecimal! + + " Notional value of all open short positions " + shortOpenInterestUSD: BigDecimal! + + " Notional value of all open positions " + totalOpenInterestUSD: BigDecimal! + + " Total number of long positions (not cumulative) " + longPositionCount: Int! + + " Total number of short positions (not cumulative) " + shortPositionCount: Int! + + " Total number of open positions (not cumulative) " + openPositionCount: Int! + + " Total number of closed positions " + closedPositionCount: Int! + + " Total number of positions (open and closed) " + cumulativePositionCount: Int! + + " All historical trade notional volume occurred in this pool, in USD " + cumulativeVolumeUSD: BigDecimal! + + " Cumulative volume of pool by token amount " + cumulativeVolumeByTokenAmount: [BigInt!]! + + " Cumulative volume of pool in USD " + cumulativeVolumeByTokenUSD: [BigDecimal!]! + + " Inflow historical trade notional volume occurred in this pool, in USD, based on value of underlying assets coming into protocol from trade, at the time of position opened. " + cumulativeInflowVolumeUSD: BigDecimal! + + " Cumulative inflow volume of pool by token amount " + cumulativeInflowVolumeByTokenAmount: [BigInt!]! + + " Cumulative inflow volume of pool in USD " + cumulativeInflowVolumeByTokenUSD: [BigDecimal!]! + + " Inflow historical trade notional volume occurred in this pool, in USD, based on value of underlying assets coming into protocol from trade, at the time of position closed. " + cumulativeClosedInflowVolumeUSD: BigDecimal! + + " Cumulative closed inflow volume of pool by token amount " + cumulativeClosedInflowVolumeByTokenAmount: [BigInt!]! + + " Cumulative closed inflow volume of pool in USD " + cumulativeClosedInflowVolumeByTokenUSD: [BigDecimal!]! + + " Outflow historical trade notional volume occurred in this pool, in USD, based on value of underlying assets coming outof protocol from trade. " + cumulativeOutflowVolumeUSD: BigDecimal! + + " Cumulative outflow volume of pool by token amount " + cumulativeOutflowVolumeByTokenAmount: [BigInt!]! + + " Cumulative outflow volume of pool in USD " + cumulativeOutflowVolumeByTokenUSD: [BigDecimal!]! + + " Amount of input tokens in the pool. The ordering should be the same as the pool's `inputTokens` field. " + inputTokenBalances: [BigInt!]! + + " Weights of input tokens in the liquidity pool in percentage values. For example, 50/50 for Uniswap pools, 48.2/51.8 for a Curve pool, 10/10/80 for a Balancer pool " + inputTokenWeights: [BigDecimal!]! + + " Total supply of output token. Note that certain DEXes don't have an output token (e.g. Bancor) " + outputTokenSupply: BigInt + + " Price per share of output token in USD " + outputTokenPriceUSD: BigDecimal + + " Total supply of output tokens that are staked (usually in the MasterChef contract). Used to calculate reward APY. " + stakedOutputTokenAmount: BigInt + + " Per-block reward token emission as of the current block normalized to a day, in token's native amount. This should be ideally calculated as the theoretical rate instead of the realized amount. " + rewardTokenEmissionsAmount: [BigInt!] + + " Per-block reward token emission as of the current block normalized to a day, in USD value. This should be ideally calculated as the theoretical rate instead of the realized amount. " + rewardTokenEmissionsUSD: [BigDecimal!] + + ##### Snapshots ##### + + " Liquidity pool daily snapshots " + dailySnapshots: [LiquidityPoolDailySnapshot!]! @derivedFrom(field: "pool") + + " Liquidity pool hourly snapshots " + hourlySnapshots: [LiquidityPoolHourlySnapshot!]! @derivedFrom(field: "pool") + + ##### Events ##### + + " All deposit (add liquidity) events occurred in this pool " + deposits: [Deposit!]! @derivedFrom(field: "pool") + + " All withdraw (remove liquidity) events occurred in this pool " + withdraws: [Withdraw!]! @derivedFrom(field: "pool") + + " All trade (swap) events occurred in this pool " + swaps: [Swap!]! @derivedFrom(field: "pool") + + " Day ID of the most recent daily snapshot " + _lastSnapshotDayID: BigInt + + " Hour ID of the most recent hourly snapshot " + _lastSnapshotHourID: BigInt + + " Timestamp of the last time this entity was updated " + _lastUpdateTimestamp: BigInt + + longOpenInterest: BigInt! + shortOpenInterest: BigInt! + totalOpenInterest: BigInt! + + marketSize: BigInt + marketSkew: BigInt +} + +################################# +##### Pool-Level Timeseries ##### +################################# + +type LiquidityPoolDailySnapshot @entity { + " { Smart contract address of the pool }-{ # of days since Unix epoch time } " + id: Bytes! + + " Number of days since Unix epoch time " + days: Int! + + " The protocol this snapshot belongs to " + protocol: DerivPerpProtocol! + + " The pool this snapshot belongs to " + pool: LiquidityPool! + + ##### Quantitative Data ##### + + " Current TVL (Total Value Locked) of this pool " + totalValueLockedUSD: BigDecimal! + + " All revenue generated by the liquidity pool, accrued to the supply side. " + cumulativeSupplySideRevenueUSD: BigDecimal! + + " Daily revenue generated by the liquidity pool, accrued to the supply side. " + dailySupplySideRevenueUSD: BigDecimal! + + " All revenue generated by the liquidity pool, accrued to the protocol. " + cumulativeProtocolSideRevenueUSD: BigDecimal! + + " Daily revenue generated by the liquidity pool, accrued to the protocol. " + dailyProtocolSideRevenueUSD: BigDecimal! + + " Daily revenue generated by the liquidity pool. " + dailyTotalRevenueUSD: BigDecimal! + + " All revenue generated by the liquidity pool. " + cumulativeTotalRevenueUSD: BigDecimal! + + " Daily funding rate based on rate given by protocol, inform us if this is not provided." + dailyFundingrate: [BigDecimal!]! + + " Daily Notional value of all open long positions " + dailyLongOpenInterestUSD: BigDecimal! + + " Daily Notional value of all open short positions " + dailyShortOpenInterestUSD: BigDecimal! + + " Daily Notional value of all open positions " + dailyTotalOpenInterestUSD: BigDecimal! + + " Daily premium paid to enter a position. " + dailyEntryPremiumUSD: BigDecimal! + + " All premium paid to enter a position. " + cumulativeEntryPremiumUSD: BigDecimal! + + " Daily premium paid to exit a position. " + dailyExitPremiumUSD: BigDecimal! + + " All premium paid to exit a position. " + cumulativeExitPremiumUSD: BigDecimal! + + " Daily premium paid. " + dailyTotalPremiumUSD: BigDecimal! + + " All premium paid. " + cumulativeTotalPremiumUSD: BigDecimal! + + " Daily premium paid to deposit in liquidity pools. " + dailyDepositPremiumUSD: BigDecimal! + + " All premium paid to deposit in liquidity pools. " + cumulativeDepositPremiumUSD: BigDecimal! + + " Daily premium paid to withdraw from liquidity pools. " + dailyWithdrawPremiumUSD: BigDecimal! + + " All premium paid to withdraw from liquidity pools. " + cumulativeWithdrawPremiumUSD: BigDecimal! + + " Daily premium paid to enter and exit liquidity pool. " + dailyTotalLiquidityPremiumUSD: BigDecimal! + + " All premium paid to enter and exit liquidity pool. " + cumulativeTotalLiquidityPremiumUSD: BigDecimal! + + " Number of unique daily users " + dailyActiveUsers: Int! + + " Number of cumulative users " + cumulativeUniqueUsers: Int! + + " Number of unique daily depositors " + dailyActiveDepositors: Int! + + " Number of cumulative depositors " + cumulativeUniqueDepositors: Int! + + " Number of unique daily borrowers " + dailyActiveBorrowers: Int! + + " Number of cumulative borrowers " + cumulativeUniqueBorrowers: Int! + + " Number of unique daily liquidators (accounts that performed liquidation) " + dailyActiveLiquidators: Int! + + " Number of cumulative liquidators (accounts that performed liquidation) " + cumulativeUniqueLiquidators: Int! + + " Number of unique daily liquidatees (accounts that got liquidated) " + dailyActiveLiquidatees: Int! + + " Number of cumulative liquidatees (accounts that got liquidated) " + cumulativeUniqueLiquidatees: Int! + + " Daily number of long positions " + dailyLongPositionCount: Int! + + " Total number of long positions (not cumulative) " + longPositionCount: Int! + + " Daily number of short positions " + dailyShortPositionCount: Int! + + " Total number of short positions (not cumulative) " + shortPositionCount: Int! + + " Daily number of open positions " + dailyOpenPositionCount: Int! + + " Total number of open positions (not cumulative) " + openPositionCount: Int! + + " Daily number of closed positions " + dailyClosedPositionCount: Int! + + " Total number of closed positions " + closedPositionCount: Int! + + " Daily number of positions (open and closed) " + dailyCumulativePositionCount: Int! + + " Total number of positions (open and closed) " + cumulativePositionCount: Int! + + " Daily trade notional volume occurred in USD " + dailyVolumeUSD: BigDecimal! + + " Daily trade notional volume for a specific input token, in native amount. The ordering should be the same as the pool's `inputTokens` field. " + dailyVolumeByTokenAmount: [BigInt!]! + + " Cumulative volume of pool by token amount " + cumulativeVolumeByTokenAmount: [BigInt!]! + + " Daily trade notional volume for a specific input token, in USD. The ordering should be the same as the pool's `inputTokens` field. " + dailyVolumeByTokenUSD: [BigDecimal!]! + + " Cumulative volume of pool in USD " + cumulativeVolumeByTokenUSD: [BigDecimal!]! + + " All historical trade notional volume occurred in this pool, in USD " + cumulativeVolumeUSD: BigDecimal! + + " Daily Inflow trade notional volume in this pool, in USD, based on value of underlying assets coming into protocol from trade, at time of position open" + dailyInflowVolumeUSD: BigDecimal! + + " Daily Inflow trade notional volume occurred in in this pool for a specific input token, in native amount, at time of position open. The ordering should be the same as the pool's `inputTokens` field. " + dailyInflowVolumeByTokenAmount: [BigInt!]! + + " Cumulative inflow volume of pool by token amount " + cumulativeInflowVolumeByTokenAmount: [BigInt!]! + + " Daily Inflow trade notional volume occurred in this pool for a specific input token, in USD, based on value of underlying assets coming into protocol from trade, at time of position open. The ordering should be the same as the pool's `inputTokens` field. " + dailyInflowVolumeByTokenUSD: [BigDecimal!]! + + " Cumulative inflow volume of pool in USD " + cumulativeInflowVolumeByTokenUSD: [BigDecimal!]! + + " Inflow historical trade notional volume occurred in this pool, in USD, based on value of underlying assets coming into protocol from trade, at the time of position open. " + cumulativeInflowVolumeUSD: BigDecimal! + + " Daily Inflow trade notional volume in this pool, in USD, based on value of underlying assets coming into protocol from trade, at time of position closed" + dailyClosedInflowVolumeUSD: BigDecimal! + + " Daily Inflow trade notional volume occurred in in this pool for a specific input token, in native amount, at time of position closed The ordering should be the same as the pool's `inputTokens` field. " + dailyClosedInflowVolumeByTokenAmount: [BigInt!]! + + " Cumulative closed inflow volume of pool by token amount " + cumulativeClosedInflowVolumeByTokenAmount: [BigInt!]! + + " Daily Inflow trade notional volume occurred in this pool for a specific input token, in USD, based on value of underlying assets coming into protocol from trade, at time of position closed. The ordering should be the same as the pool's `inputTokens` field. " + dailyClosedInflowVolumeByTokenUSD: [BigDecimal!]! + + " Cumulative closed inflow volume of pool in USD " + cumulativeClosedInflowVolumeByTokenUSD: [BigDecimal!]! + + " Inflow historical trade notional volume occurred in this pool, in USD, based on value of underlying assets coming into protocol from trade, at the time of position closed. " + cumulativeClosedInflowVolumeUSD: BigDecimal! + + " Daily Outflow trade notional volume occurred in this pool in USD, based on value of underlying assets coming out of protocol from trade " + dailyOutflowVolumeUSD: BigDecimal! + + " Daily Outflow trade notional volume occurred in this pool for a specific input token, in native amount. The ordering should be the same as the pool's `inputTokens` field. " + dailyOutflowVolumeByTokenAmount: [BigInt!]! + + " Cumulative outflow volume of pool by token amount " + cumulativeOutflowVolumeByTokenAmount: [BigInt!]! + + " Daily Outflow trade notional volume occurred in this pool for a specific input token, in USD, based on value of underlying assets coming out of protocol from trade. The ordering should be the same as the pool's `inputTokens` field. " + dailyOutflowVolumeByTokenUSD: [BigDecimal!]! + + " Cumulative outflow volume of pool in USD " + cumulativeOutflowVolumeByTokenUSD: [BigDecimal!]! + + " Outflow historical trade notional volume occurred in this pool, in USD, based on value of underlying assets coming outof protocol from trade. " + cumulativeOutflowVolumeUSD: BigDecimal! + + " Amount of input tokens in the pool. The ordering should be the same as the pool's `inputTokens` field. " + inputTokenBalances: [BigInt!]! + + " Weights of input tokens in the liquidity pool in percentage values. For example, 50/50 for Uniswap pools, 48.2/51.8 for a Curve pool, 10/10/80 for a Balancer pool " + inputTokenWeights: [BigDecimal!]! + + " Total supply of output token. Note that certain DEXes don't have an output token (e.g. Bancor) " + outputTokenSupply: BigInt + + " Price per share of output token in USD " + outputTokenPriceUSD: BigDecimal + + " Total supply of output tokens that are staked (usually in the MasterChef contract). Used to calculate reward APY. " + stakedOutputTokenAmount: BigInt + + " Per-block reward token emission as of the current block normalized to a day, in token's native amount. This should be ideally calculated as the theoretical rate instead of the realized amount. " + rewardTokenEmissionsAmount: [BigInt!] + + " Per-block reward token emission as of the current block normalized to a day, in USD value. This should be ideally calculated as the theoretical rate instead of the realized amount. " + rewardTokenEmissionsUSD: [BigDecimal!] + + longOpenInterest: BigInt! + shortOpenInterest: BigInt! + totalOpenInterest: BigInt! + + marketSize: BigInt + marketSkew: BigInt +} + +type LiquidityPoolHourlySnapshot @entity { + " { Smart contract address of the pool }-{ # of hours since Unix epoch time } " + id: Bytes! + + " Number of hours since Unix epoch time " + hours: Int! + + " The protocol this snapshot belongs to " + protocol: DerivPerpProtocol! + + " The pool this snapshot belongs to " + pool: LiquidityPool! + + ##### Quantitative Data ##### + + " Current TVL (Total Value Locked) of this pool " + totalValueLockedUSD: BigDecimal! + + " All revenue generated by the liquidity pool, accrued to the supply side. " + cumulativeSupplySideRevenueUSD: BigDecimal! + + " Hourly revenue generated by the liquidity pool, accrued to the supply side. " + hourlySupplySideRevenueUSD: BigDecimal! + + " All revenue generated by the liquidity pool, accrued to the protocol. " + cumulativeProtocolSideRevenueUSD: BigDecimal! + + " Hourly revenue generated by the liquidity pool, accrued to the protocol. " + hourlyProtocolSideRevenueUSD: BigDecimal! + + " All revenue generated by the liquidity pool. " + cumulativeTotalRevenueUSD: BigDecimal! + + " Hourly revenue generated by the liquidity pool. " + hourlyTotalRevenueUSD: BigDecimal! + + " Hourly funding rate based on rate given by protocol, inform us if this is not provided." + hourlyFundingrate: [BigDecimal!]! + + " Hourly Notional value of all open long positions " + hourlyLongOpenInterestUSD: BigDecimal! + + " Hourly Notional value of all open short positions " + hourlyShortOpenInterestUSD: BigDecimal! + + " Hourly Notional value of all open positions " + hourlyTotalOpenInterestUSD: BigDecimal! + + " All premium paid to enter a position. " + hourlyEntryPremiumUSD: BigDecimal! + + " All premium paid to enter a position. " + cumulativeEntryPremiumUSD: BigDecimal! + + " Hourly premium paid to exit a position. " + hourlyExitPremiumUSD: BigDecimal! + + " All premium paid to exit a position. " + cumulativeExitPremiumUSD: BigDecimal! + + " Hourly premium paid. " + hourlyTotalPremiumUSD: BigDecimal! + + " All premium paid. " + cumulativeTotalPremiumUSD: BigDecimal! + + " Hourly premium paid to deposit in liquidity pools. " + hourlyDepositPremiumUSD: BigDecimal! + + " All premium paid to deposit in liquidity pools. " + cumulativeDepositPremiumUSD: BigDecimal! + + " Hourly premium paid to withdraw from liquidity pools. " + hourlyWithdrawPremiumUSD: BigDecimal! + + " All premium paid to withdraw from liquidity pools. " + cumulativeWithdrawPremiumUSD: BigDecimal! + + " Hourly premium paid to enter and exit liquidity pool. " + hourlyTotalLiquidityPremiumUSD: BigDecimal! + + " All premium paid to enter and exit liquidity pool. " + cumulativeTotalLiquidityPremiumUSD: BigDecimal! + + "Hourly trade volume, in USD " + hourlyVolumeUSD: BigDecimal! + + " Hourly trade volume occurred in this pool for a specific input token, in native amount. The ordering should be the same as the pool's `inputTokens` field. " + hourlyVolumeByTokenAmount: [BigInt!]! + + " Cumulative volume of pool by token amount " + cumulativeVolumeByTokenAmount: [BigInt!]! + + " Hourly trade volume occurred in this pool for a specific input token, in USD. The ordering should be the same as the pool's `inputTokens` field. " + hourlyVolumeByTokenUSD: [BigDecimal!]! + + " Cumulative volume of pool in USD " + cumulativeVolumeByTokenUSD: [BigDecimal!]! + + " All historical trade volume occurred in this pool, in USD " + cumulativeVolumeUSD: BigDecimal! + + " Hourly Inflow trade notional volume, in USD, at time position open. " + hourlyInflowVolumeUSD: BigDecimal! + + " Hourly Inflow trade notional volume occurred in this pool for a specific input token, in native amount, at time position open. The ordering should be the same as the pool's `inputTokens` field. " + hourlyInflowVolumeByTokenAmount: [BigInt!]! + + " Cumulative inflow volume of pool by token amount " + cumulativeInflowVolumeByTokenAmount: [BigInt!]! + + " Hourly Inflow trade notional volume occurred in in this pool for a specific input token, in USD, at time position open. The ordering should be the same as the pool's `inputTokens` field. " + hourlyInflowVolumeByTokenUSD: [BigDecimal!]! + + " Cumulative inflow volume of pool in USD " + cumulativeInflowVolumeByTokenUSD: [BigDecimal!]! + + " Inflow historical trade notional volume occurred in this pool, in USD, at time position open. " + cumulativeInflowVolumeUSD: BigDecimal! + + " Hourly Inflow trade notional volume, in USD, at time position closed. " + hourlyClosedInflowVolumeUSD: BigDecimal! + + " Hourly Inflow trade notional volume occurred in this pool for a specific input token, in native amount, at time position closed. The ordering should be the same as the pool's `inputTokens` field. " + hourlyClosedInflowVolumeByTokenAmount: [BigInt!]! + + " Cumulative closed inflow volume of pool by token amount " + cumulativeClosedInflowVolumeByTokenAmount: [BigInt!]! + + " Hourly Inflow trade notional volume occurred in in this pool for a specific input token, in USD, at time position closed. The ordering should be the same as the pool's `inputTokens` field. " + hourlyClosedInflowVolumeByTokenUSD: [BigDecimal!]! + + " Cumulative closed inflow volume of pool in USD " + cumulativeClosedInflowVolumeByTokenUSD: [BigDecimal!]! + + " Inflow historical trade notional volume occurred in this pool, in USD, at time position closed. " + cumulativeClosedInflowVolumeUSD: BigDecimal! + + " Hourly Outflow trade notional volume occurred in this pool, in USD " + hourlyOutflowVolumeUSD: BigDecimal! + + " Hourly Outflow trade notional volume occurred in this pool for a specific input token, in native amount. The ordering should be the same as the pool's `inputTokens` field. " + hourlyOutflowVolumeByTokenAmount: [BigInt!]! + + " Cumulative outflow volume of pool by token amount " + cumulativeOutflowVolumeByTokenAmount: [BigInt!]! + + " Hourly Outflow trade notional volume occurred in this pool for a specific input token, in USD. The ordering should be the same as the pool's `inputTokens` field. " + hourlyOutflowVolumeByTokenUSD: [BigDecimal!]! + + " Cumulative outflow volume of pool in USD " + cumulativeOutflowVolumeByTokenUSD: [BigDecimal!]! + + " Outflow historical trade notional volume occurred in this pool, in USD " + cumulativeOutflowVolumeUSD: BigDecimal! + + " Amount of input tokens in the pool. The ordering should be the same as the pool's `inputTokens` field. " + inputTokenBalances: [BigInt!]! + + " Weights of input tokens in the liquidity pool in percentage values. For example, 50/50 for Uniswap pools, 48.2/51.8 for a Curve pool, 10/10/80 for a Balancer pool " + inputTokenWeights: [BigDecimal!]! + + " Total supply of output token. Note that certain DEXes don't have an output token (e.g. Bancor) " + outputTokenSupply: BigInt + + " Price per share of output token in USD " + outputTokenPriceUSD: BigDecimal + + " Total supply of output tokens that are staked (usually in the MasterChef contract). Used to calculate reward APY. " + stakedOutputTokenAmount: BigInt + + " Per-block reward token emission as of the current block normalized to a day (not hour), in token's native amount. This should be ideally calculated as the theoretical rate instead of the realized amount. " + rewardTokenEmissionsAmount: [BigInt!] + + " Per-block reward token emission as of the current block normalized to a day (not hour), in USD value. This should be ideally calculated as the theoretical rate instead of the realized amount. " + rewardTokenEmissionsUSD: [BigDecimal!] + + longOpenInterest: BigInt! + shortOpenInterest: BigInt! + totalOpenInterest: BigInt! + + marketSize: BigInt + marketSkew: BigInt +} + +################################## +##### Transaction-Level Data ##### +################################## + +""" +An event is any user action that occurs in a protocol. Generally, they are Ethereum events +emitted by a function in the smart contracts, stored in transaction receipts as event logs. +However, some user actions of interest are function calls that don't emit events. For example, +the deposit and withdraw functions in Yearn do not emit any events. In our subgraphs, we still +store them as events, although they are not technically Ethereum events emitted by smart +contracts. +""" +interface Event { + " { Event type }-{ Transaction hash }-{ Log index } " + id: Bytes! + + " Transaction hash of the transaction that emitted this event " + hash: Bytes! + + " Event log index. For transactions that don't emit event, create arbitrary index starting from 0 " + logIndex: Int! + + " The protocol this transaction belongs to " + protocol: DerivPerpProtocol! + + " Address that received the tokens " + to: Bytes! + + " Address that sent the tokens " + from: Bytes! + + " Account that controls this transaction " + account: Account! + + " Block number of this event " + blockNumber: BigInt! + + " Timestamp of this event " + timestamp: BigInt! +} + +"Deposits in liquidity pool" +type Deposit implements Event @entity(immutable: true) { + " deposit-{ Transaction hash }-{ Log index } " + id: Bytes! + + " Transaction hash of the transaction that emitted this event " + hash: Bytes! + + " Event log index. For transactions that don't emit event, create arbitrary index starting from 0 " + logIndex: Int! + + " The protocol this transaction belongs to " + protocol: DerivPerpProtocol! + + " Address that received the tokens " + to: Bytes! + + " Address that sent the tokens " + from: Bytes! + + " Account that controls this transaction " + account: Account! + + " Block number of this event " + blockNumber: BigInt! + + " Timestamp of this event " + timestamp: BigInt! + + " Input tokens of the pool. E.g. WETH and USDC to a WETH-USDC pool " + inputTokens: [Token!]! + + " Output token of the pool. E.g. the UNI-LP token " + outputToken: Token + + " Amount of input tokens in the token's native unit " + inputTokenAmounts: [BigInt!]! + + " Amount of output tokens in the token's native unit " + outputTokenAmount: BigInt + + " USD-normalized value of the transaction of the underlying (e.g. sum of tokens deposited into a pool) " + amountUSD: BigDecimal! + + " The pool involving this transaction " + pool: LiquidityPool! +} + +"Withdraw in liquidity pool" +type Withdraw implements Event @entity(immutable: true) { + " withdraw-{ Transaction hash }-{ Log index }" + id: Bytes! + + " Transaction hash of the transaction that emitted this event " + hash: Bytes! + + " Event log index. For transactions that don't emit event, create arbitrary index starting from 0 " + logIndex: Int! + + " The protocol this transaction belongs to " + protocol: DerivPerpProtocol! + + " Address that received the tokens " + to: Bytes! + + " Address that sent the tokens " + from: Bytes! + + " Account that controls this transaction " + account: Account! + + " Block number of this event " + blockNumber: BigInt! + + " Timestamp of this event " + timestamp: BigInt! + + " Input tokens of the pool (not input tokens of the event/transaction). E.g. WETH and USDC from a WETH-USDC pool " + inputTokens: [Token!]! + + " Output token of the pool (not output token of the event/transaction). E.g. the UNI-LP token " + outputToken: Token + + " Amount of input tokens in the token's native unit " + inputTokenAmounts: [BigInt!]! + + " Amount of output tokens in the token's native unit " + outputTokenAmount: BigInt + + " USD-normalized value of the transaction of the underlying (e.g. sum of tokens withdrawn from a pool) " + amountUSD: BigDecimal! + + " The pool involving this transaction " + pool: LiquidityPool! +} + +type Borrow implements Event @entity(immutable: true) { + " Borrow-{ Transaction hash }-{ Log index }" + id: Bytes! + + " Transaction hash of the transaction that emitted this event " + hash: Bytes! + + " Event log index. For transactions that don't emit event, create arbitrary index starting from 0 " + logIndex: Int! + + " The protocol this transaction belongs to " + protocol: DerivPerpProtocol! + + " The position this Borrow belongs to" + position: Position! + + " Address that received the tokens " + to: Bytes! + + " Address that sent the tokens " + from: Bytes! + + " Block number of this event " + blockNumber: BigInt! + + " Timestamp of this event " + timestamp: BigInt! + + " Account that is borrowing " + account: Account! + + " Asset borrowed " + asset: Token! + + " Amount of borrowed in token " + amount: BigInt! + + " Amount of borrowed in USD " + amountUSD: BigDecimal! + + " The pool involving this transaction " + pool: LiquidityPool! +} + +"Collateral In for trading" +type CollateralIn implements Event @entity(immutable: true) { + " deposit-{ Transaction hash }-{ Log index } " + id: Bytes! + + " Transaction hash of the transaction that emitted this event " + hash: Bytes! + + " Event log index. For transactions that don't emit event, create arbitrary index starting from 0 " + logIndex: Int! + + " The protocol this transaction belongs to " + protocol: DerivPerpProtocol! + + " The position this transaction belongs to as relates to Long or Short but not LP " + position: Position + + " Address that received the tokens " + to: Bytes! + + " Address that sent the tokens " + from: Bytes! + + " Account that controls this transaction " + account: Account! + + " Block number of this event " + blockNumber: BigInt! + + " Timestamp of this event " + timestamp: BigInt! + + " Input tokens of the pool. E.g. WETH and USDC to a WETH-USDC pool " + inputTokens: [Token!]! + + " Output token of the pool. E.g. the UNI-LP token " + outputToken: Token + + " Amount of input tokens in the token's native unit " + inputTokenAmounts: [BigInt!]! + + " Amount of output tokens in the token's native unit " + outputTokenAmount: BigInt + + " USD-normalized value of the transaction of the underlying (e.g. sum of tokens deposited into a pool) " + amountUSD: BigDecimal! + + " The pool involving this transaction " + pool: LiquidityPool! +} + +"Collateral out for trading" +type CollateralOut implements Event @entity(immutable: true) { + " withdraw-{ Transaction hash }-{ Log index }" + id: Bytes! + + " Transaction hash of the transaction that emitted this event " + hash: Bytes! + + " Event log index. For transactions that don't emit event, create arbitrary index starting from 0 " + logIndex: Int! + + " The protocol this transaction belongs to " + protocol: DerivPerpProtocol! + + " The positionthis transaction belongs to as it relates to long or short, but not LP" + position: Position! + + " Address that received the tokens " + to: Bytes! + + " Address that sent the tokens " + from: Bytes! + + " Account that controls this transaction " + account: Account! + + " Block number of this event " + blockNumber: BigInt! + + " Timestamp of this event " + timestamp: BigInt! + + " Input tokens of the pool (not input tokens of the event/transaction). E.g. WETH and USDC from a WETH-USDC pool " + inputTokens: [Token!]! + + " Output token of the pool (not output token of the event/transaction). E.g. the UNI-LP token " + outputToken: Token + + " Amount of input tokens in the token's native unit " + inputTokenAmounts: [BigInt!]! + + " Amount of output tokens in the token's native unit " + outputTokenAmount: BigInt + + " USD-normalized value of the transaction of the underlying (e.g. sum of tokens withdrawn from a pool) " + amountUSD: BigDecimal! + + " The pool involving this transaction " + pool: LiquidityPool! +} + +#This only applies to protocols that have a DEX (e.g. DYDX) and not to protocols that use oracle prices (e.g. GMX). +type Swap implements Event @entity(immutable: true) { + " swap-{ Transaction hash }-{ Log index } " + id: Bytes! + + " Transaction hash of the transaction that emitted this event " + hash: Bytes! + + " Event log index. For transactions that don't emit event, create arbitrary index starting from 0 " + logIndex: Int! + + " The protocol this transaction belongs to " + protocol: DerivPerpProtocol! + + " Address that received the tokens " + to: Bytes! + + " Address that sent the tokens " + from: Bytes! + + " Account that controls this transaction " + account: Account! + + " Block number of this event " + blockNumber: BigInt! + + " Timestamp of this event " + timestamp: BigInt! + + " Token deposited into pool " + tokenIn: Token! + + " Amount of token deposited into pool in native units " + amountIn: BigInt! + + " Amount of token deposited into pool in USD " + amountInUSD: BigDecimal! + + " Token withdrawn from pool " + tokenOut: Token! + + " Amount of token withdrawn from pool in native units " + amountOut: BigInt! + + " Amount of token withdrawn from pool in USD " + amountOutUSD: BigDecimal! + + " The contract address for the trading pair or pool " + tradingPair: Bytes! + + " The pool involving this transaction " + pool: LiquidityPool! +} + +type Liquidate implements Event @entity(immutable: true) { + " liquidate-{ Transaction hash }-{ Log index }" + id: Bytes! + + " Transaction hash of the transaction that emitted this event " + hash: Bytes! + + " Event log index. For transactions that don't emit event, create arbitrary index starting from 0 " + logIndex: Int! + + " The protocol this transaction belongs to " + protocol: DerivPerpProtocol! + + " The position this Liquidate belongs to" + position: Position! + + " Address that received the tokens " + to: Bytes! + + " Address that sent the tokens " + from: Bytes! + + " Block number of this event " + blockNumber: BigInt! + + " Timestamp of this event " + timestamp: BigInt! + + " Account that carried out the liquidation " + account: Account! + + " Account that got liquidated " + liquidatee: Account! + + " Asset repaid (borrowed) " + asset: Token! + + " Amount of collateral liquidated in native units " + amount: BigInt! + + " Amount of collateral liquidated in USD " + amountUSD: BigDecimal! + + " Amount of profit from liquidation in USD " + profitUSD: BigDecimal! + + " The pool involving this transaction " + pool: LiquidityPool! +} + +# An account is a unique Ethereum address +# Helps to accumulate total unique users +type Account @entity { + " Address of the account " + id: Bytes! + + " All premium paid to enter a position. " + cumulativeEntryPremiumUSD: BigDecimal! + + " All premium paid to exit a position. " + cumulativeExitPremiumUSD: BigDecimal! + + " All premium paid. " + cumulativeTotalPremiumUSD: BigDecimal! + + " All premium paid to deposit in liquidity pools. " + cumulativeDepositPremiumUSD: BigDecimal! + + " All premium paid to withdraw from liquidity pools. " + cumulativeWithdrawPremiumUSD: BigDecimal! + + " All premium paid to enter and exit liquidity pool. " + cumulativeTotalLiquidityPremiumUSD: BigDecimal! + + " All Position events occurred in this account " + positions: [Position!]! @derivedFrom(field: "account") + + " Total number of long positions (not cumulative) " + longPositionCount: Int! + + " Total number of short positions (not cumulative) " + shortPositionCount: Int! + + " Total number of open positions (not cumulative) " + openPositionCount: Int! + + " Total number of closed positions " + closedPositionCount: Int! + + " Total number of liquidations " + cumulativeUniqueLiquidatees: Int! + + " All deposit (add liquidity) events occurred in this account " + deposits: [Deposit!]! @derivedFrom(field: "account") + + " Number of deposits in this account " + depositCount: Int! + + " All withdraw (remove liquidity) events occurred in this account " + withdraws: [Withdraw!]! @derivedFrom(field: "account") + + " Number of withdraws in this account " + withdrawCount: Int! + + " All borrows events occurred in this account " + borrows: [Borrow!]! @derivedFrom(field: "account") + + " Number of borrows in this account " + borrowCount: Int! + + " All collateral put into protocol for trading events occurred in this account " + collateralIn: [CollateralIn!]! @derivedFrom(field: "account") + + " Number of times collateral was put into protocol for trading in this account " + collateralInCount: Int! + + " All collateral taken out from trading events occurred in this account " + collateralOut: [CollateralOut!]! @derivedFrom(field: "account") + + " Number of times collateral was taken out from trading in this account " + collateralOutCount: Int! + + " All swaps events occurred in this account " + swaps: [Swap!]! @derivedFrom(field: "account") + + " Number of swaps in this account " + swapCount: Int! + + " All liquidation events where this account was the liquidator " + liquidates: [Liquidate!]! @derivedFrom(field: "account") + + " Number of times this account liquidated a position " + liquidateCount: Int! + + " All liquidation events where this account got liquidated " + liquidations: [Liquidate!]! @derivedFrom(field: "liquidatee") + + " Number of times this account has been liquidated " + liquidationCount: Int! +} + +# Helper entity for calculating daily/hourly active users +type ActiveAccount @entity(immutable: true) { + " { daily/hourly }-{ Address of the account }-{ Days/hours since Unix epoch } " + id: Bytes! +} + +enum PositionSide { + " Position opened as long " + LONG + + " Position opened as short " + SHORT +} + +# A position is defined as who has what position in the protocol and distribution of longs and shorts at a positional level +type Position @entity { + " { Account address }-{ Pool address }-{ Position Side }-{ Counter } " + id: Bytes! + + " Account that owns this position " + account: Account! + + " The market in which this position was opened " + liquidityPool: LiquidityPool! + + " The asset in which this position was used as collateral " + collateral: Token! + + " The asset in which this position is long or short " + asset: Token! + + " The hash of the transaction that opened this position " + hashOpened: Bytes! + + " The hash of the transaction that closed this position (null if open) " + hashClosed: Bytes + + " Block number of when the position was opened " + blockNumberOpened: BigInt! + + " Block number of when the position was closed (null if open) " + blockNumberClosed: BigInt + + " Timestamp when the position was opened " + timestampOpened: BigInt! + + " Timestamp when the position was closed (null if open) " + timestampClosed: BigInt + + " Side of the position (either long or short) " + side: PositionSide! + + " Funding rate given by protocol at the time of position open, inform us if this is not provided." + fundingrateOpen: BigDecimal! + + " Funding rate given by protocol at the time of position open, inform us if this is not provided." + fundingrateClosed: BigDecimal + + " Multiplier leverage of position e.g. 10X or 2.5X " + leverage: BigDecimal! + + " Notional value of position, in asset units " + balance: BigInt! + + " Notional value of collateral position, in collateral units " + collateralBalance: BigInt! + + " Notional value of position, in USD, at time of open " + balanceUSD: BigDecimal! + + " Notional value of collateral position, in USD " + collateralBalanceUSD: BigDecimal! + + " Notional value of position right before position closed, in USD, only useful at close events. " + closeBalanceUSD: BigDecimal + + " Notional value of collateral position ight before position closed, in USD, only useful at close events " + closeCollateralBalanceUSD: BigDecimal + + " Realised profit and loss in USD at the time of close or event " + realisedPnlUSD: BigDecimal + + " All collateral put into protocol for trading events occurred in this account " + collateralIn: [CollateralIn!]! @derivedFrom(field: "position") + + " Number of collateral in related to this position " + collateralInCount: Int! + + " All collateral taken out from trading events occurred in this account " + collateralOut: [CollateralOut!]! @derivedFrom(field: "position") + + " Number of collateral out related to this position " + collateralOutCount: Int! + + " Liquidation event related to this position (if exists) " + liquidation: Liquidate @derivedFrom(field: "position") + + " Number of liquidations related to this position " + liquidationCount: Int! + + " Position daily snapshots for open positions " + snapshots: [PositionSnapshot!]! @derivedFrom(field: "position") + + price: BigInt! + + fundingIndex: BigInt! + + size: BigInt! + + isClosed: Boolean! +} + +type PositionSnapshot @entity(immutable: true) { + " { Position ID }-{ Transaction hash }-{ Log index } " + id: Bytes! + + " Transaction hash of the transaction that triggered this snapshot " + hash: Bytes! + + " Event log index. For transactions that don't emit event, create arbitrary index starting from 0 " + logIndex: Int! + + " Nonce of the transaction that triggered this snapshot " + nonce: BigInt! + + "Position this snapshot refers to" + position: Position! + + " Account that owns this position " + account: Account! + + " Funding rate given by protocol at the time of position at snapshot, inform us if this is not provided. " + fundingrate: BigDecimal + + " Notional value of position, in asset units " + balance: BigInt! + + " Notional value of collateral position, in collateral units " + collateralBalance: BigInt! + + " Notional value of position, in USD, at time of open " + balanceUSD: BigDecimal! + + " Notional value of collateral position, in USD " + collateralBalanceUSD: BigDecimal! + + " Realised profit and loss in USD at the time of close or event " + realisedPnlUSD: BigDecimal + + " Block number of this snapshot " + blockNumber: BigInt! + + " Timestamp of this snapshot " + timestamp: BigInt! +} + +########################### +##### Helper Entities ##### +########################### + +# Helper entity for calculating daily/hourly fields +type _ActivityHelper @entity { + id: Bytes! + + activeUsers: Int! + activeDepositors: Int! + activeBorrowers: Int! + activeLiquidators: Int! + activeLiquidatees: Int! + + transactionCount: Int! + + depositCount: Int! + withdrawCount: Int! + borrowCount: Int! + swapCount: Int! +} + +# Helper entity for getting positions +type _PositionCounter @entity { + " { Account address }-{ Pool address }-{ Position Side } " + id: Bytes! + + " Next count " + nextCount: Int! +} + +type _SmartMarginAccount @entity { + id: ID! + owner: Account! + version: Bytes! +} + +type _FundingRate @entity { + id: Bytes! + + funding: BigInt! +} diff --git a/subgraphs/kwenta/src/common/constants.ts b/subgraphs/kwenta/src/common/constants.ts new file mode 100644 index 0000000000..854e465914 --- /dev/null +++ b/subgraphs/kwenta/src/common/constants.ts @@ -0,0 +1,177 @@ +import { BigDecimal, BigInt } from "@graphprotocol/graph-ts"; + +//////////////////// +///// Versions ///// +//////////////////// + +export const PROTOCOL_NAME = "Kwenta"; +export const PROTOCOL_SLUG = "kwenta"; + +//////////////////////// +///// Schema Enums ///// +//////////////////////// + +// The network names corresponding to the Network enum in the schema. +// They also correspond to the ones in `dataSource.network()` after converting to lower case. +// See below for a complete list: +// https://thegraph.com/docs/en/hosted-service/what-is-hosted-service/#supported-networks-on-the-hosted-service +export namespace Network { + export const ARBITRUM_ONE = "ARBITRUM_ONE"; + export const ARWEAVE_MAINNET = "ARWEAVE_MAINNET"; + export const AURORA = "AURORA"; + export const AVALANCHE = "AVALANCHE"; + export const BOBA = "BOBA"; + export const BSC = "BSC"; // aka BNB Chain + export const CELO = "CELO"; + export const COSMOS = "COSMOS"; + export const CRONOS = "CRONOS"; + export const MAINNET = "MAINNET"; // Ethereum mainnet + export const FANTOM = "FANTOM"; + export const FUSE = "FUSE"; + export const HARMONY = "HARMONY"; + export const JUNO = "JUNO"; + export const MOONBEAM = "MOONBEAM"; + export const MOONRIVER = "MOONRIVER"; + export const NEAR_MAINNET = "NEAR_MAINNET"; + export const OPTIMISM = "OPTIMISM"; + export const OSMOSIS = "OSMOSIS"; + export const MATIC = "MATIC"; // aka Polygon + export const XDAI = "XDAI"; // aka Gnosis Chain +} + +export namespace ProtocolType { + export const EXCHANGE = "EXCHANGE"; + export const LENDING = "LENDING"; + export const YIELD = "YIELD"; + export const BRIDGE = "BRIDGE"; + export const GENERIC = "GENERIC"; +} + +export namespace VaultFeeType { + export const MANAGEMENT_FEE = "MANAGEMENT_FEE"; + export const PERFORMANCE_FEE = "PERFORMANCE_FEE"; + export const DEPOSIT_FEE = "DEPOSIT_FEE"; + export const WITHDRAWAL_FEE = "WITHDRAWAL_FEE"; +} + +export namespace LiquidityPoolFeeType { + export const FIXED_TRADING_FEE = "FIXED_TRADING_FEE"; + export const TIERED_TRADING_FEE = "TIERED_TRADING_FEE"; + export const DYNAMIC_TRADING_FEE = "DYNAMIC_TRADING_FEE"; + export const FIXED_LP_FEE = "FIXED_LP_FEE"; + export const DYNAMIC_LP_FEE = "DYNAMIC_LP_FEE"; + export const FIXED_PROTOCOL_FEE = "FIXED_PROTOCOL_FEE"; + export const DYNAMIC_PROTOCOL_FEE = "DYNAMIC_PROTOCOL_FEE"; +} + +export namespace RewardTokenType { + export const DEPOSIT = "DEPOSIT"; + export const BORROW = "BORROW"; +} + +export namespace LendingType { + export const CDP = "CDP"; + export const POOLED = "POOLED"; +} + +export namespace RiskType { + export const GLOBAL = "GLOBAL"; + export const ISOLATED = "ISOLATED"; +} + +export namespace InterestRateType { + export const STABLE = "STABLE"; + export const VARIABLE = "VARIABLE"; + export const FIXED = "FIXED"; +} + +export namespace InterestRateSide { + export const LENDER = "LENDER"; + export const BORROWER = "BORROWER"; +} + +export namespace PositionSide { + export const LENDER = "LENDER"; + export const BORROWER = "BORROWER"; +} + +export namespace UsageType { + export const DEPOSIT = "DEPOSIT"; + export const WITHDRAW = "WITHDRAW"; + export const SWAP = "SWAP"; +} + +////////////////////////////// +///// Ethereum Addresses ///// +////////////////////////////// + +export const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000"; +export const ETH_ADDRESS = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"; + +export const UNISWAP_V2_FACTORY = "0x5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f"; + +export const WETH_ADDRESS = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"; +export const USDC_WETH_PAIR = "0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc"; // created 10008355 +export const DAI_WETH_PAIR = "0xa478c2975ab1ea89e8196811f51a7b7ade33eb11"; // created block 10042267 +export const USDT_WETH_PAIR = "0x0d4a11d5eeaac28ec3f61d100daf4d40471f1852"; // created block 10093341 + +//////////////////////// +///// Type Helpers ///// +//////////////////////// + +export const DEFAULT_DECIMALS = 18; + +export const USDC_DECIMALS = 6; +export const USDC_DENOMINATOR = BigDecimal.fromString("1000000"); + +export const BIGINT_ZERO = BigInt.fromI32(0); +export const BIGINT_ONE = BigInt.fromI32(1); +export const BIGINT_TWO = BigInt.fromI32(2); +export const BIGINT_HUNDRED = BigInt.fromI32(100); +export const BIGINT_THOUSAND = BigInt.fromI32(1000); +export const BIGINT_TEN_TO_EIGHTEENTH = BigInt.fromString("10").pow(18); +export const BIGINT_MAX = BigInt.fromString( + "115792089237316195423570985008687907853269984665640564039457584007913129639935" +); + +export const INT_NEGATIVE_ONE = -1 as i32; +export const INT_ZERO = 0 as i32; +export const INT_ONE = 1 as i32; +export const INT_TWO = 2 as i32; +export const INT_FOUR = 4 as i32; + +export const BIGDECIMAL_ZERO = new BigDecimal(BIGINT_ZERO); +export const BIGDECIMAL_ONE = new BigDecimal(BIGINT_ONE); +export const BIGDECIMAL_TWO = new BigDecimal(BIGINT_TWO); + +export const MAX_UINT = BigInt.fromI32(2).times(BigInt.fromI32(255)); + +///////////////////// +///// Date/Time ///// +///////////////////// + +export const SECONDS_PER_DAY = 60 * 60 * 24; // 86400 +export const SECONDS_PER_HOUR = 60 * 60; // 3600 +export const MS_PER_DAY = new BigDecimal(BigInt.fromI32(24 * 60 * 60 * 1000)); +export const DAYS_PER_YEAR = new BigDecimal(BigInt.fromI32(365)); +export const MS_PER_YEAR = DAYS_PER_YEAR.times( + new BigDecimal(BigInt.fromI32(24 * 60 * 60 * 1000)) +); + +//////////////// +///// Misc ///// +//////////////// + +export const ETH_SYMBOL = "ETH"; +export const ETH_NAME = "Ether"; + +///////////////////////////// +///// Protocol Specific ///// +///////////////////////////// + +export const FACTORY_ADDRESS = "0x920cf626a271321c151d027030d5d08af699456b"; +export const TRADING_FEE = BigDecimal.fromString("3"); +export const PROTOCOL_FEE_TO_ON = BigDecimal.fromString("0.5"); +export const LP_FEE_TO_ON = BigDecimal.fromString("2.5"); +export const PROTOCOL_FEE_TO_OFF = BigDecimal.fromString("0.0"); +export const LP_FEE_TO_OFF = BigDecimal.fromString("3"); diff --git a/subgraphs/kwenta/src/common/getters.ts b/subgraphs/kwenta/src/common/getters.ts new file mode 100644 index 0000000000..1883327b0d --- /dev/null +++ b/subgraphs/kwenta/src/common/getters.ts @@ -0,0 +1,88 @@ +// import { log } from "@graphprotocol/graph-ts" +import { Address } from "@graphprotocol/graph-ts"; +import { + Token, + DexAmmProtocol, + LiquidityPool, + RewardToken, +} from "../../generated/schema"; +import { fetchTokenSymbol, fetchTokenName, fetchTokenDecimals } from "./tokens"; +import { + BIGDECIMAL_ZERO, + Network, + INT_ZERO, + FACTORY_ADDRESS, + ProtocolType, + SECONDS_PER_DAY, + BIGINT_ZERO, + RewardTokenType, + PROTOCOL_NAME, + PROTOCOL_SLUG, +} from "./constants"; +import { Versions } from "../versions"; + +export function getOrCreateToken(tokenAddress: Address): Token { + let token = Token.load(tokenAddress.toHexString()); + // fetch info if null + if (!token) { + token = new Token(tokenAddress.toHexString()); + token.symbol = fetchTokenSymbol(tokenAddress); + token.name = fetchTokenName(tokenAddress); + token.decimals = fetchTokenDecimals(tokenAddress); + token.lastPriceUSD = BIGDECIMAL_ZERO; + token.lastPriceBlockNumber = BIGINT_ZERO; + token.save(); + } + return token; +} + +export function getOrCreateRewardToken(address: Address): RewardToken { + let rewardToken = RewardToken.load(address.toHexString()); + if (rewardToken == null) { + const token = getOrCreateToken(address); + rewardToken = new RewardToken(address.toHexString()); + rewardToken.token = token.id; + rewardToken.type = RewardTokenType.DEPOSIT; + rewardToken.save(); + + return rewardToken as RewardToken; + } + return rewardToken as RewardToken; +} + +export function getLiquidityPool(poolAddress: string): LiquidityPool { + return LiquidityPool.load(poolAddress)!; +} + +/////////////////////////// +///// DexAmm Specific ///// +/////////////////////////// + +export function getOrCreateDex(): DexAmmProtocol { + let protocol = DexAmmProtocol.load(FACTORY_ADDRESS); + + if (!protocol) { + protocol = new DexAmmProtocol(FACTORY_ADDRESS); + protocol.name = PROTOCOL_NAME; + protocol.slug = PROTOCOL_SLUG; + protocol.totalValueLockedUSD = BIGDECIMAL_ZERO; + protocol.cumulativeVolumeUSD = BIGDECIMAL_ZERO; + protocol.cumulativeSupplySideRevenueUSD = BIGDECIMAL_ZERO; + protocol.cumulativeProtocolSideRevenueUSD = BIGDECIMAL_ZERO; + protocol.cumulativeTotalRevenueUSD = BIGDECIMAL_ZERO; + protocol.cumulativeUniqueUsers = INT_ZERO; + protocol.network = Network.MAINNET; + protocol.type = ProtocolType.EXCHANGE; + } + + protocol.schemaVersion = Versions.getSchemaVersion(); + protocol.subgraphVersion = Versions.getSubgraphVersion(); + protocol.methodologyVersion = Versions.getMethodologyVersion(); + protocol.save(); + + return protocol; +} + +export function getDaysSinceEpoch(secondsSinceEpoch: number): string { + return (Math.floor(secondsSinceEpoch / SECONDS_PER_DAY)).toString(); +} diff --git a/subgraphs/kwenta/src/common/metrics.ts b/subgraphs/kwenta/src/common/metrics.ts new file mode 100644 index 0000000000..071c24fd26 --- /dev/null +++ b/subgraphs/kwenta/src/common/metrics.ts @@ -0,0 +1,139 @@ +import { Address, ethereum } from "@graphprotocol/graph-ts"; +import { Account, ActiveAccount } from "../../generated/schema"; +import { + INT_ONE, + SECONDS_PER_DAY, + SECONDS_PER_HOUR, + UsageType, +} from "./constants"; +import { + getLiquidityPool, + getOrCreateDex, + getOrCreateFinancialsDailySnapshot, + getOrCreateLiquidityPoolDailySnapshot, + getOrCreateLiquidityPoolHourlySnapshot, + getOrCreateUsageMetricDailySnapshot, + getOrCreateUsageMetricHourlySnapshot, +} from "./getters"; + +// These are meant more as boilerplates that'll be filled out depending on the +// subgraph, and will be different from subgraph to subgraph, hence left +// partially implemented and commented out. +// They are common within a subgraph but not common across different subgraphs. + +// Update FinancialsDailySnapshots entity +export function updateFinancials(event: ethereum.Event): void { + const financialMetricsDaily = getOrCreateFinancialsDailySnapshot(event); + + const protocol = getOrCreateDex(); + + // Update the block number and timestamp to that of the last transaction of that day + financialMetricsDaily.blockNumber = event.block.number; + financialMetricsDaily.timestamp = event.block.timestamp; + financialMetricsDaily.totalValueLockedUSD = protocol.totalValueLockedUSD; + financialMetricsDaily.cumulativeVolumeUSD = protocol.cumulativeVolumeUSD; + + financialMetricsDaily.save(); +} + +// Update usage metrics entities +export function updateUsageMetrics( + event: ethereum.Event, + fromAddress: Address, + usageType: string +): void { + const from = fromAddress.toHexString(); + + const usageMetricsDaily = getOrCreateUsageMetricDailySnapshot(event); + const usageMetricsHourly = getOrCreateUsageMetricHourlySnapshot(event); + + const protocol = getOrCreateDex(); + + // Update the block number and timestamp to that of the last transaction of that day + usageMetricsDaily.blockNumber = event.block.number; + usageMetricsDaily.timestamp = event.block.timestamp; + usageMetricsDaily.dailyTransactionCount += INT_ONE; + + usageMetricsHourly.blockNumber = event.block.number; + usageMetricsHourly.timestamp = event.block.timestamp; + usageMetricsHourly.hourlyTransactionCount += INT_ONE; + + if (usageType == UsageType.DEPOSIT) { + usageMetricsDaily.dailyDepositCount += INT_ONE; + usageMetricsHourly.hourlyDepositCount += INT_ONE; + } else if (usageType == UsageType.WITHDRAW) { + usageMetricsDaily.dailyWithdrawCount += INT_ONE; + usageMetricsHourly.hourlyWithdrawCount += INT_ONE; + } else if (usageType == UsageType.SWAP) { + usageMetricsDaily.dailySwapCount += INT_ONE; + usageMetricsHourly.hourlySwapCount += INT_ONE; + } + + // Number of days since Unix epoch + const day = event.block.timestamp.toI32() / SECONDS_PER_DAY; + const hour = event.block.timestamp.toI32() / SECONDS_PER_HOUR; + + const dayId = day.toString(); + const hourId = hour.toString(); + + // Combine the id and the user address to generate a unique user id for the day + const dailyActiveAccountId = from.concat("-").concat(dayId); + let dailyActiveAccount = ActiveAccount.load(dailyActiveAccountId); + if (!dailyActiveAccount) { + dailyActiveAccount = new ActiveAccount(dailyActiveAccountId); + usageMetricsDaily.dailyActiveUsers += INT_ONE; + dailyActiveAccount.save(); + } + + const hourlyActiveAccountId = from.concat("-").concat(hourId); + let hourlyActiveAccount = ActiveAccount.load(hourlyActiveAccountId); + if (!hourlyActiveAccount) { + hourlyActiveAccount = new ActiveAccount(hourlyActiveAccountId); + usageMetricsHourly.hourlyActiveUsers += INT_ONE; + hourlyActiveAccount.save(); + } + + let account = Account.load(from); + if (!account) { + account = new Account(from); + protocol.cumulativeUniqueUsers += INT_ONE; + account.save(); + } + usageMetricsDaily.cumulativeUniqueUsers = protocol.cumulativeUniqueUsers; + usageMetricsHourly.cumulativeUniqueUsers = protocol.cumulativeUniqueUsers; + + usageMetricsDaily.save(); + usageMetricsHourly.save(); + protocol.save(); +} + +// Update Pool Snapshots entities +export function updatePoolMetrics(event: ethereum.Event): void { + // get or create pool metrics + const poolMetricsDaily = getOrCreateLiquidityPoolDailySnapshot(event); + const poolMetricsHourly = getOrCreateLiquidityPoolHourlySnapshot(event); + + const pool = getLiquidityPool(event.address.toHexString()); + + // Update the block number and timestamp to that of the last transaction of that day + poolMetricsDaily.totalValueLockedUSD = pool.totalValueLockedUSD; + poolMetricsDaily.cumulativeVolumeUSD = pool.cumulativeVolumeUSD; + poolMetricsDaily.inputTokenBalances = pool.inputTokenBalances; + poolMetricsDaily.inputTokenWeights = pool.inputTokenWeights; + poolMetricsDaily.outputTokenSupply = pool.outputTokenSupply; + poolMetricsDaily.outputTokenPriceUSD = pool.outputTokenPriceUSD; + poolMetricsDaily.blockNumber = event.block.number; + poolMetricsDaily.timestamp = event.block.timestamp; + + poolMetricsHourly.totalValueLockedUSD = pool.totalValueLockedUSD; + poolMetricsHourly.cumulativeVolumeUSD = pool.cumulativeVolumeUSD; + poolMetricsHourly.inputTokenBalances = pool.inputTokenBalances; + poolMetricsHourly.inputTokenWeights = pool.inputTokenWeights; + poolMetricsHourly.outputTokenSupply = pool.outputTokenSupply; + poolMetricsHourly.outputTokenPriceUSD = pool.outputTokenPriceUSD; + poolMetricsHourly.blockNumber = event.block.number; + poolMetricsHourly.timestamp = event.block.timestamp; + + poolMetricsDaily.save(); + poolMetricsHourly.save(); +} diff --git a/subgraphs/kwenta/src/common/rewards.ts b/subgraphs/kwenta/src/common/rewards.ts new file mode 100644 index 0000000000..82664376f0 --- /dev/null +++ b/subgraphs/kwenta/src/common/rewards.ts @@ -0,0 +1,292 @@ +///////////////////// +// VERSION 1.0.3 //// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// The purpose of this program is to dynamically estimate the blocks generated for the 24 HR period following the most recent update. // +// It does so by calculating the moving average block rate for an arbitrary length of time preceding the current block. // +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +import { log, BigDecimal, BigInt } from "@graphprotocol/graph-ts"; +import { NetworkConfigs } from "../../configurations/configure"; +import { _CircularBuffer } from "../../generated/schema"; +import { Network } from "./constants"; +import { + BIGDECIMAL_ZERO, + INT_FOUR, + INT_NEGATIVE_ONE, + INT_ONE, + INT_TWO, + INT_ZERO, +} from "./constants"; + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// WINDOW_SIZE_SECONDS, TIMESTAMP_STORAGE_INTERVALS, and BUFFER_SIZE can be modified. These are just recommended values - 'somewhat' arbitrary. // +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +// The storage interval tells you to only store blocks where the timestamps are separated by at least this amount. +// Increasing this value will mean less blocks stored and less frequently computes blocksSpeed. +export const TIMESTAMP_STORAGE_INTERVAL = 600; + +// The window size determines the range of blocks that you track from the current block minus the window size. +// Window of block time used to calculate the moving average. +// Increasing means less deviation but also less sensitivity to changing block speeds. +export const WINDOW_SIZE_SECONDS = 86400; + +// BUFFER_SIZE determined the size of the array +// Makes the buffer the maximum amount of blocks that can be stored given the block rate and storage interval +// Recommended value is (RATE_IN_SECODNDS / TIMESTAMP_STORAGE_INTERVAL) * 2 - > Round up to nearest even integer +export const BUFFER_SIZE = 288; + +// Add this entity to the schema. +// type _CircularBuffer @entity { +// " 'CIRCULAR_BUFFER' " +// id: ID! + +// " Array of sorted block numbers sorted continuously " +// blocks: [Int!]! + +// " The index in the blocks array which will be used with the newest block to calculate block speed (Usally set to about a day before newest block) " +// windowStartIndex: Int! + +// " The next index in the blocks array that will be replaced with the newest block " +// nextIndex: Int! + +// " This determines the size of the blocks array. Should be set to contain at least a days worth of blocks according to a 1 day window for measuring speed" +// bufferSize: Int! + +// " The current calculated number of blocks per day based on calculated block speed " +// blocksPerDay: BigDecimal! + +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +export const CIRCULAR_BUFFER = "CIRCULAR_BUFFER"; + +// Describes whether the interval for which rewards are emitted is done by block or timestamp +export namespace RewardIntervalType { + export const BLOCK = "BLOCK"; + export const TIMESTAMP = "TIMESTAMP"; +} + +// Forecast period. This gives you the time period that you want to estimate count of blocks per interval, based on moving average block speed. +// 86400 = 1 Day +export const RATE_IN_SECONDS = 86400; +export const RATE_IN_SECONDS_BD = BigDecimal.fromString( + RATE_IN_SECONDS.toString() +); + +// Estimated seconds per block of the protocol +export const STARTING_BLOCKS_PER_DAY = RATE_IN_SECONDS_BD.div( + getStartingBlockRate() +); + +export const WINDOW_SIZE_SECONDS_BD = BigDecimal.fromString( + WINDOW_SIZE_SECONDS.toString() +); + +// Call this function in event handlers frequently enough so that it calls on blocks frequently enough +/** + * @param {BigInt} currentTimestamp - Timestamp for current event + * @param {BigInt} currentBlockNumber - Block nunmber of current event + * @param {BigInt} rewardRate - Rate of reward emissions per reward interval + * @param {BigInt} rewardType - Describes whether rewards are given per block or timestamp + * @returns {BigDecimal} - Returns estimated blocks for specified rate + */ +export function getRewardsPerDay( + currentTimestamp: BigInt, + currentBlockNumber: BigInt, + rewardRate: BigDecimal, + rewardType: string +): BigDecimal { + const circularBuffer = getOrCreateCircularBuffer(); + + // Create entity for the current block + const currentTimestampI32 = currentTimestamp.toI32(); + const currentBlockNumberI32 = currentBlockNumber.toI32(); + + const blocks = circularBuffer.blocks; + + // Interval between index and the index of the start of the window block + const windowWidth = abs( + circularBuffer.windowStartIndex - circularBuffer.nextIndex + ); + if (windowWidth == INT_ZERO) { + if (circularBuffer.nextIndex >= circularBuffer.bufferSize) { + blocks[INT_ZERO] = currentTimestampI32; + blocks[INT_ONE] = currentBlockNumberI32; + circularBuffer.nextIndex = INT_TWO; + } else { + blocks[circularBuffer.nextIndex] = currentTimestampI32; + blocks[circularBuffer.nextIndex + INT_ONE] = currentBlockNumberI32; + circularBuffer.nextIndex += INT_TWO; + } + + circularBuffer.save(); + + // return because there is only 1 reference point. + if (rewardType == RewardIntervalType.TIMESTAMP) { + return rewardRate.times(RATE_IN_SECONDS_BD); + } else { + return circularBuffer.blocksPerDay.times(rewardRate); + } + } + + // Add current timestamp and block numnber to array if new block is at least X blocks later than previously stored. + // Used to save memory and efficiency on array resizing. + let recentSavedTimestamp: i32; + if (circularBuffer.nextIndex == INT_ZERO) { + recentSavedTimestamp = blocks[circularBuffer.bufferSize - INT_TWO]; + } else { + recentSavedTimestamp = blocks[circularBuffer.nextIndex - INT_TWO]; + } + + if ( + currentTimestampI32 - recentSavedTimestamp <= + TIMESTAMP_STORAGE_INTERVAL + ) { + if (rewardType == RewardIntervalType.TIMESTAMP) { + return rewardRate.times(RATE_IN_SECONDS_BD); + } else { + return circularBuffer.blocksPerDay.times(rewardRate); + } + } + + blocks[circularBuffer.nextIndex] = currentTimestampI32; + blocks[circularBuffer.nextIndex + INT_ONE] = currentBlockNumberI32; + if (circularBuffer.nextIndex >= BUFFER_SIZE - INT_TWO) { + circularBuffer.nextIndex = INT_ZERO; + } else { + circularBuffer.nextIndex += INT_TWO; + } + // The timestamp at the start of the window (default 24 hours in seconds). + const startTimestamp = currentTimestampI32 - WINDOW_SIZE_SECONDS; + + // Make sure to still have 2 blocks to calculate rate (This shouldn't happen past the beginning). + while (true) { + if (circularBuffer.nextIndex > circularBuffer.windowStartIndex) { + if ( + circularBuffer.nextIndex - circularBuffer.windowStartIndex <= + INT_FOUR + ) { + break; + } + } else { + if ( + BUFFER_SIZE - + circularBuffer.windowStartIndex + + circularBuffer.nextIndex <= + INT_FOUR + ) { + break; + } + } + const windowIndexBlockTimestamp = blocks[circularBuffer.windowStartIndex]; + + // Shift the start of the window if the current timestamp moves out of desired rate window + if (windowIndexBlockTimestamp < startTimestamp) { + circularBuffer.windowStartIndex = + circularBuffer.windowStartIndex + INT_TWO; + if (circularBuffer.windowStartIndex >= circularBuffer.bufferSize) { + circularBuffer.windowStartIndex = INT_ZERO; + } + } else { + break; + } + } + + // Wideness of the window in seconds. + const windowSecondsCount = BigDecimal.fromString( + (currentTimestampI32 - blocks[circularBuffer.windowStartIndex]).toString() + ); + + // Wideness of the window in blocks. + const windowBlocksCount = BigDecimal.fromString( + ( + currentBlockNumberI32 - blocks[circularBuffer.windowStartIndex + INT_ONE] + ).toString() + ); + + // Estimate block speed for the window in seconds. + const unnormalizedBlockSpeed = + WINDOW_SIZE_SECONDS_BD.div(windowSecondsCount).times(windowBlocksCount); + + // block speed converted to specified rate. + const normalizedBlockSpeed = RATE_IN_SECONDS_BD.div( + WINDOW_SIZE_SECONDS_BD + ).times(unnormalizedBlockSpeed); + + // Update BlockTracker with new values. + circularBuffer.blocksPerDay = normalizedBlockSpeed; + circularBuffer.blocks = blocks; + + circularBuffer.save(); + + if (rewardType == RewardIntervalType.TIMESTAMP) { + return rewardRate.times(RATE_IN_SECONDS_BD); + } else { + return rewardRate.times(circularBuffer.blocksPerDay); + } +} + +function getOrCreateCircularBuffer(): _CircularBuffer { + let circularBuffer = _CircularBuffer.load(CIRCULAR_BUFFER); + + if (!circularBuffer) { + circularBuffer = new _CircularBuffer(CIRCULAR_BUFFER); + + const blocks = new Array(BUFFER_SIZE); + for (let i = INT_ZERO; i < BUFFER_SIZE; i += INT_TWO) { + blocks[i] = INT_NEGATIVE_ONE; + blocks[i + INT_ONE] = INT_NEGATIVE_ONE; + } + + circularBuffer.blocks = blocks; + circularBuffer.windowStartIndex = INT_ZERO; + circularBuffer.nextIndex = INT_ZERO; + circularBuffer.bufferSize = BUFFER_SIZE; + circularBuffer.blocksPerDay = STARTING_BLOCKS_PER_DAY; + + circularBuffer.save(); + } + + return circularBuffer; +} + +function getStartingBlockRate(): BigDecimal { + // Block rates pulled from google searches - rough estimates + + if (NetworkConfigs.getNetwork() == Network.MAINNET) { + return BigDecimal.fromString("13.39"); + } else if (NetworkConfigs.getNetwork() == Network.ARBITRUM_ONE) { + return BigDecimal.fromString("15"); + } else if (NetworkConfigs.getNetwork() == Network.AURORA) { + return BigDecimal.fromString("1.03"); + } else if (NetworkConfigs.getNetwork() == Network.BSC) { + return BigDecimal.fromString("5"); + } else if (NetworkConfigs.getNetwork() == Network.CELO) { + return BigDecimal.fromString("5"); + } else if (NetworkConfigs.getNetwork() == Network.FANTOM) { + return BigDecimal.fromString("1"); + } else if (NetworkConfigs.getNetwork() == Network.FUSE) { + return BigDecimal.fromString("1"); + } else if (NetworkConfigs.getNetwork() == Network.OPTIMISM) { + return BigDecimal.fromString("12.5"); + } else if (NetworkConfigs.getNetwork() == Network.MATIC) { + return BigDecimal.fromString("2"); + } else if (NetworkConfigs.getNetwork() == Network.XDAI) { + return BigDecimal.fromString("5"); + } else if (NetworkConfigs.getNetwork() == Network.MOONBEAM) { + return BigDecimal.fromString("13.39"); + } else if (NetworkConfigs.getNetwork() == Network.MOONRIVER) { + return BigDecimal.fromString("13.39"); + } else if (NetworkConfigs.getNetwork() == Network.AVALANCHE) { + return BigDecimal.fromString("13.39"); + } else if (NetworkConfigs.getNetwork() == Network.CRONOS) { + return BigDecimal.fromString("5.5"); + } + + // else if (network == SubgraphNetwork.AVALANCHE) return BigDecimal.fromString("2.5") + // else if (dataSource.network() == "harmony") return BigDecimal.fromString("13.39") + else { + log.warning("getStartingBlockRate(): Network not found", []); + return BIGDECIMAL_ZERO; + } +} diff --git a/subgraphs/kwenta/src/common/snapshot.ts b/subgraphs/kwenta/src/common/snapshot.ts new file mode 100644 index 0000000000..754ac2c5ad --- /dev/null +++ b/subgraphs/kwenta/src/common/snapshot.ts @@ -0,0 +1,321 @@ +import { Bytes, ethereum } from "@graphprotocol/graph-ts"; +import { SECONDS_PER_DAY, SECONDS_PER_HOUR } from "./constants"; +import { + DexAmmProtocol, + UsageMetricsDailySnapshot, + FinancialsDailySnapshot, + UsageMetricsHourlySnapshot, + LiquidityPoolDailySnapshot, + LiquidityPoolHourlySnapshot, + LiquidityPool, + _ActivityHelper, +} from "../../generated/schema"; + +const ActivityHelperID = Bytes.fromUTF8("_ActivityHelper"); + +export function createProtocolSnapshots( + event: ethereum.Event, + protocol: DexAmmProtocol +): void { + const dayID = event.block.timestamp.toI32() / SECONDS_PER_DAY; + const hourID = event.block.timestamp.toI32() / SECONDS_PER_HOUR; + const snapshotDayID = protocol.lastUpdateTimestamp.toI32() / SECONDS_PER_DAY; + const snapshotHourID = + protocol.lastUpdateTimestamp.toI32() / SECONDS_PER_HOUR; + + if (snapshotDayID != dayID) { + takeFinancialsDailySnapshot(event, protocol, snapshotDayID); + takeUsageDailySnapshot(event, protocol, snapshotDayID); + protocol.lastSnapshotDayID = snapshotDayID; + protocol.save(); + } + if (snapshotHourID != hourID) { + takeUsageHourlySnapshot(event, protocol, snapshotHourID); + protocol.lastSnapshotHourID = snapshotHourID; + protocol.save(); + } +} + +export function createLiquidityPoolSnapshots( + event: ethereum.Event, + pool: LiquidityPool +): void { + const dayID = event.block.timestamp.toI32() / SECONDS_PER_DAY; + const hourID = event.block.timestamp.toI32() / SECONDS_PER_HOUR; + const snapshotDayID = pool.lastUpdateTimestamp.toI32() / SECONDS_PER_DAY; + const snapshotHourID = pool.lastUpdateTimestamp.toI32() / SECONDS_PER_HOUR; + + if (snapshotDayID != dayID) { + takeLiquidityPoolDailySnapshot(event, pool, snapshotDayID); + pool.lastSnapshotDayID = snapshotDayID; + pool.save(); + } + + if (snapshotHourID != hourID) { + takeLiquidityPoolHourlySnapshot(event, pool, snapshotHourID); + pool.lastSnapshotHourID = snapshotHourID; + pool.save(); + } +} + +function takeFinancialsDailySnapshot( + event: ethereum.Event, + protocol: DexAmmProtocol, + day: i32 +): void { + const snapshot = new FinancialsDailySnapshot(Bytes.fromI32(day)); + const previousSnapshot = FinancialsDailySnapshot.load( + protocol.lastSnapshotDayID + ); + + snapshot.day = day; + snapshot.protocol = protocol.id; + snapshot.blockNumber = event.block.number; + snapshot.timestamp = event.block.timestamp; + + // tvl + snapshot.totalValueLockedUSD = protocol.totalValueLockedUSD; + snapshot.protocolControlledValueUSD = protocol.protocolControlledValueUSD; + + // revenues + snapshot.cumulativeSupplySideRevenueUSD = + protocol.cumulativeSupplySideRevenueUSD; + snapshot.cumulativeProtocolSideRevenueUSD = + protocol.cumulativeProtocolSideRevenueUSD; + snapshot.cumulativeTotalRevenueUSD = protocol.cumulativeTotalRevenueUSD; + + // deltas + let supplySideRevenueDelta = snapshot.cumulativeSupplySideRevenueUSD; + let protocolSideRevenueDelta = snapshot.cumulativeProtocolSideRevenueUSD; + let totalRevenueDelta = snapshot.cumulativeTotalRevenueUSD; + + if (previousSnapshot) { + supplySideRevenueDelta = snapshot.cumulativeSupplySideRevenueUSD.minus( + previousSnapshot.cumulativeSupplySideRevenueUSD + ); + protocolSideRevenueDelta = snapshot.cumulativeProtocolSideRevenueUSD.minus( + previousSnapshot.cumulativeProtocolSideRevenueUSD + ); + totalRevenueDelta = snapshot.cumulativeTotalRevenueUSD.minus( + previousSnapshot.cumulativeTotalRevenueUSD + ); + } + snapshot.dailySupplySideRevenueUSD = supplySideRevenueDelta; + snapshot.dailyProtocolSideRevenueUSD = protocolSideRevenueDelta; + snapshot.dailyTotalRevenueUSD = totalRevenueDelta; + + snapshot.save(); +} + +function takeUsageDailySnapshot( + event: ethereum.Event, + protocol: DexAmmProtocol, + day: i32 +): void { + const activity = initActivityHelper(); + + const snapshot = new UsageMetricsDailySnapshot(Bytes.fromI32(day)); + const previousSnapshot = UsageMetricsDailySnapshot.load( + protocol.lastSnapshotDayID + ); + + snapshot.protocol = protocol.id; + snapshot.day = day; + snapshot.blockNumber = event.block.number; + snapshot.timestamp = event.block.timestamp; + + // unique users + snapshot.cumulativeUniqueUsers = protocol.cumulativeUniqueUsers; + snapshot.cumulativeUniqueTransferSenders = + protocol.cumulativeUniqueTransferSenders; + snapshot.cumulativeUniqueTransferReceivers = + protocol.cumulativeUniqueTransferReceivers; + snapshot.cumulativeUniqueLiquidityProviders = + protocol.cumulativeUniqueLiquidityProviders; + snapshot.cumulativeUniqueMessageSenders = + protocol.cumulativeUniqueMessageSenders; + + // daily activity + snapshot.dailyActiveUsers = activity.dailyActiveUsers; + + // transaction counts + snapshot.cumulativeTransactionCount = protocol.cumulativeTransactionCount; + + // misc + snapshot.totalPoolCount = protocol.totalPoolCount; + + // deltas + let transactionDelta = snapshot.cumulativeTransactionCount; + + if (previousSnapshot) { + transactionDelta = + snapshot.cumulativeTransactionCount - + previousSnapshot.cumulativeTransactionCount; + } + snapshot.dailyTransactionCount = transactionDelta; + snapshot.save(); + + activity.dailyActiveUsers = 0; + activity.save(); +} + +function takeUsageHourlySnapshot( + event: ethereum.Event, + protocol: DexAmmProtocol, + hour: i32 +): void { + const activity = initActivityHelper(); + + const snapshot = new UsageMetricsHourlySnapshot(Bytes.fromI32(hour)); + const previousSnapshot = UsageMetricsHourlySnapshot.load( + protocol.lastSnapshotHourID + ); + + snapshot.protocol = protocol.id; + snapshot.hour = hour; + snapshot.blockNumber = event.block.number; + snapshot.timestamp = event.block.timestamp; + + // unique users + snapshot.cumulativeUniqueUsers = protocol.cumulativeUniqueUsers; + + // hourly activity + snapshot.hourlyActiveUsers = activity.hourlyActiveUsers; + + // transaction counts + snapshot.cumulativeTransactionCount = protocol.cumulativeTransactionCount; + + // deltas + let transactionDelta = snapshot.cumulativeTransactionCount; + if (previousSnapshot) { + transactionDelta = + snapshot.cumulativeTransactionCount - + previousSnapshot.cumulativeTransactionCount; + } + snapshot.hourlyTransactionCount = transactionDelta; + snapshot.save(); + + activity.hourlyActiveUsers = 0; + activity.save(); +} + +function takeLiquidityPoolHourlySnapshot( + event: ethereum.Event, + pool: LiquidityPool, + hour: i32 +): void { + const snapshot = new LiquidityPoolHourlySnapshot(pool.id.concatI32(hour)); + const previousSnapshot = LiquidityPoolHourlySnapshot.load( + pool.id.concatI32(pool.lastSnapshotHourID) + ); + + snapshot.hour = hour; + snapshot.protocol = pool.protocol; + snapshot.pool = pool.id; + snapshot.timestamp = event.block.timestamp; + snapshot.blockNumber = event.block.number; + + // tvl and balances + snapshot.totalValueLockedUSD = pool.totalValueLockedUSD; + snapshot.inputTokenBalance = pool.inputTokenBalance; + snapshot.totalLiquidity = pool.totalLiquidity; + snapshot.totalLiquidityUSD = pool.totalLiquidityUSD; + snapshot.stakedLiquidity = pool.stakedLiquidity; + snapshot.rewardTokenEmissions = pool.rewardTokenEmissions; + snapshot.rewardTokenEmissionsUSD = pool.rewardTokenEmissionsUSD; + + // revenues + snapshot.cumulativeSupplySideRevenueUSD = pool.cumulativeSupplySideRevenueUSD; + snapshot.cumulativeProtocolSideRevenueUSD = + pool.cumulativeProtocolSideRevenueUSD; + snapshot.cumulativeTotalRevenueUSD = pool.cumulativeTotalRevenueUSD; + + // deltas + let supplySideRevenueDelta = snapshot.cumulativeSupplySideRevenueUSD; + let protocolSideRevenueDelta = snapshot.cumulativeProtocolSideRevenueUSD; + let totalRevenueDelta = snapshot.cumulativeTotalRevenueUSD; + + if (previousSnapshot) { + supplySideRevenueDelta = snapshot.cumulativeSupplySideRevenueUSD.minus( + previousSnapshot.cumulativeSupplySideRevenueUSD + ); + protocolSideRevenueDelta = snapshot.cumulativeProtocolSideRevenueUSD.minus( + previousSnapshot.cumulativeProtocolSideRevenueUSD + ); + totalRevenueDelta = snapshot.cumulativeTotalRevenueUSD.minus( + previousSnapshot.cumulativeTotalRevenueUSD + ); + } + snapshot.hourlySupplySideRevenueUSD = supplySideRevenueDelta; + snapshot.hourlyProtocolSideRevenueUSD = protocolSideRevenueDelta; + snapshot.hourlyTotalRevenueUSD = totalRevenueDelta; + + snapshot.save(); +} + +function takeLiquidityPoolDailySnapshot( + event: ethereum.Event, + pool: LiquidityPool, + day: i32 +): void { + const snapshot = new LiquidityPoolDailySnapshot(pool.id.concatI32(day)); + const previousSnapshot = LiquidityPoolDailySnapshot.load( + pool.id.concatI32(pool.lastSnapshotDayID) + ); + + snapshot.day = day; + snapshot.protocol = pool.protocol; + snapshot.pool = pool.id; + snapshot.timestamp = event.block.timestamp; + snapshot.blockNumber = event.block.number; + + // tvl and balances + snapshot.totalValueLockedUSD = pool.totalValueLockedUSD; + snapshot.inputTokenBalance = pool.inputTokenBalance; + snapshot.totalLiquidity = pool.totalLiquidity; + snapshot.totalLiquidityUSD = pool.totalLiquidityUSD; + snapshot.stakedLiquidity = pool.stakedLiquidity; + snapshot.rewardTokenEmissions = pool.rewardTokenEmissions; + snapshot.rewardTokenEmissionsUSD = pool.rewardTokenEmissionsUSD; + + // revenues + snapshot.cumulativeSupplySideRevenueUSD = pool.cumulativeSupplySideRevenueUSD; + snapshot.cumulativeProtocolSideRevenueUSD = + pool.cumulativeProtocolSideRevenueUSD; + snapshot.cumulativeTotalRevenueUSD = pool.cumulativeTotalRevenueUSD; + + // deltas + let supplySideRevenueDelta = snapshot.cumulativeSupplySideRevenueUSD; + let protocolSideRevenueDelta = snapshot.cumulativeProtocolSideRevenueUSD; + let totalRevenueDelta = snapshot.cumulativeTotalRevenueUSD; + + if (previousSnapshot) { + supplySideRevenueDelta = snapshot.cumulativeSupplySideRevenueUSD.minus( + previousSnapshot.cumulativeSupplySideRevenueUSD + ); + protocolSideRevenueDelta = snapshot.cumulativeProtocolSideRevenueUSD.minus( + previousSnapshot.cumulativeProtocolSideRevenueUSD + ); + totalRevenueDelta = snapshot.cumulativeTotalRevenueUSD.minus( + previousSnapshot.cumulativeTotalRevenueUSD + ); + } + snapshot.dailySupplySideRevenueUSD = supplySideRevenueDelta; + snapshot.dailyProtocolSideRevenueUSD = protocolSideRevenueDelta; + snapshot.dailyTotalRevenueUSD = totalRevenueDelta; + + snapshot.save(); +} + +function initActivityHelper(): _ActivityHelper { + let helper = _ActivityHelper.load(ActivityHelperID); + if (helper) { + return helper; + } + helper = new _ActivityHelper(ActivityHelperID); + helper.hourlyActiveUsers = 0; + helper.dailyActiveUsers = 0; + + helper.save(); + return helper; +} diff --git a/subgraphs/kwenta/src/common/tokens.ts b/subgraphs/kwenta/src/common/tokens.ts new file mode 100644 index 0000000000..00b6db52a8 --- /dev/null +++ b/subgraphs/kwenta/src/common/tokens.ts @@ -0,0 +1,188 @@ +/* eslint-disable prefer-const */ +import { ERC20 } from "../../generated/FuturesMarketManager2/ERC20"; +import { ERC20SymbolBytes } from "../../generated/FuturesMarketManager2/ERC20SymbolBytes"; +import { ERC20NameBytes } from "../../generated/FuturesMarketManager2/ERC20NameBytes"; +import { Address } from "@graphprotocol/graph-ts"; + +export const INVALID_TOKEN_DECIMALS = 0; +export const UNKNOWN_TOKEN_VALUE = "unknown"; + +export function fetchTokenSymbol(tokenAddress: Address): string { + let contract = ERC20.bind(tokenAddress); + let contractSymbolBytes = ERC20SymbolBytes.bind(tokenAddress); + + // try types string and bytes32 for symbol + let symbolValue = UNKNOWN_TOKEN_VALUE; + let symbolResult = contract.try_symbol(); + if (!symbolResult.reverted) { + return symbolResult.value; + } + + // non-standard ERC20 implementation + let symbolResultBytes = contractSymbolBytes.try_symbol(); + if (!symbolResultBytes.reverted) { + // for broken pairs that have no symbol function exposed + if (!isNullEthValue(symbolResultBytes.value.toHexString())) { + symbolValue = symbolResultBytes.value.toString(); + } else { + // try with the static definition + let staticTokenDefinition = + StaticTokenDefinition.fromAddress(tokenAddress); + if (staticTokenDefinition != null) { + symbolValue = staticTokenDefinition.symbol; + } + } + } + + return symbolValue; +} + +export function fetchTokenName(tokenAddress: Address): string { + let contract = ERC20.bind(tokenAddress); + let contractNameBytes = ERC20NameBytes.bind(tokenAddress); + + // try types string and bytes32 for name + let nameValue = UNKNOWN_TOKEN_VALUE; + let nameResult = contract.try_name(); + if (!nameResult.reverted) { + return nameResult.value; + } + + // non-standard ERC20 implementation + let nameResultBytes = contractNameBytes.try_name(); + if (!nameResultBytes.reverted) { + // for broken exchanges that have no name function exposed + if (!isNullEthValue(nameResultBytes.value.toHexString())) { + nameValue = nameResultBytes.value.toString(); + } else { + // try with the static definition + let staticTokenDefinition = + StaticTokenDefinition.fromAddress(tokenAddress); + if (staticTokenDefinition != null) { + nameValue = staticTokenDefinition.name; + } + } + } + + return nameValue; +} + +export function fetchTokenDecimals(tokenAddress: Address): i32 { + let contract = ERC20.bind(tokenAddress); + + // try types uint8 for decimals + let decimalResult = contract.try_decimals(); + if (!decimalResult.reverted) { + let decimalValue = decimalResult.value; + return decimalValue.toI32(); + } + + // try with the static definition + let staticTokenDefinition = StaticTokenDefinition.fromAddress(tokenAddress); + if (staticTokenDefinition != null) { + return staticTokenDefinition.decimals as i32; + } else { + return INVALID_TOKEN_DECIMALS as i32; + } +} + +export function isNullEthValue(value: string): boolean { + return ( + value == + "0x0000000000000000000000000000000000000000000000000000000000000001" + ); +} + +// Initialize a Token Definition with the attributes +class StaticTokenDefinition { + address: Address; + symbol: string; + name: string; + decimals: i32; + + // Initialize a Token Definition with its attributes + constructor(address: Address, symbol: string, name: string, decimals: i32) { + this.address = address; + this.symbol = symbol; + this.name = name; + this.decimals = decimals; + } + + // Get all tokens with a static defintion + static getStaticDefinitions(): Array { + let staticDefinitions = new Array(6); + + // Add DGD + let tokenDGD = new StaticTokenDefinition( + Address.fromString("0xe0b7927c4af23765cb51314a0e0521a9645f0e2a"), + "DGD", + "DGD", + 9 as i32 + ); + staticDefinitions.push(tokenDGD); + + // Add AAVE + let tokenAAVE = new StaticTokenDefinition( + Address.fromString("0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9"), + "AAVE", + "Aave Token", + 18 as i32 + ); + staticDefinitions.push(tokenAAVE); + + // Add LIF + let tokenLIF = new StaticTokenDefinition( + Address.fromString("0xeb9951021698b42e4399f9cbb6267aa35f82d59d"), + "LIF", + "Lif", + 18 as i32 + ); + staticDefinitions.push(tokenLIF); + + // Add SVD + let tokenSVD = new StaticTokenDefinition( + Address.fromString("0xbdeb4b83251fb146687fa19d1c660f99411eefe3"), + "SVD", + "savedroid", + 18 as i32 + ); + staticDefinitions.push(tokenSVD); + + // Add TheDAO + let tokenTheDAO = new StaticTokenDefinition( + Address.fromString("0xbb9bc244d798123fde783fcc1c72d3bb8c189413"), + "TheDAO", + "TheDAO", + 16 as i32 + ); + staticDefinitions.push(tokenTheDAO); + + // Add HPB + let tokenHPB = new StaticTokenDefinition( + Address.fromString("0x38c6a68304cdefb9bec48bbfaaba5c5b47818bb2"), + "HPB", + "HPBCoin", + 18 as i32 + ); + staticDefinitions.push(tokenHPB); + + return staticDefinitions; + } + + // Helper for hardcoded tokens + static fromAddress(tokenAddress: Address): StaticTokenDefinition | null { + let staticDefinitions = this.getStaticDefinitions(); + let tokenAddressHex = tokenAddress.toHexString(); + + // Search the definition using the address + for (let i = 0; i < staticDefinitions.length; i++) { + let staticDefinition = staticDefinitions[i]; + if (staticDefinition.address.toHexString() == tokenAddressHex) { + return staticDefinition; + } + } + + // If not found, return null + return null; + } +} diff --git a/subgraphs/kwenta/src/common/utils/arrays.ts b/subgraphs/kwenta/src/common/utils/arrays.ts new file mode 100644 index 0000000000..a542dab8cf --- /dev/null +++ b/subgraphs/kwenta/src/common/utils/arrays.ts @@ -0,0 +1,66 @@ +export function removeFromArrayAtIndex(x: T[], index: i32): T[] { + const retval = new Array(x.length - 1); + let nI = 0; + for (let i = 0; i < x.length; i++) { + if (i != index) { + retval[nI] = x[i]; + nI += 1; + } + } + return retval; +} + +export function addToArrayAtIndex(x: T[], item: T, index: i32 = -1): T[] { + if (x.length == 0) { + return [item]; + } + if (index == -1 || index > x.length) { + index = x.length; + } + const retval = new Array(); + let i = 0; + while (i < index) { + retval.push(x[i]); + i += 1; + } + retval.push(item); + while (i < x.length) { + retval.push(x[i]); + i += 1; + } + return retval; +} + +export function arrayDiff(a: T[], b: T[]): T[] { + let diff: T[] = new Array(); + for (let i: i32 = 0; i < a.length; i++) { + if (b.indexOf(a[i]) == -1) { + diff = diff.concat([a[i]]); + } + } + + return diff; +} + +export function arrayUnique(array: T[]): T[] { + let unique: T[] = new Array(); + for (let i: i32 = 0; i < array.length; i++) { + if (array.indexOf(array[i]) == i) { + unique = unique.concat([array[i]]); + } + } + + return unique; +} + +export function arrayUniqueBy(array: T[], pluck: (item: T) => string): T[] { + const references = array.map((item) => pluck(item)); + let unique: T[] = new Array(); + for (let i: i32 = 0; i < references.length; i++) { + if (references.indexOf(references[i]) == i) { + unique = unique.concat([array[i]]); + } + } + + return unique; +} diff --git a/subgraphs/kwenta/src/common/utils/datetime.ts b/subgraphs/kwenta/src/common/utils/datetime.ts new file mode 100644 index 0000000000..39b600c1e3 --- /dev/null +++ b/subgraphs/kwenta/src/common/utils/datetime.ts @@ -0,0 +1,64 @@ +import { BigInt } from "@graphprotocol/graph-ts"; +import { SECONDS_PER_DAY } from "../constants"; + +export const minute = BigInt.fromI32(60); +export const hour = BigInt.fromI32(3600); +export const day = BigInt.fromI32(86400); + +export const one = BigInt.fromI32(1); + +export function getMinuteOpenTime(timestamp: BigInt): BigInt { + const interval = minute; + return getOpenTime(timestamp, interval); +} + +export function getMinuteCloseTime(timestamp: BigInt): BigInt { + return getMinuteOpenTime(timestamp).plus(minute).minus(one); +} + +export function getTenMinuteOpenTime(timestamp: BigInt): BigInt { + const interval = minute.times(BigInt.fromI32(10)); + return getOpenTime(timestamp, interval); +} + +export function getTenMinuteCloseTime(timestamp: BigInt): BigInt { + return getTenMinuteOpenTime(timestamp) + .plus(minute.times(BigInt.fromI32(10))) + .minus(one); +} + +export function getHourOpenTime(timestamp: BigInt): BigInt { + const interval = hour; + return getOpenTime(timestamp, interval); +} + +export function getHourCloseTime(timestamp: BigInt): BigInt { + return getHourOpenTime(timestamp).plus(hour).minus(one); +} + +export function getDayOpenTime(timestamp: BigInt): BigInt { + const interval = day; + return getOpenTime(timestamp, interval); +} + +export function getDayCloseTime(timestamp: BigInt): BigInt { + return getDayOpenTime(timestamp).plus(day).minus(one); +} + +export function getDaysSinceEpoch(secondsSinceEpoch: number): string { + return (Math.floor(secondsSinceEpoch / SECONDS_PER_DAY)).toString(); +} + +// helpers + +export function getOpenTime(timestamp: BigInt, interval: BigInt): BigInt { + const excess = timestamp.mod(interval); + return timestamp.minus(excess); +} + +export function isSameDay(t1: BigInt, t2: BigInt): boolean { + const startOfDay1 = getDayOpenTime(t1); + const startOfDay2 = getDayOpenTime(t2); + + return startOfDay1.equals(startOfDay2); +} diff --git a/subgraphs/kwenta/src/common/utils/numbers.ts b/subgraphs/kwenta/src/common/utils/numbers.ts new file mode 100644 index 0000000000..3d0c09ac73 --- /dev/null +++ b/subgraphs/kwenta/src/common/utils/numbers.ts @@ -0,0 +1,92 @@ +import { BigDecimal, BigInt } from "@graphprotocol/graph-ts"; +import { BIGDECIMAL_ONE } from "../constants"; + +export function bigIntToBigDecimal( + quantity: BigInt, + decimals: i32 = 18 +): BigDecimal { + return quantity.divDecimal( + BigInt.fromI32(10) + .pow(decimals as u8) + .toBigDecimal() + ); +} + +// returns 10^exp +export function exponentToBigDecimal(exp: i32): BigDecimal { + let bd = BigDecimal.fromString("1"); + const ten = BigDecimal.fromString("10"); + for (let i = 0; i < exp; i++) { + bd = bd.times(ten); + } + return bd; +} + +// a fast approximation of (1 + rate)^exponent +export function bigDecimalExponential( + rate: BigDecimal, + exponent: BigDecimal +): BigDecimal { + // binomial expansion to obtain (1 + x)^n : (1 + rate)^exponent + // 1 + n *x + (n/2*(n-1))*x**2+(n/6*(n-1)*(n-2))*x**3+(n/12*(n-1)*(n-2)*(n-3))*x**4 + // this is less precise, but more efficient than `powerBigDecimal` when power is big + const firstTerm = exponent.times(rate); + const secondTerm = exponent + .div(BIGDECIMAL_TWO) + .times(exponent.minus(BIGDECIMAL_ONE)) + .times(rate.times(rate)); + const thirdTerm = exponent + .div(BIGDECIMAL_SIX) + .times(exponent.minus(BIGDECIMAL_TWO)) + .times(rate.times(rate).times(rate)); + const fourthTerm = exponent + .div(BIGDECIMAL_TWELVE) + .times(exponent.minus(BIGDECIMAL_THREE)) + .times(rate.times(rate).times(rate).times(rate)); + return firstTerm.plus(secondTerm).plus(thirdTerm).plus(fourthTerm); +} + +export function calculateAverage(prices: BigDecimal[]): BigDecimal { + let sum = BigDecimal.fromString("0"); + for (let i = 0; i < prices.length; i++) { + sum = sum.plus(prices[i]); + } + + return sum.div( + BigDecimal.fromString(BigInt.fromI32(prices.length).toString()) + ); +} + +export function calculateMedian(prices: BigDecimal[]): BigDecimal { + const sorted = prices.sort((a, b) => { + return a.equals(b) ? 0 : a.gt(b) ? 1 : -1; + }); + + const mid = Math.ceil(sorted.length / 2) as i32; + if (sorted.length % 2 == 0) { + return sorted[mid].plus(sorted[mid - 1]).div(BigDecimal.fromString("2")); + } + + return sorted[mid - 1]; +} + +// Ray is 27 decimal Wad is 18 decimal +// These functions were made for the AAVE subgraph. Visit the following link to verify that AAVE's definition for RAY units match what are needed for your protocol +// https://docs.aave.com/developers/v/2.0/glossary + +export function rayToWad(a: BigInt): BigInt { + const halfRatio = BigInt.fromI32(10).pow(9).div(BigInt.fromI32(2)); + return halfRatio.plus(a).div(BigInt.fromI32(10).pow(9)); +} + +export function wadToRay(a: BigInt): BigInt { + const result = a.times(BigInt.fromI32(10).pow(9)); + return result; +} + +export function round(numberToRound: BigDecimal): BigDecimal { + const parsedNumber: number = parseFloat(numberToRound.toString()); + const roundedNumber: number = + Math.ceil((parsedNumber + Number.EPSILON) * 100) / 100; + return BigDecimal.fromString(roundedNumber.toString()); +} diff --git a/subgraphs/kwenta/src/common/utils/strings.ts b/subgraphs/kwenta/src/common/utils/strings.ts new file mode 100644 index 0000000000..a55bf872e6 --- /dev/null +++ b/subgraphs/kwenta/src/common/utils/strings.ts @@ -0,0 +1,52 @@ +import { BigInt } from "@graphprotocol/graph-ts"; + +export function hexToNumberString(hex: string): string { + let hexNumber = BigInt.fromI32(0); + + if (hex.startsWith("0x")) { + hex = hex.slice(2); + } + + for (let i = 0; i < hex.length; i += 1) { + const character = hex.substr(hex.length - 1 - i, 1); + const digit = parseInt(character, 16) as u8; + if (digit) { + hexNumber = hexNumber.plus( + BigInt.fromI32(digit).times(BigInt.fromI32(16).pow(i as u8)) + ); + } + } + + return hexNumber.toString(); +} + +export function hexToAscii(hex: string): string { + let output = ""; + for (let i = 0; i < hex.length; i += 2) { + const charCode = parseInt(hex.substr(i, 2), 16) as u8; + + if (charCode) { + output += String.fromCharCode(charCode); + } + + // catch cases with charCode outside 32...126, + // in which case it's probably a number... + if (charCode && (charCode < 32 || charCode > 126)) { + return hexToNumberString(hex); + } + } + + return output; +} + +// Converts upper snake case to lower kebab case and appends a hyphen. +// (e.g. "TRADING_FEE" to "trading-fee-"), mainly used to create entity IDs +export function enumToPrefix(snake: string): string { + return snake.toLowerCase().replace("_", "-") + "-"; +} + +// Prefix an ID with a enum string in order to differentiate IDs +// e.g. combine TRADING_FEE and 0x1234 into trading-fee-0x1234 +export function prefixID(enumString: string, ID: string): string { + return enumToPrefix(enumString) + ID; +} diff --git a/subgraphs/kwenta/src/mappings/handlers.ts b/subgraphs/kwenta/src/mappings/handlers.ts new file mode 100644 index 0000000000..4bcee98700 --- /dev/null +++ b/subgraphs/kwenta/src/mappings/handlers.ts @@ -0,0 +1,495 @@ +import { TokenPricer, ProtocolConfig } from "../sdk/protocols/config"; +import { SDK } from "../sdk/protocols/perpfutures"; +import { NetworkConfigs } from "../../configurations/configure"; +import { Versions } from "../versions"; +import { + _SmartMarginAccount, + Token, + _FundingRate, +} from "../../generated/schema"; +import { _ERC20 } from "../../generated/FuturesMarketManager2/_ERC20"; +import { + Address, + BigDecimal, + BigInt, + Bytes, + dataSource, + ethereum, + log, +} from "@graphprotocol/graph-ts"; +import { getUsdPrice, getUsdPricePerToken } from "../prices"; +import { + bigDecimalToBigInt, + bigIntToBigDecimal, + safeDivide, +} from "../sdk/util/numbers"; + +import { + TokenInitializer, + TokenParams, +} from "../sdk/protocols/perpfutures/tokens"; +import { + BIGDECIMAL_MINUS_ONE, + BIGINT_MINUS_ONE, + LiquidityPoolFeeType, + PositionSide, +} from "../sdk/util/constants"; +import { + MarketAdded as MarketAddedEvent, + MarketRemoved, +} from "../../generated/FuturesMarketManager2/FuturesMarketManager"; +import { + FundingRecomputed as FundingRecomputedEvent, + MarginTransferred as MarginTransferredEvent, + PositionLiquidated as PositionLiquidatedEvent, + PositionModified as PositionModifiedEvent, +} from "../../generated/templates/FuturesV1Market/FuturesMarket"; +import { + PerpsV2MarketProxyable, + PositionLiquidated1 as PositionLiquidatedV2Event, + PositionModified1 as PositionModifiedV2Event, +} from "../../generated/templates/PerpsV2Market/PerpsV2MarketProxyable"; +import { FuturesV1Market, PerpsV2Market } from "../../generated/templates"; +import { createTokenAmountArray, getFundingRateId } from "./helpers"; +import { BIGDECIMAL_ZERO, BIGINT_ZERO } from "../common/constants"; +import { NewAccount as NewSmartMarginAccountEvent } from "../../generated/SmartMarginFactory1/SmartMarginFactory"; +import { Pool } from "../sdk/protocols/perpfutures/pool"; + +class Pricer implements TokenPricer { + getTokenPrice(token: Token): BigDecimal { + const price = getUsdPricePerToken(Address.fromBytes(token.id)); + return price.usdPrice; + } + + getAmountValueUSD(token: Token, amount: BigInt): BigDecimal { + const _amount = bigIntToBigDecimal(amount, token.decimals); + return getUsdPrice(Address.fromBytes(token.id), _amount); + } +} + +// Implement TokenInitializer +class TokenInit implements TokenInitializer { + getTokenParams(address: Address): TokenParams { + const erc20 = _ERC20.bind(address); + const name = erc20.name(); + const symbol = erc20.symbol(); + const decimals = erc20.decimals().toI32(); + return { + name, + symbol, + decimals, + }; + } +} + +const conf = new ProtocolConfig( + NetworkConfigs.getFactoryAddress().toHexString(), + NetworkConfigs.getProtocolName(), + NetworkConfigs.getProtocolSlug(), + Versions +); + +/* + This function is called when a new v1 market added + We just checks if it is a v1 market, and then stores it +*/ +export function handleV1MarketAdded(event: MarketAddedEvent): void { + const marketKey = event.params.marketKey.toString(); + const sdk = SDK.initializeFromEvent( + conf, + new Pricer(), + new TokenInit(), + event + ); + + // check that it's a v1 market before adding + if (marketKey.startsWith("s") && !marketKey.endsWith("PERP")) { + log.info("New V1 market added: {}", [marketKey]); + + const pool = sdk.Pools.loadPool(event.params.market); + if (!pool.isInitialized) { + const token = sdk.Tokens.getOrCreateToken( + NetworkConfigs.getSUSDAddress() + ); + pool.initialize(marketKey, marketKey, [token], null, "chainlink"); + // todo: fees + } + // futures v1 market + FuturesV1Market.create(event.params.market); + } +} + +/* + This function is called when a new v2 market added + We just checks if it is a v2 market, and then stores it +*/ +export function handleV2MarketAdded(event: MarketAddedEvent): void { + const marketKey = event.params.marketKey.toString(); + const sdk = SDK.initializeFromEvent( + conf, + new Pricer(), + new TokenInit(), + event + ); + + // check that it's a v1 market before adding + if (marketKey.endsWith("PERP")) { + log.info("New V2 market added: {}", [marketKey]); + + const pool = sdk.Pools.loadPool(event.params.market); + if (!pool.isInitialized) { + const token = sdk.Tokens.getOrCreateToken( + NetworkConfigs.getSUSDAddress() + ); + pool.initialize(marketKey, marketKey, [token], null, "chainlink"); + // todo: fees + } + + // perps v2 market + PerpsV2Market.create(event.params.market); + } +} + +/* + This function is fired when a new smart margin account is created. + We are storing the new smart margin account with it's owner address for future reference. +*/ +export function handleNewAccountSmartMargin( + event: NewSmartMarginAccountEvent +): void { + // create a new entity to store the cross-margin account owner + const smAccountAddress = event.params.account as Address; + let smartMarginAccount = _SmartMarginAccount.load(smAccountAddress.toHex()); + const sdk = SDK.initializeFromEvent( + conf, + new Pricer(), + new TokenInit(), + event + ); + if (smartMarginAccount == null) { + smartMarginAccount = new _SmartMarginAccount(smAccountAddress.toHex()); + + const loadAccountResponse = sdk.Accounts.loadAccount(event.params.creator); + if (loadAccountResponse.isNewUser) { + const protocol = sdk.Protocol; + protocol.addUser(); + } + smartMarginAccount.owner = loadAccountResponse.account.getBytesId(); + + smartMarginAccount.version = event.params.version; + smartMarginAccount.save(); + } +} + +/* + This function is fired when a Margin is transferred from or to a market position of an account. + If marginDelta > 0 then it is "deposit", else it is "withdraw". +*/ +export function handleMarginTransferred(event: MarginTransferredEvent): void { + const marketAddress = dataSource.address(); + const marginDelta = event.params.marginDelta; + const caller = event.params.account; + + const sdk = SDK.initializeFromEvent( + conf, + new Pricer(), + new TokenInit(), + event + ); + const pool = sdk.Pools.loadPool(marketAddress); + const token = sdk.Tokens.getOrCreateToken(NetworkConfigs.getSUSDAddress()); + + const loadAccountResponse = sdk.Accounts.loadAccount(caller); + const account = loadAccountResponse.account; + if (loadAccountResponse.isNewUser) { + const protocol = sdk.Protocol; + protocol.addUser(); + pool.addUser(); + } + const amounts = createTokenAmountArray(pool, [token], [marginDelta.abs()]); + // Deposit + if (marginDelta.gt(BIGINT_ZERO)) { + account.deposit(pool, amounts, BIGINT_ZERO); + pool.addInflowVolumeByToken(token, marginDelta.abs()); + + pool.addInputTokenBalances(amounts); + } + // Withdraw + if (marginDelta.lt(BIGINT_ZERO)) { + account.withdraw(pool, amounts, BIGINT_ZERO); + + pool.addOutflowVolumeByToken(token, marginDelta.abs()); + + pool.addInputTokenBalances( + amounts.map((amount) => amount.times(BIGINT_MINUS_ONE)) + ); + } +} + +/* + This function is fired when the funding of a pool is recomputed + We are storing the position with index for future reference +*/ +export function handleFundingRecomputed(event: FundingRecomputedEvent): void { + const marketAddress = dataSource.address(); + const fundingRate = event.params.funding; + + const sdk = SDK.initializeFromEvent( + conf, + new Pricer(), + new TokenInit(), + event + ); + const pool = sdk.Pools.loadPool(marketAddress); + const fundingRateEntity = new _FundingRate( + getFundingRateId(pool, event.params.index) + ); + fundingRateEntity.funding = event.params.funding; + fundingRateEntity.save(); + pool.setFundingRate([bigIntToBigDecimal(fundingRate)]); +} + +/* + This function is first when a position of a account is modified, in the following cases: + 1. A new position is created + 2. An existing position changes side, ex : LONG becomes SHORT, or SHORT becomes LONG + 3. An existing position is on same side just increase or decrease in the size + 4. A position is closed + 5. A position is liquidated + */ +export function handlePositionModified(event: PositionModifiedEvent): void { + const marketAddress = dataSource.address(); + const sdk = SDK.initializeFromEvent( + conf, + new Pricer(), + new TokenInit(), + event + ); + const pool = sdk.Pools.loadPool(marketAddress); + const isClose = event.params.size.isZero(); + const sendingAccount = event.params.account; + + const smartMarginAccount = _SmartMarginAccount.load(sendingAccount.toHex()); + + const accountAddress = smartMarginAccount + ? Address.fromBytes(smartMarginAccount.owner) + : sendingAccount; + + const loadAccountResponse = sdk.Accounts.loadAccount(accountAddress); + const account = loadAccountResponse.account; + if (loadAccountResponse.isNewUser) { + const protocol = sdk.Protocol; + protocol.addUser(); + pool.addUser(); + } + + const token = sdk.Tokens.getOrCreateToken(NetworkConfigs.getSUSDAddress()); + + const fees = event.params.fee; + + /* if tradeSize == 0 then either margin transferred or position liquidated + (both these events are not checked here) */ + if (event.params.tradeSize.gt(BIGINT_ZERO)) { + // loading account last position in this pool, otherwise create new one + const isLong = event.params.size.gt(BIGINT_ZERO); + const positionResponse = sdk.Positions.loadPosition( + pool, + account, + token, + token, + isLong ? PositionSide.LONG : PositionSide.SHORT, + event, + true + ); + + // fetching market size for testing + + const position = positionResponse.position; + const newPositionSize = event.params.size; + const oldPositionSize = position.getSize(); + const oldPositionPrice = position.getPrice(); + + let fundingAccrued = BIGINT_ZERO; + let currentFundingRate = BIGINT_ZERO; + + const previousFunding = _FundingRate.load( + getFundingRateId(pool, position.getFundingIndex()) + ); + const currentFunding = _FundingRate.load( + getFundingRateId(pool, event.params.fundingIndex) + ); + + if (currentFunding != null) { + currentFundingRate = currentFunding.funding; + } + if ( + position.getFundingIndex() != event.params.fundingIndex && + currentFunding && + previousFunding + ) { + fundingAccrued = currentFunding.funding + .minus(previousFunding.funding) + .times(oldPositionSize) + .div(BigInt.fromI32(10).pow(18)); + } + + // position closed + if (isClose) { + const pnl = event.params.lastPrice + .minus(oldPositionPrice) + .times(oldPositionSize) + .div(BigInt.fromI32(10).pow(18)) + .plus(fundingAccrued) + .minus(fees); + + const totalMarginRemaining = event.params.margin; + position.setBalanceClosed(token, totalMarginRemaining); + position.setCollateralBalanceClosed(token, totalMarginRemaining); + position.setRealisedPnlUsdClosed(bigIntToBigDecimal(pnl)); + position.setFundingrateClosed(bigIntToBigDecimal(currentFundingRate)); + position.closePosition(); + } else { + const totalMarginRemaining = event.params.margin; + + const positionTotalPrice = event.params.lastPrice.times(newPositionSize); + const leverage = positionTotalPrice.div(totalMarginRemaining); + + position.setBalance(token, totalMarginRemaining); + position.setCollateralBalance(token, totalMarginRemaining); + position.setPrice(event.params.lastPrice); + position.setSize(event.params.size); + position.setFundingIndex(event.params.fundingIndex); + position.setLeverage(bigIntToBigDecimal(leverage)); + } + const volume = event.params.lastPrice + .times(newPositionSize) + .div(BigInt.fromI32(10).pow(18)) + .abs(); + pool.addVolumeByToken(token, volume); + } + updateOpenInterest(marketAddress, pool, event.params.lastPrice); + pool.addRevenueByToken(token, BIGINT_ZERO, fees); +} + +/* + This function is fired when a position is modified in v2 markets, + everything else similar to v1 market position modified event +*/ +export function handlePositionModifiedV2(event: PositionModifiedV2Event): void { + const v1Params = event.parameters.filter((value) => { + return value.name !== "skew"; + }); + + const v1Event = new PositionModifiedEvent( + event.address, + event.logIndex, + event.transactionLogIndex, + event.logType, + event.block, + event.transaction, + v1Params, + event.receipt + ); + handlePositionModified(v1Event); +} + +/* + This function is fired when a position is liquidated in v1 market +*/ +export function handlePositionLiquidated(event: PositionLiquidatedEvent): void { + liquidation( + event, + event.params.account, + event.params.liquidator, + event.params.fee + ); +} + +/* + This function is fired when a position is liquidated in v2 market +*/ +export function handlePositionLiquidatedV2( + event: PositionLiquidatedV2Event +): void { + const totalFee = event.params.flaggerFee + .plus(event.params.liquidatorFee) + .plus(event.params.stakersFee); + + liquidation(event, event.params.account, event.params.liquidator, totalFee); +} + +// common liquidation logic +function liquidation( + event: ethereum.Event, + sendingAccount: Address, + liquidator: Address, + totalFees: BigInt +): void { + const sdk = SDK.initializeFromEvent( + conf, + new Pricer(), + new TokenInit(), + event + ); + const pool = sdk.Pools.loadPool(dataSource.address()); + const smartMarginAccount = _SmartMarginAccount.load(sendingAccount.toHex()); + const accountAddress = smartMarginAccount + ? Address.fromBytes(smartMarginAccount.owner) + : sendingAccount; + + const loadAccountResponse = sdk.Accounts.loadAccount(accountAddress); + const account = loadAccountResponse.account; + if (loadAccountResponse.isNewUser) { + const protocol = sdk.Protocol; + protocol.addUser(); + pool.addUser(); + } + const token = sdk.Tokens.getOrCreateToken(NetworkConfigs.getSUSDAddress()); + + const position = sdk.Positions.loadLastPosition(pool, account, token, token); + if (position != null) { + const pnl = position + .getRealisedPnlUsd() + .minus(bigIntToBigDecimal(totalFees)); + account.liquidate( + pool, + Address.fromBytes(token.id), + Address.fromBytes(token.id), + position.position.collateralBalance, + liquidator, + accountAddress, + position.getBytesID(), + pnl + ); + position.addLiquidationCount(); + position.setBalanceClosed(token, BIGINT_ZERO); + position.setCollateralBalanceClosed(token, BIGINT_ZERO); + position.setRealisedPnlUsdClosed(pnl); + position.closePosition(); + } +} + +function updateOpenInterest( + marketAddress: Address, + pool: Pool, + lastPrice: BigInt +): void { + const contract = PerpsV2MarketProxyable.bind(marketAddress); + const marketSizeCall = contract.try_marketSize(); + const marketSkewCall = contract.try_marketSkew(); + let marketSize = BIGINT_ZERO; + let marketSkew = BIGINT_ZERO; + if (!marketSizeCall.reverted && !marketSkewCall.reverted) { + marketSize = marketSizeCall.value; + marketSkew = marketSkewCall.value; + } + + const shortOpenInterstAmount = marketSize + .minus(marketSkew) + .div(BigInt.fromI32(2)); + const longOpenInterstAmount = marketSize + .plus(marketSkew) + .div(BigInt.fromI32(2)); + pool.setLongOpenInterest(longOpenInterstAmount, lastPrice); + pool.setShortOpenInterest(shortOpenInterstAmount, lastPrice); +} diff --git a/subgraphs/kwenta/src/mappings/helpers.ts b/subgraphs/kwenta/src/mappings/helpers.ts new file mode 100644 index 0000000000..a2de6688af --- /dev/null +++ b/subgraphs/kwenta/src/mappings/helpers.ts @@ -0,0 +1,34 @@ +import { BigInt, Bytes } from "@graphprotocol/graph-ts"; + +import { Pool } from "../sdk/protocols/perpfutures/pool"; +import { BIGINT_ZERO } from "../sdk/util/constants"; + +import { Token } from "../../generated/schema"; + +export function createTokenAmountArray( + pool: Pool, + tokens: Token[], + amounts: BigInt[] +): BigInt[] { + if (tokens.length != amounts.length) { + return new Array(); + } + + const tokenAmounts = new Array(pool.getInputTokens().length).fill( + BIGINT_ZERO + ); + + for (let idx = 0; idx < amounts.length; idx++) { + const indexOfToken = pool.getInputTokens().indexOf(tokens[idx].id); + tokenAmounts[indexOfToken] = amounts[idx]; + } + + return tokenAmounts; +} + +export function getFundingRateId(pool: Pool, fundingIndex: BigInt): Bytes { + return pool + .getBytesID() + .concat(Bytes.fromUTF8("-")) + .concat(Bytes.fromByteArray(Bytes.fromBigInt(fundingIndex))); +} diff --git a/subgraphs/kwenta/src/prices/README.md b/subgraphs/kwenta/src/prices/README.md new file mode 100644 index 0000000000..51fc9fb576 --- /dev/null +++ b/subgraphs/kwenta/src/prices/README.md @@ -0,0 +1,240 @@ +# Price Oracle + +## Configuration + +In `subgraph.yaml`, add the following code snippet inside the `abis` section of the `datasources` which is going to fetch prices of token using the `Price Oracle`. +**NOTE**: Include the following code snippet in each of the datasources, that is dependent on the `Price Oracle` and update imports in each file inside oracle folder. + +``` +########################################### +############## Price Oracle ############### +########################################### +# ERC20 +- name: _ERC20 + file: ./abis/Prices/ERC20.json +# Curve Contracts +- name: CurvePool + file: ./abis/Prices/Curve/Pool.json +- name: CurveRegistry + file: ./abis/Prices/Curve/Registry.json +- name: CalculationsCurve + file: ./abis/Prices/Calculations/Curve.json +# YearnLens Contracts +- name: YearnLensContract + file: ./abis/Prices/YearnLens.json +# Aave Oracle Contract +- name: AaveOracleContract + file: ./abis/Prices/AaveOracle.json +# SushiSwap Contracts +- name: CalculationsSushiSwap + file: ./abis/Prices/Calculations/SushiSwap.json +# ChainLink Contracts +- name: ChainLinkContract + file: ./abis/Prices/ChainLink.json +# Uniswap Contracts +- name: UniswapRouter + file: ./abis/Prices/Uniswap/Router.json +- name: UniswapFactory + file: ./abis/Prices/Uniswap/Factory.json +- name: UniswapPair + file: ./abis/Prices/Uniswap/Pair.json +``` + +## Usage + +Following are some ways through which you can get the prices of tokens: + +``` +import { BigDecimal } from "@graphprotocol/graph-ts"; +import { getUsdPricePerToken, getUsdPrice } from "../Oracle"; + +// Method 1 +// Using function getUsdPricePerToken(tokenAddr: Address): CustomPriceType + +let tokenPrice: BigDecimal; +let fetchPrice = getUsdPricePerToken(tokenAddr); + +// fetchPrice.reverted: Bool +// fetchPrice.usdPrice: BigDecimal +// fetchPrice.decimals: number + +tokenPrice = fetchPrice.usdPrice * amount + +// Method 2 +// Using function getUsdPrice(tokenAddr: Address, amount: BigDecimal): BigDecimal + +let tokenPrice = getUsdPrice(tokenAddr, amount); +``` + +## Optimizations + +- Reorder the methods present in `index.ts`, depending on which method works best for you. + +## Folder Structure + +``` +Prices +├── calculations +│ ├── CalculationsCurve.ts +│ └── CalculationsSushiSwap.ts +├── common +│ ├── types.ts +│ ├── constants.ts +│ └── utils.ts +├── config +│ ├── arbitrum.ts +│ ├── aurora.ts +│ ├── avalanche.ts +│ ├── bsc.ts +│ ├── fantom.ts +│ ├── gnosis.ts +│ ├── harmony.ts +│ ├── mainnet.ts +│ ├── moonbeam.ts +│ ├── optimism.ts +│ └── polygon.ts +├── oracles +│ ├── AaveOracle.ts +│ ├── ChainLinkFeed.ts +│ └── YearnLensOracle.ts +├── routers +│ ├── CurveRouter.ts +│ └── UniswapForksRouter.ts +│── README.md +└── index.ts +``` + +## Development Status + +🔨 = In progress. +🛠 = Feature complete. Additional testing required. +`MultiCall` = If the method uses more than two `JSON RPC Call`. + +### Arbitrum + +| **Method** | **Address** | **StartBlock** | **MultiCall** | +| ------------ | :------------------------------------------: | :------------: | :-----------: | +| YearnLens | `0x043518ab266485dc085a1db095b8d9c2fc78e9b9` | `2396321` | ❎ | +| AaveOracle | `0xb56c2F0B653B2e0b10C9b928C8580Ac5Df02C7C7` | `7740843` | ❎ | +| Curve | `0x3268c3bda100ef0ff3c2d044f23eab62c80d78d2` | `11707234` | ❎ | +| SushiSwap | `0x5ea7e501c9a23f4a76dc7d33a11d995b13a1dd25` | `2396120` | ❎ | +| CurveRouters | | | | +| | `0x445FE580eF8d70FF569aB36e80c647af338db351` | `1362056` | ✅ | +| | `0x0E9fBb167DF83EdE3240D6a5fa5d40c6C6851e15` | `4530115` | ✅ | +| UniswapForks | | | | +| | `0x1b02da8cb0d097eb8d57a175b88c7d8b47997506` | `73` | ✅ | + +### Aurora + +| **Method** | **Address** | **StartBlock** | **MultiCall** | +| ------------ | :------------------------------------------: | :------------: | :-----------: | +| CurveRouters | | | | +| | `0x5B5CFE992AdAC0C9D48E05854B2d91C73a003858` | `62440525` | ✅ | +| UniswapForks | | | | +| | `0x2CB45Edb4517d5947aFdE3BEAbF95A582506858B` | | ✅ | + +### Avalanche + +| **Method** | **Address** | **StartBlock** | **MultiCall** | +| ------------ | :------------------------------------------: | :------------: | :-----------: | +| AaveOracle | `0xEBd36016B3eD09D4693Ed4251c67Bd858c3c7C9C` | `11970477` | ❎ | +| CurveRouters | | | | +| | `0x8474DdbE98F5aA3179B3B3F5942D724aFcdec9f6` | `5254206` | ✅ | +| | `0x90f421832199e93d01b64DaF378b183809EB0988` | `9384663` | ✅ | +| UniswapForks | | | | +| | `0x60aE616a2155Ee3d9A68541Ba4544862310933d4` | `2486393` | ✅ | +| | `0xE54Ca86531e17Ef3616d22Ca28b0D458b6C89106` | `56879` | ✅ | +| | `0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506` | `506236` | ✅ | + +### BSC + +| **Method** | **Address** | **StartBlock** | **MultiCall** | +| ------------ | :------------------------------------------: | :------------: | :-----------: | +| UniswapForks | | | | +| | `0x10ED43C718714eb63d5aA57B78B54704E256024E` | `6810080` | ✅ | +| | `0x05fF2B0DB69458A0750badebc4f9e13aDd608C7F` | `586899` | ✅ | + +### Fantom + +| **Method** | **Address** | **StartBlock** | **MultiCall** | +| ------------ | :------------------------------------------: | :------------: | :-----------: | +| YearnLens | `0x57aa88a0810dfe3f9b71a9b179dd8bf5f956c46a` | `17091856` | ❎ | +| Curve | `0x0b53e9df372e72d8fdcdbedfbb56059957a37128` | `27067399` | ❎ | +| SushiSwap | `0x44536de2220987d098d1d29d3aafc7f7348e9ee4` | `3809480` | ❎ | +| CurveRouters | | | | +| | `0x0f854EA9F38ceA4B1c2FC79047E9D0134419D5d6` | `5655918` | ✅ | +| | `0x4fb93D7d320E8A263F22f62C2059dFC2A8bCbC4c` | `27552509` | ✅ | +| UniswapForks | | | | +| | `0xbe4fc72f8293f9d3512d58b969c98c3f676cb957` | `3796241` | ✅ | +| | `0x16327E3FbDaCA3bcF7E38F5Af2599D2DDc33aE52` | `4250168` | ✅ | +| | `0x1b02da8cb0d097eb8d57a175b88c7d8b47997506` | `2457904` | ✅ | + +### Gnosis + +| **Method** | **Address** | **StartBlock** | **MultiCall** | +| ------------ | :------------------------------------------: | :------------: | :-----------: | +| CurveRouters | | | | +| | `0x55E91365697EB8032F98290601847296eC847210` | `20754886` | ✅ | +| | `0x8A4694401bE8F8FCCbC542a3219aF1591f87CE17` | `23334728` | ✅ | +| UniswapForks | | | | +| | `0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506` | `14735910` | ✅ | + +### Harmony + +| **Method** | **Address** | **StartBlock** | **MultiCall** | +| ------------ | :------------------------------------------: | :------------: | :-----------: | +| AaveOracle | `0x3c90887ede8d65ccb2777a5d577beab2548280ad` | `23930344` | ❎ | +| CurveRouters | | | | +| | `0x0a53FaDa2d943057C47A301D25a4D9b3B8e01e8E` | `18003250` | ✅ | +| UniswapForks | | | | +| | `0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506` | `11256069` | ✅ | + +### Mainnet + +| **Method** | **Address** | **StartBlock** | **MultiCall** | +| ------------ | :------------------------------------------: | :------------: | :-----------: | +| YearnLens | `0x83d95e0d5f402511db06817aff3f9ea88224b030` | `12242339` | ❎ | +| ChainLink | `0x47Fb2585D2C56Fe188D0E6ec628a38b74fCeeeDf` | `12864088` | ❎ | +| Curve | `0x25BF7b72815476Dd515044F9650Bf79bAd0Df655` | `12370088` | ❎ | +| SushiSwap | `0x8263e161A855B644f582d9C164C66aABEe53f927` | `12692284` | ❎ | +| CurveRouters | | | | +| | `0x7D86446dDb609eD0F5f8684AcF30380a356b2B4c` | `11154794` | ✅ | +| | `0x8F942C20D02bEfc377D41445793068908E2250D0` | `13986752` | ✅ | +| UniswapForks | | | | +| | `0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F` | `10794261` | ✅ | +| | `0x7a250d5630b4cf539739df2c5dacb4c659f2488d` | `10207858` | ✅ | + +### Moonbeam + +| **Method** | **Address** | **StartBlock** | **MultiCall** | +| ------------ | :------------------------------------------: | :------------: | :-----------: | +| CurveRouters | | | | +| | `0xC2b1DF84112619D190193E48148000e3990Bf627` | `1452049` | ✅ | +| UniswapForks | | | | +| | `0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506` | `503734` | ✅ | + +### Optimism + +| **Method** | **Address** | **StartBlock** | **MultiCall** | +| ------------ | :------------------------------------------: | :------------: | :-----------: | +| YearnLens | `0xb082d9f4734c535d9d80536f7e87a6f4f471bf65` | `18109291` | ❎ | +| AaveOracle | `0xD81eb3728a631871a7eBBaD631b5f424909f0c77` | `4365625` | ❎ | +| Curve | `0x0ffe8434eae67c9838b12c3cd11ac4005daa7227` | `18368996` | ❎ | +| SushiSwap | `0x5fd3815dcb668200a662114fbc9af13ac0a55b4d` | `18216910` | ❎ | +| CurveRouters | | | | +| | `0xC5cfaDA84E902aD92DD40194f0883ad49639b023` | `2373837` | ✅ | +| | `0x7DA64233Fefb352f8F501B357c018158ED8aA455` | `3729171` | ✅ | +| UniswapForks | | | | +| | `0x9c12939390052919aF3155f41Bf4160Fd3666A6f` | `19702709` | ✅ | + +### Polygon + +| **Method** | **Address** | **StartBlock** | **MultiCall** | +| ------------ | :------------------------------------------: | :------------: | :-----------: | +| AaveOracle | `0xb023e699F5a33916Ea823A16485e259257cA8Bd1` | `25825996` | ❎ | +| CurveRouters | | | | +| | `0x094d12e5b541784701FD8d65F11fc0598FBC6332` | `13991825` | ✅ | +| | `0x47bB542B9dE58b970bA50c9dae444DDB4c16751a` | `23556360` | ✅ | +| UniswapForks | | | | +| | `0xa5e0829caced8ffdd4de3c43696c57f7d7a678ff` | `4931900` | ✅ | +| | `0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506` | `11333235` | ✅ | diff --git a/subgraphs/kwenta/src/prices/calculations/CalculationsCurve.ts b/subgraphs/kwenta/src/prices/calculations/CalculationsCurve.ts new file mode 100644 index 0000000000..821b4c58a2 --- /dev/null +++ b/subgraphs/kwenta/src/prices/calculations/CalculationsCurve.ts @@ -0,0 +1,47 @@ +import * as utils from "../common/utils"; +import * as constants from "../common/constants"; +import { CustomPriceType, OracleContract } from "../common/types"; +import { Address, BigDecimal, BigInt, ethereum } from "@graphprotocol/graph-ts"; +import { CalculationsCurve as CalculationsCurveContract } from "../../../generated/FuturesMarketManager2/CalculationsCurve"; + +export function getCalculationsCurveContract( + contract: OracleContract, + block: ethereum.Block | null = null +): CalculationsCurveContract | null { + if ( + (block && contract.startBlock.gt(block.number)) || + utils.isNullAddress(contract.address) + ) + return null; + + return CalculationsCurveContract.bind(contract.address); +} + +export function getTokenPriceUSDC( + tokenAddr: Address, + block: ethereum.Block | null = null +): CustomPriceType { + const config = utils.getConfig(); + + if (!config || config.curveCalculationsBlacklist().includes(tokenAddr)) + return new CustomPriceType(); + + const calculationCurveContract = getCalculationsCurveContract( + config.curveCalculations(), + block + ); + if (!calculationCurveContract) return new CustomPriceType(); + + const tokenPrice: BigDecimal = utils + .readValue( + calculationCurveContract.try_getCurvePriceUsdc(tokenAddr), + constants.BIGINT_ZERO + ) + .toBigDecimal(); + + return CustomPriceType.initialize( + tokenPrice, + constants.DEFAULT_USDC_DECIMALS, + constants.OracleType.CURVE_CALCULATIONS + ); +} diff --git a/subgraphs/kwenta/src/prices/calculations/CalculationsSushiswap.ts b/subgraphs/kwenta/src/prices/calculations/CalculationsSushiswap.ts new file mode 100644 index 0000000000..6f9ae48718 --- /dev/null +++ b/subgraphs/kwenta/src/prices/calculations/CalculationsSushiswap.ts @@ -0,0 +1,47 @@ +import * as utils from "../common/utils"; +import * as constants from "../common/constants"; +import { CustomPriceType, OracleContract } from "../common/types"; +import { Address, BigDecimal, BigInt, ethereum } from "@graphprotocol/graph-ts"; +import { CalculationsSushiSwap as CalculationsSushiContract } from "../../../generated/FuturesMarketManager2/CalculationsSushiSwap"; + +export function getSushiSwapContract( + contract: OracleContract, + block: ethereum.Block | null = null +): CalculationsSushiContract | null { + if ( + (block && contract.startBlock.gt(block.number)) || + utils.isNullAddress(contract.address) + ) + return null; + + return CalculationsSushiContract.bind(contract.address); +} + +export function getTokenPriceUSDC( + tokenAddr: Address, + block: ethereum.Block | null = null +): CustomPriceType { + const config = utils.getConfig(); + + if (!config || config.sushiCalculationsBlacklist().includes(tokenAddr)) + return new CustomPriceType(); + + const calculationSushiContract = getSushiSwapContract( + config.sushiCalculations(), + block + ); + if (!calculationSushiContract) return new CustomPriceType(); + + const tokenPrice: BigDecimal = utils + .readValue( + calculationSushiContract.try_getPriceUsdc(tokenAddr), + constants.BIGINT_ZERO + ) + .toBigDecimal(); + + return CustomPriceType.initialize( + tokenPrice, + constants.DEFAULT_USDC_DECIMALS, + constants.OracleType.SUSHI_CALCULATIONS + ); +} diff --git a/subgraphs/kwenta/src/prices/common/constants.ts b/subgraphs/kwenta/src/prices/common/constants.ts new file mode 100644 index 0000000000..32100b7a08 --- /dev/null +++ b/subgraphs/kwenta/src/prices/common/constants.ts @@ -0,0 +1,38 @@ +import { Address, BigDecimal, BigInt } from "@graphprotocol/graph-ts"; + +/////////////////////////////////////////////////////////////////////////// +/////////////////////////////////// COMMON //////////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export namespace NULL { + export const TYPE_STRING = "0x0000000000000000000000000000000000000000"; + export const TYPE_ADDRESS = Address.fromString(TYPE_STRING); +} + +export namespace OracleType { + export const AAVE_ORACLE = "AaveOracle"; + export const CURVE_ROUTER = "CurveRouter"; + export const CHAINLINK_FEED = "ChainlinkFeed"; + export const YEARN_LENS_ORACLE = "YearnLensOracle"; + export const CURVE_CALCULATIONS = "CurveCalculations"; + export const UNISWAP_FORKS_ROUTER = "UniswapForksRouter"; + export const SUSHI_CALCULATIONS = "SushiswapCalculations"; +} + +export const CHAIN_LINK_USD_ADDRESS = Address.fromString( + "0x0000000000000000000000000000000000000348" +); + +export const PRICE_LIB_VERSION = "1.2.0"; + +export const BIGINT_ZERO = BigInt.fromI32(0); +export const BIGINT_ONE = BigInt.fromI32(1); +export const BIGINT_TEN = BigInt.fromI32(10); +export const BIGINT_TEN_THOUSAND = BigInt.fromI32(10000); + +export const BIGDECIMAL_ZERO = new BigDecimal(BIGINT_ZERO); +export const BIGDECIMAL_USD_PRICE = BigDecimal.fromString("1000000"); + +export const AAVE_ORACLE_DECIMALS = 8; +export const DEFAULT_USDC_DECIMALS = 6; +export const DEFAULT_DECIMALS = BigInt.fromI32(18); diff --git a/subgraphs/kwenta/src/prices/common/types.ts b/subgraphs/kwenta/src/prices/common/types.ts new file mode 100644 index 0000000000..7227bf05c5 --- /dev/null +++ b/subgraphs/kwenta/src/prices/common/types.ts @@ -0,0 +1,103 @@ +import * as constants from "./constants"; +import { Address, BigDecimal, BigInt } from "@graphprotocol/graph-ts"; + +export class Wrapped { + inner: T; + + constructor(inner: T) { + this.inner = inner; + } +} + +export class OracleContract { + private _contractAddress: string; + private _contractStartBlock: i32; + + constructor( + contractAddress: string = constants.NULL.TYPE_STRING, + startBlock: i32 = -1 + ) { + this._contractAddress = contractAddress; + this._contractStartBlock = startBlock; + } + + get address(): Address { + return Address.fromString(this._contractAddress); + } + + get startBlock(): BigInt { + return BigInt.fromI32(this._contractStartBlock); + } +} + +export class CustomPriceType { + // `null` indicates a reverted call. + private _usdPrice: Wrapped; + private _decimals: Wrapped; + private _oracleType: string; + + constructor() { + this._usdPrice = new Wrapped(constants.BIGDECIMAL_ZERO); + this._decimals = new Wrapped(constants.BIGINT_ZERO.toI32() as u8); + this._oracleType = ""; + } + + static initialize( + _usdPrice: BigDecimal, + _decimals: i32 = 0, + _oracleType: string = "" + ): CustomPriceType { + const result = new CustomPriceType(); + result._usdPrice = new Wrapped(_usdPrice); + result._decimals = new Wrapped(_decimals as u8); + result._oracleType = _oracleType; + + return result; + } + + get reverted(): bool { + return this._usdPrice.inner == constants.BIGDECIMAL_ZERO; + } + + get usdPrice(): BigDecimal { + return changetype>(this._usdPrice).inner.div( + constants.BIGINT_TEN.pow(this.decimals as u8).toBigDecimal() + ); + } + + get decimals(): i32 { + return changetype>(this._decimals).inner; + } + + get oracleType(): string { + return this._oracleType; + } +} + +export interface Configurations { + network(): string; + + yearnLens(): OracleContract; + chainLink(): OracleContract; + yearnLensBlacklist(): Address[]; + + aaveOracle(): OracleContract; + aaveOracleBlacklist(): Address[]; + + curveCalculations(): OracleContract; + curveCalculationsBlacklist(): Address[]; + + sushiCalculations(): OracleContract; + sushiCalculationsBlacklist(): Address[]; + + uniswapForks(): OracleContract[]; + curveRegistry(): OracleContract[]; + + hardcodedStables(): Address[]; + + ethAddress(): Address; + wethAddress(): Address; + usdcAddress(): Address; + + usdcTokenDecimals(): BigInt; +} diff --git a/subgraphs/kwenta/src/prices/common/utils.ts b/subgraphs/kwenta/src/prices/common/utils.ts new file mode 100644 index 0000000000..10f518977f --- /dev/null +++ b/subgraphs/kwenta/src/prices/common/utils.ts @@ -0,0 +1,96 @@ +import * as BSC from "../config/bsc"; +import * as CELO from "../config/celo"; +import * as FUSE from "../config/fuse"; +import * as XDAI from "../config/gnosis"; +import * as CRONOS from "../config/cronos"; +import * as AURORA from "../config/aurora"; +import * as FANTOM from "../config/fantom"; +import * as POLYGON from "../config/polygon"; +import * as MAINNET from "../config/mainnet"; +import * as HARMONY from "../config/harmony"; +import * as MOONBEAM from "../config/moonbeam"; +import * as OPTIMISM from "../config/optimism"; +import * as AVALANCHE from "../config/avalanche"; +import * as ARBITRUM_ONE from "../config/arbitrum"; + +import { Configurations } from "./types"; +import * as constants from "./constants"; +import * as TEMPLATE from "../config/template"; +import { _ERC20 } from "../../../generated/FuturesMarketManager2/_ERC20"; +import { Address, BigInt, dataSource, ethereum } from "@graphprotocol/graph-ts"; + +export function isNullAddress(tokenAddr: Address): boolean { + return tokenAddr.equals(constants.NULL.TYPE_ADDRESS); +} + +export function readValue( + callResult: ethereum.CallResult, + defaultValue: T +): T { + return callResult.reverted ? defaultValue : callResult.value; +} + +export function getTokenName(tokenAddr: Address): string { + const tokenContract = _ERC20.bind(tokenAddr); + const name = readValue(tokenContract.try_name(), ""); + + return name; +} + +export function getTokenDecimals(tokenAddr: Address): BigInt { + const tokenContract = _ERC20.bind(tokenAddr); + + const decimals = readValue( + tokenContract.try_decimals(), + constants.DEFAULT_DECIMALS + ); + + return decimals; +} + +export function getTokenSupply(tokenAddr: Address): BigInt { + const tokenContract = _ERC20.bind(tokenAddr); + + const totalSupply = readValue( + tokenContract.try_totalSupply(), + constants.BIGINT_ONE + ); + + return totalSupply; +} + +export function getConfig(): Configurations { + const network = dataSource.network(); + + if (network == XDAI.NETWORK_STRING) { + return new XDAI.config(); + } else if (network == AURORA.NETWORK_STRING) { + return new AURORA.config(); + } else if (network == BSC.NETWORK_STRING) { + return new BSC.config(); + } else if (network == FANTOM.NETWORK_STRING) { + return new FANTOM.config(); + } else if (network == POLYGON.NETWORK_STRING) { + return new POLYGON.config(); + } else if (network == MAINNET.NETWORK_STRING) { + return new MAINNET.config(); + } else if (network == HARMONY.NETWORK_STRING) { + return new HARMONY.config(); + } else if (network == MOONBEAM.NETWORK_STRING) { + return new MOONBEAM.config(); + } else if (network == OPTIMISM.NETWORK_STRING) { + return new OPTIMISM.config(); + } else if (network == AVALANCHE.NETWORK_STRING) { + return new AVALANCHE.config(); + } else if (network == ARBITRUM_ONE.NETWORK_STRING) { + return new ARBITRUM_ONE.config(); + } else if (network == CRONOS.NETWORK_STRING) { + return new CRONOS.config(); + } else if (network == CELO.NETWORK_STRING) { + return new CELO.config(); + } else if (network == FUSE.NETWORK_STRING) { + return new FUSE.config(); + } + + return new TEMPLATE.config(); +} diff --git a/subgraphs/kwenta/src/prices/config/arbitrum.ts b/subgraphs/kwenta/src/prices/config/arbitrum.ts new file mode 100644 index 0000000000..2c0b11099c --- /dev/null +++ b/subgraphs/kwenta/src/prices/config/arbitrum.ts @@ -0,0 +1,137 @@ +import { Address, BigInt } from "@graphprotocol/graph-ts"; +import { Configurations, OracleContract } from "../common/types"; + +export const NETWORK_STRING = "arbitrum-one"; + +/////////////////////////////////////////////////////////////////////////// +///////////////////// CALCULATIONS/ORACLE CONTRACT //////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const YEARN_LENS_CONTRACT_ADDRESS = new OracleContract( + "0x043518ab266485dc085a1db095b8d9c2fc78e9b9", + 2396321 +); +export const AAVE_ORACLE_CONTRACT_ADDRESS = new OracleContract( + "0xb56c2f0b653b2e0b10c9b928c8580ac5df02c7c7", + 7740843 +); +export const SUSHISWAP_CALCULATIONS_ADDRESS = new OracleContract( + "0x5ea7e501c9a23f4a76dc7d33a11d995b13a1dd25", + 2396120 +); +export const CHAIN_LINK_CONTRACT_ADDRESS = new OracleContract(); + +/////////////////////////////////////////////////////////////////////////// +///////////////////////////// CURVE CONTRACT ////////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const CURVE_CALCULATIONS_ADDRESS = new OracleContract( + "0x3268c3bda100ef0ff3c2d044f23eab62c80d78d2", + 11707234 +); + +export const CURVE_REGISTRY_ADDRESSES: OracleContract[] = [ + new OracleContract("0x445fe580ef8d70ff569ab36e80c647af338db351", 1362056), + new OracleContract("0x0e9fbb167df83ede3240d6a5fa5d40c6c6851e15", 4530115), +]; + +/////////////////////////////////////////////////////////////////////////// +/////////////////////////// UNISWAP FORKS CONTRACT //////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const UNISWAP_FORKS_ROUTER_ADDRESSES: OracleContract[] = [ + new OracleContract("0x1b02da8cb0d097eb8d57a175b88c7d8b47997506", 73), // SushiSwap +]; + +/////////////////////////////////////////////////////////////////////////// +/////////////////////////// BLACKLISTED TOKENS //////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const YEARN_LENS_BLACKLIST: Address[] = []; +export const AAVE_ORACLE_BLACKLIST: Address[] = []; +export const CURVE_CALCULATIONS_BLACKSLIST: Address[] = []; +export const SUSHI_CALCULATIONS_BLACKSLIST: Address[] = []; + +/////////////////////////////////////////////////////////////////////////// +//////////////////////////// HARDCODED STABLES //////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const HARDCODED_STABLES: Address[] = []; + +/////////////////////////////////////////////////////////////////////////// +///////////////////////////////// HELPERS ///////////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const USDC_TOKEN_DECIMALS = BigInt.fromI32(6); + +export const ETH_ADDRESS = Address.fromString( + "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee" +); +export const WETH_ADDRESS = Address.fromString( + "0x82af49447d8a07e3bd95bd0d56f35241523fbab1" +); +export const USDC_ADDRESS = Address.fromString( + "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8" +); + +export class config implements Configurations { + network(): string { + return NETWORK_STRING; + } + + yearnLens(): OracleContract { + return YEARN_LENS_CONTRACT_ADDRESS; + } + chainLink(): OracleContract { + return CHAIN_LINK_CONTRACT_ADDRESS; + } + yearnLensBlacklist(): Address[] { + return YEARN_LENS_BLACKLIST; + } + + aaveOracle(): OracleContract { + return AAVE_ORACLE_CONTRACT_ADDRESS; + } + aaveOracleBlacklist(): Address[] { + return AAVE_ORACLE_BLACKLIST; + } + + curveCalculations(): OracleContract { + return CURVE_CALCULATIONS_ADDRESS; + } + curveCalculationsBlacklist(): Address[] { + return CURVE_CALCULATIONS_BLACKSLIST; + } + + sushiCalculations(): OracleContract { + return SUSHISWAP_CALCULATIONS_ADDRESS; + } + sushiCalculationsBlacklist(): Address[] { + return SUSHI_CALCULATIONS_BLACKSLIST; + } + + uniswapForks(): OracleContract[] { + return UNISWAP_FORKS_ROUTER_ADDRESSES; + } + curveRegistry(): OracleContract[] { + return CURVE_REGISTRY_ADDRESSES; + } + + hardcodedStables(): Address[] { + return HARDCODED_STABLES; + } + + ethAddress(): Address { + return ETH_ADDRESS; + } + wethAddress(): Address { + return WETH_ADDRESS; + } + usdcAddress(): Address { + return USDC_ADDRESS; + } + + usdcTokenDecimals(): BigInt { + return USDC_TOKEN_DECIMALS; + } +} diff --git a/subgraphs/kwenta/src/prices/config/aurora.ts b/subgraphs/kwenta/src/prices/config/aurora.ts new file mode 100644 index 0000000000..833b94911b --- /dev/null +++ b/subgraphs/kwenta/src/prices/config/aurora.ts @@ -0,0 +1,124 @@ +import { Address, BigInt } from "@graphprotocol/graph-ts"; +import { Configurations, OracleContract } from "../common/types"; + +export const NETWORK_STRING = "aurora"; + +/////////////////////////////////////////////////////////////////////////// +///////////////////// CALCULATIONS/ORACLE CONTRACT //////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const YEARN_LENS_CONTRACT_ADDRESS = new OracleContract(); +export const CHAIN_LINK_CONTRACT_ADDRESS = new OracleContract(); +export const AAVE_ORACLE_CONTRACT_ADDRESS = new OracleContract(); +export const SUSHISWAP_CALCULATIONS_ADDRESS = new OracleContract(); + +/////////////////////////////////////////////////////////////////////////// +///////////////////////////// CURVE CONTRACT ////////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const CURVE_CALCULATIONS_ADDRESS = new OracleContract(); + +export const CURVE_REGISTRY_ADDRESSES: OracleContract[] = [ + new OracleContract("0x5b5cfe992adac0c9d48e05854b2d91c73a003858", 62440526), +]; + +/////////////////////////////////////////////////////////////////////////// +/////////////////////////// UNISWAP FORKS CONTRACT //////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const UNISWAP_FORKS_ROUTER_ADDRESSES: OracleContract[] = [ + new OracleContract("0x2cb45edb4517d5947afde3beabf95a582506858b", 49607893), // TriSolaris +]; + +/////////////////////////////////////////////////////////////////////////// +/////////////////////////// BLACKLISTED TOKENS //////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const YEARN_LENS_BLACKLIST: Address[] = []; +export const AAVE_ORACLE_BLACKLIST: Address[] = []; +export const CURVE_CALCULATIONS_BLACKSLIST: Address[] = []; +export const SUSHI_CALCULATIONS_BLACKSLIST: Address[] = []; + +/////////////////////////////////////////////////////////////////////////// +//////////////////////////// HARDCODED STABLES //////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const HARDCODED_STABLES: Address[] = []; + +/////////////////////////////////////////////////////////////////////////// +///////////////////////////////// HELPERS ///////////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const USDC_TOKEN_DECIMALS = BigInt.fromI32(6); + +export const ETH_ADDRESS = Address.fromString( + "0x8bec47865ade3b172a928df8f990bc7f2a3b9f79" // Aurora +); +export const WETH_ADDRESS = Address.fromString( + "0xc9bdeed33cd01541e1eed10f90519d2c06fe3feb" // WETH +); +export const USDC_ADDRESS = Address.fromString( + "0xb12bfca5a55806aaf64e99521918a4bf0fc40802" +); + +export class config implements Configurations { + network(): string { + return NETWORK_STRING; + } + + yearnLens(): OracleContract { + return YEARN_LENS_CONTRACT_ADDRESS; + } + chainLink(): OracleContract { + return CHAIN_LINK_CONTRACT_ADDRESS; + } + yearnLensBlacklist(): Address[] { + return YEARN_LENS_BLACKLIST; + } + + aaveOracle(): OracleContract { + return AAVE_ORACLE_CONTRACT_ADDRESS; + } + aaveOracleBlacklist(): Address[] { + return AAVE_ORACLE_BLACKLIST; + } + + curveCalculations(): OracleContract { + return CURVE_CALCULATIONS_ADDRESS; + } + curveCalculationsBlacklist(): Address[] { + return CURVE_CALCULATIONS_BLACKSLIST; + } + + sushiCalculations(): OracleContract { + return SUSHISWAP_CALCULATIONS_ADDRESS; + } + sushiCalculationsBlacklist(): Address[] { + return SUSHI_CALCULATIONS_BLACKSLIST; + } + + uniswapForks(): OracleContract[] { + return UNISWAP_FORKS_ROUTER_ADDRESSES; + } + curveRegistry(): OracleContract[] { + return CURVE_REGISTRY_ADDRESSES; + } + + hardcodedStables(): Address[] { + return HARDCODED_STABLES; + } + + ethAddress(): Address { + return ETH_ADDRESS; + } + wethAddress(): Address { + return WETH_ADDRESS; + } + usdcAddress(): Address { + return USDC_ADDRESS; + } + + usdcTokenDecimals(): BigInt { + return USDC_TOKEN_DECIMALS; + } +} diff --git a/subgraphs/kwenta/src/prices/config/avalanche.ts b/subgraphs/kwenta/src/prices/config/avalanche.ts new file mode 100644 index 0000000000..f012ea6af4 --- /dev/null +++ b/subgraphs/kwenta/src/prices/config/avalanche.ts @@ -0,0 +1,131 @@ +import { Address, BigInt } from "@graphprotocol/graph-ts"; +import { Configurations, OracleContract } from "../common/types"; + +export const NETWORK_STRING = "avalanche"; + +/////////////////////////////////////////////////////////////////////////// +///////////////////// CALCULATIONS/ORACLE CONTRACT //////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const YEARN_LENS_CONTRACT_ADDRESS = new OracleContract(); +export const CHAIN_LINK_CONTRACT_ADDRESS = new OracleContract(); +export const SUSHISWAP_CALCULATIONS_ADDRESS = new OracleContract(); + +export const AAVE_ORACLE_CONTRACT_ADDRESS = new OracleContract( + "0xebd36016b3ed09d4693ed4251c67bd858c3c7c9c", + 11970477 +); + +/////////////////////////////////////////////////////////////////////////// +///////////////////////////// CURVE CONTRACT ////////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const CURVE_CALCULATIONS_ADDRESS = new OracleContract(); + +export const CURVE_REGISTRY_ADDRESSES: OracleContract[] = [ + new OracleContract("0x8474ddbe98f5aa3179b3b3f5942d724afcdec9f6", 5254206), + new OracleContract("0x90f421832199e93d01b64daf378b183809eb0988", 9384663), +]; + +/////////////////////////////////////////////////////////////////////////// +/////////////////////////// UNISWAP FORKS CONTRACT //////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const UNISWAP_FORKS_ROUTER_ADDRESSES: OracleContract[] = [ + new OracleContract("0x60ae616a2155ee3d9a68541ba4544862310933d4", 2486393), // TraderJOE + new OracleContract("0xe54ca86531e17ef3616d22ca28b0d458b6c89106", 56879), // Pangolin + new OracleContract("0x1b02da8cb0d097eb8d57a175b88c7d8b47997506", 506236), // Sushiswap +]; + +/////////////////////////////////////////////////////////////////////////// +/////////////////////////// BLACKLISTED TOKENS //////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const YEARN_LENS_BLACKLIST: Address[] = []; +export const AAVE_ORACLE_BLACKLIST: Address[] = []; +export const CURVE_CALCULATIONS_BLACKSLIST: Address[] = []; +export const SUSHI_CALCULATIONS_BLACKSLIST: Address[] = []; + +/////////////////////////////////////////////////////////////////////////// +//////////////////////////// HARDCODED STABLES //////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const HARDCODED_STABLES: Address[] = []; + +/////////////////////////////////////////////////////////////////////////// +///////////////////////////////// HELPERS ///////////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const USDC_TOKEN_DECIMALS = BigInt.fromI32(6); + +export const ETH_ADDRESS = Address.fromString( + "0x49d5c2bdffac6ce2bfdb6640f4f80f226bc10bab" +); +export const WETH_ADDRESS = Address.fromString( + "0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7" +); +export const USDC_ADDRESS = Address.fromString( + "0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e" +); + +export class config implements Configurations { + network(): string { + return NETWORK_STRING; + } + + yearnLens(): OracleContract { + return YEARN_LENS_CONTRACT_ADDRESS; + } + chainLink(): OracleContract { + return CHAIN_LINK_CONTRACT_ADDRESS; + } + yearnLensBlacklist(): Address[] { + return YEARN_LENS_BLACKLIST; + } + + aaveOracle(): OracleContract { + return AAVE_ORACLE_CONTRACT_ADDRESS; + } + aaveOracleBlacklist(): Address[] { + return AAVE_ORACLE_BLACKLIST; + } + + curveCalculations(): OracleContract { + return CURVE_CALCULATIONS_ADDRESS; + } + curveCalculationsBlacklist(): Address[] { + return CURVE_CALCULATIONS_BLACKSLIST; + } + + sushiCalculations(): OracleContract { + return SUSHISWAP_CALCULATIONS_ADDRESS; + } + sushiCalculationsBlacklist(): Address[] { + return SUSHI_CALCULATIONS_BLACKSLIST; + } + + uniswapForks(): OracleContract[] { + return UNISWAP_FORKS_ROUTER_ADDRESSES; + } + curveRegistry(): OracleContract[] { + return CURVE_REGISTRY_ADDRESSES; + } + + hardcodedStables(): Address[] { + return HARDCODED_STABLES; + } + + ethAddress(): Address { + return ETH_ADDRESS; + } + wethAddress(): Address { + return WETH_ADDRESS; + } + usdcAddress(): Address { + return USDC_ADDRESS; + } + + usdcTokenDecimals(): BigInt { + return USDC_TOKEN_DECIMALS; + } +} diff --git a/subgraphs/kwenta/src/prices/config/bsc.ts b/subgraphs/kwenta/src/prices/config/bsc.ts new file mode 100644 index 0000000000..db5cb1d2b1 --- /dev/null +++ b/subgraphs/kwenta/src/prices/config/bsc.ts @@ -0,0 +1,122 @@ +import * as constants from "../common/constants"; +import { Address, BigInt } from "@graphprotocol/graph-ts"; +import { Configurations, OracleContract } from "../common/types"; + +export const NETWORK_STRING = "bsc"; + +/////////////////////////////////////////////////////////////////////////// +///////////////////// CALCULATIONS/ORACLE CONTRACT //////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const YEARN_LENS_CONTRACT_ADDRESS = new OracleContract(); +export const CHAIN_LINK_CONTRACT_ADDRESS = new OracleContract(); +export const AAVE_ORACLE_CONTRACT_ADDRESS = new OracleContract(); +export const SUSHISWAP_CALCULATIONS_ADDRESS = new OracleContract(); + +/////////////////////////////////////////////////////////////////////////// +///////////////////////////// CURVE CONTRACT ////////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const CURVE_CALCULATIONS_ADDRESS = new OracleContract(); + +export const CURVE_REGISTRY_ADDRESSES: OracleContract[] = []; + +/////////////////////////////////////////////////////////////////////////// +/////////////////////////// UNISWAP FORKS CONTRACT //////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const UNISWAP_FORKS_ROUTER_ADDRESSES: OracleContract[] = [ + new OracleContract("0x10ed43c718714eb63d5aa57b78b54704e256024e", 6810080), // PancakeSwap v2 + new OracleContract("0x05ff2b0db69458a0750badebc4f9e13add608c7f", 586899), // PancakeSwap v1 +]; + +/////////////////////////////////////////////////////////////////////////// +/////////////////////////// BLACKLISTED TOKENS //////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const YEARN_LENS_BLACKLIST: Address[] = []; +export const AAVE_ORACLE_BLACKLIST: Address[] = []; +export const CURVE_CALCULATIONS_BLACKSLIST: Address[] = []; +export const SUSHI_CALCULATIONS_BLACKSLIST: Address[] = []; + +/////////////////////////////////////////////////////////////////////////// +//////////////////////////// HARDCODED STABLES //////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const HARDCODED_STABLES: Address[] = []; + +/////////////////////////////////////////////////////////////////////////// +///////////////////////////////// HELPERS ///////////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const USDC_TOKEN_DECIMALS = BigInt.fromI32(18); + +export const ETH_ADDRESS = constants.NULL.TYPE_ADDRESS; +export const WETH_ADDRESS = Address.fromString( + "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c" +); +export const USDC_ADDRESS = Address.fromString( + "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d" +); + +export class config implements Configurations { + network(): string { + return NETWORK_STRING; + } + + yearnLens(): OracleContract { + return YEARN_LENS_CONTRACT_ADDRESS; + } + chainLink(): OracleContract { + return CHAIN_LINK_CONTRACT_ADDRESS; + } + yearnLensBlacklist(): Address[] { + return YEARN_LENS_BLACKLIST; + } + + aaveOracle(): OracleContract { + return AAVE_ORACLE_CONTRACT_ADDRESS; + } + aaveOracleBlacklist(): Address[] { + return AAVE_ORACLE_BLACKLIST; + } + + curveCalculations(): OracleContract { + return CURVE_CALCULATIONS_ADDRESS; + } + curveCalculationsBlacklist(): Address[] { + return CURVE_CALCULATIONS_BLACKSLIST; + } + + sushiCalculations(): OracleContract { + return SUSHISWAP_CALCULATIONS_ADDRESS; + } + sushiCalculationsBlacklist(): Address[] { + return SUSHI_CALCULATIONS_BLACKSLIST; + } + + uniswapForks(): OracleContract[] { + return UNISWAP_FORKS_ROUTER_ADDRESSES; + } + curveRegistry(): OracleContract[] { + return CURVE_REGISTRY_ADDRESSES; + } + + hardcodedStables(): Address[] { + return HARDCODED_STABLES; + } + + ethAddress(): Address { + return ETH_ADDRESS; + } + wethAddress(): Address { + return WETH_ADDRESS; + } + usdcAddress(): Address { + return USDC_ADDRESS; + } + + usdcTokenDecimals(): BigInt { + return USDC_TOKEN_DECIMALS; + } +} diff --git a/subgraphs/kwenta/src/prices/config/celo.ts b/subgraphs/kwenta/src/prices/config/celo.ts new file mode 100644 index 0000000000..035dcf448b --- /dev/null +++ b/subgraphs/kwenta/src/prices/config/celo.ts @@ -0,0 +1,123 @@ +import { Address, BigInt } from "@graphprotocol/graph-ts"; +import { Configurations, OracleContract } from "../common/types"; + +export const NETWORK_STRING = "celo"; + +/////////////////////////////////////////////////////////////////////////// +///////////////////// CALCULATIONS/ORACLE CONTRACT //////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const YEARN_LENS_CONTRACT_ADDRESS = new OracleContract(); +export const CHAIN_LINK_CONTRACT_ADDRESS = new OracleContract(); +export const AAVE_ORACLE_CONTRACT_ADDRESS = new OracleContract(); +export const SUSHISWAP_CALCULATIONS_ADDRESS = new OracleContract(); + +/////////////////////////////////////////////////////////////////////////// +///////////////////////////// CURVE CONTRACT ////////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const CURVE_CALCULATIONS_ADDRESS = new OracleContract(); + +export const CURVE_REGISTRY_ADDRESSES: OracleContract[] = []; + +/////////////////////////////////////////////////////////////////////////// +/////////////////////////// UNISWAP FORKS CONTRACT //////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const UNISWAP_FORKS_ROUTER_ADDRESSES: OracleContract[] = [ + new OracleContract("0xe3d8bd6aed4f159bc8000a9cd47cffdb95f96121", 5272598), // Ubeswap + new OracleContract("0x1b02da8cb0d097eb8d57a175b88c7d8b47997506", 7254057), // Sushiswap +]; + +/////////////////////////////////////////////////////////////////////////// +/////////////////////////// BLACKLISTED TOKENS //////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const YEARN_LENS_BLACKLIST: Address[] = []; +export const AAVE_ORACLE_BLACKLIST: Address[] = []; +export const CURVE_CALCULATIONS_BLACKSLIST: Address[] = []; +export const SUSHI_CALCULATIONS_BLACKSLIST: Address[] = []; + +/////////////////////////////////////////////////////////////////////////// +//////////////////////////// HARDCODED STABLES //////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const HARDCODED_STABLES: Address[] = []; + +/////////////////////////////////////////////////////////////////////////// +///////////////////////////////// HELPERS ///////////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const USDC_TOKEN_DECIMALS = BigInt.fromI32(6); + +export const ETH_ADDRESS = Address.fromString( + "0x122013fd7df1c6f636a5bb8f03108e876548b455" +); +export const WETH_ADDRESS = Address.fromString( + "0x471ece3750da237f93b8e339c536989b8978a438" // Celo native asset (CELO) +); +export const USDC_ADDRESS = Address.fromString( + "0x37f750b7cc259a2f741af45294f6a16572cf5cad" +); + +export class config implements Configurations { + network(): string { + return NETWORK_STRING; + } + + yearnLens(): OracleContract { + return YEARN_LENS_CONTRACT_ADDRESS; + } + chainLink(): OracleContract { + return CHAIN_LINK_CONTRACT_ADDRESS; + } + yearnLensBlacklist(): Address[] { + return YEARN_LENS_BLACKLIST; + } + + aaveOracle(): OracleContract { + return AAVE_ORACLE_CONTRACT_ADDRESS; + } + aaveOracleBlacklist(): Address[] { + return AAVE_ORACLE_BLACKLIST; + } + + curveCalculations(): OracleContract { + return CURVE_CALCULATIONS_ADDRESS; + } + curveCalculationsBlacklist(): Address[] { + return CURVE_CALCULATIONS_BLACKSLIST; + } + + sushiCalculations(): OracleContract { + return SUSHISWAP_CALCULATIONS_ADDRESS; + } + sushiCalculationsBlacklist(): Address[] { + return SUSHI_CALCULATIONS_BLACKSLIST; + } + + uniswapForks(): OracleContract[] { + return UNISWAP_FORKS_ROUTER_ADDRESSES; + } + curveRegistry(): OracleContract[] { + return CURVE_REGISTRY_ADDRESSES; + } + + hardcodedStables(): Address[] { + return HARDCODED_STABLES; + } + + ethAddress(): Address { + return ETH_ADDRESS; + } + wethAddress(): Address { + return WETH_ADDRESS; + } + usdcAddress(): Address { + return USDC_ADDRESS; + } + + usdcTokenDecimals(): BigInt { + return USDC_TOKEN_DECIMALS; + } +} diff --git a/subgraphs/kwenta/src/prices/config/cronos.ts b/subgraphs/kwenta/src/prices/config/cronos.ts new file mode 100644 index 0000000000..f0be429d49 --- /dev/null +++ b/subgraphs/kwenta/src/prices/config/cronos.ts @@ -0,0 +1,122 @@ +import { Address, BigInt } from "@graphprotocol/graph-ts"; +import { Configurations, OracleContract } from "../common/types"; + +export const NETWORK_STRING = "cronos"; + +/////////////////////////////////////////////////////////////////////////// +///////////////////// CALCULATIONS/ORACLE CONTRACT //////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const YEARN_LENS_CONTRACT_ADDRESS = new OracleContract(); +export const CHAIN_LINK_CONTRACT_ADDRESS = new OracleContract(); +export const AAVE_ORACLE_CONTRACT_ADDRESS = new OracleContract(); +export const SUSHISWAP_CALCULATIONS_ADDRESS = new OracleContract(); + +/////////////////////////////////////////////////////////////////////////// +///////////////////////////// CURVE CONTRACT ////////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const CURVE_CALCULATIONS_ADDRESS = new OracleContract(); + +export const CURVE_REGISTRY_ADDRESSES: OracleContract[] = []; + +/////////////////////////////////////////////////////////////////////////// +/////////////////////////// UNISWAP FORKS CONTRACT //////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const UNISWAP_FORKS_ROUTER_ADDRESSES: OracleContract[] = [ + new OracleContract("0x145863eb42cf62847a6ca784e6416c1682b1b2ae", 5247), // VVS Finance +]; + +/////////////////////////////////////////////////////////////////////////// +/////////////////////////// BLACKLISTED TOKENS //////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const YEARN_LENS_BLACKLIST: Address[] = []; +export const AAVE_ORACLE_BLACKLIST: Address[] = []; +export const CURVE_CALCULATIONS_BLACKSLIST: Address[] = []; +export const SUSHI_CALCULATIONS_BLACKSLIST: Address[] = []; + +/////////////////////////////////////////////////////////////////////////// +//////////////////////////// HARDCODED STABLES //////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const HARDCODED_STABLES: Address[] = []; + +/////////////////////////////////////////////////////////////////////////// +///////////////////////////////// HELPERS ///////////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const USDC_TOKEN_DECIMALS = BigInt.fromI32(6); + +export const ETH_ADDRESS = Address.fromString( + "0xe44fd7fcb2b1581822d0c862b68222998a0c299a" +); +export const WETH_ADDRESS = Address.fromString( + "0x5c7f8a570d578ed84e63fdfa7b1ee72deae1ae23" // Wrapped CRO (WCRO) +); +export const USDC_ADDRESS = Address.fromString( + "0xc21223249ca28397b4b6541dffaecc539bff0c59" +); + +export class config implements Configurations { + network(): string { + return NETWORK_STRING; + } + + yearnLens(): OracleContract { + return YEARN_LENS_CONTRACT_ADDRESS; + } + chainLink(): OracleContract { + return CHAIN_LINK_CONTRACT_ADDRESS; + } + yearnLensBlacklist(): Address[] { + return YEARN_LENS_BLACKLIST; + } + + aaveOracle(): OracleContract { + return AAVE_ORACLE_CONTRACT_ADDRESS; + } + aaveOracleBlacklist(): Address[] { + return AAVE_ORACLE_BLACKLIST; + } + + curveCalculations(): OracleContract { + return CURVE_CALCULATIONS_ADDRESS; + } + curveCalculationsBlacklist(): Address[] { + return CURVE_CALCULATIONS_BLACKSLIST; + } + + sushiCalculations(): OracleContract { + return SUSHISWAP_CALCULATIONS_ADDRESS; + } + sushiCalculationsBlacklist(): Address[] { + return SUSHI_CALCULATIONS_BLACKSLIST; + } + + uniswapForks(): OracleContract[] { + return UNISWAP_FORKS_ROUTER_ADDRESSES; + } + curveRegistry(): OracleContract[] { + return CURVE_REGISTRY_ADDRESSES; + } + + hardcodedStables(): Address[] { + return HARDCODED_STABLES; + } + + ethAddress(): Address { + return ETH_ADDRESS; + } + wethAddress(): Address { + return WETH_ADDRESS; + } + usdcAddress(): Address { + return USDC_ADDRESS; + } + + usdcTokenDecimals(): BigInt { + return USDC_TOKEN_DECIMALS; + } +} diff --git a/subgraphs/kwenta/src/prices/config/fantom.ts b/subgraphs/kwenta/src/prices/config/fantom.ts new file mode 100644 index 0000000000..c43f5497a7 --- /dev/null +++ b/subgraphs/kwenta/src/prices/config/fantom.ts @@ -0,0 +1,136 @@ +import { Address, BigInt } from "@graphprotocol/graph-ts"; +import { Configurations, OracleContract } from "../common/types"; + +export const NETWORK_STRING = "fantom"; + +/////////////////////////////////////////////////////////////////////////// +///////////////////// CALCULATIONS/ORACLE CONTRACT //////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const YEARN_LENS_CONTRACT_ADDRESS = new OracleContract( + "0x57aa88a0810dfe3f9b71a9b179dd8bf5f956c46a", + 17091856 +); +export const CHAIN_LINK_CONTRACT_ADDRESS = new OracleContract(); +export const AAVE_ORACLE_CONTRACT_ADDRESS = new OracleContract(); +export const SUSHISWAP_CALCULATIONS_ADDRESS = new OracleContract( + "0x44536de2220987d098d1d29d3aafc7f7348e9ee4", + 3809480 +); + +/////////////////////////////////////////////////////////////////////////// +///////////////////////////// CURVE CONTRACT ////////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const CURVE_CALCULATIONS_ADDRESS = new OracleContract( + "0x0b53e9df372e72d8fdcdbedfbb56059957a37128", + 27067399 +); + +export const CURVE_REGISTRY_ADDRESSES: OracleContract[] = [ + new OracleContract("0x0f854ea9f38cea4b1c2fc79047e9d0134419d5d6", 5655918), + new OracleContract("0x4fb93d7d320e8a263f22f62c2059dfc2a8bcbc4c", 27552509), +]; + +/////////////////////////////////////////////////////////////////////////// +/////////////////////////// UNISWAP FORKS CONTRACT //////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const UNISWAP_FORKS_ROUTER_ADDRESSES: OracleContract[] = [ + new OracleContract("0xbe4fc72f8293f9d3512d58b969c98c3f676cb957", 3796241), // Uniswap v2 + new OracleContract("0x16327e3fbdaca3bcf7e38f5af2599d2ddc33ae52", 4250168), // Spiritswap + new OracleContract("0x1b02da8cb0d097eb8d57a175b88c7d8b47997506", 2457904), // Sushiswap +]; + +/////////////////////////////////////////////////////////////////////////// +/////////////////////////// BLACKLISTED TOKENS //////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const YEARN_LENS_BLACKLIST: Address[] = []; +export const AAVE_ORACLE_BLACKLIST: Address[] = []; +export const CURVE_CALCULATIONS_BLACKSLIST: Address[] = []; +export const SUSHI_CALCULATIONS_BLACKSLIST: Address[] = []; + +/////////////////////////////////////////////////////////////////////////// +//////////////////////////// HARDCODED STABLES //////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const HARDCODED_STABLES: Address[] = []; + +/////////////////////////////////////////////////////////////////////////// +///////////////////////////////// HELPERS ///////////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const USDC_TOKEN_DECIMALS = BigInt.fromI32(6); + +export const ETH_ADDRESS = Address.fromString( + "0x658b0c7613e890ee50b8c4bc6a3f41ef411208ad" +); +export const WETH_ADDRESS = Address.fromString( + "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83" +); +export const USDC_ADDRESS = Address.fromString( + "0x04068da6c83afcfa0e13ba15a6696662335d5b75" +); + +export class config implements Configurations { + network(): string { + return NETWORK_STRING; + } + + yearnLens(): OracleContract { + return YEARN_LENS_CONTRACT_ADDRESS; + } + chainLink(): OracleContract { + return CHAIN_LINK_CONTRACT_ADDRESS; + } + yearnLensBlacklist(): Address[] { + return YEARN_LENS_BLACKLIST; + } + + aaveOracle(): OracleContract { + return AAVE_ORACLE_CONTRACT_ADDRESS; + } + aaveOracleBlacklist(): Address[] { + return AAVE_ORACLE_BLACKLIST; + } + + curveCalculations(): OracleContract { + return CURVE_CALCULATIONS_ADDRESS; + } + curveCalculationsBlacklist(): Address[] { + return CURVE_CALCULATIONS_BLACKSLIST; + } + + sushiCalculations(): OracleContract { + return SUSHISWAP_CALCULATIONS_ADDRESS; + } + sushiCalculationsBlacklist(): Address[] { + return SUSHI_CALCULATIONS_BLACKSLIST; + } + + uniswapForks(): OracleContract[] { + return UNISWAP_FORKS_ROUTER_ADDRESSES; + } + curveRegistry(): OracleContract[] { + return CURVE_REGISTRY_ADDRESSES; + } + + hardcodedStables(): Address[] { + return HARDCODED_STABLES; + } + + ethAddress(): Address { + return ETH_ADDRESS; + } + wethAddress(): Address { + return WETH_ADDRESS; + } + usdcAddress(): Address { + return USDC_ADDRESS; + } + + usdcTokenDecimals(): BigInt { + return USDC_TOKEN_DECIMALS; + } +} diff --git a/subgraphs/kwenta/src/prices/config/fuse.ts b/subgraphs/kwenta/src/prices/config/fuse.ts new file mode 100644 index 0000000000..eee170f6a5 --- /dev/null +++ b/subgraphs/kwenta/src/prices/config/fuse.ts @@ -0,0 +1,123 @@ +import { Address, BigInt } from "@graphprotocol/graph-ts"; +import { Configurations, OracleContract } from "../common/types"; + +export const NETWORK_STRING = "fuse"; + +/////////////////////////////////////////////////////////////////////////// +///////////////////// CALCULATIONS/ORACLE CONTRACT //////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const YEARN_LENS_CONTRACT_ADDRESS = new OracleContract(); +export const CHAIN_LINK_CONTRACT_ADDRESS = new OracleContract(); +export const AAVE_ORACLE_CONTRACT_ADDRESS = new OracleContract(); +export const SUSHISWAP_CALCULATIONS_ADDRESS = new OracleContract(); + +/////////////////////////////////////////////////////////////////////////// +///////////////////////////// CURVE CONTRACT ////////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const CURVE_CALCULATIONS_ADDRESS = new OracleContract(); + +export const CURVE_REGISTRY_ADDRESSES: OracleContract[] = []; + +/////////////////////////////////////////////////////////////////////////// +/////////////////////////// UNISWAP FORKS CONTRACT //////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const UNISWAP_FORKS_ROUTER_ADDRESSES: OracleContract[] = [ + new OracleContract("0xe3f85aad0c8dd7337427b9df5d0fb741d65eeeb5", 15645719), // Voltage Finance + new OracleContract("0x1b02da8cb0d097eb8d57a175b88c7d8b47997506", 12936314), // Sushiswap +]; + +/////////////////////////////////////////////////////////////////////////// +/////////////////////////// BLACKLISTED TOKENS //////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const YEARN_LENS_BLACKLIST: Address[] = []; +export const AAVE_ORACLE_BLACKLIST: Address[] = []; +export const CURVE_CALCULATIONS_BLACKSLIST: Address[] = []; +export const SUSHI_CALCULATIONS_BLACKSLIST: Address[] = []; + +/////////////////////////////////////////////////////////////////////////// +//////////////////////////// HARDCODED STABLES //////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const HARDCODED_STABLES: Address[] = []; + +/////////////////////////////////////////////////////////////////////////// +///////////////////////////////// HELPERS ///////////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const USDC_TOKEN_DECIMALS = BigInt.fromI32(6); + +export const ETH_ADDRESS = Address.fromString( + "0xa722c13135930332eb3d749b2f0906559d2c5b99" +); +export const WETH_ADDRESS = Address.fromString( + "0x0be9e53fd7edac9f859882afdda116645287c629" // Wrapped Fuse (WFUSE) +); +export const USDC_ADDRESS = Address.fromString( + "0x620fd5fa44be6af63715ef4e65ddfa0387ad13f5" +); + +export class config implements Configurations { + network(): string { + return NETWORK_STRING; + } + + yearnLens(): OracleContract { + return YEARN_LENS_CONTRACT_ADDRESS; + } + chainLink(): OracleContract { + return CHAIN_LINK_CONTRACT_ADDRESS; + } + yearnLensBlacklist(): Address[] { + return YEARN_LENS_BLACKLIST; + } + + aaveOracle(): OracleContract { + return AAVE_ORACLE_CONTRACT_ADDRESS; + } + aaveOracleBlacklist(): Address[] { + return AAVE_ORACLE_BLACKLIST; + } + + curveCalculations(): OracleContract { + return CURVE_CALCULATIONS_ADDRESS; + } + curveCalculationsBlacklist(): Address[] { + return CURVE_CALCULATIONS_BLACKSLIST; + } + + sushiCalculations(): OracleContract { + return SUSHISWAP_CALCULATIONS_ADDRESS; + } + sushiCalculationsBlacklist(): Address[] { + return SUSHI_CALCULATIONS_BLACKSLIST; + } + + uniswapForks(): OracleContract[] { + return UNISWAP_FORKS_ROUTER_ADDRESSES; + } + curveRegistry(): OracleContract[] { + return CURVE_REGISTRY_ADDRESSES; + } + + hardcodedStables(): Address[] { + return HARDCODED_STABLES; + } + + ethAddress(): Address { + return ETH_ADDRESS; + } + wethAddress(): Address { + return WETH_ADDRESS; + } + usdcAddress(): Address { + return USDC_ADDRESS; + } + + usdcTokenDecimals(): BigInt { + return USDC_TOKEN_DECIMALS; + } +} diff --git a/subgraphs/kwenta/src/prices/config/gnosis.ts b/subgraphs/kwenta/src/prices/config/gnosis.ts new file mode 100644 index 0000000000..7e326f9717 --- /dev/null +++ b/subgraphs/kwenta/src/prices/config/gnosis.ts @@ -0,0 +1,125 @@ +import { Address, BigInt } from "@graphprotocol/graph-ts"; +import { Configurations, OracleContract } from "../common/types"; + +export const NETWORK_STRING: string = "xdai"; + +/////////////////////////////////////////////////////////////////////////// +///////////////////// CALCULATIONS/ORACLE CONTRACT //////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const YEARN_LENS_CONTRACT_ADDRESS = new OracleContract(); +export const CHAIN_LINK_CONTRACT_ADDRESS = new OracleContract(); +export const AAVE_ORACLE_CONTRACT_ADDRESS = new OracleContract(); +export const SUSHISWAP_CALCULATIONS_ADDRESS = new OracleContract(); + +/////////////////////////////////////////////////////////////////////////// +///////////////////////////// CURVE CONTRACT ////////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const CURVE_CALCULATIONS_ADDRESS = new OracleContract(); + +export const CURVE_REGISTRY_ADDRESSES: OracleContract[] = [ + new OracleContract("0x55e91365697eb8032f98290601847296ec847210", 20754886), + new OracleContract("0x8a4694401be8f8fccbc542a3219af1591f87ce17", 23334728), +]; + +/////////////////////////////////////////////////////////////////////////// +/////////////////////////// UNISWAP FORKS CONTRACT //////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const UNISWAP_FORKS_ROUTER_ADDRESSES: OracleContract[] = [ + new OracleContract("0x1b02da8cb0d097eb8d57a175b88c7d8b47997506", 14735910), // SushiSwap +]; + +/////////////////////////////////////////////////////////////////////////// +/////////////////////////// BLACKLISTED TOKENS //////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const YEARN_LENS_BLACKLIST: Address[] = []; +export const AAVE_ORACLE_BLACKLIST: Address[] = []; +export const CURVE_CALCULATIONS_BLACKSLIST: Address[] = []; +export const SUSHI_CALCULATIONS_BLACKSLIST: Address[] = []; + +/////////////////////////////////////////////////////////////////////////// +//////////////////////////// HARDCODED STABLES //////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const HARDCODED_STABLES: Address[] = []; + +/////////////////////////////////////////////////////////////////////////// +///////////////////////////////// HELPERS ///////////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const USDC_TOKEN_DECIMALS = BigInt.fromI32(6); + +export const ETH_ADDRESS = Address.fromString( + "0x6a023ccd1ff6f2045c3309768ead9e68f978f6e1" +); +export const WETH_ADDRESS = Address.fromString( + "0xe91d153e0b41518a2ce8dd3d7944fa863463a97d" +); +export const USDC_ADDRESS = Address.fromString( + "0xddafbb505ad214d7b80b1f830fccc89b60fb7a83" +); + +export class config implements Configurations { + network(): string { + return NETWORK_STRING; + } + + yearnLens(): OracleContract { + return YEARN_LENS_CONTRACT_ADDRESS; + } + chainLink(): OracleContract { + return CHAIN_LINK_CONTRACT_ADDRESS; + } + yearnLensBlacklist(): Address[] { + return YEARN_LENS_BLACKLIST; + } + + aaveOracle(): OracleContract { + return AAVE_ORACLE_CONTRACT_ADDRESS; + } + aaveOracleBlacklist(): Address[] { + return AAVE_ORACLE_BLACKLIST; + } + + curveCalculations(): OracleContract { + return CURVE_CALCULATIONS_ADDRESS; + } + curveCalculationsBlacklist(): Address[] { + return CURVE_CALCULATIONS_BLACKSLIST; + } + + sushiCalculations(): OracleContract { + return SUSHISWAP_CALCULATIONS_ADDRESS; + } + sushiCalculationsBlacklist(): Address[] { + return SUSHI_CALCULATIONS_BLACKSLIST; + } + + uniswapForks(): OracleContract[] { + return UNISWAP_FORKS_ROUTER_ADDRESSES; + } + curveRegistry(): OracleContract[] { + return CURVE_REGISTRY_ADDRESSES; + } + + hardcodedStables(): Address[] { + return HARDCODED_STABLES; + } + + ethAddress(): Address { + return ETH_ADDRESS; + } + wethAddress(): Address { + return WETH_ADDRESS; + } + usdcAddress(): Address { + return USDC_ADDRESS; + } + + usdcTokenDecimals(): BigInt { + return USDC_TOKEN_DECIMALS; + } +} diff --git a/subgraphs/kwenta/src/prices/config/harmony.ts b/subgraphs/kwenta/src/prices/config/harmony.ts new file mode 100644 index 0000000000..39d4b0b16c --- /dev/null +++ b/subgraphs/kwenta/src/prices/config/harmony.ts @@ -0,0 +1,127 @@ +import { Address, BigInt } from "@graphprotocol/graph-ts"; +import { Configurations, OracleContract } from "../common/types"; + +export const NETWORK_STRING = "harmony"; + +/////////////////////////////////////////////////////////////////////////// +///////////////////// CALCULATIONS/ORACLE CONTRACT //////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const YEARN_LENS_CONTRACT_ADDRESS = new OracleContract(); +export const CHAIN_LINK_CONTRACT_ADDRESS = new OracleContract(); +export const SUSHISWAP_CALCULATIONS_ADDRESS = new OracleContract(); +export const AAVE_ORACLE_CONTRACT_ADDRESS = new OracleContract( + "0xb56c2f0b653b2e0b10c9b928c8580ac5df02c7c7", + 23930344 +); + +/////////////////////////////////////////////////////////////////////////// +///////////////////////////// CURVE CONTRACT ////////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const CURVE_CALCULATIONS_ADDRESS = new OracleContract(); + +export const CURVE_REGISTRY_ADDRESSES: OracleContract[] = [ + new OracleContract("0x0a53fada2d943057c47a301d25a4d9b3b8e01e8e", 18003250), +]; + +/////////////////////////////////////////////////////////////////////////// +/////////////////////////// UNISWAP FORKS CONTRACT //////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const UNISWAP_FORKS_ROUTER_ADDRESSES: OracleContract[] = [ + new OracleContract("0x1b02da8cb0d097eb8d57a175b88c7d8b47997506", 11256069), // SushiSwap +]; + +/////////////////////////////////////////////////////////////////////////// +/////////////////////////// BLACKLISTED TOKENS //////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const YEARN_LENS_BLACKLIST: Address[] = []; +export const AAVE_ORACLE_BLACKLIST: Address[] = []; +export const CURVE_CALCULATIONS_BLACKSLIST: Address[] = []; +export const SUSHI_CALCULATIONS_BLACKSLIST: Address[] = []; + +/////////////////////////////////////////////////////////////////////////// +//////////////////////////// HARDCODED STABLES //////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const HARDCODED_STABLES: Address[] = []; + +/////////////////////////////////////////////////////////////////////////// +///////////////////////////////// HELPERS ///////////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const USDC_TOKEN_DECIMALS = BigInt.fromI32(6); + +export const ETH_ADDRESS = Address.fromString( + "0x6983d1e6def3690c4d616b13597a09e6193ea013" +); +export const WETH_ADDRESS = Address.fromString( + "0xcf664087a5bb0237a0bad6742852ec6c8d69a27a" +); +export const USDC_ADDRESS = Address.fromString( + "0x985458e523db3d53125813ed68c274899e9dfab4" +); + +export class config implements Configurations { + network(): string { + return NETWORK_STRING; + } + + yearnLens(): OracleContract { + return YEARN_LENS_CONTRACT_ADDRESS; + } + chainLink(): OracleContract { + return CHAIN_LINK_CONTRACT_ADDRESS; + } + yearnLensBlacklist(): Address[] { + return YEARN_LENS_BLACKLIST; + } + + aaveOracle(): OracleContract { + return AAVE_ORACLE_CONTRACT_ADDRESS; + } + aaveOracleBlacklist(): Address[] { + return AAVE_ORACLE_BLACKLIST; + } + + curveCalculations(): OracleContract { + return CURVE_CALCULATIONS_ADDRESS; + } + curveCalculationsBlacklist(): Address[] { + return CURVE_CALCULATIONS_BLACKSLIST; + } + + sushiCalculations(): OracleContract { + return SUSHISWAP_CALCULATIONS_ADDRESS; + } + sushiCalculationsBlacklist(): Address[] { + return SUSHI_CALCULATIONS_BLACKSLIST; + } + + uniswapForks(): OracleContract[] { + return UNISWAP_FORKS_ROUTER_ADDRESSES; + } + curveRegistry(): OracleContract[] { + return CURVE_REGISTRY_ADDRESSES; + } + + hardcodedStables(): Address[] { + return HARDCODED_STABLES; + } + + ethAddress(): Address { + return ETH_ADDRESS; + } + wethAddress(): Address { + return WETH_ADDRESS; + } + usdcAddress(): Address { + return USDC_ADDRESS; + } + + usdcTokenDecimals(): BigInt { + return USDC_TOKEN_DECIMALS; + } +} diff --git a/subgraphs/kwenta/src/prices/config/mainnet.ts b/subgraphs/kwenta/src/prices/config/mainnet.ts new file mode 100644 index 0000000000..4614a69788 --- /dev/null +++ b/subgraphs/kwenta/src/prices/config/mainnet.ts @@ -0,0 +1,174 @@ +import { Address, BigInt } from "@graphprotocol/graph-ts"; +import { Configurations, OracleContract } from "../common/types"; + +export const NETWORK_STRING = "mainnet"; + +/////////////////////////////////////////////////////////////////////////// +///////////////////// CALCULATIONS/ORACLE CONTRACT //////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const YEARN_LENS_CONTRACT_ADDRESS = new OracleContract( + "0x83d95e0d5f402511db06817aff3f9ea88224b030", + 12242339 +); +export const CHAIN_LINK_CONTRACT_ADDRESS = new OracleContract( + "0x47fb2585d2c56fe188d0e6ec628a38b74fceeedf", + 12864088 +); +export const AAVE_ORACLE_CONTRACT_ADDRESS = new OracleContract(); +export const SUSHISWAP_CALCULATIONS_ADDRESS = new OracleContract( + "0x8263e161a855b644f582d9c164c66aabee53f927", + 12692284 +); + +/////////////////////////////////////////////////////////////////////////// +///////////////////////////// CURVE CONTRACT ////////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const CURVE_CALCULATIONS_ADDRESS = new OracleContract( + "0x25bf7b72815476dd515044f9650bf79bad0df655", + 12370088 +); + +export const CURVE_REGISTRY_ADDRESSES: OracleContract[] = [ + new OracleContract("0x7d86446ddb609ed0f5f8684acf30380a356b2b4c", 11154794), + new OracleContract("0x8f942c20d02befc377d41445793068908e2250d0", 13986752), +]; + +/////////////////////////////////////////////////////////////////////////// +/////////////////////////// UNISWAP FORKS CONTRACT //////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const UNISWAP_FORKS_ROUTER_ADDRESSES: OracleContract[] = [ + new OracleContract("0xd9e1ce17f2641f24ae83637ab66a2cca9c378b9f", 10794261), // SushiSwap + new OracleContract("0x7a250d5630b4cf539739df2c5dacb4c659f2488d", 10207858), // Uniswap +]; + +/////////////////////////////////////////////////////////////////////////// +/////////////////////////// BLACKLISTED TOKENS //////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const YEARN_LENS_BLACKLIST: Address[] = [ + Address.fromString("0x5f98805a4e8be255a32880fdec7f6728c6568ba0"), // LUSD + Address.fromString("0x8daebade922df735c38c80c7ebd708af50815faa"), // tBTC + Address.fromString("0x0316eb71485b0ab14103307bf65a021042c6d380"), // Huobi BTC + Address.fromString("0xca3d75ac011bf5ad07a98d02f18225f9bd9a6bdf"), // crvTriCrypto +]; +export const AAVE_ORACLE_BLACKLIST: Address[] = []; +export const CURVE_CALCULATIONS_BLACKSLIST: Address[] = [ + Address.fromString("0xca3d75ac011bf5ad07a98d02f18225f9bd9a6bdf"), // crvTriCrypto + Address.fromString("0xc4ad29ba4b3c580e6d59105fff484999997675ff"), // crv3Crypto +]; +export const SUSHI_CALCULATIONS_BLACKSLIST: Address[] = []; + +/////////////////////////////////////////////////////////////////////////// +//////////////////////////// HARDCODED STABLES //////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const HARDCODED_STABLES: Address[] = [ + Address.fromString("0xd632f22692fac7611d2aa1c0d552930d43caed3b"), // Curve.fi Factory USD Metapool: Frax + Address.fromString("0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3"), // Magic Internet Money + Address.fromString("0x5a6a4d54456819380173272a5e8e9b9904bdf41b"), // Curve.fi Factory USD Metapool: Magic Internet Money 3Pool + Address.fromString("0xbc6da0fe9ad5f3b0d58160288917aa56653660e9"), // Alchemix USD + Address.fromString("0x43b4fdfd4ff969587185cdb6f0bd875c5fc83f8c"), // Curve.fi Factory USD Metapool: Alchemix USD + Address.fromString("0x57ab1ec28d129707052df4df418d58a2d46d5f51"), // Synth SUSD + Address.fromString("0xc25a3a3b969415c80451098fa907ec722572917f"), // Curve.fi DAI/USDC/USDT/sUSD + Address.fromString("0x0000000000085d4780b73119b644ae5ecd22b376"), // TrueUSD + Address.fromString("0xecd5e75afb02efa118af914515d6521aabd189f1"), // Curve.fi Factory USD Metapool: TrueUSD + Address.fromString("0xfd2a8fa60abd58efe3eee34dd494cd491dc14900"), // Curve.fi aDAI/aUSDC/aUSDT + Address.fromString("0x8ee017541375f6bcd802ba119bddc94dad6911a1"), // Curve.fi Factory USD Metapool: PUSd + Address.fromString("0x5b3b5df2bf2b6543f78e053bd91c4bdd820929f1"), // Curve.fi Factory USD Metapool: USDM + Address.fromString("0x04b727c7e246ca70d496ecf52e6b6280f3c8077d"), // Curve.fi Factory USD Metapool: apeUSDFRAXBP + Address.fromString("0x3175df0976dfa876431c2e9ee6bc45b65d3473cc"), // Curve.fi FRAX/USDC + Address.fromString("0xbcb91e689114b9cc865ad7871845c95241df4105"), // Curve.fi Factory USD Metapool: PWRD Metapool + Address.fromString("0x26ea744e5b887e5205727f55dfbe8685e3b21951"), // iearn USDC + Address.fromString("0xc2cb1040220768554cf699b0d863a3cd4324ce32"), // iearn DAI + Address.fromString("0x04bc0ab673d88ae9dbc9da2380cb6b79c4bca9ae"), // iearn BUSD + Address.fromString("0xe6354ed5bc4b393a5aad09f21c46e101e692d447"), // iearn USDT + Address.fromString("0x3b3ac5386837dc563660fb6a0937dfaa5924333b"), // Curve.fi yDAI/yUSDC/yUSDT/yBUSD + Address.fromString("0xc2f5fea5197a3d92736500fd7733fcc7a3bbdf3f"), // Curve.fi Factory USD Metapool: fUSD-3pool + Address.fromString("0x0c10bf8fcb7bf5412187a595ab97a3609160b5c6"), // Decentralized USD + Address.fromString("0x028171bca77440897b824ca71d1c56cac55b68a3"), // Aave interest bearing DAI + Address.fromString("0x3ed3b47dd13ec9a98b44e6204a523e766b225811"), // Aave interest bearing USDT + Address.fromString("0xbcca60bb61934080951369a648fb03df4f96263c"), // Aave interest bearing USDC + Address.fromString("0x6c5024cd4f8a59110119c56f8933403a539555eb"), // Aave interest bearing SUSD + Address.fromString("0xd71ecff9342a5ced620049e616c5035f1db98620"), // Synth sEUR +]; + +/////////////////////////////////////////////////////////////////////////// +///////////////////////////////// HELPERS ///////////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const USDC_TOKEN_DECIMALS = BigInt.fromI32(6); + +export const ETH_ADDRESS = Address.fromString( + "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee" +); +export const WETH_ADDRESS = Address.fromString( + "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" +); +export const USDC_ADDRESS = Address.fromString( + "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" +); + +export class config implements Configurations { + network(): string { + return NETWORK_STRING; + } + + yearnLens(): OracleContract { + return YEARN_LENS_CONTRACT_ADDRESS; + } + chainLink(): OracleContract { + return CHAIN_LINK_CONTRACT_ADDRESS; + } + yearnLensBlacklist(): Address[] { + return YEARN_LENS_BLACKLIST; + } + + aaveOracle(): OracleContract { + return AAVE_ORACLE_CONTRACT_ADDRESS; + } + aaveOracleBlacklist(): Address[] { + return AAVE_ORACLE_BLACKLIST; + } + + curveCalculations(): OracleContract { + return CURVE_CALCULATIONS_ADDRESS; + } + curveCalculationsBlacklist(): Address[] { + return CURVE_CALCULATIONS_BLACKSLIST; + } + + sushiCalculations(): OracleContract { + return SUSHISWAP_CALCULATIONS_ADDRESS; + } + sushiCalculationsBlacklist(): Address[] { + return SUSHI_CALCULATIONS_BLACKSLIST; + } + + uniswapForks(): OracleContract[] { + return UNISWAP_FORKS_ROUTER_ADDRESSES; + } + curveRegistry(): OracleContract[] { + return CURVE_REGISTRY_ADDRESSES; + } + + hardcodedStables(): Address[] { + return HARDCODED_STABLES; + } + + ethAddress(): Address { + return ETH_ADDRESS; + } + wethAddress(): Address { + return WETH_ADDRESS; + } + usdcAddress(): Address { + return USDC_ADDRESS; + } + + usdcTokenDecimals(): BigInt { + return USDC_TOKEN_DECIMALS; + } +} diff --git a/subgraphs/kwenta/src/prices/config/moonbeam.ts b/subgraphs/kwenta/src/prices/config/moonbeam.ts new file mode 100644 index 0000000000..f3009cdb3c --- /dev/null +++ b/subgraphs/kwenta/src/prices/config/moonbeam.ts @@ -0,0 +1,124 @@ +import { Address, BigInt } from "@graphprotocol/graph-ts"; +import { Configurations, OracleContract } from "../common/types"; + +export const NETWORK_STRING = "moonbeam"; + +/////////////////////////////////////////////////////////////////////////// +///////////////////// CALCULATIONS/ORACLE CONTRACT //////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const YEARN_LENS_CONTRACT_ADDRESS = new OracleContract(); +export const CHAIN_LINK_CONTRACT_ADDRESS = new OracleContract(); +export const AAVE_ORACLE_CONTRACT_ADDRESS = new OracleContract(); +export const SUSHISWAP_CALCULATIONS_ADDRESS = new OracleContract(); + +/////////////////////////////////////////////////////////////////////////// +///////////////////////////// CURVE CONTRACT ////////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const CURVE_CALCULATIONS_ADDRESS = new OracleContract(); + +export const CURVE_REGISTRY_ADDRESSES: OracleContract[] = [ + new OracleContract("0xc2b1df84112619d190193e48148000e3990bf627", 1452049), +]; + +/////////////////////////////////////////////////////////////////////////// +/////////////////////////// UNISWAP FORKS CONTRACT //////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const UNISWAP_FORKS_ROUTER_ADDRESSES: OracleContract[] = [ + new OracleContract("0x445fe580ef8d70ff569ab36e80c647af338db351", 503734), // SushiSwap +]; + +/////////////////////////////////////////////////////////////////////////// +/////////////////////////// BLACKLISTED TOKENS //////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const YEARN_LENS_BLACKLIST: Address[] = []; +export const AAVE_ORACLE_BLACKLIST: Address[] = []; +export const CURVE_CALCULATIONS_BLACKSLIST: Address[] = []; +export const SUSHI_CALCULATIONS_BLACKSLIST: Address[] = []; + +/////////////////////////////////////////////////////////////////////////// +//////////////////////////// HARDCODED STABLES //////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const HARDCODED_STABLES: Address[] = []; + +/////////////////////////////////////////////////////////////////////////// +///////////////////////////////// HELPERS ///////////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const USDC_TOKEN_DECIMALS = BigInt.fromI32(6); + +export const ETH_ADDRESS = Address.fromString( + "0xfa9343c3897324496a05fc75abed6bac29f8a40f" +); +export const WETH_ADDRESS = Address.fromString( + "0xacc15dc74880c9944775448304b263d191c6077f" +); +export const USDC_ADDRESS = Address.fromString( + "0x818ec0a7fe18ff94269904fced6ae3dae6d6dc0b" +); + +export class config implements Configurations { + network(): string { + return NETWORK_STRING; + } + + yearnLens(): OracleContract { + return YEARN_LENS_CONTRACT_ADDRESS; + } + chainLink(): OracleContract { + return CHAIN_LINK_CONTRACT_ADDRESS; + } + yearnLensBlacklist(): Address[] { + return YEARN_LENS_BLACKLIST; + } + + aaveOracle(): OracleContract { + return AAVE_ORACLE_CONTRACT_ADDRESS; + } + aaveOracleBlacklist(): Address[] { + return AAVE_ORACLE_BLACKLIST; + } + + curveCalculations(): OracleContract { + return CURVE_CALCULATIONS_ADDRESS; + } + curveCalculationsBlacklist(): Address[] { + return CURVE_CALCULATIONS_BLACKSLIST; + } + + sushiCalculations(): OracleContract { + return SUSHISWAP_CALCULATIONS_ADDRESS; + } + sushiCalculationsBlacklist(): Address[] { + return SUSHI_CALCULATIONS_BLACKSLIST; + } + + uniswapForks(): OracleContract[] { + return UNISWAP_FORKS_ROUTER_ADDRESSES; + } + curveRegistry(): OracleContract[] { + return CURVE_REGISTRY_ADDRESSES; + } + + hardcodedStables(): Address[] { + return HARDCODED_STABLES; + } + + ethAddress(): Address { + return ETH_ADDRESS; + } + wethAddress(): Address { + return WETH_ADDRESS; + } + usdcAddress(): Address { + return USDC_ADDRESS; + } + + usdcTokenDecimals(): BigInt { + return USDC_TOKEN_DECIMALS; + } +} diff --git a/subgraphs/kwenta/src/prices/config/optimism.ts b/subgraphs/kwenta/src/prices/config/optimism.ts new file mode 100644 index 0000000000..a270efacc3 --- /dev/null +++ b/subgraphs/kwenta/src/prices/config/optimism.ts @@ -0,0 +1,136 @@ +import { Address, BigInt } from "@graphprotocol/graph-ts"; +import { Configurations, OracleContract } from "../common/types"; + +export const NETWORK_STRING = "optimism"; + +/////////////////////////////////////////////////////////////////////////// +///////////////////// CALCULATIONS/ORACLE CONTRACT //////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const YEARN_LENS_CONTRACT_ADDRESS = new OracleContract( + "0xb082d9f4734c535d9d80536f7e87a6f4f471bf65", + 18109291 +); +export const CHAIN_LINK_CONTRACT_ADDRESS = new OracleContract(); +export const AAVE_ORACLE_CONTRACT_ADDRESS = new OracleContract( + "0xd81eb3728a631871a7ebbad631b5f424909f0c77", + 4365625 +); +export const SUSHISWAP_CALCULATIONS_ADDRESS = new OracleContract( + "0x5fd3815dcb668200a662114fbc9af13ac0a55b4d", + 18216910 +); + +/////////////////////////////////////////////////////////////////////////// +///////////////////////////// CURVE CONTRACT ////////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const CURVE_CALCULATIONS_ADDRESS = new OracleContract( + "0x0ffe8434eae67c9838b12c3cd11ac4005daa7227", + 18368996 +); + +export const CURVE_REGISTRY_ADDRESSES: OracleContract[] = [ + new OracleContract("0xc5cfada84e902ad92dd40194f0883ad49639b023", 2373837), + new OracleContract("0x445fe580ef8d70ff569ab36e80c647af338db351", 3729171), +]; + +/////////////////////////////////////////////////////////////////////////// +/////////////////////////// UNISWAP FORKS CONTRACT //////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const UNISWAP_FORKS_ROUTER_ADDRESSES: OracleContract[] = [ + new OracleContract("0x9c12939390052919af3155f41bf4160fd3666a6f", 19702709), // Velodrame +]; +/////////////////////////////////////////////////////////////////////////// +/////////////////////////// BLACKLISTED TOKENS //////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const YEARN_LENS_BLACKLIST: Address[] = []; +export const AAVE_ORACLE_BLACKLIST: Address[] = []; +export const CURVE_CALCULATIONS_BLACKSLIST: Address[] = []; +export const SUSHI_CALCULATIONS_BLACKSLIST: Address[] = []; + +/////////////////////////////////////////////////////////////////////////// +//////////////////////////// HARDCODED STABLES //////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const HARDCODED_STABLES: Address[] = []; + +/////////////////////////////////////////////////////////////////////////// +///////////////////////////////// HELPERS ///////////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const USDC_TOKEN_DECIMALS = BigInt.fromI32(6); + +export const ETH_ADDRESS = Address.fromString( + "0x4200000000000000000000000000000000000042" +); +export const WETH_ADDRESS = Address.fromString( + "0x4200000000000000000000000000000000000006" +); +export const USDC_ADDRESS = Address.fromString( + "0x7f5c764cbc14f9669b88837ca1490cca17c31607" +); + +export class config implements Configurations { + network(): string { + return NETWORK_STRING; + } + + yearnLens(): OracleContract { + return YEARN_LENS_CONTRACT_ADDRESS; + } + chainLink(): OracleContract { + return CHAIN_LINK_CONTRACT_ADDRESS; + } + yearnLensBlacklist(): Address[] { + return YEARN_LENS_BLACKLIST; + } + + aaveOracle(): OracleContract { + return AAVE_ORACLE_CONTRACT_ADDRESS; + } + aaveOracleBlacklist(): Address[] { + return AAVE_ORACLE_BLACKLIST; + } + + curveCalculations(): OracleContract { + return CURVE_CALCULATIONS_ADDRESS; + } + curveCalculationsBlacklist(): Address[] { + return CURVE_CALCULATIONS_BLACKSLIST; + } + + sushiCalculations(): OracleContract { + return SUSHISWAP_CALCULATIONS_ADDRESS; + } + sushiCalculationsBlacklist(): Address[] { + return SUSHI_CALCULATIONS_BLACKSLIST; + } + + uniswapForks(): OracleContract[] { + return UNISWAP_FORKS_ROUTER_ADDRESSES; + } + curveRegistry(): OracleContract[] { + return CURVE_REGISTRY_ADDRESSES; + } + + hardcodedStables(): Address[] { + return HARDCODED_STABLES; + } + + ethAddress(): Address { + return ETH_ADDRESS; + } + wethAddress(): Address { + return WETH_ADDRESS; + } + usdcAddress(): Address { + return USDC_ADDRESS; + } + + usdcTokenDecimals(): BigInt { + return USDC_TOKEN_DECIMALS; + } +} diff --git a/subgraphs/kwenta/src/prices/config/polygon.ts b/subgraphs/kwenta/src/prices/config/polygon.ts new file mode 100644 index 0000000000..c8d174fdf9 --- /dev/null +++ b/subgraphs/kwenta/src/prices/config/polygon.ts @@ -0,0 +1,130 @@ +import { BigInt, Address } from "@graphprotocol/graph-ts"; +import { Configurations, OracleContract } from "../common/types"; + +export const NETWORK_STRING = "matic"; + +/////////////////////////////////////////////////////////////////////////// +///////////////////// CALCULATIONS/ORACLE CONTRACT //////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const YEARN_LENS_CONTRACT_ADDRESS = new OracleContract(); +export const CHAIN_LINK_CONTRACT_ADDRESS = new OracleContract(); +export const SUSHISWAP_CALCULATIONS_ADDRESS = new OracleContract(); + +export const AAVE_ORACLE_CONTRACT_ADDRESS = new OracleContract( + "0xb023e699f5a33916ea823a16485e259257ca8bd1", + 25825996 +); + +/////////////////////////////////////////////////////////////////////////// +///////////////////////////// CURVE CONTRACT ////////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const CURVE_CALCULATIONS_ADDRESS = new OracleContract(); + +export const CURVE_REGISTRY_ADDRESSES: OracleContract[] = [ + new OracleContract("0x094d12e5b541784701fd8d65f11fc0598fbc6332", 13991825), + new OracleContract("0x47bb542b9de58b970ba50c9dae444ddb4c16751a", 23556360), +]; + +/////////////////////////////////////////////////////////////////////////// +/////////////////////////// UNISWAP FORKS CONTRACT //////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const UNISWAP_FORKS_ROUTER_ADDRESSES: OracleContract[] = [ + new OracleContract("0xa5e0829caced8ffdd4de3c43696c57f7d7a678ff", 4931900), // QuickSwap + new OracleContract("0x1b02da8cb0d097eb8d57a175b88c7d8b47997506", 11333235), // SushiSwap +]; + +/////////////////////////////////////////////////////////////////////////// +/////////////////////////// BLACKLISTED TOKENS //////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const YEARN_LENS_BLACKLIST: Address[] = []; +export const AAVE_ORACLE_BLACKLIST: Address[] = []; +export const CURVE_CALCULATIONS_BLACKSLIST: Address[] = []; +export const SUSHI_CALCULATIONS_BLACKSLIST: Address[] = []; + +/////////////////////////////////////////////////////////////////////////// +//////////////////////////// HARDCODED STABLES //////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const HARDCODED_STABLES: Address[] = []; + +/////////////////////////////////////////////////////////////////////////// +///////////////////////////////// HELPERS ///////////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const USDC_TOKEN_DECIMALS = BigInt.fromI32(6); + +export const ETH_ADDRESS = Address.fromString( + "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619" +); +export const WETH_ADDRESS = Address.fromString( + "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270" +); +export const USDC_ADDRESS = Address.fromString( + "0x2791bca1f2de4661ed88a30c99a7a9449aa84174" +); + +export class config implements Configurations { + network(): string { + return NETWORK_STRING; + } + + yearnLens(): OracleContract { + return YEARN_LENS_CONTRACT_ADDRESS; + } + chainLink(): OracleContract { + return CHAIN_LINK_CONTRACT_ADDRESS; + } + yearnLensBlacklist(): Address[] { + return YEARN_LENS_BLACKLIST; + } + + aaveOracle(): OracleContract { + return AAVE_ORACLE_CONTRACT_ADDRESS; + } + aaveOracleBlacklist(): Address[] { + return AAVE_ORACLE_BLACKLIST; + } + + curveCalculations(): OracleContract { + return CURVE_CALCULATIONS_ADDRESS; + } + curveCalculationsBlacklist(): Address[] { + return CURVE_CALCULATIONS_BLACKSLIST; + } + + sushiCalculations(): OracleContract { + return SUSHISWAP_CALCULATIONS_ADDRESS; + } + sushiCalculationsBlacklist(): Address[] { + return SUSHI_CALCULATIONS_BLACKSLIST; + } + + uniswapForks(): OracleContract[] { + return UNISWAP_FORKS_ROUTER_ADDRESSES; + } + curveRegistry(): OracleContract[] { + return CURVE_REGISTRY_ADDRESSES; + } + + hardcodedStables(): Address[] { + return HARDCODED_STABLES; + } + + ethAddress(): Address { + return ETH_ADDRESS; + } + wethAddress(): Address { + return WETH_ADDRESS; + } + usdcAddress(): Address { + return USDC_ADDRESS; + } + + usdcTokenDecimals(): BigInt { + return USDC_TOKEN_DECIMALS; + } +} diff --git a/subgraphs/kwenta/src/prices/config/template.ts b/subgraphs/kwenta/src/prices/config/template.ts new file mode 100644 index 0000000000..1916693083 --- /dev/null +++ b/subgraphs/kwenta/src/prices/config/template.ts @@ -0,0 +1,114 @@ +import * as constants from "../common/constants"; +import { Address, BigInt } from "@graphprotocol/graph-ts"; +import { Configurations, OracleContract } from "../common/types"; + +export const NETWORK_STRING = "default"; + +/////////////////////////////////////////////////////////////////////////// +///////////////////// CALCULATIONS/ORACLE CONTRACT //////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const YEARN_LENS_CONTRACT_ADDRESS = new OracleContract(); +export const CHAIN_LINK_CONTRACT_ADDRESS = new OracleContract(); +export const AAVE_ORACLE_CONTRACT_ADDRESS = new OracleContract(); +export const SUSHISWAP_CALCULATIONS_ADDRESS = new OracleContract(); + +/////////////////////////////////////////////////////////////////////////// +///////////////////////////// CURVE CONTRACT ////////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const CURVE_CALCULATIONS_ADDRESS = new OracleContract(); +export const CURVE_REGISTRY_ADDRESSES: OracleContract[] = []; + +/////////////////////////////////////////////////////////////////////////// +/////////////////////////// UNISWAP FORKS CONTRACT //////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const UNISWAP_FORKS_ROUTER_ADDRESSES: OracleContract[] = []; + +/////////////////////////////////////////////////////////////////////////// +/////////////////////////// BLACKLISTED TOKENS //////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const YEARN_LENS_BLACKLIST: Address[] = []; +export const AAVE_ORACLE_BLACKLIST: Address[] = []; +export const CURVE_CALCULATIONS_BLACKSLIST: Address[] = []; +export const SUSHI_CALCULATIONS_BLACKSLIST: Address[] = []; + +/////////////////////////////////////////////////////////////////////////// +//////////////////////////// HARDCODED STABLES //////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const HARDCODED_STABLES: Address[] = []; + +/////////////////////////////////////////////////////////////////////////// +///////////////////////////////// HELPERS ///////////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +export const USDC_TOKEN_DECIMALS = BigInt.fromI32(6); + +export const ETH_ADDRESS = constants.NULL.TYPE_ADDRESS; +export const WETH_ADDRESS = constants.NULL.TYPE_ADDRESS; +export const USDC_ADDRESS = constants.NULL.TYPE_ADDRESS; + +export class config implements Configurations { + network(): string { + return NETWORK_STRING; + } + + yearnLens(): OracleContract { + return YEARN_LENS_CONTRACT_ADDRESS; + } + chainLink(): OracleContract { + return CHAIN_LINK_CONTRACT_ADDRESS; + } + yearnLensBlacklist(): Address[] { + return YEARN_LENS_BLACKLIST; + } + + aaveOracle(): OracleContract { + return AAVE_ORACLE_CONTRACT_ADDRESS; + } + aaveOracleBlacklist(): Address[] { + return AAVE_ORACLE_BLACKLIST; + } + + curveCalculations(): OracleContract { + return CURVE_CALCULATIONS_ADDRESS; + } + curveCalculationsBlacklist(): Address[] { + return CURVE_CALCULATIONS_BLACKSLIST; + } + + sushiCalculations(): OracleContract { + return SUSHISWAP_CALCULATIONS_ADDRESS; + } + sushiCalculationsBlacklist(): Address[] { + return SUSHI_CALCULATIONS_BLACKSLIST; + } + + uniswapForks(): OracleContract[] { + return UNISWAP_FORKS_ROUTER_ADDRESSES; + } + curveRegistry(): OracleContract[] { + return CURVE_REGISTRY_ADDRESSES; + } + + hardcodedStables(): Address[] { + return HARDCODED_STABLES; + } + + ethAddress(): Address { + return ETH_ADDRESS; + } + wethAddress(): Address { + return WETH_ADDRESS; + } + usdcAddress(): Address { + return USDC_ADDRESS; + } + + usdcTokenDecimals(): BigInt { + return USDC_TOKEN_DECIMALS; + } +} diff --git a/subgraphs/kwenta/src/prices/index.ts b/subgraphs/kwenta/src/prices/index.ts new file mode 100644 index 0000000000..3a2c0ce408 --- /dev/null +++ b/subgraphs/kwenta/src/prices/index.ts @@ -0,0 +1,140 @@ +import { + log, + Address, + ethereum, + BigDecimal, + dataSource, +} from "@graphprotocol/graph-ts"; +import { CustomPriceType } from "./common/types"; + +import * as utils from "./common/utils"; +import * as constants from "./common/constants"; +import * as AaveOracle from "./oracles/AaveOracle"; +import * as CurveRouter from "./routers/CurveRouter"; +import * as ChainLinkFeed from "./oracles/ChainLinkFeed"; +import * as YearnLensOracle from "./oracles/YearnLensOracle"; +import * as UniswapForksRouter from "./routers/UniswapForksRouter"; +import * as CurveCalculations from "./calculations/CalculationsCurve"; +import * as SushiCalculations from "./calculations/CalculationsSushiswap"; + +export function getUsdPricePerToken( + tokenAddr: Address, + block: ethereum.Block | null = null +): CustomPriceType { + if (tokenAddr.equals(constants.NULL.TYPE_ADDRESS)) { + return new CustomPriceType(); + } + + const config = utils.getConfig(); + if (config.network() == "default") { + log.warning("Failed to fetch price: network {} not implemented", [ + dataSource.network(), + ]); + + return new CustomPriceType(); + } + + if (config.hardcodedStables().includes(tokenAddr)) { + return CustomPriceType.initialize( + constants.BIGDECIMAL_USD_PRICE, + constants.DEFAULT_USDC_DECIMALS + ); + } + + // 1. Yearn Lens Oracle + const yearnLensPrice = YearnLensOracle.getTokenPriceUSDC(tokenAddr, block); + if (!yearnLensPrice.reverted) { + log.info("[YearnLensOracle] tokenAddress: {}, Price: {}", [ + tokenAddr.toHexString(), + yearnLensPrice.usdPrice.toString(), + ]); + return yearnLensPrice; + } + + // 2. ChainLink Feed Registry + const chainLinkPrice = ChainLinkFeed.getTokenPriceUSDC(tokenAddr, block); + if (!chainLinkPrice.reverted) { + log.info("[ChainLinkFeed] tokenAddress: {}, Price: {}", [ + tokenAddr.toHexString(), + chainLinkPrice.usdPrice.toString(), + ]); + return chainLinkPrice; + } + + // 3. CalculationsCurve + const calculationsCurvePrice = CurveCalculations.getTokenPriceUSDC( + tokenAddr, + block + ); + if (!calculationsCurvePrice.reverted) { + log.info("[CalculationsCurve] tokenAddress: {}, Price: {}", [ + tokenAddr.toHexString(), + calculationsCurvePrice.usdPrice.toString(), + ]); + return calculationsCurvePrice; + } + + // 4. CalculationsSushiSwap + const calculationsSushiSwapPrice = SushiCalculations.getTokenPriceUSDC( + tokenAddr, + block + ); + if (!calculationsSushiSwapPrice.reverted) { + log.info("[CalculationsSushiSwap] tokenAddress: {}, Price: {}", [ + tokenAddr.toHexString(), + calculationsSushiSwapPrice.usdPrice.toString(), + ]); + return calculationsSushiSwapPrice; + } + + // 6. Aave Oracle + const aaveOraclePrice = AaveOracle.getTokenPriceUSDC(tokenAddr, block); + if (!aaveOraclePrice.reverted) { + log.info("[AaveOracle] tokenAddress: {}, Price: {}", [ + tokenAddr.toHexString(), + aaveOraclePrice.usdPrice.toString(), + ]); + return aaveOraclePrice; + } + + // 7. Curve Router + const curvePrice = CurveRouter.getCurvePriceUsdc(tokenAddr, block); + if (!curvePrice.reverted) { + log.info("[CurveRouter] tokenAddress: {}, Price: {}", [ + tokenAddr.toHexString(), + curvePrice.usdPrice.toString(), + ]); + return curvePrice; + } + + // 8. Uniswap Router + const uniswapPrice = UniswapForksRouter.getTokenPriceUSDC(tokenAddr, block); + if (!uniswapPrice.reverted) { + log.info("[UniswapRouter] tokenAddress: {}, Price: {}", [ + tokenAddr.toHexString(), + uniswapPrice.usdPrice.toString(), + ]); + return uniswapPrice; + } + + log.warning("[Oracle] Failed to Fetch Price, Name: {} Address: {}", [ + utils.getTokenName(tokenAddr), + tokenAddr.toHexString(), + ]); + + return new CustomPriceType(); +} + +export function getUsdPrice( + tokenAddr: Address, + amount: BigDecimal, + block: ethereum.Block | null = null +): BigDecimal { + const tokenPrice = getUsdPricePerToken(tokenAddr, block); + + if (!tokenPrice.reverted) { + return tokenPrice.usdPrice.times(amount); + } + + return constants.BIGDECIMAL_ZERO; +} diff --git a/subgraphs/kwenta/src/prices/oracles/AaveOracle.ts b/subgraphs/kwenta/src/prices/oracles/AaveOracle.ts new file mode 100644 index 0000000000..9f222944f4 --- /dev/null +++ b/subgraphs/kwenta/src/prices/oracles/AaveOracle.ts @@ -0,0 +1,44 @@ +import * as utils from "../common/utils"; +import * as constants from "../common/constants"; +import { CustomPriceType, OracleContract } from "../common/types"; +import { Address, BigDecimal, BigInt, ethereum } from "@graphprotocol/graph-ts"; +import { AaveOracleContract } from "../../../generated/FuturesMarketManager2/AaveOracleContract"; + +export function getAaveOracleContract( + contract: OracleContract, + block: ethereum.Block | null = null +): AaveOracleContract | null { + if ( + (block && contract.startBlock.gt(block.number)) || + utils.isNullAddress(contract.address) + ) + return null; + + return AaveOracleContract.bind(contract.address); +} + +export function getTokenPriceUSDC( + tokenAddr: Address, + block: ethereum.Block | null = null +): CustomPriceType { + const config = utils.getConfig(); + + if (!config || config.aaveOracleBlacklist().includes(tokenAddr)) + return new CustomPriceType(); + + const aaveOracleContract = getAaveOracleContract(config.aaveOracle(), block); + if (!aaveOracleContract) return new CustomPriceType(); + + const tokenPrice: BigDecimal = utils + .readValue( + aaveOracleContract.try_getAssetPrice(tokenAddr), + constants.BIGINT_ZERO + ) + .toBigDecimal(); + + return CustomPriceType.initialize( + tokenPrice, + constants.AAVE_ORACLE_DECIMALS, + constants.OracleType.AAVE_ORACLE + ); +} diff --git a/subgraphs/kwenta/src/prices/oracles/ChainLinkFeed.ts b/subgraphs/kwenta/src/prices/oracles/ChainLinkFeed.ts new file mode 100644 index 0000000000..e08124dc37 --- /dev/null +++ b/subgraphs/kwenta/src/prices/oracles/ChainLinkFeed.ts @@ -0,0 +1,53 @@ +import * as utils from "../common/utils"; +import * as constants from "../common/constants"; +import { Address, ethereum } from "@graphprotocol/graph-ts"; +import { CustomPriceType, OracleContract } from "../common/types"; +import { ChainLinkContract } from "../../../generated/FuturesMarketManager2/ChainLinkContract"; + +export function getChainLinkContract( + contract: OracleContract, + block: ethereum.Block | null = null +): ChainLinkContract | null { + if ( + (block && contract.startBlock.gt(block.number)) || + utils.isNullAddress(contract.address) + ) + return null; + + return ChainLinkContract.bind(contract.address); +} + +export function getTokenPriceUSDC( + tokenAddr: Address, + block: ethereum.Block | null = null +): CustomPriceType { + const config = utils.getConfig(); + if (!config) return new CustomPriceType(); + + const chainLinkContract = getChainLinkContract(config.chainLink(), block); + if (!chainLinkContract) return new CustomPriceType(); + + const result = chainLinkContract.try_latestRoundData( + tokenAddr, + constants.CHAIN_LINK_USD_ADDRESS + ); + + if (!result.reverted) { + const decimals = chainLinkContract.try_decimals( + tokenAddr, + constants.CHAIN_LINK_USD_ADDRESS + ); + + if (decimals.reverted) { + return new CustomPriceType(); + } + + return CustomPriceType.initialize( + result.value.value1.toBigDecimal(), + decimals.value, + constants.OracleType.CHAINLINK_FEED + ); + } + + return new CustomPriceType(); +} diff --git a/subgraphs/kwenta/src/prices/oracles/YearnLensOracle.ts b/subgraphs/kwenta/src/prices/oracles/YearnLensOracle.ts new file mode 100644 index 0000000000..ccef7ab856 --- /dev/null +++ b/subgraphs/kwenta/src/prices/oracles/YearnLensOracle.ts @@ -0,0 +1,44 @@ +import * as utils from "../common/utils"; +import * as constants from "../common/constants"; +import { CustomPriceType, OracleContract } from "../common/types"; +import { Address, BigDecimal, BigInt, ethereum } from "@graphprotocol/graph-ts"; +import { YearnLensContract } from "../../../generated/FuturesMarketManager2/YearnLensContract"; + +export function getYearnLensContract( + contract: OracleContract, + block: ethereum.Block | null = null +): YearnLensContract | null { + if ( + (block && contract.startBlock.gt(block.number)) || + utils.isNullAddress(contract.address) + ) + return null; + + return YearnLensContract.bind(contract.address); +} + +export function getTokenPriceUSDC( + tokenAddr: Address, + block: ethereum.Block | null = null +): CustomPriceType { + const config = utils.getConfig(); + + if (!config || config.yearnLensBlacklist().includes(tokenAddr)) + return new CustomPriceType(); + + const yearnLensContract = getYearnLensContract(config.yearnLens(), block); + if (!yearnLensContract) return new CustomPriceType(); + + const tokenPrice: BigDecimal = utils + .readValue( + yearnLensContract.try_getPriceUsdcRecommended(tokenAddr), + constants.BIGINT_ZERO + ) + .toBigDecimal(); + + return CustomPriceType.initialize( + tokenPrice, + constants.DEFAULT_USDC_DECIMALS, + constants.OracleType.YEARN_LENS_ORACLE + ); +} diff --git a/subgraphs/kwenta/src/prices/routers/CurveRouter.ts b/subgraphs/kwenta/src/prices/routers/CurveRouter.ts new file mode 100644 index 0000000000..77801cd97b --- /dev/null +++ b/subgraphs/kwenta/src/prices/routers/CurveRouter.ts @@ -0,0 +1,326 @@ +import { getUsdPricePerToken } from ".."; +import * as utils from "../common/utils"; +import * as constants from "../common/constants"; +import { CustomPriceType } from "../common/types"; +import { BigInt, Address, BigDecimal, ethereum } from "@graphprotocol/graph-ts"; +import { CurvePool as CurvePoolContract } from "../../../generated/FuturesMarketManager2/CurvePool"; +import { CurveRegistry as CurveRegistryContract } from "../../../generated/FuturesMarketManager2/CurveRegistry"; + +export function isCurveLpToken( + lpAddress: Address, + block: ethereum.Block +): bool { + const poolAddress = getPoolFromLpToken(lpAddress, block); + if (poolAddress.notEqual(constants.NULL.TYPE_ADDRESS)) return true; + + return false; +} + +export function getPoolFromLpToken( + lpAddress: Address, + block: ethereum.Block | null = null +): Address { + const config = utils.getConfig(); + const curveRegistryAdresses = config.curveRegistry(); + + for (let idx = 0; idx < curveRegistryAdresses.length; idx++) { + const curveRegistry = curveRegistryAdresses[idx]; + if (block && curveRegistry.startBlock.gt(block.number)) continue; + + const curveRegistryContract = CurveRegistryContract.bind( + curveRegistry.address + ); + + const poolAddress = utils.readValue
( + curveRegistryContract.try_get_pool_from_lp_token(lpAddress), + constants.NULL.TYPE_ADDRESS + ); + + if (poolAddress.notEqual(constants.NULL.TYPE_ADDRESS)) return poolAddress; + } + + return constants.NULL.TYPE_ADDRESS; +} + +export function isLpCryptoPool( + lpAddress: Address, + block: ethereum.Block | null = null +): bool { + const poolAddress = getPoolFromLpToken(lpAddress, block); + + if (poolAddress != constants.NULL.TYPE_ADDRESS) { + return isPoolCryptoPool(poolAddress); + } + + return false; +} + +export function isPoolCryptoPool(poolAddress: Address): bool { + const poolContract = CurvePoolContract.bind(poolAddress); + + const priceOracleCall = poolContract.try_price_oracle(); + if (!priceOracleCall.reverted) return true; + + const priceOracle1Call = poolContract.try_price_oracle1( + constants.BIGINT_ZERO + ); + if (!priceOracle1Call.reverted) return true; + + return false; +} + +export function getCurvePriceUsdc( + lpAddress: Address, + block: ethereum.Block | null = null +): CustomPriceType { + if (isLpCryptoPool(lpAddress, block)) + return cryptoPoolLpPriceUsdc(lpAddress, block); + + const basePrice = getBasePrice(lpAddress, block); + const virtualPrice = getVirtualPrice(lpAddress, block).toBigDecimal(); + + const config = utils.getConfig(); + const usdcTokenDecimals = config.usdcTokenDecimals(); + + const decimalsAdjustment = + constants.DEFAULT_DECIMALS.minus(usdcTokenDecimals); + const priceUsdc = virtualPrice + .times(basePrice.usdPrice) + .times( + constants.BIGINT_TEN.pow(decimalsAdjustment.toI32() as u8).toBigDecimal() + ); + + return CustomPriceType.initialize( + priceUsdc, + decimalsAdjustment.plus(constants.DEFAULT_DECIMALS).toI32() as u8, + constants.OracleType.CURVE_ROUTER + ); +} + +export function getBasePrice( + lpAddress: Address, + block: ethereum.Block | null = null +): CustomPriceType { + const poolAddress = getPoolFromLpToken(lpAddress, block); + + if (poolAddress.equals(constants.NULL.TYPE_ADDRESS)) + return new CustomPriceType(); + + const underlyingCoinAddress = getUnderlyingCoinFromPool(poolAddress, block); + const basePrice = getPriceUsdcRecommended(underlyingCoinAddress, block); + + return basePrice; +} + +export function getUnderlyingCoinFromPool( + poolAddress: Address, + block: ethereum.Block | null = null +): Address { + const config = utils.getConfig(); + const curveRegistryAdresses = config.curveRegistry(); + + for (let idx = 0; idx < curveRegistryAdresses.length; idx++) { + const curveRegistry = curveRegistryAdresses[idx]; + if (block && curveRegistry.startBlock.gt(block.number)) continue; + + const curveRegistryContract = CurveRegistryContract.bind( + curveRegistry.address + ); + + const coins = utils.readValue( + curveRegistryContract.try_get_underlying_coins(poolAddress), + [] + ); + + if (coins.length != 0) return getPreferredCoinFromCoins(coins); + } + + return constants.NULL.TYPE_ADDRESS; +} + +export function getPreferredCoinFromCoins(coins: Address[]): Address { + let preferredCoinAddress = constants.NULL.TYPE_ADDRESS; + for (let coinIdx = 0; coinIdx < 8; coinIdx++) { + const coinAddress = coins[coinIdx]; + + if (coinAddress.notEqual(constants.NULL.TYPE_ADDRESS)) { + preferredCoinAddress = coinAddress; + } + // Found preferred coin and we're at the end of the token array + if ( + (preferredCoinAddress.notEqual(constants.NULL.TYPE_ADDRESS) && + coinAddress.equals(constants.NULL.TYPE_ADDRESS)) || + coinIdx == 7 + ) { + break; + } + } + + return preferredCoinAddress; +} + +export function getVirtualPrice( + curveLpTokenAddress: Address, + block: ethereum.Block | null = null +): BigInt { + const config = utils.getConfig(); + const curveRegistryAdresses = config.curveRegistry(); + + for (let idx = 0; idx < curveRegistryAdresses.length; idx++) { + const curveRegistry = curveRegistryAdresses[idx]; + if (block && curveRegistry.startBlock.gt(block.number)) continue; + + const curveRegistryContract = CurveRegistryContract.bind( + curveRegistry.address + ); + + const virtualPriceCall = + curveRegistryContract.try_get_virtual_price_from_lp_token( + curveLpTokenAddress + ); + + if (!virtualPriceCall.reverted) return virtualPriceCall.value; + } + + return constants.BIGINT_ZERO; +} + +export function getPriceUsdcRecommended( + tokenAddress: Address, + block: ethereum.Block | null = null +): CustomPriceType { + return getUsdPricePerToken(tokenAddress, block); +} + +export function cryptoPoolLpPriceUsdc( + lpAddress: Address, + block: ethereum.Block | null = null +): CustomPriceType { + const totalSupply = utils.getTokenSupply(lpAddress); + + const totalValueUsdc = cryptoPoolLpTotalValueUsdc(lpAddress, block); + const priceUsdc = totalValueUsdc + .times( + constants.BIGINT_TEN.pow( + constants.DEFAULT_DECIMALS.toI32() as u8 + ).toBigDecimal() + ) + .div(totalSupply.toBigDecimal()); + + return CustomPriceType.initialize( + priceUsdc, + 0, + constants.OracleType.CURVE_ROUTER + ); +} + +export function cryptoPoolLpTotalValueUsdc( + lpAddress: Address, + block: ethereum.Block | null = null +): BigDecimal { + const poolAddress = getPoolFromLpToken(lpAddress, block); + + const underlyingTokensAddresses = + cryptoPoolUnderlyingTokensAddressesByPoolAddress(poolAddress); + + let totalValue = constants.BIGDECIMAL_ZERO; + + for ( + let tokenIdx = 0; + tokenIdx < underlyingTokensAddresses.length; + tokenIdx++ + ) { + const tokenValueUsdc = cryptoPoolTokenAmountUsdc( + poolAddress, + underlyingTokensAddresses[tokenIdx], + BigInt.fromI32(tokenIdx), + block + ); + totalValue = totalValue.plus(tokenValueUsdc); + } + + return totalValue; +} + +export function cryptoPoolTokenAmountUsdc( + poolAddress: Address, + tokenAddress: Address, + tokenIdx: BigInt, + block: ethereum.Block | null = null +): BigDecimal { + const poolContract = CurvePoolContract.bind(poolAddress); + + const tokenBalance = utils + .readValue( + poolContract.try_balances(tokenIdx), + constants.BIGINT_ZERO + ) + .toBigDecimal(); + + const tokenDecimals = utils.getTokenDecimals(tokenAddress); + const tokenPrice = getPriceUsdcRecommended(tokenAddress, block); + const tokenValueUsdc = tokenBalance + .times(tokenPrice.usdPrice) + .div(constants.BIGINT_TEN.pow(tokenDecimals.toI32() as u8).toBigDecimal()); + + return tokenValueUsdc; +} + +export function cryptoPoolUnderlyingTokensAddressesByPoolAddress( + poolAddress: Address +): Address[] { + const poolContract = CurvePoolContract.bind(poolAddress); + + let idx = 0; + const coins: Address[] = []; + while (idx >= 0) { + const coin = utils.readValue
( + poolContract.try_coins(BigInt.fromI32(idx)), + constants.NULL.TYPE_ADDRESS + ); + + if (coin.equals(constants.NULL.TYPE_ADDRESS)) { + return coins; + } + + coins.push(coin); + idx += 1; + } + + return coins; +} + +export function getPriceUsdc( + tokenAddress: Address, + block: ethereum.Block +): CustomPriceType { + if (isCurveLpToken(tokenAddress, block)) + return getCurvePriceUsdc(tokenAddress, block); + + const poolContract = CurvePoolContract.bind(tokenAddress); + const virtualPrice = utils + .readValue( + poolContract.try_get_virtual_price(), + constants.BIGINT_ZERO + ) + .toBigDecimal(); + + const coins: Address[] = []; + for (let i = 0; i < 8; i++) { + const coin = utils.readValue
( + poolContract.try_coins(BigInt.fromI32(i)), + constants.NULL.TYPE_ADDRESS + ); + + coins.push(coin); + } + + const preferredCoin = getPreferredCoinFromCoins(coins); + const price = getPriceUsdcRecommended(preferredCoin, block); + + return CustomPriceType.initialize( + price.usdPrice.times(virtualPrice), + constants.DEFAULT_DECIMALS.toI32() as u8, + constants.OracleType.CURVE_ROUTER + ); +} diff --git a/subgraphs/kwenta/src/prices/routers/UniswapForksRouter.ts b/subgraphs/kwenta/src/prices/routers/UniswapForksRouter.ts new file mode 100644 index 0000000000..d3a3cffd00 --- /dev/null +++ b/subgraphs/kwenta/src/prices/routers/UniswapForksRouter.ts @@ -0,0 +1,221 @@ +import * as utils from "../common/utils"; +import * as constants from "../common/constants"; +import { CustomPriceType } from "../common/types"; +import { Address, BigInt, ethereum, log } from "@graphprotocol/graph-ts"; +import { UniswapPair as UniswapPairContract } from "../../../generated/FuturesMarketManager2/UniswapPair"; +import { UniswapRouter as UniswapRouterContract } from "../../../generated/FuturesMarketManager2/UniswapRouter"; + +export function isLpToken(tokenAddress: Address, ethAddress: Address): bool { + if (tokenAddress.equals(ethAddress)) return false; + + const lpToken = UniswapRouterContract.bind(tokenAddress); + const isFactoryAvailable = utils.readValue( + lpToken.try_factory(), + constants.NULL.TYPE_ADDRESS + ); + + if (isFactoryAvailable.equals(constants.NULL.TYPE_ADDRESS)) return false; + + return true; +} + +export function getTokenPriceUSDC( + tokenAddress: Address, + block: ethereum.Block | null = null +): CustomPriceType { + const config = utils.getConfig(); + if (!config) return new CustomPriceType(); + + const ethAddress = config.ethAddress(); + const usdcAddress = config.usdcAddress(); + + if (isLpToken(tokenAddress, ethAddress)) { + return getLpTokenPriceUsdc(tokenAddress, block); + } + return getPriceFromRouterUSDC(tokenAddress, usdcAddress, block); +} + +export function getPriceFromRouterUSDC( + tokenAddress: Address, + usdcAddress: Address, + block: ethereum.Block | null = null +): CustomPriceType { + return getPriceFromRouter(tokenAddress, usdcAddress, block); +} + +export function getPriceFromRouter( + token0Address: Address, + token1Address: Address, + block: ethereum.Block | null = null +): CustomPriceType { + const config = utils.getConfig(); + + const ethAddress = config.ethAddress(); + const wethAddress = config.wethAddress(); + + // Construct swap path + const path: Address[] = []; + let numberOfJumps: BigInt; + + // Convert ETH address to WETH + if (token0Address == ethAddress) token0Address = wethAddress; + if (token1Address == ethAddress) token1Address = wethAddress; + + const inputTokenIsWeth: bool = + token0Address.equals(wethAddress) || token1Address.equals(wethAddress); + + if (inputTokenIsWeth) { + // Path = [token0, weth] or [weth, token1] + numberOfJumps = BigInt.fromI32(1); + + path.push(token0Address); + path.push(token1Address); + } else { + // Path = [token0, weth, token1] + numberOfJumps = BigInt.fromI32(2); + + path.push(token0Address); + path.push(wethAddress); + path.push(token1Address); + } + + const token0Decimals = utils.getTokenDecimals(token0Address); + const amountIn = constants.BIGINT_TEN.pow(token0Decimals.toI32() as u8); + + const routerAddresses = config.uniswapForks(); + + let amountOut = constants.BIGINT_ZERO; + for (let idx = 0; idx < routerAddresses.length; idx++) { + const routerAddress = routerAddresses[idx]; + if (block && routerAddress.startBlock.gt(block.number)) continue; + + const uniswapForkRouter = UniswapRouterContract.bind(routerAddress.address); + const amountOutArray = uniswapForkRouter.try_getAmountsOut(amountIn, path); + + if (!amountOutArray.reverted) { + amountOut = amountOutArray.value[amountOutArray.value.length - 1]; + break; + } + } + + const feeBips = BigInt.fromI32(30); + + const amountOutBigDecimal = amountOut + .times(constants.BIGINT_TEN_THOUSAND) + .div(constants.BIGINT_TEN_THOUSAND.minus(feeBips.times(numberOfJumps))) + .toBigDecimal(); + + return CustomPriceType.initialize( + amountOutBigDecimal, + config.usdcTokenDecimals().toI32() as u8, + constants.OracleType.UNISWAP_FORKS_ROUTER + ); +} + +export function getLpTokenPriceUsdc( + tokenAddress: Address, + block: ethereum.Block | null = null +): CustomPriceType { + const uniSwapPair = UniswapPairContract.bind(tokenAddress); + + const totalLiquidity: CustomPriceType = getLpTokenTotalLiquidityUsdc( + tokenAddress, + block + ); + const totalSupply = utils.readValue( + uniSwapPair.try_totalSupply(), + constants.BIGINT_ZERO + ); + if (totalSupply == constants.BIGINT_ZERO || totalLiquidity.reverted) { + return new CustomPriceType(); + } + + let pairDecimals: number; + const pairDecimalsCall = uniSwapPair.try_decimals(); + + if (pairDecimalsCall.reverted) { + log.warning( + "[UniswapForksRouter] Failed to fetch pair decimals, tokenAddress: {}", + [tokenAddress.toHexString()] + ); + + return new CustomPriceType(); + } else { + pairDecimals = pairDecimalsCall.value; + } + + const pricePerLpTokenUsdc = totalLiquidity.usdPrice + .times(constants.BIGINT_TEN.pow(pairDecimals as u8).toBigDecimal()) + .div(totalSupply.toBigDecimal()); + + return CustomPriceType.initialize( + pricePerLpTokenUsdc, + constants.DEFAULT_USDC_DECIMALS, + constants.OracleType.UNISWAP_FORKS_ROUTER + ); +} + +export function getLpTokenTotalLiquidityUsdc( + tokenAddress: Address, + block: ethereum.Block | null = null +): CustomPriceType { + const uniSwapPair = UniswapPairContract.bind(tokenAddress); + + const token0Address = utils.readValue
( + uniSwapPair.try_token0(), + constants.NULL.TYPE_ADDRESS + ); + const token1Address = utils.readValue
( + uniSwapPair.try_token1(), + constants.NULL.TYPE_ADDRESS + ); + + if ( + token0Address.equals(constants.NULL.TYPE_ADDRESS) || + token1Address.equals(constants.NULL.TYPE_ADDRESS) + ) { + return new CustomPriceType(); + } + + const token0Decimals = utils.getTokenDecimals(token0Address); + const token1Decimals = utils.getTokenDecimals(token1Address); + + const reservesCall = uniSwapPair.try_getReserves(); + + if (reservesCall.reverted) return new CustomPriceType(); + + const token0Price = getTokenPriceUSDC(token0Address, block); + const token1Price = getTokenPriceUSDC(token1Address, block); + + if (token0Price.reverted || token1Price.reverted) { + return new CustomPriceType(); + } + + const reserves = reservesCall.value; + const reserve0 = reserves.value0; + const reserve1 = reserves.value1; + + if ( + reserve0.notEqual(constants.BIGINT_ZERO) || + reserve1.notEqual(constants.BIGINT_ZERO) + ) { + const liquidity0 = reserve0 + .div(constants.BIGINT_TEN.pow(token0Decimals.toI32() as u8)) + .toBigDecimal() + .times(token0Price.usdPrice); + + const liquidity1 = reserve1 + .div(constants.BIGINT_TEN.pow(token1Decimals.toI32() as u8)) + .toBigDecimal() + .times(token1Price.usdPrice); + + const totalLiquidity = liquidity0.plus(liquidity1); + + return CustomPriceType.initialize( + totalLiquidity, + constants.DEFAULT_USDC_DECIMALS, + constants.OracleType.UNISWAP_FORKS_ROUTER + ); + } + return new CustomPriceType(); +} diff --git a/subgraphs/kwenta/src/sdk/README.md b/subgraphs/kwenta/src/sdk/README.md new file mode 100644 index 0000000000..cb7d3f8403 --- /dev/null +++ b/subgraphs/kwenta/src/sdk/README.md @@ -0,0 +1,24 @@ +## Wat dis? + +This folder contains a library which abstracts the developer from most of the _schema related_ functionality. Ideally, building a subgraph should only consist on understading a protocol and translating certain events into actions and metrics. But the particularities of how this metrics are stored and how they relate to each other inside the schema can and should be abstracted away. Things like taking snapshots of entities every X amount of time, updating TVL every time there is a deposit/withdrawal, updating fees at _swap & pool & protocol & snapshot levels_, etc ... This library aims to do that. + +When using this library, entities should not be updated directly, but always through the library unless absolutely needed. An exception to this is if you create your own auxiliary entity to aid on the handling of some events. + +## How It's Organized + +Pretty straightforward, `/protocols` and `/util`. + +Because we are currently experimenting different approaches, each protocol type has a different schema, and AssemblyScript has some limitations when dealing with interfaces, so far, each protocol type has its own implementation. They all live in their respective folders under `/protocols`, and have very little shared code. + +`/util` contains all these common functions and constants we use over and over. + +## Setting it up + +It would be ideal to have the library to get setup automatically with the messari-cli, in a similar way as we do to generate versions. We might eventually get there, but so far it consists on a manual copy process. + +Refer to each protocol type readme, since requirements might vary: + +- [Bridges](./protocols/bridge/README.md) +- [Lending](./protocols/lending/README.md) +- DEX +- Yield diff --git a/subgraphs/kwenta/src/sdk/protocols/config.ts b/subgraphs/kwenta/src/sdk/protocols/config.ts new file mode 100644 index 0000000000..f75004e165 --- /dev/null +++ b/subgraphs/kwenta/src/sdk/protocols/config.ts @@ -0,0 +1,45 @@ +import { BigDecimal, BigInt } from "@graphprotocol/graph-ts"; +import { Token } from "../../../generated/schema"; +import { Versions } from "../../../../../deployment/context/interface"; + +export interface ProtocolConfigurer { + getID(): string; + getName(): string; + getSlug(): string; + getVersions(): Versions; +} + +export class ProtocolConfig implements ProtocolConfigurer { + id: string; + name: string; + slug: string; + versions: Versions; + + constructor(id: string, name: string, slug: string, versions: Versions) { + this.id = id; + this.name = name; + this.slug = slug; + this.versions = versions; + } + + getID(): string { + return this.id; + } + + getName(): string { + return this.name; + } + + getSlug(): string { + return this.slug; + } + + getVersions(): Versions { + return this.versions; + } +} + +export interface TokenPricer { + getTokenPrice(token: Token): BigDecimal; + getAmountValueUSD(token: Token, amount: BigInt): BigDecimal; +} diff --git a/subgraphs/kwenta/src/sdk/protocols/perpfutures/README.md b/subgraphs/kwenta/src/sdk/protocols/perpfutures/README.md new file mode 100644 index 0000000000..fdf7a2103a --- /dev/null +++ b/subgraphs/kwenta/src/sdk/protocols/perpfutures/README.md @@ -0,0 +1,43 @@ +# Perpetual SDK `1.1.0` + +The perpetual SDK follows the `1.3.0` Derivatives Perpetual Futures schema. + +## Setup + +- Copy over the whole SDK folder into your subgraph `src`. You won't need any of the other protocols, so you can safely delete those. +- Run `graph codegen` to make sure every import resolves if you want your intelisense and import navigation to work. + +That's it. To simplify setup we've tried to not make it depend on any contract calls. If it needed to make any, you would need to add the ABI of the given contract to your manifest and change the import paths wherever it is used in the library. + +## How to use + +You should probably forget about GraphQL entities altoghether if using this. Only exception being auxiliary entities, or a very specific usecase that the library doesn't support or gets in the way. + +The library is initialized via a single constructor and a single import: + +```typescript +import { SDK } from "./sdk/protocols/perpfutures"; + +const sdk = SDK.initialize(conf, pricer, tokenInit, event); + +// ALSO accepts ethereum.Call +// const sdk = SDK.initialize(conf, pricer, tokenInit, call); +``` + +Where: + +- `event`/`call` is the event/function being handled by the handler making use of the SDK. +- `conf` should be an implementation of `ProtocolConfigurer`. For convenience you can find an implementation that you can import directly at `./sdk/protocols/config`. +- `pricer` should be an implementation of `TokenPricer`, found at `./sdk/protocols/config`. It allows the library to automatically calculate prices internally. Implementing it yourself allows you to use any pricing source you'd need. +- `tokenInit` should be an implementation of `./sdk/protocols/perpfutures/tokens:TokenInitializer`. It is used to populate the `Token` entity for the first time, and was decided to require it to be implemented to avoid the library depending on ABIs and to give some flexibility in case we need to deal with non-compliant ERC20 tokens. + +The SDK class exposes 5 classes for you to use: + +- `sdk.Protocol` +- `sdk.Accounts` +- `sdk.Pools` +- `sdk.Position` +- `sdk.Tokens` +- `sdk.Pricer` + +We'll see them in a second. But you should know that for this all to work properly you need to **always use these classes methods and never other constructors directly**. diff --git a/subgraphs/kwenta/src/sdk/protocols/perpfutures/account.ts b/subgraphs/kwenta/src/sdk/protocols/perpfutures/account.ts new file mode 100644 index 0000000000..49e8294abf --- /dev/null +++ b/subgraphs/kwenta/src/sdk/protocols/perpfutures/account.ts @@ -0,0 +1,682 @@ +import { + log, + Bytes, + BigInt, + Address, + BigDecimal, +} from "@graphprotocol/graph-ts"; + +import { Pool } from "./pool"; +import { Perpetual } from "./protocol"; +import { TokenManager } from "./tokens"; +import * as constants from "../../util/constants"; +import { EventType, ActivityType, TransactionType } from "./enums"; +import { CustomEventType, getUnixDays, getUnixHours } from "../../util/events"; + +import { + Swap, + Borrow, + Deposit, + Withdraw, + Liquidate, + CollateralIn, + CollateralOut, + ActiveAccount, + Account as AccountSchema, +} from "../../../../generated/schema"; + +/** + * This file contains the AccountClass, which does + * the operations on the Account entity. This includes: + * - Creating a new Account + * - Updating an existing Account + * - Making a position + * - Making position snapshots + * + * Schema Version: 1.3.0 + * SDK Version: 1.1.0 + * Author(s): + * - @harsh9200 + * - @dhruv-chauhan + */ + +class LoadAccountResponse { + account: Account; + isNewUser: boolean; + + constructor(account: Account, isNewUser: boolean) { + this.account = account; + this.isNewUser = isNewUser; + } +} + +export class AccountManager { + protocol: Perpetual; + tokens: TokenManager; + + constructor(protocol: Perpetual, tokens: TokenManager) { + this.protocol = protocol; + this.tokens = tokens; + } + + loadAccount(address: Address): LoadAccountResponse { + let isNewUser = false; + let entity = AccountSchema.load(address); + if (!entity) { + isNewUser = true; + entity = new AccountSchema(address); + + entity.cumulativeEntryPremiumUSD = constants.BIGDECIMAL_ZERO; + entity.cumulativeExitPremiumUSD = constants.BIGDECIMAL_ZERO; + entity.cumulativeTotalPremiumUSD = constants.BIGDECIMAL_ZERO; + + entity.cumulativeDepositPremiumUSD = constants.BIGDECIMAL_ZERO; + entity.cumulativeWithdrawPremiumUSD = constants.BIGDECIMAL_ZERO; + entity.cumulativeTotalLiquidityPremiumUSD = constants.BIGDECIMAL_ZERO; + + entity.longPositionCount = 0; + entity.shortPositionCount = 0; + entity.openPositionCount = 0; + entity.closedPositionCount = 0; + entity.cumulativeUniqueLiquidatees = 0; + + entity.depositCount = 0; + entity.withdrawCount = 0; + entity.borrowCount = 0; + entity.swapCount = 0; + entity.collateralInCount = 0; + entity.collateralOutCount = 0; + entity.liquidateCount = 0; + entity.liquidationCount = 0; + + entity.save(); + } + + const account = new Account(this.protocol, entity, this.tokens); + return new LoadAccountResponse(account, isNewUser); + } +} + +export class AccountWasActive { + hourly: boolean; + daily: boolean; +} + +export class Account { + account: AccountSchema; + event: CustomEventType; + protocol: Perpetual; + tokens: TokenManager; + pool: Pool | null; + + constructor( + protocol: Perpetual, + account: AccountSchema, + tokens: TokenManager + ) { + this.pool = null; + this.account = account; + this.protocol = protocol; + this.tokens = tokens; + this.event = protocol.getCurrentEvent(); + } + + private getIdFromEvent(type: EventType): Bytes { + return Bytes.fromUTF8(type.toLowerCase()) + .concat(Bytes.fromUTF8("-")) + .concat(this.event.transaction.hash) + .concat(Bytes.fromUTF8("-")) + .concatI32(this.event.logIndex.toI32()); + } + + private getAmountUSD(tokens: Bytes[], amounts: BigInt[]): BigDecimal { + let amountUSD = constants.BIGDECIMAL_ZERO; + if (tokens.length != amounts.length) return amountUSD; + + for (let idx = 0; idx < tokens.length; idx++) { + const token = this.tokens.getOrCreateToken( + Address.fromBytes(tokens[idx]) + ); + + amountUSD = amountUSD.plus( + this.protocol.getTokenPricer().getAmountValueUSD(token, amounts[idx]) + ); + } + return amountUSD; + } + + private isActiveByActivityID(id: Bytes): boolean { + let dAct = ActiveAccount.load(id); + if (dAct) return false; + + dAct = new ActiveAccount(id); + dAct.save(); + + return true; + } + + private trackActivity(activityType: ActivityType): void { + const days = getUnixDays(this.event.block); + const hours = getUnixHours(this.event.block); + + const generalHourlyID = `${this.account.id.toHexString()}-hourly-${hours}`; + const generalDailyID = `${this.account.id.toHexString()}-daily-${days}`; + + const generalActivity: AccountWasActive = { + daily: this.isActiveByActivityID(Bytes.fromUTF8(generalDailyID)), + hourly: this.isActiveByActivityID(Bytes.fromUTF8(generalHourlyID)), + }; + + const typeHourlyID = `${this.account.id.toHexString()}-hourly-${hours}-${activityType}`; + const typeDailyID = `${this.account.id.toHexString()}-daily-${days}-${activityType}`; + + const typeActivity: AccountWasActive = { + daily: this.isActiveByActivityID(Bytes.fromUTF8(typeDailyID)), + hourly: this.isActiveByActivityID(Bytes.fromUTF8(typeHourlyID)), + }; + + if (activityType == ActivityType.DEPOSIT) { + this.protocol.addActiveDepositor(typeActivity); + } else if (activityType == ActivityType.BORROW) { + this.protocol.addActiveBorrower(typeActivity); + } else if (activityType == ActivityType.LIQUIDATOR) { + this.protocol.addActiveLiquidator(typeActivity); + } else if (activityType == ActivityType.LIQUIDATEE) { + this.protocol.addActiveLiquidatee(typeActivity); + } + + this.protocol.addActiveUser(generalActivity); + } + + getBytesId(): Bytes { + return this.account.id; + } + + /** + * + * @param pool The pool where the liquidity was deposited. + * @param amounts The amount deposited of inputTokens. + * @param sharesMinted The amount of shares minted of outputToken. + * @param updateMetrics Optional, defaults to true. If true it will update the protocol and pool's deposit and transaction count. + * @returns Deposit + */ + deposit( + pool: Pool, + amounts: BigInt[], + sharesMinted: BigInt, + updateMetrics: bool = true + ): Deposit { + const depositId = this.getIdFromEvent(EventType.DEPOSIT); + const deposit = new Deposit(depositId); + + if (amounts.length != pool.getInputTokens().length) { + log.critical( + "[Account][Deposit] Pool:{} inputTokens length does not match deposit amount array length", + [pool.getBytesID().toHexString()] + ); + } + + deposit.hash = this.event.transaction.hash; + deposit.logIndex = this.event.logIndex.toI32(); + deposit.protocol = this.protocol.getBytesID(); + deposit.to = pool.getBytesID(); + deposit.from = this.account.id; + deposit.account = this.account.id; + deposit.blockNumber = this.event.block.number; + deposit.timestamp = this.event.block.timestamp; + deposit.inputTokens = pool.getInputTokens(); + deposit.outputToken = pool.getOutputToken(); + deposit.inputTokenAmounts = amounts; + deposit.outputTokenAmount = sharesMinted; + deposit.amountUSD = this.getAmountUSD(pool.getInputTokens(), amounts); + deposit.pool = pool.getBytesID(); + deposit.save(); + + if (updateMetrics) { + this.pool = pool; + this.countDeposit(); + this.protocol.addTransaction(TransactionType.DEPOSIT); + } + + return deposit; + } + + /** + * + * @param pool The pool where the liquidity was withdrawn. + * @param amounts The amount withdrawn of inputTokens. + * @param sharesBurnt The amount of shares burnt of outputToken. + * @param updateMetrics Optional, defaults to true. If true it will update the protocol withdraw and transaction count. + * @returns Withdraw + */ + withdraw( + pool: Pool, + amounts: BigInt[], + sharesBurnt: BigInt, + updateMetrics: bool = true + ): Withdraw { + const withdrawId = this.getIdFromEvent(EventType.WITHDRAW); + const withdraw = new Withdraw(withdrawId); + + if (amounts.length != pool.getInputTokens().length) { + log.critical( + "[Account][Withdraw] Pool:{} inputTokens length does not match Withdraw amount array length", + [pool.getBytesID().toHexString()] + ); + } + + withdraw.hash = this.event.transaction.hash; + withdraw.logIndex = this.event.logIndex.toI32(); + withdraw.protocol = this.protocol.getBytesID(); + withdraw.to = this.account.id; + withdraw.from = pool.getBytesID(); + withdraw.account = this.account.id; + withdraw.blockNumber = this.event.block.number; + withdraw.timestamp = this.event.block.timestamp; + withdraw.inputTokens = pool.getInputTokens(); + withdraw.outputToken = pool.getOutputToken(); + withdraw.inputTokenAmounts = amounts; + withdraw.outputTokenAmount = sharesBurnt; + withdraw.amountUSD = this.getAmountUSD(pool.getInputTokens(), amounts); + withdraw.pool = pool.getBytesID(); + withdraw.save(); + + if (updateMetrics) { + this.pool = pool; + this.countWithdraw(); + this.protocol.addTransaction(TransactionType.WITHDRAW); + } + return withdraw; + } + + /** + * + * @param pool The pool where the liquidity was swapped. + * @param tokenIn The token deposited into the pool. + * @param amountIn The token amount deposited into the pool. + * @param tokenIn The token withdrawn from the pool. + * @param amountIn The token amount withdrawn from the pool. + * @param tradingPair The contract address for the trading pair or pool. + * @param updateMetrics Optional, defaults to true. If true it will update the protocol swap and transaction count. + * @returns Swap + */ + swap( + pool: Pool, + tokenIn: Address, + amountIn: BigInt, + tokenOut: Address, + amountOut: BigInt, + tradingPair: Address, + updateMetrics: bool = true + ): Swap { + const swapId = this.getIdFromEvent(EventType.SWAP); + const swap = new Swap(swapId); + + swap.hash = this.event.transaction.hash; + swap.logIndex = this.event.logIndex.toI32(); + swap.protocol = this.protocol.getBytesID(); + swap.to = pool.getBytesID(); + swap.from = this.account.id; + swap.account = this.account.id; + swap.blockNumber = this.event.block.number; + swap.timestamp = this.event.block.timestamp; + + swap.tokenIn = tokenIn; + swap.amountIn = amountIn; + swap.amountInUSD = this.protocol + .getTokenPricer() + .getAmountValueUSD(this.tokens.getOrCreateToken(tokenIn), amountIn); + + swap.tokenOut = tokenOut; + swap.amountOut = amountOut; + swap.amountOutUSD = this.protocol + .getTokenPricer() + .getAmountValueUSD(this.tokens.getOrCreateToken(tokenOut), amountOut); + + swap.tradingPair = tradingPair; + swap.pool = pool.getBytesID(); + swap.save(); + + if (updateMetrics) { + this.pool = pool; + this.countSwap(); + this.protocol.addTransaction(TransactionType.SWAP); + } + return swap; + } + + /** + * + * @param pool The pool where the liquidity was swapped. + * @param tokenIn The token deposited into the pool. + * @param amountIn The token amount deposited into the pool. + * @param tokenIn The token withdrawn from the pool. + * @param amountIn The token amount withdrawn from the pool. + * @param tradingPair The contract address for the trading pair or pool. + * @param updateMetrics Optional, defaults to true. If true it will update the pool and protocol TVL and inputTokenBalance. + * @returns Borrow + */ + borrow( + pool: Pool, + position: Bytes, + asset: Address, + amount: BigInt, + updateMetrics: bool = true + ): Borrow { + const borrowId = this.getIdFromEvent(EventType.SWAP); + const borrow = new Borrow(borrowId); + + borrow.hash = this.event.transaction.hash; + borrow.logIndex = this.event.logIndex.toI32(); + borrow.protocol = this.protocol.getBytesID(); + borrow.position = position; + borrow.to = pool.getBytesID(); + borrow.from = this.account.id; + borrow.blockNumber = this.event.block.number; + borrow.timestamp = this.event.block.timestamp; + borrow.account = this.account.id; + + borrow.asset = asset; + borrow.amount = amount; + borrow.amountUSD = this.protocol + .getTokenPricer() + .getAmountValueUSD(this.tokens.getOrCreateToken(asset), amount); + borrow.pool = pool.getBytesID(); + borrow.save(); + + if (updateMetrics) { + this.pool = pool; + this.countBorrow(); + this.protocol.addTransaction(TransactionType.BORROW); + } + return borrow; + } + + /** + * + * @param pool The pool where the collateral was deposited. + * @param position + * @param amounts The amount deposited of inputTokens. + * @param sharesMinted The amount of shares minted of outputToken. + * @param updateMetrics Optional, defaults to true. If true it will update the pool and protocol TVL and inputTokenBalance. + * @returns CollateralIn + */ + collateralIn( + pool: Pool, + position: Bytes, + amounts: BigInt[], + sharesMinted: BigInt, + updateMetrics: bool = true + ): CollateralIn { + const collateralId = this.getIdFromEvent(EventType.DEPOSIT); + const collateralIn = new CollateralIn(collateralId); + + if (amounts.length != pool.getInputTokens().length) { + log.critical( + "[Account][collateralIn] Pool:{} inputTokens length does not match collateralIn amount array length", + [pool.getBytesID().toHexString()] + ); + } + + collateralIn.hash = this.event.transaction.hash; + collateralIn.logIndex = this.event.logIndex.toI32(); + collateralIn.protocol = this.protocol.getBytesID(); + collateralIn.position = position; + collateralIn.to = pool.getBytesID(); + collateralIn.from = this.account.id; + collateralIn.account = this.account.id; + collateralIn.blockNumber = this.event.block.number; + collateralIn.timestamp = this.event.block.timestamp; + collateralIn.inputTokens = pool.getInputTokens(); + collateralIn.outputToken = pool.getOutputToken(); + collateralIn.inputTokenAmounts = amounts; + collateralIn.outputTokenAmount = sharesMinted; + collateralIn.amountUSD = this.getAmountUSD(pool.getInputTokens(), amounts); + collateralIn.pool = pool.getBytesID(); + collateralIn.save(); + + if (updateMetrics) { + this.pool = pool; + this.countCollateralIn(); + this.protocol.addTransaction(TransactionType.COLLATERAL_IN); + } + return collateralIn; + } + + /** + * + * @param pool The pool where the collateral was withdrawn. + * @param position The position this transaction belongs to as relates to Long or Short but not LP. + * @param amounts The amount withdrawn of inputTokens. + * @param sharesMinted The amount of shares burnt of outputToken. + * @param updateMetrics Optional, defaults to true. If true it will update the pool and protocol TVL and inputTokenBalance. + * @returns CollateralOut + */ + collateralOut( + pool: Pool, + position: Bytes, + amounts: BigInt[], + sharesBurnt: BigInt, + updateMetrics: bool = true + ): CollateralOut { + const collateralId = this.getIdFromEvent(EventType.WITHDRAW); + const collateralOut = new CollateralOut(collateralId); + + if (amounts.length != pool.getInputTokens().length) { + log.critical( + "[Account][collateralOut] Pool:{} inputTokens length does not match collateralOut amount array length", + [pool.getBytesID().toHexString()] + ); + } + + collateralOut.hash = this.event.transaction.hash; + collateralOut.logIndex = this.event.logIndex.toI32(); + collateralOut.protocol = this.protocol.getBytesID(); + collateralOut.position = position; + collateralOut.to = this.account.id; + collateralOut.from = pool.getBytesID(); + collateralOut.account = this.account.id; + collateralOut.blockNumber = this.event.block.number; + collateralOut.timestamp = this.event.block.timestamp; + collateralOut.inputTokens = pool.getInputTokens(); + collateralOut.outputToken = pool.getOutputToken(); + collateralOut.inputTokenAmounts = amounts; + collateralOut.outputTokenAmount = sharesBurnt; + collateralOut.amountUSD = this.getAmountUSD(pool.getInputTokens(), amounts); + collateralOut.pool = pool.getBytesID(); + collateralOut.save(); + + if (updateMetrics) { + this.pool = pool; + this.countCollateralOut(); + this.protocol.addTransaction(TransactionType.COLLATERAL_OUT); + } + return collateralOut; + } + + /** + * + * @param pool The pool where the liquidation happened. + * @param asset Asset repaid (borrowed) + * @param collateralToken Token which was the collateral + * @param amountLiquidated Amount of collateral liquidated in native units + * @param liquidator Account that carried out the liquidation + * @param liquidatee Account that got liquidated + * @param position The position this Liquidate belongs to + * @param profitUSD Amount of profit from liquidation in USD + * @param updateMetrics Optional, defaults to true. If true it will update the pool and protocol TVL and inputTokenBalance. + * @returns Liquidate + */ + liquidate( + pool: Pool, + asset: Address, + collateralToken: Address, + amountLiquidated: BigInt, + liquidator: Address, + liquidatee: Address, + position: Bytes, + profitUSD: BigDecimal, + updateMetrics: bool = true + ): Liquidate { + const liquidateId = this.getIdFromEvent(EventType.LIQUIDATE); + const liquidate = new Liquidate(liquidateId); + + liquidate.hash = this.event.transaction.hash; + liquidate.logIndex = this.event.logIndex.toI32(); + liquidate.protocol = this.protocol.getBytesID(); + liquidate.position = position; + liquidate.to = liquidator; + liquidate.from = liquidatee; + liquidate.blockNumber = this.event.block.number; + liquidate.timestamp = this.event.block.timestamp; + liquidate.account = liquidator; + liquidate.liquidatee = liquidatee; + liquidate.asset = asset; + liquidate.amount = amountLiquidated; + liquidate.amountUSD = this.protocol + .getTokenPricer() + .getAmountValueUSD( + this.tokens.getOrCreateToken(collateralToken), + amountLiquidated + ); + liquidate.profitUSD = profitUSD; + liquidate.pool = pool.getBytesID(); + liquidate.save(); + + if (updateMetrics) { + this.pool = pool; + this.countLiquidatee(); + this.countLiquidator(liquidator); + this.protocol.addTransaction(TransactionType.LIQUIDATE); + } + return liquidate; + } + + /** + * Adds 1 to the account total deposit count. If it is the first deposit ever + * and the account has not withdrawn before it will also increase + * the number of unique depositors in the protocol and pool. + */ + countDeposit(): void { + if (this.account.depositCount == 0) { + this.protocol.addDepositor(); + if (this.pool) this.pool!.addDepositor(); + } + + this.account.depositCount += 1; + this.account.save(); + + this.trackActivity(ActivityType.DEPOSIT); + } + + /** + * Adds 1 to the account total withdraw count. + */ + countWithdraw(): void { + this.account.withdrawCount += 1; + this.account.save(); + } + + /** + * Adds 1 to the account total borrow count. If it is the first borrow ever + * and the account has not borrowed before it will also increase + * the number of unique borrowers in the protocol and pool. + */ + countBorrow(): void { + if (this.account.borrowCount == 0) { + this.protocol.addBorrower(); + if (this.pool) this.pool!.addBorrower(); + } + + this.account.borrowCount += 1; + this.account.save(); + + this.trackActivity(ActivityType.BORROW); + } + + /** + * Adds 1 to the account total swap count. + */ + countSwap(): void { + this.account.swapCount += 1; + this.account.save(); + } + + /** + * Adds 1 to the account total collateralIn count. + */ + countCollateralIn(): void { + this.account.collateralInCount += 1; + this.account.save(); + } + + /** + * Adds 1 to the account total collateralOut count. + */ + countCollateralOut(): void { + this.account.collateralOutCount += 1; + this.account.save(); + } + + /** + * Adds 1 to the account total liquidation count. If it is the first liquidation ever + * it will also increase the number of unique liquidation in the protocol and the associated pool. + */ + countLiquidator(liquidator: Address): void { + let entity = AccountSchema.load(liquidator); + if (!entity) { + const accountManager = new AccountManager(this.protocol, this.tokens); + accountManager.loadAccount(liquidator); + + entity = AccountSchema.load(liquidator); + } + + if (entity!.liquidateCount == 0) { + this.protocol.addLiquidator(); + if (this.pool) this.pool!.addLiquidator(); + } + + entity!.liquidateCount += 1; + entity!.save(); + + this.trackActivity(ActivityType.LIQUIDATOR); + } + + /** + * Adds 1 to the account total liquidatee count. If it is the first liquidatee ever + * it will also increase the number of unique liquidatee in the protocol and the associated pool. + */ + countLiquidatee(): void { + if (this.account.liquidationCount == 0) { + this.protocol.addLiquidatee(); + if (this.pool) this.pool!.addLiquidatee(); + } + + this.account.liquidationCount += 1; + this.account.save(); + + this.trackActivity(ActivityType.LIQUIDATEE); + } + + openPosition(positionSide: constants.PositionSide): void { + if (positionSide == constants.PositionSide.LONG) { + this.account.longPositionCount += 1; + } else { + this.account.shortPositionCount += 1; + } + this.account.openPositionCount += 1; + this.account.save(); + } + + closePosition(positionSide: constants.PositionSide): void { + if (positionSide == constants.PositionSide.LONG) { + this.account.longPositionCount -= 1; + } else { + this.account.shortPositionCount -= 1; + } + this.account.openPositionCount -= 1; + this.account.closedPositionCount += 1; + + this.account.save(); + } +} diff --git a/subgraphs/kwenta/src/sdk/protocols/perpfutures/config.ts b/subgraphs/kwenta/src/sdk/protocols/perpfutures/config.ts new file mode 100644 index 0000000000..c95c17437a --- /dev/null +++ b/subgraphs/kwenta/src/sdk/protocols/perpfutures/config.ts @@ -0,0 +1,33 @@ +import { Versions } from "../../../../../../deployment/context/interface"; + +import { ProtocolConfigurer } from "../config"; + +export class PerpetualConfig implements ProtocolConfigurer { + id: string; + name: string; + slug: string; + versions: Versions; + + constructor(id: string, name: string, slug: string, versions: Versions) { + this.id = id; + this.name = name; + this.slug = slug; + this.versions = versions; + } + + getID(): string { + return this.id; + } + + getName(): string { + return this.name; + } + + getSlug(): string { + return this.slug; + } + + getVersions(): Versions { + return this.versions; + } +} diff --git a/subgraphs/kwenta/src/sdk/protocols/perpfutures/enums.ts b/subgraphs/kwenta/src/sdk/protocols/perpfutures/enums.ts new file mode 100644 index 0000000000..25f069fa55 --- /dev/null +++ b/subgraphs/kwenta/src/sdk/protocols/perpfutures/enums.ts @@ -0,0 +1,32 @@ +export namespace TransactionType { + export const DEPOSIT = "DEPOSIT"; + export const WITHDRAW = "WITHDRAW"; + export const BORROW = "BORROW"; + export const SWAP = "SWAP"; + export const COLLATERAL_IN = "COLLATERAL_IN"; + export const COLLATERAL_OUT = "COLLATERAL_OUT"; + export const LIQUIDATE = "LIQUIDATE"; +} +export type TransactionType = string; + +export namespace PositionType { + export const LONG = "LONG"; + export const SHORT = "SHORT"; +} +export type PositionType = string; + +export namespace EventType { + export const DEPOSIT = "DEPOSIT"; + export const WITHDRAW = "WITHDRAW"; + export const SWAP = "SWAP"; + export const LIQUIDATE = "LIQUIDATE"; +} +export type EventType = string; + +export namespace ActivityType { + export const LIQUIDATOR = "LIQUIDATOR"; + export const LIQUIDATEE = "LIQUIDATEE"; + export const DEPOSIT = "DEPOSIT"; + export const BORROW = "BORROW"; +} +export type ActivityType = string; diff --git a/subgraphs/kwenta/src/sdk/protocols/perpfutures/index.ts b/subgraphs/kwenta/src/sdk/protocols/perpfutures/index.ts new file mode 100644 index 0000000000..63385d321d --- /dev/null +++ b/subgraphs/kwenta/src/sdk/protocols/perpfutures/index.ts @@ -0,0 +1,64 @@ +import { ethereum } from "@graphprotocol/graph-ts"; + +import { PoolManager } from "./pool"; +import { PositionManager } from "./position"; +import { Perpetual } from "./protocol"; +import { AccountManager } from "./account"; +import * as constants from "../../util/constants"; +import { CustomEventType } from "../../util/events"; +import { TokenInitializer, TokenManager } from "./tokens"; +import { ProtocolConfigurer, TokenPricer } from "../config"; + +export class SDK { + Protocol: Perpetual; + Accounts: AccountManager; + Pools: PoolManager; + Positions: PositionManager; + Tokens: TokenManager; + Pricer: TokenPricer; + + constructor( + config: ProtocolConfigurer, + pricer: TokenPricer, + tokenInitializer: TokenInitializer, + event: CustomEventType + ) { + this.Protocol = Perpetual.load(config, pricer, event); + this.Tokens = new TokenManager(this.Protocol, tokenInitializer); + this.Accounts = new AccountManager(this.Protocol, this.Tokens); + this.Pools = new PoolManager(this.Protocol, this.Tokens); + this.Positions = new PositionManager(this.Protocol, this.Tokens); + this.Pricer = pricer; + + this.Protocol.sdk = this; + } + + static initializeFromEvent( + config: ProtocolConfigurer, + pricer: TokenPricer, + tokenInitializer: TokenInitializer, + event: ethereum.Event + ): SDK { + const customEvent = CustomEventType.initialize( + event.block, + event.transaction, + event.logIndex, + event + ); + return new SDK(config, pricer, tokenInitializer, customEvent); + } + + static initializeFromCall( + config: ProtocolConfigurer, + pricer: TokenPricer, + tokenInitializer: TokenInitializer, + event: ethereum.Call + ): SDK { + const customEvent = CustomEventType.initialize( + event.block, + event.transaction, + constants.BIGINT_ZERO + ); + return new SDK(config, pricer, tokenInitializer, customEvent); + } +} diff --git a/subgraphs/kwenta/src/sdk/protocols/perpfutures/pool.ts b/subgraphs/kwenta/src/sdk/protocols/perpfutures/pool.ts new file mode 100644 index 0000000000..e20c8c75b7 --- /dev/null +++ b/subgraphs/kwenta/src/sdk/protocols/perpfutures/pool.ts @@ -0,0 +1,998 @@ +import { Bytes, BigDecimal, BigInt } from "@graphprotocol/graph-ts"; + +import { + sortBytesArray, + updateArrayAtIndex, + sortArrayByReference, + addArrays, +} from "../../util/arrays"; +import { PositionType, TransactionType } from "./enums"; +import { Perpetual } from "./protocol"; +import { TokenManager } from "./tokens"; +import { PoolSnapshot } from "./poolSnapshot"; +import * as constants from "../../util/constants"; +import { bigIntToBigDecimal, exponentToBigDecimal } from "../../util/numbers"; + +import { + LiquidityPoolFee, + Token as TokenSchema, + LiquidityPool as LiquidityPoolSchema, +} from "../../../../generated/schema"; + +/** + * This file contains the PoolManager, which is used to + * initialize new pools in the protocol. + * + * Schema Version: 1.3.0 + * SDK Version: 1.1.0 + * Author(s): + * - @harsh9200 + * - @dhruv-chauhan + */ + +export class PoolManager { + protocol: Perpetual; + tokens: TokenManager; + + constructor(protocol: Perpetual, tokens: TokenManager) { + this.protocol = protocol; + this.tokens = tokens; + } + + loadPool(id: Bytes): Pool { + let entity = LiquidityPoolSchema.load(id); + if (entity) return new Pool(this.protocol, entity, this.tokens); + + entity = new LiquidityPoolSchema(id); + entity.protocol = this.protocol.getBytesID(); + + const pool = new Pool(this.protocol, entity, this.tokens); + pool.isInitialized = false; + return pool; + } +} + +export class Pool { + pool: LiquidityPoolSchema; + protocol: Perpetual; + tokens: TokenManager; + snapshoter: PoolSnapshot; + + public isInitialized: boolean = true; + + constructor( + protocol: Perpetual, + pool: LiquidityPoolSchema, + tokens: TokenManager + ) { + this.pool = pool; + this.protocol = protocol; + this.tokens = tokens; + this.snapshoter = new PoolSnapshot(pool, protocol.event); + } + + initialize( + name: string, + symbol: string, + inputTokens: TokenSchema[], + outputToken: TokenSchema | null, + oracle: string | null = null + ): void { + if (this.isInitialized) return; + + const event = this.protocol.getCurrentEvent(); + this.pool.protocol = this.protocol.getBytesID(); + this.pool.name = name; + this.pool.symbol = symbol; + this.pool.oracle = oracle; + this.pool.inputTokens = inputTokens.map((token) => token.id); + this.pool.outputToken = outputToken ? outputToken.id : null; + + this.pool.fees = []; + this.pool.rewardTokens = []; + + this.pool.createdTimestamp = event.block.timestamp; + this.pool.createdBlockNumber = event.block.number; + + this.pool.fundingrate = new Array(inputTokens.length).fill( + constants.BIGDECIMAL_ZERO + ); + this.pool.totalValueLockedUSD = constants.BIGDECIMAL_ZERO; + + this.pool.cumulativeSupplySideRevenueUSD = constants.BIGDECIMAL_ZERO; + this.pool.cumulativeProtocolSideRevenueUSD = constants.BIGDECIMAL_ZERO; + this.pool.cumulativeTotalRevenueUSD = constants.BIGDECIMAL_ZERO; + + this.pool.cumulativeEntryPremiumUSD = constants.BIGDECIMAL_ZERO; + this.pool.cumulativeExitPremiumUSD = constants.BIGDECIMAL_ZERO; + this.pool.cumulativeTotalPremiumUSD = constants.BIGDECIMAL_ZERO; + + this.pool.cumulativeDepositPremiumUSD = constants.BIGDECIMAL_ZERO; + this.pool.cumulativeWithdrawPremiumUSD = constants.BIGDECIMAL_ZERO; + this.pool.cumulativeTotalLiquidityPremiumUSD = constants.BIGDECIMAL_ZERO; + + this.pool.longOpenInterestUSD = constants.BIGDECIMAL_ZERO; + this.pool.shortOpenInterestUSD = constants.BIGDECIMAL_ZERO; + this.pool.totalOpenInterestUSD = constants.BIGDECIMAL_ZERO; + + this.pool.cumulativeUniqueUsers = 0; + this.pool.cumulativeUniqueDepositors = 0; + this.pool.cumulativeUniqueBorrowers = 0; + this.pool.cumulativeUniqueLiquidators = 0; + this.pool.cumulativeUniqueLiquidatees = 0; + + this.pool.longPositionCount = 0; + this.pool.shortPositionCount = 0; + + this.pool.openPositionCount = 0; + this.pool.closedPositionCount = 0; + this.pool.cumulativePositionCount = 0; + + this.pool.cumulativeVolumeUSD = constants.BIGDECIMAL_ZERO; + this.pool.cumulativeVolumeByTokenAmount = new Array( + inputTokens.length + ).fill(constants.BIGINT_ZERO); + this.pool.cumulativeVolumeByTokenUSD = new Array( + inputTokens.length + ).fill(constants.BIGDECIMAL_ZERO); + + this.pool.cumulativeInflowVolumeUSD = constants.BIGDECIMAL_ZERO; + this.pool.cumulativeInflowVolumeByTokenAmount = new Array( + inputTokens.length + ).fill(constants.BIGINT_ZERO); + this.pool.cumulativeInflowVolumeByTokenUSD = new Array( + inputTokens.length + ).fill(constants.BIGDECIMAL_ZERO); + + this.pool.cumulativeClosedInflowVolumeUSD = constants.BIGDECIMAL_ZERO; + this.pool.cumulativeClosedInflowVolumeByTokenAmount = new Array( + inputTokens.length + ).fill(constants.BIGINT_ZERO); + this.pool.cumulativeClosedInflowVolumeByTokenUSD = new Array( + inputTokens.length + ).fill(constants.BIGDECIMAL_ZERO); + + this.pool.cumulativeOutflowVolumeUSD = constants.BIGDECIMAL_ZERO; + this.pool.cumulativeOutflowVolumeByTokenAmount = new Array( + inputTokens.length + ).fill(constants.BIGINT_ZERO); + this.pool.cumulativeOutflowVolumeByTokenUSD = new Array( + inputTokens.length + ).fill(constants.BIGDECIMAL_ZERO); + + this.pool.inputTokenBalances = new Array(inputTokens.length).fill( + constants.BIGINT_ZERO + ); + this.pool.inputTokenWeights = new Array( + inputTokens.length + ).fill(constants.BIGDECIMAL_ZERO); + + this.pool.outputTokenSupply = constants.BIGINT_ZERO; + this.pool.outputTokenPriceUSD = constants.BIGDECIMAL_ZERO; + + this.pool.stakedOutputTokenAmount = constants.BIGINT_ZERO; + this.pool.rewardTokenEmissionsAmount = []; + this.pool.rewardTokenEmissionsUSD = []; + + this.pool._lastSnapshotDayID = constants.BIGINT_ZERO; + this.pool._lastSnapshotHourID = constants.BIGINT_ZERO; + this.pool._lastUpdateTimestamp = event.block.timestamp; + + this.pool.longOpenInterest = constants.BIGINT_ZERO; + this.pool.shortOpenInterest = constants.BIGINT_ZERO; + this.pool.totalOpenInterest = constants.BIGINT_ZERO; + this.save(); + + this.protocol.addPool(); + } + + private save(): void { + this.pool._lastUpdateTimestamp = this.protocol.event.block.timestamp; + this.pool.save(); + } + + getBytesID(): Bytes { + return this.pool.id; + } + + getInputTokens(): Bytes[] { + return this.pool.inputTokens; + } + + getOutputToken(): Bytes { + if (!this.pool.outputToken) return Bytes.empty(); + + return this.pool.outputToken!; + } + + setPoolFee( + feeType: constants.LiquidityPoolFeeType, + feePercentage: BigDecimal | null = null + ): void { + const feeId = Bytes.fromUTF8(feeType) + .concat(Bytes.fromUTF8("-")) + .concat(this.getBytesID()); + + let fees = LiquidityPoolFee.load(feeId); + if (!fees) { + fees = new LiquidityPoolFee(feeId); + fees.feeType = feeType; + + if (!this.pool.fees.includes(feeId)) { + const poolFees = this.pool.fees; + poolFees.push(feeId); + + this.pool.fees = poolFees; + this.save(); + } + } + + fees.feePercentage = feePercentage; + fees.save(); + } + + /** + * Updates the total value locked for this pool to the given value. + * Will also update the protocol's total value locked based on the change in this pool's. + */ + setTotalValueLocked(newTVL: BigDecimal): void { + const delta = newTVL.minus(this.pool.totalValueLockedUSD); + this.addTotalValueLocked(delta); + } + + /** + * Adds the given delta to the total value locked for this pool. + * Will also update the protocol's total value locked based on the change in this pool's. + * + * @param delta The change in total value locked for this pool. + */ + addTotalValueLocked(delta: BigDecimal): void { + this.pool.totalValueLockedUSD = this.pool.totalValueLockedUSD.plus(delta); + this.save(); + + this.protocol.addTotalValueLocked(delta); + } + + /** + * Recalculates the total value locked for this pool based on its current input token balance. + * This function will also update the protocol's total value locked based on the change in this pool's. + */ + refreshTotalValueLocked(): void { + let totalValueLockedUSD = constants.BIGDECIMAL_ZERO; + + for (let idx = 0; idx < this.pool.inputTokens.length; idx++) { + const inputTokenBalance = this.pool.inputTokenBalances[idx]; + const inputToken = this.tokens.getOrCreateTokenFromBytes( + this.pool.inputTokens[idx] + ); + + const amountUSD = this.getInputTokenAmountPrice( + inputToken, + inputTokenBalance + ); + totalValueLockedUSD = totalValueLockedUSD.plus(amountUSD); + } + + this.setTotalValueLocked(totalValueLockedUSD); + // this.refreshInputTokenWeights(); + } + + /** + * Adds the given delta to the cumulative volume for this pool. + * Will also update the protocol's total volume on the change in this pool's. + * @param delta The change in total value locked for this pool. + */ + addVolume(delta: BigDecimal): void { + this.pool.cumulativeVolumeUSD = this.pool.cumulativeVolumeUSD.plus(delta); + this.save(); + + this.protocol.addVolume(delta); + } + + /** + * Adds a given USD value to the pool and protocol supplySideRevenue. It can be a positive or negative amount. + * Same as for the rest of setters, this is mostly to be called internally by the library. + * But you can use it if you need to. It will also update the protocol's snapshots. + * @param rev {BigDecimal} The value to add to the protocol's supplySideRevenue. + */ + private addSupplySideRevenueUSD(rev: BigDecimal): void { + this.pool.cumulativeTotalRevenueUSD = + this.pool.cumulativeTotalRevenueUSD.plus(rev); + this.pool.cumulativeSupplySideRevenueUSD = + this.pool.cumulativeSupplySideRevenueUSD.plus(rev); + this.save(); + + this.protocol.addSupplySideRevenueUSD(rev); + } + + /** + * Adds a given USD value to the pool and protocol protocolSideRevenue. It can be a positive or negative amount. + * Same as for the rest of setters, this is mostly to be called internally by the library. + * But you can use it if you need to. It will also update the protocol's snapshots. + * @param rev {BigDecimal} The value to add to the protocol's protocolSideRevenue. + */ + private addProtocolSideRevenueUSD(rev: BigDecimal): void { + this.pool.cumulativeTotalRevenueUSD = + this.pool.cumulativeTotalRevenueUSD.plus(rev); + this.pool.cumulativeProtocolSideRevenueUSD = + this.pool.cumulativeProtocolSideRevenueUSD.plus(rev); + this.save(); + + this.protocol.addProtocolSideRevenueUSD(rev); + } + + /** + * Adds a given USD value to the pool and protocol's supplySideRevenue and protocolSideRevenue. It can be a positive or negative amount. + * Same as for the rest of setters, this is mostly to be called internally by the library. + * But you can use it if you need to. It will also update the protocol's snapshots. + * @param protocolSide {BigDecimal} The value to add to the protocol's protocolSideRevenue. + * @param supplySide {BigDecimal} The value to add to the protocol's supplySideRevenue. + */ + addRevenueUSD(protocolSide: BigDecimal, supplySide: BigDecimal): void { + this.addSupplySideRevenueUSD(supplySide); + this.addProtocolSideRevenueUSD(protocolSide); + } + + addRevenueByToken( + token: TokenSchema, + protocolSide: BigInt, + supplySide: BigInt + ): void { + const pAmountUSD = this.protocol.pricer.getAmountValueUSD( + token, + protocolSide + ); + const sAmountUSD = this.protocol.pricer.getAmountValueUSD( + token, + supplySide + ); + + this.addRevenueUSD(pAmountUSD, sAmountUSD); + } + + /** + * Adds a given USD value to the pool and protocol entryPremium. It can be a positive or negative amount. + * Same as for the rest of setters, this is mostly to be called internally by the library. + * But you can use it if you need to. It will also update the protocol's snapshots. + * @param premium {BigDecimal} The value to add to the pool and protocol's entryPremium. + */ + private addEntryPremiumUSD(premium: BigDecimal): void { + this.pool.cumulativeTotalPremiumUSD = + this.pool.cumulativeTotalPremiumUSD.plus(premium); + this.pool.cumulativeEntryPremiumUSD = + this.pool.cumulativeEntryPremiumUSD.plus(premium); + this.save(); + + this.protocol.addEntryPremiumUSD(premium); + } + + /** + * Adds a given USD value to the pool and protocol exitPremium. It can be a positive or negative amount. + * Same as for the rest of setters, this is mostly to be called internally by the library. + * But you can use it if you need to. It will also update the protocol's snapshots. + * @param premium {BigDecimal} The value to add to the pool and protocol's entryPremium. + */ + private addExitPremiumUSD(premium: BigDecimal): void { + this.pool.cumulativeTotalPremiumUSD = + this.pool.cumulativeTotalPremiumUSD.plus(premium); + this.pool.cumulativeExitPremiumUSD = + this.pool.cumulativeExitPremiumUSD.plus(premium); + this.save(); + + this.protocol.addExitPremiumUSD(premium); + } + + /** + * Adds a given USD value to the pool and protocol depositPremium. It can be a positive or negative amount. + * Same as for the rest of setters, this is mostly to be called internally by the library. + * But you can use it if you need to. It will also update the protocol's snapshots. + * @param premium {BigDecimal} The value to add to the pool and protocol's depositPremium. + */ + private addDepositPremiumUSD(premium: BigDecimal): void { + this.pool.cumulativeTotalLiquidityPremiumUSD = + this.pool.cumulativeTotalLiquidityPremiumUSD.plus(premium); + this.pool.cumulativeDepositPremiumUSD = + this.pool.cumulativeDepositPremiumUSD.plus(premium); + this.save(); + + this.protocol.addDepositPremiumUSD(premium); + } + + /** + * Adds a given USD value to the pool and protocol withdrawPremium. It can be a positive or negative amount. + * Same as for the rest of setters, this is mostly to be called internally by the library. + * But you can use it if you need to. It will also update the protocol's snapshots. + * @param premium {BigDecimal} The value to add to the pool and protocol's withdrawPremium. + */ + private addWithdrawPremiumUSD(premium: BigDecimal): void { + this.pool.cumulativeTotalLiquidityPremiumUSD = + this.pool.cumulativeTotalLiquidityPremiumUSD.plus(premium); + this.pool.cumulativeWithdrawPremiumUSD = + this.pool.cumulativeWithdrawPremiumUSD.plus(premium); + this.save(); + + this.protocol.addWithdrawPremiumUSD(premium); + } + + addPremiumByToken( + token: TokenSchema, + amount: BigInt, + transactionType: TransactionType + ): void { + const premiumUSD = this.protocol.pricer.getAmountValueUSD(token, amount); + + if (transactionType == TransactionType.DEPOSIT) { + this.addDepositPremiumUSD(premiumUSD); + } + if (transactionType == TransactionType.WITHDRAW) { + this.addWithdrawPremiumUSD(premiumUSD); + } + if (transactionType == TransactionType.COLLATERAL_IN) { + this.addEntryPremiumUSD(premiumUSD); + } + if (transactionType == TransactionType.COLLATERAL_OUT) { + this.addExitPremiumUSD(premiumUSD); + } + } + + /** + * Adds a given USD value to the pool's long and total openInterestUSD. + * + * @param amountChangeUSD {BigDecimal} The value to add to the pool's openInterest in USD. + */ + + updateLongOpenInterest(amountChange: BigInt, price: BigInt): void { + const longOpenInterest = this.pool.longOpenInterest.plus(amountChange); + const totalOpenInterest = this.pool.totalOpenInterest.plus(amountChange); + + this.pool.totalOpenInterest = totalOpenInterest; + this.pool.longOpenInterest = longOpenInterest; + + const longOpenInterestUSD = bigIntToBigDecimal(longOpenInterest).times( + bigIntToBigDecimal(price) + ); + const totalOpenInterestUSD = bigIntToBigDecimal(totalOpenInterest).times( + bigIntToBigDecimal(price) + ); + const amountChangeUSD = longOpenInterestUSD.minus( + this.pool.longOpenInterestUSD + ); + + this.pool.totalOpenInterestUSD = totalOpenInterestUSD; + this.pool.longOpenInterestUSD = longOpenInterestUSD; + this.save(); + this.protocol.updateLongOpenInterestUSD(amountChangeUSD); + } + + setLongOpenInterest(amount: BigInt, price: BigInt): void { + const longOpenInterest = amount; + const totalOpenInterest = this.pool.totalOpenInterest.plus( + longOpenInterest.minus(this.pool.longOpenInterest) + ); + + this.pool.totalOpenInterest = totalOpenInterest; + this.pool.longOpenInterest = longOpenInterest; + + const longOpenInterestUSD = bigIntToBigDecimal(longOpenInterest).times( + bigIntToBigDecimal(price) + ); + const totalOpenInterestUSD = bigIntToBigDecimal(totalOpenInterest).times( + bigIntToBigDecimal(price) + ); + const amountChangeUSD = longOpenInterestUSD.minus( + this.pool.longOpenInterestUSD + ); + + this.pool.totalOpenInterestUSD = totalOpenInterestUSD; + this.pool.longOpenInterestUSD = longOpenInterestUSD; + this.save(); + this.protocol.updateLongOpenInterestUSD(amountChangeUSD); + } + + setShortOpenInterest(amount: BigInt, price: BigInt): void { + const shortOpenInterest = amount; + const totalOpenInterest = this.pool.totalOpenInterest.plus( + shortOpenInterest.minus(this.pool.shortOpenInterest) + ); + + this.pool.totalOpenInterest = totalOpenInterest; + this.pool.shortOpenInterest = shortOpenInterest; + const shortOpenInterestUSD = bigIntToBigDecimal(shortOpenInterest).times( + bigIntToBigDecimal(price) + ); + const totalOpenInterestUSD = bigIntToBigDecimal(totalOpenInterest).times( + bigIntToBigDecimal(price) + ); + const amountChangeUSD = shortOpenInterestUSD.minus( + this.pool.shortOpenInterestUSD + ); + + this.pool.totalOpenInterestUSD = totalOpenInterestUSD; + this.pool.shortOpenInterestUSD = shortOpenInterestUSD; + this.save(); + this.protocol.updateShortOpenInterestUSD(amountChangeUSD); + } + + updateShortOpenInterest(amountChange: BigInt, price: BigInt): void { + const shortOpenInterest = this.pool.shortOpenInterest.plus(amountChange); + const totalOpenInterest = this.pool.totalOpenInterest.plus(amountChange); + + this.pool.totalOpenInterest = totalOpenInterest; + this.pool.shortOpenInterest = shortOpenInterest; + const shortOpenInterestUSD = bigIntToBigDecimal(shortOpenInterest).times( + bigIntToBigDecimal(price) + ); + const totalOpenInterestUSD = bigIntToBigDecimal(totalOpenInterest).times( + bigIntToBigDecimal(price) + ); + const amountChangeUSD = shortOpenInterestUSD.minus( + this.pool.shortOpenInterestUSD + ); + + this.pool.totalOpenInterestUSD = totalOpenInterestUSD; + this.pool.shortOpenInterestUSD = shortOpenInterestUSD; + this.save(); + this.protocol.updateShortOpenInterestUSD(amountChangeUSD); + } + updateLongOpenInterestUSD(amountChangeUSD: BigDecimal): void { + this.pool.totalOpenInterestUSD = + this.pool.totalOpenInterestUSD.plus(amountChangeUSD); + this.pool.longOpenInterestUSD = + this.pool.longOpenInterestUSD.plus(amountChangeUSD); + + this.save(); + this.protocol.updateLongOpenInterestUSD(amountChangeUSD); + } + + /** + * Adds a given USD value to the pool's short and total openInterestUSD. + * + * @param amountChangeUSD {BigDecimal} The value to add to the pool's openInterest in USD. + */ + updateShortOpenInterestUSD(amountChangeUSD: BigDecimal): void { + this.pool.totalOpenInterestUSD = + this.pool.totalOpenInterestUSD.plus(amountChangeUSD); + this.pool.shortOpenInterestUSD = + this.pool.shortOpenInterestUSD.plus(amountChangeUSD); + + this.save(); + this.protocol.updateShortOpenInterestUSD(amountChangeUSD); + } + + /** + * Adds a given USD value to the pool InflowVolumeUSD. It can be a positive or negative amount. + * @param volume {BigDecimal} The value to add to the pool's InflowVolumeUSD. + */ + addInflowVolumeUSD(volume: BigDecimal): void { + this.pool.cumulativeInflowVolumeUSD = + this.pool.cumulativeInflowVolumeUSD.plus(volume); + this.save(); + + this.protocol.addInflowVolumeUSD(volume); + } + + /** + * Adds a given USD value to the pool ClosedInflowVolumeUSD. It can be a positive or negative amount. + * @param volume {BigDecimal} The value to add to the pool's ClosedInflowVolumeUSD. + */ + addClosedInflowVolumeUSD(volume: BigDecimal): void { + this.pool.cumulativeClosedInflowVolumeUSD = + this.pool.cumulativeClosedInflowVolumeUSD.plus(volume); + this.save(); + + this.protocol.addClosedInflowVolumeUSD(volume); + } + + /** + * Adds a given USD value to the pool OutflowVolumeUSD. It can be a positive or negative amount. + * @param volume {BigDecimal} The value to add to the pool's OutflowVolumeUSD. + */ + addOutflowVolumeUSD(volume: BigDecimal): void { + this.pool.cumulativeOutflowVolumeUSD = + this.pool.cumulativeOutflowVolumeUSD.plus(volume); + this.save(); + + this.protocol.addOutflowVolumeUSD(volume); + } + + /** + * Adds a given amount to the pool's outputTokenSupply. It should only be used for pools + * of type LIQUIDITY. Or pools that emit some kind of LP token on deposit. + * @param amount + */ + addOutputTokenSupply(amount: BigInt): void { + this.setOutputTokenSupply( + this.pool.outputTokenSupply + ? this.pool.outputTokenSupply!.plus(amount) + : amount + ); + } + + /** + * Sets the pool's outputTokenSupply value. It should only be used for pools + * of type LIQUIDITY. Or pools that emit some kind of LP token on deposit. + * It will also update the outputTokenPriceUSD value. + * @param amount + */ + setOutputTokenSupply(amount: BigInt): void { + this.pool.outputTokenSupply = amount; + this.refreshOutputTokenPriceUSD(); + this.save(); + } + + /** + * Updates the price of the pool's output token in USD. + * This is automatically called when changing the output token supply via setOutputTokenSupply + * but can be called manually if necessary. + */ + refreshOutputTokenPriceUSD(): void { + if (!this.pool.outputToken) return; + + const token = this.tokens.getOrCreateTokenFromBytes(this.pool.outputToken!); + const price = this.protocol.pricer.getTokenPrice(token); + + this.pool.outputTokenPriceUSD = price; + this.save(); + } + + /** + * Adds a given amount to the pool's stakedOutputTokenAmount. + * @param amount + * @returns + */ + addStakedOutputTokenAmount(amount: BigInt): void { + this.setStakedOutputTokenAmount( + this.pool.stakedOutputTokenAmount + ? this.pool.stakedOutputTokenAmount!.plus(amount) + : amount + ); + } + + /** + * Sets the pool's stakedOutputTokenAmount value. + * @param amount + */ + setStakedOutputTokenAmount(amount: BigInt): void { + this.pool.stakedOutputTokenAmount = amount; + this.save(); + } + + /** + * Utility function to convert some amount of input token to USD. + * + * @param amount the amount of inputTokens to convert to USD + * @returns The converted amount. + */ + getInputTokenAmountPrice(token: TokenSchema, amount: BigInt): BigDecimal { + const price = this.protocol.getTokenPricer().getTokenPrice(token); + token.lastPriceUSD = price; + token.save(); + + return amount.divDecimal(exponentToBigDecimal(token.decimals)).times(price); + } + + /** + * Recalculates the input token weights for this pool based on its current input token tvl. + */ + refreshInputTokenWeights(): void { + const inputTokenWeights: BigDecimal[] = []; + + for (let idx = 0; idx < this.pool.inputTokens.length; idx++) { + const inputTokenBalance = this.pool.inputTokenBalances[idx]; + const inputToken = this.tokens.getOrCreateTokenFromBytes( + this.pool.inputTokens[idx] + ); + const inputTokenTVL = this.getInputTokenAmountPrice( + inputToken, + inputTokenBalance + ); + + inputTokenWeights.push( + inputTokenTVL + .div(this.pool.totalValueLockedUSD) + .times(constants.BIGDECIMAL_HUNDRED) + ); + } + + this.pool.inputTokenWeights = inputTokenWeights; + this.pool.save(); + } + + /** + * Sets the pool's input token balances to the given amount. It will optionally + * update the pool's and protocol's total value locked. If not stated, will default to true. + * + * @param newBalances amount to be set as the pool's input token balance. + * @param updateMetrics optional parameter to indicate whether to update the pool's and protocol's total value locked. + */ + setInputTokenBalances( + newBalances: BigInt[], + updateMetrics: boolean = true + ): void { + this.pool.inputTokenBalances = newBalances; + this.save(); + + if (updateMetrics) this.refreshTotalValueLocked(); + } + + addInputTokenBalances( + amounts: BigInt[], + updateMetrics: boolean = true + ): void { + if (amounts.length != this.pool.inputTokenBalances.length) { + return; + } + + const newBalances = addArrays( + this.pool.inputTokenBalances, + amounts + ); + this.setInputTokenBalances(newBalances, updateMetrics); + } + /** + * Sets the pool fundingRate. + * @param fundingrate pool funding rate. + */ + setFundingRate(fundingrate: BigDecimal[]): void { + this.pool.fundingrate = fundingrate; + this.pool.save(); + } + + /** + * Sets the rewardTokenEmissions and its USD value for a given reward token. + * It will also create the RewardToken entity and add it to the pool rewardTokens array + * if not already present. + * @param type The type of reward token + * @param token The actual token being rewarded + * @param amount The daily amount of reward tokens emitted to this pool + */ + setRewardEmissions( + type: constants.RewardTokenType, + token: TokenSchema, + amount: BigInt + ): void { + const rToken = this.tokens.getOrCreateRewardToken(token, type); + const amountUSD = this.protocol.pricer.getAmountValueUSD(token, amount); + if (!this.pool.rewardTokens) { + this.pool.rewardTokens = [rToken.id]; + this.pool.rewardTokenEmissionsAmount = [amount]; + this.pool.rewardTokenEmissionsUSD = [amountUSD]; + this.save(); + return; + } + + if (this.pool.rewardTokens!.includes(rToken.id)) { + const index = this.pool.rewardTokens!.indexOf(rToken.id); + this.pool.rewardTokenEmissionsAmount = updateArrayAtIndex( + this.pool.rewardTokenEmissionsAmount!, + amount, + index + ); + this.pool.rewardTokenEmissionsUSD = updateArrayAtIndex( + this.pool.rewardTokenEmissionsUSD!, + amountUSD, + index + ); + this.save(); + return; + } + + const tokens = this.pool.rewardTokens!.concat([rToken.id]); + const newOrder = sortBytesArray(tokens); + + let amounts = this.pool.rewardTokenEmissionsAmount!.concat([amount]); + let amountsUSD = this.pool.rewardTokenEmissionsUSD!.concat([amountUSD]); + amounts = sortArrayByReference(newOrder, tokens, amounts); + amountsUSD = sortArrayByReference(newOrder, tokens, amountsUSD); + + this.pool.rewardTokens = tokens; + this.pool.rewardTokenEmissionsAmount = amounts; + this.pool.rewardTokenEmissionsUSD = amountsUSD; + this.save(); + } + + /** + * Adds some value to the cumulativeUniqueUsers counter. If the value is omitted it will default to 1. + * If you are loading accounts with the AccountManager you won't need to use this method. + * @param count {u8} The value to add to the counter. + */ + addUser(count: u8 = 1): void { + this.pool.cumulativeUniqueUsers += count; + this.save(); + } + + /** + * Adds some value to the cumulativeUniqueDepositors counter. If the value is omitted it will default to 1. + * If you are loading accounts with the AccountManager you won't need to use this method. + * @param count {u8} The value to add to the counter. + */ + addDepositor(count: u8 = 1): void { + this.pool.cumulativeUniqueDepositors += count; + this.save(); + } + + /** + * Adds some value to the cumulativeUniqueBorrowers counter. If the value is omitted it will default to 1. + * If you are loading accounts with the AccountManager you won't need to use this method. + * @param count {u8} The value to add to the counter. + */ + addBorrower(count: u8 = 1): void { + this.pool.cumulativeUniqueBorrowers += count; + this.save(); + } + + /** + * Adds some value to the cumulativeUniqueLiquidators counter. If the value is omitted it will default to 1. + * @param count {u8} The value to add to the counter. + */ + addLiquidator(count: u8 = 1): void { + this.pool.cumulativeUniqueLiquidators += count; + this.save(); + } + + /** + * Adds some value to the cumulativeUniqueLiquidatees counter. If the value is omitted it will default to 1. + * @param count {u8} The value to add to the counter. + */ + addLiquidatee(count: u8 = 1): void { + this.pool.cumulativeUniqueLiquidatees += count; + this.save(); + } + + /** + * Adds 1 to the cumulativePositionCount counter and adds 1 to the counter corresponding the given position type. + * @param positionSide {PositionType} The type of transaction to add. + * @see PositionType + * @see Account + */ + openPosition(positionSide: PositionType): void { + if (positionSide == PositionType.LONG) { + this.pool.longPositionCount += 1; + } else if (positionSide == PositionType.SHORT) { + this.pool.shortPositionCount += 1; + } + + this.pool.openPositionCount += 1; + this.pool.cumulativePositionCount += 1; + this.save(); + } + + /** + * Subtracts 1 to the cumulativePositionCount counter and adds 1 to the counter corresponding the given position type. + * @param positionSide {PositionType} The type of transaction to add. + * @see PositionType + * @see Account + */ + closePosition(positionSide: PositionType): void { + if (positionSide == PositionType.LONG) { + this.pool.longPositionCount -= 1; + } else if (positionSide == PositionType.SHORT) { + this.pool.shortPositionCount -= 1; + } + + this.pool.openPositionCount -= 1; + this.pool.closedPositionCount += 1; + this.save(); + } + + /** + * Adds the volume of a given input token by its amount and its USD value. + * It will also add the amount to the total volume of the pool and the protocol + * @param token The input token + * @param amount The amount of the token + */ + addVolumeByToken(token: TokenSchema, amount: BigInt): void { + const amountUSD = this.protocol.pricer.getAmountValueUSD(token, amount); + + const tokenIndex = this.pool.inputTokens.indexOf(token.id); + if (tokenIndex == -1) return; + + const cumulativeVolumeByTokenAmount = + this.pool.cumulativeVolumeByTokenAmount; + const cumulativeVolumeByTokenUSD = this.pool.cumulativeVolumeByTokenUSD; + + cumulativeVolumeByTokenAmount[tokenIndex] = + cumulativeVolumeByTokenAmount[tokenIndex].plus(amount); + cumulativeVolumeByTokenUSD[tokenIndex] = + cumulativeVolumeByTokenUSD[tokenIndex].plus(amountUSD); + + this.pool.cumulativeVolumeByTokenUSD = cumulativeVolumeByTokenUSD; + this.pool.cumulativeVolumeByTokenAmount = cumulativeVolumeByTokenAmount; + + this.save(); + this.addVolume(amountUSD); + } + + /** + * Adds the inflow volume of a given input token by its amount and its USD value. + * It will also add the amount to the total inflow volume of the pool and the protocol + * @param token The input token + * @param amount The amount of the token + */ + addInflowVolumeByToken(token: TokenSchema, amount: BigInt): void { + const amountUSD = this.protocol.pricer.getAmountValueUSD(token, amount); + + const tokenIndex = this.pool.inputTokens.indexOf(token.id); + if (tokenIndex == -1) return; + + const cumulativeInflowVolumeByTokenAmount = + this.pool.cumulativeInflowVolumeByTokenAmount; + const cumulativeInflowVolumeByTokenUSD = + this.pool.cumulativeInflowVolumeByTokenUSD; + + cumulativeInflowVolumeByTokenAmount[tokenIndex] = + cumulativeInflowVolumeByTokenAmount[tokenIndex].plus(amount); + cumulativeInflowVolumeByTokenUSD[tokenIndex] = + cumulativeInflowVolumeByTokenUSD[tokenIndex].plus(amountUSD); + + this.pool.cumulativeInflowVolumeByTokenAmount = + cumulativeInflowVolumeByTokenAmount; + this.pool.cumulativeInflowVolumeByTokenUSD = + cumulativeInflowVolumeByTokenUSD; + + this.save(); + this.addInflowVolumeUSD(amountUSD); + } + + /** + * Adds the outflow volume of a given input token by its amount and its USD value. + * It will also add the amount to the total outflow volume of the pool and the protocol + * @param token The input token + * @param amount The amount of the token + */ + addOutflowVolumeByToken(token: TokenSchema, amount: BigInt): void { + const amountUSD = this.protocol.pricer.getAmountValueUSD(token, amount); + + const tokenIndex = this.pool.inputTokens.indexOf(token.id); + if (tokenIndex == -1) return; + + const cumulativeOutflowVolumeByTokenAmount = + this.pool.cumulativeOutflowVolumeByTokenAmount; + const cumulativeOutflowVolumeByTokenUSD = + this.pool.cumulativeOutflowVolumeByTokenUSD; + + cumulativeOutflowVolumeByTokenAmount[tokenIndex] = + cumulativeOutflowVolumeByTokenAmount[tokenIndex].plus(amount); + cumulativeOutflowVolumeByTokenUSD[tokenIndex] = + cumulativeOutflowVolumeByTokenUSD[tokenIndex].plus(amountUSD); + + this.pool.cumulativeOutflowVolumeByTokenAmount = + cumulativeOutflowVolumeByTokenAmount; + this.pool.cumulativeOutflowVolumeByTokenUSD = + cumulativeOutflowVolumeByTokenUSD; + + this.save(); + this.addOutflowVolumeUSD(amountUSD); + } + + /** + * Adds the closed inflow volume of a given input token by its amount and its USD value. + * It will also add the amount to the total closed inflow volume of the pool and the protocol + * @param token The input token + * @param amount The amount of the token + */ + addClosedInflowVolumeByToken(token: TokenSchema, amount: BigInt): void { + const amountUSD = this.protocol.pricer.getAmountValueUSD(token, amount); + + const tokenIndex = this.pool.inputTokens.indexOf(token.id); + if (tokenIndex == -1) return; + + const cumulativeClosedInflowVolumeByTokenAmount = + this.pool.cumulativeClosedInflowVolumeByTokenAmount; + const cumulativeClosedInflowVolumeByTokenUSD = + this.pool.cumulativeClosedInflowVolumeByTokenUSD; + + cumulativeClosedInflowVolumeByTokenAmount[tokenIndex] = + cumulativeClosedInflowVolumeByTokenAmount[tokenIndex].plus(amount); + cumulativeClosedInflowVolumeByTokenUSD[tokenIndex] = + cumulativeClosedInflowVolumeByTokenUSD[tokenIndex].plus(amountUSD); + + this.pool.cumulativeClosedInflowVolumeByTokenAmount = + cumulativeClosedInflowVolumeByTokenAmount; + this.pool.cumulativeClosedInflowVolumeByTokenUSD = + cumulativeClosedInflowVolumeByTokenUSD; + + this.save(); + this.addClosedInflowVolumeUSD(amountUSD); + } +} diff --git a/subgraphs/kwenta/src/sdk/protocols/perpfutures/poolSnapshot.ts b/subgraphs/kwenta/src/sdk/protocols/perpfutures/poolSnapshot.ts new file mode 100644 index 0000000000..81383f7a91 --- /dev/null +++ b/subgraphs/kwenta/src/sdk/protocols/perpfutures/poolSnapshot.ts @@ -0,0 +1,546 @@ +import { BigDecimal, BigInt, Bytes, log } from "@graphprotocol/graph-ts"; + +import { subtractArrays } from "../../util/arrays"; +import * as constants from "../../util/constants"; +import { CustomEventType, getUnixDays, getUnixHours } from "../../util/events"; +import { initActivityHelper } from "./protocolSnapshot"; + +import { + LiquidityPoolDailySnapshot, + LiquidityPoolHourlySnapshot, + LiquidityPool as PoolSchema, +} from "../../../../generated/schema"; + +/** + * This file contains the PoolSnapshot, which is used to + * make all of the storage changes that occur in the pool daily and hourly snapshots. + * + * Schema Version: 1.3.0 + * SDK Version: 1.1.0 + * Author(s): + * - @harsh9200 + * - @dhruv-chauhan + */ + +export class PoolSnapshot { + pool: PoolSchema; + event: CustomEventType; + dayID: i32; + hourID: i32; + + constructor(pool: PoolSchema, event: CustomEventType) { + this.pool = pool; + this.event = event; + this.dayID = getUnixDays(event.block); + this.hourID = getUnixHours(event.block); + + this.takeSnapshots(); + } + + private takeSnapshots(): void { + if (!this.isInitialized()) return; + + const snapshotDayID = + this.pool._lastUpdateTimestamp!.toI32() / constants.SECONDS_PER_DAY; + const snapshotHourID = + this.pool._lastUpdateTimestamp!.toI32() / constants.SECONDS_PER_HOUR; + + if ( + snapshotDayID != this.dayID && + this.pool._lastSnapshotDayID!.toI32() != snapshotDayID + ) { + this.takeDailySnapshot(snapshotDayID); + this.pool._lastSnapshotDayID = BigInt.fromI32(snapshotDayID); + this.pool.save(); + } + + if ( + snapshotHourID != this.hourID && + this.pool._lastSnapshotHourID!.toI32() != snapshotHourID + ) { + this.takeHourlySnapshot(snapshotHourID); + this.pool._lastSnapshotHourID = BigInt.fromI32(snapshotHourID); + this.pool.save(); + } + } + + private isInitialized(): boolean { + // log.error( + // "[isInitialized] cannot create snapshots, pool: {} not initialized", + // [this.pool.id.toHexString()] + // ); + + return this.pool._lastSnapshotDayID && + this.pool._lastSnapshotHourID && + this.pool._lastUpdateTimestamp + ? true + : false; + } + + private takeHourlySnapshot(hour: i32): void { + const snapshot = new LiquidityPoolHourlySnapshot( + this.pool.id.concatI32(hour) + ); + + const previousSnapshot = LiquidityPoolHourlySnapshot.load( + this.pool.id.concatI32(this.pool._lastSnapshotHourID!.toI32()) + ); + + snapshot.hours = hour; + snapshot.pool = this.pool.id; + snapshot.protocol = this.pool.protocol; + + snapshot.totalValueLockedUSD = this.pool.totalValueLockedUSD; + + snapshot.cumulativeSupplySideRevenueUSD = + this.pool.cumulativeSupplySideRevenueUSD; + snapshot.hourlySupplySideRevenueUSD = previousSnapshot + ? snapshot.cumulativeSupplySideRevenueUSD.minus( + previousSnapshot.cumulativeSupplySideRevenueUSD + ) + : snapshot.cumulativeSupplySideRevenueUSD; + + snapshot.cumulativeProtocolSideRevenueUSD = + this.pool.cumulativeProtocolSideRevenueUSD; + snapshot.hourlyProtocolSideRevenueUSD = previousSnapshot + ? snapshot.cumulativeProtocolSideRevenueUSD.minus( + previousSnapshot.cumulativeProtocolSideRevenueUSD + ) + : snapshot.cumulativeProtocolSideRevenueUSD; + + snapshot.cumulativeTotalRevenueUSD = this.pool.cumulativeTotalRevenueUSD; + snapshot.hourlyTotalRevenueUSD = previousSnapshot + ? snapshot.cumulativeTotalRevenueUSD.minus( + previousSnapshot.cumulativeTotalRevenueUSD + ) + : snapshot.cumulativeTotalRevenueUSD; + + snapshot.hourlyFundingrate = this.pool.fundingrate; + + snapshot.hourlyLongOpenInterestUSD = this.pool.longOpenInterestUSD; + snapshot.hourlyShortOpenInterestUSD = this.pool.shortOpenInterestUSD; + snapshot.hourlyTotalOpenInterestUSD = this.pool.totalOpenInterestUSD; + + snapshot.cumulativeEntryPremiumUSD = this.pool.cumulativeEntryPremiumUSD; + snapshot.hourlyEntryPremiumUSD = previousSnapshot + ? snapshot.cumulativeEntryPremiumUSD.minus( + previousSnapshot.cumulativeEntryPremiumUSD + ) + : snapshot.cumulativeEntryPremiumUSD; + + snapshot.cumulativeExitPremiumUSD = this.pool.cumulativeExitPremiumUSD; + snapshot.hourlyExitPremiumUSD = previousSnapshot + ? snapshot.cumulativeExitPremiumUSD.minus( + previousSnapshot.cumulativeExitPremiumUSD + ) + : snapshot.cumulativeExitPremiumUSD; + + snapshot.cumulativeTotalPremiumUSD = this.pool.cumulativeTotalPremiumUSD; + snapshot.hourlyTotalPremiumUSD = previousSnapshot + ? snapshot.cumulativeTotalPremiumUSD.minus( + previousSnapshot.cumulativeTotalPremiumUSD + ) + : snapshot.cumulativeTotalPremiumUSD; + + snapshot.cumulativeDepositPremiumUSD = + this.pool.cumulativeDepositPremiumUSD; + snapshot.hourlyDepositPremiumUSD = previousSnapshot + ? snapshot.cumulativeDepositPremiumUSD.minus( + previousSnapshot.cumulativeDepositPremiumUSD + ) + : snapshot.cumulativeDepositPremiumUSD; + + snapshot.cumulativeWithdrawPremiumUSD = + this.pool.cumulativeWithdrawPremiumUSD; + snapshot.hourlyWithdrawPremiumUSD = previousSnapshot + ? snapshot.cumulativeWithdrawPremiumUSD.minus( + previousSnapshot.cumulativeWithdrawPremiumUSD + ) + : snapshot.cumulativeWithdrawPremiumUSD; + + snapshot.cumulativeTotalLiquidityPremiumUSD = + this.pool.cumulativeTotalLiquidityPremiumUSD; + snapshot.hourlyTotalLiquidityPremiumUSD = previousSnapshot + ? snapshot.cumulativeTotalLiquidityPremiumUSD.minus( + previousSnapshot.cumulativeTotalLiquidityPremiumUSD + ) + : snapshot.cumulativeTotalLiquidityPremiumUSD; + + snapshot.cumulativeVolumeByTokenUSD = this.pool.cumulativeVolumeByTokenUSD; + snapshot.hourlyVolumeByTokenUSD = previousSnapshot + ? subtractArrays( + snapshot.cumulativeVolumeByTokenUSD, + previousSnapshot.cumulativeVolumeByTokenUSD + ) + : snapshot.cumulativeVolumeByTokenUSD; + + snapshot.cumulativeVolumeByTokenAmount = + this.pool.cumulativeVolumeByTokenAmount; + snapshot.hourlyVolumeByTokenAmount = previousSnapshot + ? subtractArrays( + snapshot.cumulativeVolumeByTokenAmount, + previousSnapshot.cumulativeVolumeByTokenAmount + ) + : snapshot.cumulativeVolumeByTokenAmount; + + snapshot.cumulativeVolumeUSD = this.pool.cumulativeVolumeUSD; + snapshot.hourlyVolumeUSD = previousSnapshot + ? snapshot.cumulativeVolumeUSD.minus(previousSnapshot.cumulativeVolumeUSD) + : snapshot.cumulativeVolumeUSD; + + snapshot.cumulativeInflowVolumeByTokenUSD = + this.pool.cumulativeInflowVolumeByTokenUSD; + snapshot.hourlyInflowVolumeByTokenUSD = previousSnapshot + ? subtractArrays( + snapshot.cumulativeInflowVolumeByTokenUSD, + previousSnapshot.cumulativeInflowVolumeByTokenUSD + ) + : snapshot.cumulativeInflowVolumeByTokenUSD; + + snapshot.cumulativeInflowVolumeByTokenAmount = + this.pool.cumulativeInflowVolumeByTokenAmount; + snapshot.hourlyInflowVolumeByTokenAmount = previousSnapshot + ? subtractArrays( + snapshot.cumulativeInflowVolumeByTokenAmount, + previousSnapshot.cumulativeInflowVolumeByTokenAmount + ) + : snapshot.cumulativeInflowVolumeByTokenAmount; + + snapshot.cumulativeInflowVolumeUSD = this.pool.cumulativeInflowVolumeUSD; + snapshot.hourlyInflowVolumeUSD = previousSnapshot + ? snapshot.cumulativeInflowVolumeUSD.minus( + previousSnapshot.cumulativeInflowVolumeUSD + ) + : snapshot.cumulativeInflowVolumeUSD; + + snapshot.cumulativeClosedInflowVolumeByTokenUSD = + this.pool.cumulativeClosedInflowVolumeByTokenUSD; + snapshot.hourlyClosedInflowVolumeByTokenUSD = previousSnapshot + ? subtractArrays( + snapshot.cumulativeClosedInflowVolumeByTokenUSD, + previousSnapshot.cumulativeClosedInflowVolumeByTokenUSD + ) + : snapshot.cumulativeClosedInflowVolumeByTokenUSD; + + snapshot.cumulativeClosedInflowVolumeByTokenAmount = + this.pool.cumulativeInflowVolumeByTokenAmount; + snapshot.hourlyClosedInflowVolumeByTokenAmount = previousSnapshot + ? subtractArrays( + snapshot.cumulativeClosedInflowVolumeByTokenAmount, + previousSnapshot.cumulativeClosedInflowVolumeByTokenAmount + ) + : snapshot.cumulativeClosedInflowVolumeByTokenAmount; + + snapshot.cumulativeClosedInflowVolumeUSD = + this.pool.cumulativeClosedInflowVolumeUSD; + snapshot.hourlyClosedInflowVolumeUSD = previousSnapshot + ? snapshot.cumulativeClosedInflowVolumeUSD.minus( + previousSnapshot.cumulativeClosedInflowVolumeUSD + ) + : snapshot.cumulativeClosedInflowVolumeUSD; + + snapshot.cumulativeOutflowVolumeByTokenUSD = + this.pool.cumulativeOutflowVolumeByTokenUSD; + snapshot.hourlyOutflowVolumeByTokenUSD = previousSnapshot + ? subtractArrays( + snapshot.cumulativeOutflowVolumeByTokenUSD, + previousSnapshot.cumulativeOutflowVolumeByTokenUSD + ) + : snapshot.cumulativeOutflowVolumeByTokenUSD; + + snapshot.cumulativeOutflowVolumeByTokenAmount = + this.pool.cumulativeOutflowVolumeByTokenAmount; + snapshot.hourlyOutflowVolumeByTokenAmount = previousSnapshot + ? subtractArrays( + snapshot.cumulativeOutflowVolumeByTokenAmount, + previousSnapshot.cumulativeOutflowVolumeByTokenAmount + ) + : snapshot.cumulativeOutflowVolumeByTokenAmount; + + snapshot.cumulativeOutflowVolumeUSD = this.pool.cumulativeOutflowVolumeUSD; + snapshot.hourlyOutflowVolumeUSD = previousSnapshot + ? snapshot.cumulativeOutflowVolumeUSD.minus( + previousSnapshot.cumulativeOutflowVolumeUSD + ) + : snapshot.cumulativeOutflowVolumeUSD; + + snapshot.inputTokenBalances = this.pool.inputTokenBalances; + snapshot.inputTokenWeights = this.pool.inputTokenWeights; + snapshot.outputTokenSupply = this.pool.outputTokenSupply; + snapshot.outputTokenPriceUSD = this.pool.outputTokenPriceUSD; + snapshot.stakedOutputTokenAmount = this.pool.stakedOutputTokenAmount; + snapshot.rewardTokenEmissionsAmount = this.pool.rewardTokenEmissionsAmount; + snapshot.rewardTokenEmissionsUSD = this.pool.rewardTokenEmissionsUSD; + + snapshot.marketSize = this.pool.marketSize; + snapshot.marketSkew = this.pool.marketSkew; + + snapshot.longOpenInterest = this.pool.longOpenInterest; + snapshot.shortOpenInterest = this.pool.shortOpenInterest; + snapshot.totalOpenInterest = this.pool.totalOpenInterest; + snapshot.save(); + } + + private takeDailySnapshot(day: i32): void { + const snapshot = new LiquidityPoolDailySnapshot( + this.pool.id.concatI32(day) + ); + const previousSnapshot = LiquidityPoolDailySnapshot.load( + this.pool.id.concatI32(this.pool._lastSnapshotDayID!.toI32()) + ); + + snapshot.days = day; + snapshot.pool = this.pool.id; + snapshot.protocol = this.pool.protocol; + + snapshot.totalValueLockedUSD = this.pool.totalValueLockedUSD; + + snapshot.cumulativeSupplySideRevenueUSD = + this.pool.cumulativeSupplySideRevenueUSD; + snapshot.dailySupplySideRevenueUSD = previousSnapshot + ? snapshot.cumulativeSupplySideRevenueUSD.minus( + previousSnapshot.cumulativeSupplySideRevenueUSD + ) + : snapshot.cumulativeSupplySideRevenueUSD; + + snapshot.cumulativeProtocolSideRevenueUSD = + this.pool.cumulativeProtocolSideRevenueUSD; + snapshot.dailyProtocolSideRevenueUSD = previousSnapshot + ? snapshot.cumulativeProtocolSideRevenueUSD.minus( + previousSnapshot.cumulativeProtocolSideRevenueUSD + ) + : snapshot.cumulativeProtocolSideRevenueUSD; + + snapshot.cumulativeTotalRevenueUSD = this.pool.cumulativeTotalRevenueUSD; + snapshot.dailyTotalRevenueUSD = previousSnapshot + ? snapshot.cumulativeTotalRevenueUSD.minus( + previousSnapshot.cumulativeTotalRevenueUSD + ) + : snapshot.cumulativeTotalRevenueUSD; + + snapshot.dailyFundingrate = this.pool.fundingrate; + + snapshot.dailyLongOpenInterestUSD = this.pool.longOpenInterestUSD; + snapshot.dailyShortOpenInterestUSD = this.pool.shortOpenInterestUSD; + snapshot.dailyTotalOpenInterestUSD = this.pool.totalOpenInterestUSD; + + snapshot.cumulativeEntryPremiumUSD = this.pool.cumulativeEntryPremiumUSD; + snapshot.dailyEntryPremiumUSD = previousSnapshot + ? snapshot.cumulativeEntryPremiumUSD.minus( + previousSnapshot.cumulativeEntryPremiumUSD + ) + : snapshot.cumulativeEntryPremiumUSD; + + snapshot.cumulativeExitPremiumUSD = this.pool.cumulativeExitPremiumUSD; + snapshot.dailyExitPremiumUSD = previousSnapshot + ? snapshot.cumulativeExitPremiumUSD.minus( + previousSnapshot.cumulativeExitPremiumUSD + ) + : snapshot.cumulativeExitPremiumUSD; + + snapshot.cumulativeTotalPremiumUSD = this.pool.cumulativeTotalPremiumUSD; + snapshot.dailyTotalPremiumUSD = previousSnapshot + ? snapshot.cumulativeTotalPremiumUSD.minus( + previousSnapshot.cumulativeTotalPremiumUSD + ) + : snapshot.cumulativeTotalPremiumUSD; + + snapshot.cumulativeDepositPremiumUSD = + this.pool.cumulativeDepositPremiumUSD; + snapshot.dailyDepositPremiumUSD = previousSnapshot + ? snapshot.cumulativeDepositPremiumUSD.minus( + previousSnapshot.cumulativeDepositPremiumUSD + ) + : snapshot.cumulativeDepositPremiumUSD; + + snapshot.cumulativeWithdrawPremiumUSD = + this.pool.cumulativeWithdrawPremiumUSD; + snapshot.dailyWithdrawPremiumUSD = previousSnapshot + ? snapshot.cumulativeWithdrawPremiumUSD.minus( + previousSnapshot.cumulativeWithdrawPremiumUSD + ) + : snapshot.cumulativeWithdrawPremiumUSD; + + snapshot.cumulativeTotalLiquidityPremiumUSD = + this.pool.cumulativeTotalLiquidityPremiumUSD; + snapshot.dailyTotalLiquidityPremiumUSD = previousSnapshot + ? snapshot.cumulativeTotalLiquidityPremiumUSD.minus( + previousSnapshot.cumulativeTotalLiquidityPremiumUSD + ) + : snapshot.cumulativeTotalLiquidityPremiumUSD; + + snapshot.cumulativeVolumeByTokenUSD = this.pool.cumulativeVolumeByTokenUSD; + snapshot.dailyVolumeByTokenUSD = previousSnapshot + ? subtractArrays( + snapshot.cumulativeVolumeByTokenUSD, + previousSnapshot.cumulativeVolumeByTokenUSD + ) + : snapshot.cumulativeVolumeByTokenUSD; + + snapshot.cumulativeVolumeByTokenAmount = + this.pool.cumulativeVolumeByTokenAmount; + snapshot.dailyVolumeByTokenAmount = previousSnapshot + ? subtractArrays( + snapshot.cumulativeVolumeByTokenAmount, + previousSnapshot.cumulativeVolumeByTokenAmount + ) + : snapshot.cumulativeVolumeByTokenAmount; + + snapshot.cumulativeVolumeUSD = this.pool.cumulativeVolumeUSD; + snapshot.dailyVolumeUSD = previousSnapshot + ? snapshot.cumulativeVolumeUSD.minus(previousSnapshot.cumulativeVolumeUSD) + : snapshot.cumulativeVolumeUSD; + + snapshot.cumulativeInflowVolumeByTokenUSD = + this.pool.cumulativeInflowVolumeByTokenUSD; + snapshot.dailyInflowVolumeByTokenUSD = previousSnapshot + ? subtractArrays( + snapshot.cumulativeInflowVolumeByTokenUSD, + previousSnapshot.cumulativeInflowVolumeByTokenUSD + ) + : snapshot.cumulativeInflowVolumeByTokenUSD; + + snapshot.cumulativeInflowVolumeByTokenAmount = + this.pool.cumulativeInflowVolumeByTokenAmount; + snapshot.dailyInflowVolumeByTokenAmount = previousSnapshot + ? subtractArrays( + snapshot.cumulativeInflowVolumeByTokenAmount, + previousSnapshot.cumulativeInflowVolumeByTokenAmount + ) + : snapshot.cumulativeInflowVolumeByTokenAmount; + + snapshot.cumulativeInflowVolumeUSD = this.pool.cumulativeInflowVolumeUSD; + snapshot.dailyInflowVolumeUSD = previousSnapshot + ? snapshot.cumulativeInflowVolumeUSD.minus( + previousSnapshot.cumulativeInflowVolumeUSD + ) + : snapshot.cumulativeInflowVolumeUSD; + + snapshot.cumulativeClosedInflowVolumeByTokenUSD = + this.pool.cumulativeClosedInflowVolumeByTokenUSD; + snapshot.dailyClosedInflowVolumeByTokenUSD = previousSnapshot + ? subtractArrays( + snapshot.cumulativeClosedInflowVolumeByTokenUSD, + previousSnapshot.cumulativeClosedInflowVolumeByTokenUSD + ) + : snapshot.cumulativeClosedInflowVolumeByTokenUSD; + + snapshot.cumulativeClosedInflowVolumeByTokenAmount = + this.pool.cumulativeInflowVolumeByTokenAmount; + snapshot.dailyClosedInflowVolumeByTokenAmount = previousSnapshot + ? subtractArrays( + snapshot.cumulativeClosedInflowVolumeByTokenAmount, + previousSnapshot.cumulativeClosedInflowVolumeByTokenAmount + ) + : snapshot.cumulativeClosedInflowVolumeByTokenAmount; + + snapshot.cumulativeClosedInflowVolumeUSD = + this.pool.cumulativeClosedInflowVolumeUSD; + snapshot.dailyClosedInflowVolumeUSD = previousSnapshot + ? snapshot.cumulativeClosedInflowVolumeUSD.minus( + previousSnapshot.cumulativeClosedInflowVolumeUSD + ) + : snapshot.cumulativeClosedInflowVolumeUSD; + + snapshot.cumulativeOutflowVolumeByTokenUSD = + this.pool.cumulativeOutflowVolumeByTokenUSD; + snapshot.dailyOutflowVolumeByTokenUSD = previousSnapshot + ? subtractArrays( + snapshot.cumulativeOutflowVolumeByTokenUSD, + previousSnapshot.cumulativeOutflowVolumeByTokenUSD + ) + : snapshot.cumulativeOutflowVolumeByTokenUSD; + + snapshot.cumulativeOutflowVolumeByTokenAmount = + this.pool.cumulativeOutflowVolumeByTokenAmount; + snapshot.dailyOutflowVolumeByTokenAmount = previousSnapshot + ? subtractArrays( + snapshot.cumulativeOutflowVolumeByTokenAmount, + previousSnapshot.cumulativeOutflowVolumeByTokenAmount + ) + : snapshot.cumulativeOutflowVolumeByTokenAmount; + + snapshot.cumulativeOutflowVolumeUSD = this.pool.cumulativeOutflowVolumeUSD; + snapshot.dailyOutflowVolumeUSD = previousSnapshot + ? snapshot.cumulativeOutflowVolumeUSD.minus( + previousSnapshot.cumulativeOutflowVolumeUSD + ) + : snapshot.cumulativeOutflowVolumeUSD; + + snapshot.cumulativeUniqueUsers = this.pool.cumulativeUniqueUsers; + + const dailyActivityHelper = initActivityHelper( + Bytes.fromUTF8("daily-".concat(this.dayID.toString())) + ); + snapshot.dailyActiveUsers = dailyActivityHelper.activeUsers; + + snapshot.cumulativeUniqueDepositors = this.pool.cumulativeUniqueDepositors; + snapshot.dailyActiveDepositors = previousSnapshot + ? snapshot.cumulativeUniqueDepositors - + previousSnapshot.cumulativeUniqueDepositors + : snapshot.cumulativeUniqueDepositors; + + snapshot.cumulativeUniqueBorrowers = this.pool.cumulativeUniqueBorrowers; + snapshot.dailyActiveBorrowers = previousSnapshot + ? snapshot.cumulativeUniqueBorrowers - + previousSnapshot.cumulativeUniqueBorrowers + : snapshot.cumulativeUniqueBorrowers; + + snapshot.cumulativeUniqueLiquidators = + this.pool.cumulativeUniqueLiquidators; + snapshot.dailyActiveLiquidators = previousSnapshot + ? snapshot.cumulativeUniqueLiquidators - + previousSnapshot.cumulativeUniqueLiquidators + : snapshot.cumulativeUniqueLiquidators; + + snapshot.cumulativeUniqueLiquidatees = + this.pool.cumulativeUniqueLiquidatees; + snapshot.dailyActiveLiquidatees = previousSnapshot + ? snapshot.cumulativeUniqueLiquidatees - + previousSnapshot.cumulativeUniqueLiquidatees + : snapshot.cumulativeUniqueLiquidatees; + + snapshot.longPositionCount = this.pool.longPositionCount; + snapshot.dailyLongPositionCount = previousSnapshot + ? max(snapshot.longPositionCount - previousSnapshot.longPositionCount, 0) + : snapshot.longPositionCount; + + snapshot.shortPositionCount = this.pool.shortPositionCount; + snapshot.dailyShortPositionCount = previousSnapshot + ? max( + snapshot.shortPositionCount - previousSnapshot.shortPositionCount, + 0 + ) + : snapshot.shortPositionCount; + + snapshot.openPositionCount = this.pool.openPositionCount; + snapshot.dailyOpenPositionCount = previousSnapshot + ? max(snapshot.openPositionCount - previousSnapshot.openPositionCount, 0) + : snapshot.openPositionCount; + + snapshot.closedPositionCount = this.pool.closedPositionCount; + snapshot.dailyClosedPositionCount = previousSnapshot + ? snapshot.closedPositionCount - previousSnapshot.closedPositionCount + : snapshot.closedPositionCount; + + snapshot.cumulativePositionCount = this.pool.cumulativePositionCount; + snapshot.dailyCumulativePositionCount = previousSnapshot + ? snapshot.cumulativePositionCount - + previousSnapshot.cumulativePositionCount + : snapshot.cumulativePositionCount; + + snapshot.inputTokenBalances = this.pool.inputTokenBalances; + snapshot.inputTokenWeights = this.pool.inputTokenWeights; + snapshot.outputTokenSupply = this.pool.outputTokenSupply; + snapshot.outputTokenPriceUSD = this.pool.outputTokenPriceUSD; + snapshot.stakedOutputTokenAmount = this.pool.stakedOutputTokenAmount; + snapshot.rewardTokenEmissionsAmount = this.pool.rewardTokenEmissionsAmount; + snapshot.rewardTokenEmissionsUSD = this.pool.rewardTokenEmissionsUSD; + snapshot.marketSize = this.pool.marketSize; + snapshot.marketSkew = this.pool.marketSkew; + snapshot.longOpenInterest = this.pool.longOpenInterest; + snapshot.shortOpenInterest = this.pool.shortOpenInterest; + snapshot.totalOpenInterest = this.pool.totalOpenInterest; + snapshot.save(); + } +} diff --git a/subgraphs/kwenta/src/sdk/protocols/perpfutures/position.ts b/subgraphs/kwenta/src/sdk/protocols/perpfutures/position.ts new file mode 100644 index 0000000000..ff7a2d28a6 --- /dev/null +++ b/subgraphs/kwenta/src/sdk/protocols/perpfutures/position.ts @@ -0,0 +1,385 @@ +import { BigDecimal, BigInt, Bytes, log } from "@graphprotocol/graph-ts"; + +import { Pool } from "./pool"; +import { Account } from "./account"; +import { Perpetual } from "./protocol"; +import { TokenManager } from "./tokens"; +import * as constants from "../../util/constants"; + +import { + Token, + PositionSnapshot, + _PositionCounter, + Position as PositionSchema, +} from "../../../../generated/schema"; +import { PositionModified } from "../../../../generated/templates/FuturesV1Market/FuturesMarket"; + +/** + * This file contains the Position class, which is used to + * make all of the storage changes that occur in the position and + * its corresponding snapshots. + * + * Schema Version: 1.3.0 + * SDK Version: 1.1.0 + * Author(s): + * - @harsh9200 + * - @dhruv-chauhan + */ +class LoadPositionResponse { + position: Position; + isNewPosition: boolean; + + constructor(position: Position, isNewPosition: boolean) { + this.position = position; + this.isNewPosition = isNewPosition; + } +} +export class PositionManager { + protocol: Perpetual; + tokens: TokenManager; + + constructor(protocol: Perpetual, tokens: TokenManager) { + this.protocol = protocol; + this.tokens = tokens; + } + + getPositionId( + pool: Pool, + account: Account, + getLastPosition: bool = false + ): Bytes { + const positionId = account + .getBytesId() + .concat(Bytes.fromUTF8("-")) + .concat(pool.getBytesID()); + + let positionCounter = _PositionCounter.load(positionId); + if (!positionCounter) { + positionCounter = new _PositionCounter(positionId); + positionCounter.nextCount = 0; + positionCounter.save(); + } else if (!getLastPosition) { + positionCounter.nextCount += 1; + positionCounter.save(); + } + + return positionCounter.id + .concat(Bytes.fromUTF8("-")) + .concatI32(positionCounter.nextCount); + } + loadLastPosition( + pool: Pool, + account: Account, + asset: Token, + collateral: Token + ): Position | null { + const positionId = this.getPositionId(pool, account, true); + const entity = PositionSchema.load(positionId); + if (entity != null) { + return new Position( + this.protocol, + this.tokens, + pool, + account, + entity, + true + ); + } + return null; + } + loadPosition( + pool: Pool, + account: Account, + asset: Token, + collateral: Token, + positionSide: constants.PositionSide, + eventPosition: PositionModified, + getLastPosition: bool = false + ): LoadPositionResponse { + let positionId = this.getPositionId(pool, account, getLastPosition); + let openPosition = false; + let entity = PositionSchema.load(positionId); + + // if entity.hashClosed is not null that means last position is closed, and we have to open a new position + if (entity != null && entity.isClosed) { + positionId = this.getPositionId(pool, account, false); + + entity = null; + openPosition = true; + } + if (!entity) { + openPosition = true; + entity = new PositionSchema(positionId); + entity.account = account.getBytesId(); + entity.liquidityPool = pool.getBytesID(); + entity.collateral = collateral.id; + entity.asset = asset.id; + + const event = this.protocol.getCurrentEvent(); + entity.hashOpened = event.transaction.hash; + entity.blockNumberOpened = event.block.number; + entity.timestampOpened = event.block.timestamp; + + entity.side = positionSide; + entity.fundingrateOpen = constants.BIGDECIMAL_ZERO; + entity.leverage = constants.BIGDECIMAL_ZERO; + + entity.balance = constants.BIGINT_ZERO; + entity.balanceUSD = constants.BIGDECIMAL_ZERO; + + entity.collateralBalance = constants.BIGINT_ZERO; + entity.collateralBalanceUSD = constants.BIGDECIMAL_ZERO; + + entity.collateralInCount = 0; + entity.collateralOutCount = 0; + entity.liquidationCount = 0; + + entity.price = eventPosition.params.lastPrice; + entity.fundingIndex = eventPosition.params.fundingIndex; + entity.size = eventPosition.params.size; + entity.isClosed = false; + + entity.save(); + } + const position = new Position( + this.protocol, + this.tokens, + pool, + account, + entity, + openPosition + ); + + return new LoadPositionResponse(position, openPosition); + } +} + +export class Position { + protocol: Perpetual; + tokens: TokenManager; + pool: Pool; + account: Account; + position: PositionSchema; + + constructor( + protocol: Perpetual, + tokens: TokenManager, + pool: Pool, + account: Account, + position: PositionSchema, + openPosition: bool = true + ) { + this.protocol = protocol; + this.tokens = tokens; + this.pool = pool; + this.account = account; + this.position = position; + + if (openPosition) { + this.openPosition(); + } + } + + getBytesID(): Bytes { + return this.position.id; + } + + getRealisedPnlUsd(): BigDecimal { + return this.position.realisedPnlUSD !== null + ? this.position.realisedPnlUSD! + : constants.BIGDECIMAL_ZERO; + } + + getFundingIndex(): BigInt { + return this.position.fundingIndex; + } + + getSize(): BigInt { + return this.position.size; + } + + getPrice(): BigInt { + return this.position.price; + } + + private save(): void { + this.position.save(); + this.takePositionSnapshot(); + } + + openPosition(): void { + this.account.openPosition(this.position.side); + this.pool.openPosition(this.position.side); + this.protocol.openPosition(this.position.side); + } + + closePosition(): void { + const event = this.protocol.getCurrentEvent(); + this.position.hashClosed = event.transaction.hash; + this.position.blockNumberClosed = event.block.number; + this.position.timestampClosed = event.block.timestamp; + this.position.isClosed = true; + this.save(); + + this.account.closePosition(this.position.side); + this.pool.closePosition(this.position.side); + this.protocol.closePosition(this.position.side); + } + + /** + * Sets the position's fundingrateOpen value. + * @param amount + */ + setFundingrateOpen(amount: BigDecimal): void { + this.position.fundingrateOpen = amount; + this.save(); + } + + setPrice(amount: BigInt): void { + this.position.price = amount; + this.save(); + } + + setSize(amount: BigInt): void { + this.position.size = amount; + this.save(); + } + + setFundingIndex(amount: BigInt): void { + this.position.fundingIndex = amount; + this.save(); + } + /** + * Sets the position's fundingrateClosed value. + * @param amount + */ + setFundingrateClosed(amount: BigDecimal): void { + this.position.fundingrateClosed = amount; + this.save(); + } + + /** + * Sets the position's leverage value. + * @param amount + */ + setLeverage(amount: BigDecimal): void { + this.position.leverage = amount; + this.save(); + } + + /** + * Sets the position's balance value. + * @param token + * @param amount + */ + setBalance(token: Token, amount: BigInt): void { + this.position.balance = amount; + this.position.balanceUSD = this.protocol + .getTokenPricer() + .getAmountValueUSD(token, amount); + this.save(); + } + + /** + * Sets the position's collateralBalance value. + * @param token + * @param amount + */ + setCollateralBalance(token: Token, amount: BigInt): void { + this.position.collateralBalance = amount; + this.position.collateralBalanceUSD = this.protocol + .getTokenPricer() + .getAmountValueUSD(token, amount); + this.save(); + } + + /** + * Sets the position's closeBalanceUSD value. + * @param token + * @param amount + */ + setBalanceClosed(token: Token, amount: BigInt): void { + this.position.closeBalanceUSD = this.protocol + .getTokenPricer() + .getAmountValueUSD(token, amount); + this.save(); + } + + /** + * Sets the position's closeCollateralBalanceUSD value. + * @param token + * @param amount + */ + setCollateralBalanceClosed(token: Token, amount: BigInt): void { + this.position.closeCollateralBalanceUSD = this.protocol + .getTokenPricer() + .getAmountValueUSD(token, amount); + this.save(); + } + + /** + * Sets the position's realisedPnlUSD value. + * @param token + * @param amount + */ + setRealisedPnlClosed(token: Token, amount: BigInt): void { + this.position.realisedPnlUSD = this.protocol + .getTokenPricer() + .getAmountValueUSD(token, amount); + this.save(); + } + + setRealisedPnlUsdClosed(amount: BigDecimal): void { + this.position.realisedPnlUSD = amount; + this.save(); + } + + /** + * Adds 1 to the account position collateralIn count. + */ + addCollateralInCount(): void { + this.position.collateralInCount += 1; + this.save(); + } + + /** + * Adds 1 to the account position collateralOut count. + */ + addCollateralOutCount(): void { + this.position.collateralOutCount += 1; + this.save(); + } + + /** + * Adds 1 to the account position liquidation count. + */ + addLiquidationCount(): void { + this.position.liquidationCount += 1; + this.save(); + } + + private takePositionSnapshot(): void { + const event = this.protocol.getCurrentEvent(); + const snapshotId = this.position.id + .concat(event.transaction.hash) + .concat(Bytes.fromUTF8(event.transaction.index.toString())); + const snapshot = new PositionSnapshot(snapshotId); + + snapshot.hash = event.transaction.hash; + snapshot.logIndex = event.transaction.index.toI32(); + snapshot.nonce = event.transaction.nonce; + + snapshot.position = this.position.id; + snapshot.account = this.position.account; + snapshot.fundingrate = this.position.fundingrateOpen; + snapshot.balance = this.position.balance; + snapshot.collateralBalance = this.position.collateralBalance; + snapshot.balanceUSD = this.position.balanceUSD; + snapshot.collateralBalanceUSD = this.position.collateralBalanceUSD; + snapshot.realisedPnlUSD = this.position.realisedPnlUSD; + snapshot.blockNumber = this.protocol.event.block.number; + snapshot.timestamp = this.protocol.event.block.timestamp; + + snapshot.save(); + } +} diff --git a/subgraphs/kwenta/src/sdk/protocols/perpfutures/protocol.ts b/subgraphs/kwenta/src/sdk/protocols/perpfutures/protocol.ts new file mode 100644 index 0000000000..acdcdfb36c --- /dev/null +++ b/subgraphs/kwenta/src/sdk/protocols/perpfutures/protocol.ts @@ -0,0 +1,561 @@ +import { + Bytes, + Address, + dataSource, + BigDecimal, +} from "@graphprotocol/graph-ts"; + +import { SDK } from "."; +import { AccountWasActive } from "./account"; +import * as constants from "../../util/constants"; +import { CustomEventType } from "../../util/events"; +import { ProtocolSnapshot } from "./protocolSnapshot"; +import { PositionType, TransactionType } from "./enums"; +import { ProtocolConfigurer, TokenPricer } from "../config"; + +import { DerivPerpProtocol as PerpetualSchema } from "../../../../generated/schema"; + +/** + * This file contains the Perpetual class, which is used to + * make all of the storage changes that occur in a protocol. + * + * Schema Version: 1.3.0 + * SDK Version: 1.1.0 + * Author(s): + * - @harsh9200 + * - @dhruv-chauhan + */ + +/** + * ProtocolManager is a wrapper around the ProtocolSchema entity that takes care of + * safely and conveniently updating the entity. Updating the Protocol entity using this + * wrapper also takes care of the Financials and Usage snapshots. + */ +export class Perpetual { + protocol: PerpetualSchema; + event: CustomEventType; + pricer: TokenPricer; + snapshoter: ProtocolSnapshot; + sdk: SDK | null = null; + /** + * Creates a new Protocol instance. This should only be called by the Protocol.load + * @private + */ + private constructor( + protocol: PerpetualSchema, + pricer: TokenPricer, + event: CustomEventType + ) { + this.protocol = protocol; + this.event = event; + this.pricer = pricer; + this.snapshoter = new ProtocolSnapshot(protocol, event); + } + + /** + * This is the main function to instantiate a Protocol entity. Most times it is not called directly, but from the SDK initializer. + * + * @param conf {ProtocolConfigurer} An object that implements the ProtocolConfigurer interface, to set some of the protocol's properties + * @param pricer {TokenPricer} An object that implements the TokenPricer interface, to allow the wrapper to access pricing data + * @param event {CustomEventType} The event being handled at a time. + * @returns Protocol + */ + static load( + conf: ProtocolConfigurer, + pricer: TokenPricer, + event: CustomEventType + ): Perpetual { + const protocolId = Address.fromString(conf.getID()); + let protocol = PerpetualSchema.load(protocolId); + + if (!protocol) { + protocol = new PerpetualSchema(protocolId); + protocol.name = conf.getName(); + protocol.slug = conf.getSlug(); + protocol.network = dataSource.network().toUpperCase().replace("-", "_"); + protocol.type = constants.ProtocolType.PERPETUAL; + + protocol.totalValueLockedUSD = constants.BIGDECIMAL_ZERO; + protocol.cumulativeVolumeUSD = constants.BIGDECIMAL_ZERO; + + protocol.cumulativeInflowVolumeUSD = constants.BIGDECIMAL_ZERO; + protocol.cumulativeClosedInflowVolumeUSD = constants.BIGDECIMAL_ZERO; + protocol.cumulativeOutflowVolumeUSD = constants.BIGDECIMAL_ZERO; + + protocol.cumulativeSupplySideRevenueUSD = constants.BIGDECIMAL_ZERO; + protocol.cumulativeProtocolSideRevenueUSD = constants.BIGDECIMAL_ZERO; + protocol.cumulativeStakeSideRevenueUSD = constants.BIGDECIMAL_ZERO; + protocol.cumulativeTotalRevenueUSD = constants.BIGDECIMAL_ZERO; + + protocol.cumulativeEntryPremiumUSD = constants.BIGDECIMAL_ZERO; + protocol.cumulativeExitPremiumUSD = constants.BIGDECIMAL_ZERO; + protocol.cumulativeTotalPremiumUSD = constants.BIGDECIMAL_ZERO; + + protocol.cumulativeDepositPremiumUSD = constants.BIGDECIMAL_ZERO; + protocol.cumulativeWithdrawPremiumUSD = constants.BIGDECIMAL_ZERO; + protocol.cumulativeTotalLiquidityPremiumUSD = constants.BIGDECIMAL_ZERO; + + protocol.longOpenInterestUSD = constants.BIGDECIMAL_ZERO; + protocol.shortOpenInterestUSD = constants.BIGDECIMAL_ZERO; + protocol.totalOpenInterestUSD = constants.BIGDECIMAL_ZERO; + + protocol.cumulativeUniqueUsers = 0; + protocol.cumulativeUniqueDepositors = 0; + protocol.cumulativeUniqueBorrowers = 0; + protocol.cumulativeUniqueLiquidators = 0; + protocol.cumulativeUniqueLiquidatees = 0; + + protocol.longPositionCount = 0; + protocol.shortPositionCount = 0; + protocol.openPositionCount = 0; + protocol.closedPositionCount = 0; + protocol.cumulativePositionCount = 0; + + protocol.transactionCount = 0; + protocol.depositCount = 0; + protocol.withdrawCount = 0; + protocol.borrowCount = 0; + protocol.swapCount = 0; + protocol.collateralInCount = 0; + protocol.collateralOutCount = 0; + + protocol.totalPoolCount = 0; + + protocol._lastSnapshotDayID = constants.BIGINT_ZERO; + protocol._lastSnapshotHourID = constants.BIGINT_ZERO; + } + + const versions = conf.getVersions(); + protocol.schemaVersion = versions.getSchemaVersion(); + protocol.subgraphVersion = versions.getSubgraphVersion(); + protocol.methodologyVersion = versions.getMethodologyVersion(); + + const proto = new Perpetual(protocol, pricer, event); + + protocol._lastUpdateTimestamp = event.block.timestamp; + protocol.save(); + + return proto; + } + + /** + * This will save the entity to storage. If any other action needs to be performed on + * save, it should be added here. + * It is meant to be used internally. If you need to save the entity from outside the wrapper + * you should probably be using some of the setters instead. + * @private + */ + private save(): void { + this.protocol._lastUpdateTimestamp = this.event.block.timestamp; + this.protocol.save(); + } + + /** + * + * @returns {string} The ID of the protocol entity. + */ + getID(): string { + return this.protocol.id.toHexString(); + } + + /** + * + * @returns {Bytes} The ID of the protocol entity, as Bytes. + */ + getBytesID(): Bytes { + return this.protocol.id; + } + + /** + * + * @returns {CustomEventType} the event currently being handled. + */ + getCurrentEvent(): CustomEventType { + return this.event; + } + + /** + * + * @returns {TokenPricer} The pricer object used by the wrapper. + * @see TokenPricer + */ + getTokenPricer(): TokenPricer { + return this.pricer; + } + + /** + * Sets the TVL in USD for the protocol. Most times this will be called internally by + * other members of the library when TVL changes are made to them. But if the library + * is not well fitted to a given protocol and you need to set the TVL manually, you can + * use this method. + * It will also update the protocol's snapshots. + * @param tvl {BigDecimal} The new total value locked for the protocol. + */ + setTotalValueLocked(tvl: BigDecimal): void { + this.protocol.totalValueLockedUSD = tvl; + this.save(); + } + + /** + * Adds a given USD value to the protocol's TVL. It can be a positive or negative amount. + * Same as for setTotalValueLocked, this is mostly to be called internally by the library. + * But you can use it if you need to. It will also update the protocol's snapshots. + * @param amount {BigDecimal} The value to add to the protocol's TVL. + */ + addTotalValueLocked(amount: BigDecimal): void { + this.setTotalValueLocked(this.protocol.totalValueLockedUSD.plus(amount)); + } + + /** + * Adds a given USD value to the protocol's volume. It can be a positive or negative amount. + * Same as for setTotalValueLocked, this is mostly to be called internally by the library. + * But you can use it if you need to. It will also update the protocol's snapshots. + * @param volume {BigDecimal} The value to add to the protocol's volume. + */ + addVolume(volume: BigDecimal): void { + this.protocol.cumulativeVolumeUSD = + this.protocol.cumulativeVolumeUSD.plus(volume); + this.save(); + } + + /** + * Adds a given USD value to the protocol InflowVolumeUSD. It can be a positive or negative amount. + * @param volume {BigDecimal} The value to add to the protocol's InflowVolumeUSD. + */ + addInflowVolumeUSD(volume: BigDecimal): void { + this.protocol.cumulativeInflowVolumeUSD = + this.protocol.cumulativeInflowVolumeUSD.plus(volume); + this.save(); + } + + /** + * Adds a given USD value to the protocol ClosedInflowVolumeUSD. It can be a positive or negative amount. + * @param volume {BigDecimal} The value to add to the protocol's ClosedInflowVolumeUSD. + */ + addClosedInflowVolumeUSD(volume: BigDecimal): void { + this.protocol.cumulativeClosedInflowVolumeUSD = + this.protocol.cumulativeClosedInflowVolumeUSD.plus(volume); + this.save(); + } + + /** + * Adds a given USD value to the protocol OutflowVolumeUSD. It can be a positive or negative amount. + * @param volume {BigDecimal} The value to add to the protocol's OutflowVolumeUSD. + */ + addOutflowVolumeUSD(volume: BigDecimal): void { + this.protocol.cumulativeOutflowVolumeUSD = + this.protocol.cumulativeOutflowVolumeUSD.plus(volume); + this.save(); + } + + /** + * Adds a given USD value to the protocol supplySideRevenue. It can be a positive or negative amount. + * Same as for the rest of setters, this is mostly to be called internally by the library. + * But you can use it if you need to. It will also update the protocol's snapshots. + * @param rev {BigDecimal} The value to add to the protocol's supplySideRevenue. + */ + addSupplySideRevenueUSD(rev: BigDecimal): void { + this.protocol.cumulativeTotalRevenueUSD = + this.protocol.cumulativeTotalRevenueUSD.plus(rev); + this.protocol.cumulativeSupplySideRevenueUSD = + this.protocol.cumulativeSupplySideRevenueUSD.plus(rev); + this.save(); + } + + /** + * Adds a given USD value to the protocol protocolSideRevenue. It can be a positive or negative amount. + * Same as for the rest of setters, this is mostly to be called internally by the library. + * But you can use it if you need to. It will also update the protocol's snapshots. + * @param rev {BigDecimal} The value to add to the protocol's protocolSideRevenue. + */ + addProtocolSideRevenueUSD(rev: BigDecimal): void { + this.protocol.cumulativeTotalRevenueUSD = + this.protocol.cumulativeTotalRevenueUSD.plus(rev); + this.protocol.cumulativeProtocolSideRevenueUSD = + this.protocol.cumulativeProtocolSideRevenueUSD.plus(rev); + this.save(); + } + + /** + * Adds a given USD value to the protocol StakeSideRevenue. It can be a positive or negative amount. + * Same as for the rest of setters, this is mostly to be called internally by the library. + * But you can use it if you need to. It will also update the protocol's snapshots. + * @param rev {BigDecimal} The value to add to the protocol's StakeSideRevenue. + */ + addStakeSideRevenueUSD(rev: BigDecimal): void { + this.protocol.cumulativeTotalRevenueUSD = + this.protocol.cumulativeTotalRevenueUSD.plus(rev); + this.protocol.cumulativeStakeSideRevenueUSD = + this.protocol.cumulativeStakeSideRevenueUSD.plus(rev); + this.save(); + } + + /** + * Adds a given USD value to the protocol's supplySideRevenue and protocolSideRevenue. It can be a positive or negative amount. + * Same as for the rest of setters, this is mostly to be called internally by the library. + * But you can use it if you need to. It will also update the protocol's snapshots. + * @param protocolSide {BigDecimal} The value to add to the protocol's protocolSideRevenue. + * @param supplySide {BigDecimal} The value to add to the protocol's supplySideRevenue. + * @param stakeSide {BigDecimal} The value to add to the protocol's stakeSideRevenue. + */ + addRevenueUSD( + protocolSide: BigDecimal, + supplySide: BigDecimal, + stakeSide: BigDecimal + ): void { + this.addSupplySideRevenueUSD(supplySide); + this.addProtocolSideRevenueUSD(protocolSide); + this.addStakeSideRevenueUSD(stakeSide); + } + + /** + * Adds a given USD value to the protocol EntryPremium. It can be a positive or negative amount. + * Same as for the rest of setters, this is mostly to be called internally by the library. + * But you can use it if you need to. It will also update the protocol's snapshots. + * @param premium {BigDecimal} The value to add to the protocol's EntryPremium. + */ + addEntryPremiumUSD(premium: BigDecimal): void { + this.protocol.cumulativeTotalPremiumUSD = + this.protocol.cumulativeTotalPremiumUSD.plus(premium); + this.protocol.cumulativeEntryPremiumUSD = + this.protocol.cumulativeEntryPremiumUSD.plus(premium); + this.save(); + } + + /** + * Adds a given USD value to the protocol ExitPremium. It can be a positive or negative amount. + * Same as for the rest of setters, this is mostly to be called internally by the library. + * But you can use it if you need to. It will also update the protocol's snapshots. + * @param premium {BigDecimal} The value to add to the protocol's ExitPremium. + */ + addExitPremiumUSD(premium: BigDecimal): void { + this.protocol.cumulativeTotalPremiumUSD = + this.protocol.cumulativeTotalPremiumUSD.plus(premium); + this.protocol.cumulativeExitPremiumUSD = + this.protocol.cumulativeExitPremiumUSD.plus(premium); + this.save(); + } + + /** + * Adds a given USD value to the protocol depositPremium. It can be a positive or negative amount. + * Same as for the rest of setters, this is mostly to be called internally by the library. + * But you can use it if you need to. It will also update the protocol's snapshots. + * @param premium {BigDecimal} The value to add to the protocol's depositPremium. + */ + addDepositPremiumUSD(premium: BigDecimal): void { + this.protocol.cumulativeTotalLiquidityPremiumUSD = + this.protocol.cumulativeTotalLiquidityPremiumUSD.plus(premium); + this.protocol.cumulativeDepositPremiumUSD = + this.protocol.cumulativeDepositPremiumUSD.plus(premium); + this.save(); + } + + /** + * Adds a given USD value to the protocol withdrawPremium. It can be a positive or negative amount. + * Same as for the rest of setters, this is mostly to be called internally by the library. + * But you can use it if you need to. It will also update the protocol's snapshots. + * @param premium {BigDecimal} The value to add to the protocol's withdrawPremium. + */ + addWithdrawPremiumUSD(premium: BigDecimal): void { + this.protocol.cumulativeTotalLiquidityPremiumUSD = + this.protocol.cumulativeTotalLiquidityPremiumUSD.plus(premium); + this.protocol.cumulativeWithdrawPremiumUSD = + this.protocol.cumulativeWithdrawPremiumUSD.plus(premium); + this.save(); + } + + /** + * Adds a given USD value to the protocol's long and total openInterestUSD. + * + * @param amountChangeUSD {BigDecimal} The value to add to the protocol's openInterest in USD. + */ + updateLongOpenInterestUSD(amountChangeUSD: BigDecimal): void { + this.protocol.totalOpenInterestUSD = + this.protocol.totalOpenInterestUSD.plus(amountChangeUSD); + this.protocol.longOpenInterestUSD = + this.protocol.longOpenInterestUSD.plus(amountChangeUSD); + + this.save(); + } + + /** + * Adds a given USD value to the protocol's short and total openInterestUSD. + * + * @param amountChangeUSD {BigDecimal} The value to add to the protocol's openInterest in USD. + */ + updateShortOpenInterestUSD(amountChangeUSD: BigDecimal): void { + this.protocol.totalOpenInterestUSD = + this.protocol.totalOpenInterestUSD.plus(amountChangeUSD); + this.protocol.shortOpenInterestUSD = + this.protocol.shortOpenInterestUSD.plus(amountChangeUSD); + + this.save(); + } + + /** + * Adds 1 to the cumulativePositionCount counter and adds 1 to the counter corresponding the given position type. + * If you are creating transaction entities from the Account class you won't need to use this method. + * @param positionSide {PositionType} The type of transaction to add. + * @see PositionType + * @see Account + */ + openPosition(positionSide: PositionType): void { + if (positionSide == PositionType.LONG) { + this.protocol.longPositionCount += 1; + } else if (positionSide == PositionType.SHORT) { + this.protocol.shortPositionCount += 1; + } + + this.protocol.openPositionCount += 1; + this.protocol.cumulativePositionCount += 1; + this.save(); + } + + /** + * Subtracts 1 from the cumulativePositionCount counter and adds 1 to the counter corresponding the given position type. + * If you are creating transaction entities from the Account class you won't need to use this method. + * @param positionSide {PositionType} The type of transaction to add. + * @see PositionType + * @see Account + */ + closePosition(positionSide: PositionType): void { + if (positionSide == PositionType.LONG) { + this.protocol.longPositionCount -= 1; + } else if (positionSide == PositionType.SHORT) { + this.protocol.shortPositionCount -= 1; + } + + this.protocol.openPositionCount -= 1; + this.protocol.closedPositionCount += 1; + this.save(); + } + + /** + * Adds 1 to the transactionCount counter and adds 1 to the counter corresponding the given transaction type. + * If you are creating transaction entities from the Account class you won't need to use this method. + * @param type {TransactionType} The type of transaction to add. + * @see TransactionType + * @see Account + */ + addTransaction(type: TransactionType): void { + if (type == TransactionType.DEPOSIT) { + this.protocol.depositCount += 1; + } else if (type == TransactionType.WITHDRAW) { + this.protocol.withdrawCount += 1; + } else if (type == TransactionType.SWAP) { + this.protocol.swapCount += 1; + } else if (type == TransactionType.BORROW) { + this.protocol.borrowCount += 1; + } else if (type == TransactionType.COLLATERAL_IN) { + this.protocol.collateralInCount += 1; + } else if (type == TransactionType.COLLATERAL_OUT) { + this.protocol.collateralOutCount += 1; + } + + this.protocol.transactionCount += 1; + this.save(); + + this.snapshoter.addTransaction(type); + } + + /** + * Adds some value to the cumulativeUniqueUsers counter. If the value is omitted it will default to 1. + * If you are loading accounts with the AccountManager you won't need to use this method. + * @param count {u8} The value to add to the counter. + */ + addUser(count: u8 = 1): void { + this.protocol.cumulativeUniqueUsers += count; + this.save(); + } + + /** + * Will increase the hourly and daily active users counters. These will be reflected + * on the next Usage snapshot whenever it comes up. + */ + addActiveUser(activity: AccountWasActive): void { + this.snapshoter.addActiveUser(activity); + } + + /** + * Adds some value to the cumulativeUniqueBorrowers counter. If the value is omitted it will default to 1. + * If you are loading accounts with the AccountManager you won't need to use this method. + * @param count {u8} The value to add to the counter. + */ + addBorrower(count: u8 = 1): void { + this.protocol.cumulativeUniqueBorrowers += count; + this.save(); + } + + /** + * Will increase the hourly and daily active borrowers counters. These will be reflected + * on the next Usage snapshot whenever it comes up. + */ + addActiveBorrower(activity: AccountWasActive): void { + this.snapshoter.addActiveBorrower(activity); + } + + /** + * Adds some value to the cumulativeUniqueDepositors counter. If the value is omitted it will default to 1. + * If you are loading accounts with the AccountManager you won't need to use this method. + * @param count {u8} The value to add to the counter. + */ + addDepositor(count: u8 = 1): void { + this.protocol.cumulativeUniqueDepositors += count; + this.save(); + } + + /** + * Will increase the hourly and daily active depositors counters. These will be reflected + * on the next Usage snapshot whenever it comes up. + */ + addActiveDepositor(activity: AccountWasActive): void { + this.snapshoter.addActiveDepositor(activity); + } + + /** + * Adds some value to the cumulativeUniqueLiquidators counter. If the value is omitted it will default to 1. + * If you are loading accounts with the AccountManager you won't need to use this method. + * @param count {u8} The value to add to the counter. + */ + addLiquidator(count: u8 = 1): void { + this.protocol.cumulativeUniqueLiquidators += count; + this.save(); + } + + /** + * Will increase the hourly and daily active liquidators counters. These will be reflected + * on the next Usage snapshot whenever it comes up. + */ + addActiveLiquidator(activity: AccountWasActive): void { + this.snapshoter.addActiveLiquidator(activity); + } + + /** + * Adds some value to the cumulativeUniqueLiquidatees counter. If the value is omitted it will default to 1. + * If you are loading accounts with the AccountManager you won't need to use this method. + * @param count {u8} The value to add to the counter. + */ + addLiquidatee(count: u8 = 1): void { + this.protocol.cumulativeUniqueLiquidatees += count; + this.save(); + } + + /** + * Will increase the hourly and daily active liquidatees counters. These will be reflected + * on the next Usage snapshot whenever it comes up. + */ + addActiveLiquidatee(activity: AccountWasActive): void { + this.snapshoter.addActiveLiquidatee(activity); + } + + /** + * Increases the totalPoolCount counter by the given value. + * If you are using the PoolManager class you won't need to use this method. + * @param count {u8} The value to add to the counter. + * @see PoolManager + */ + addPool(count: u8 = 1): void { + this.protocol.totalPoolCount += count; + this.save(); + } +} diff --git a/subgraphs/kwenta/src/sdk/protocols/perpfutures/protocolSnapshot.ts b/subgraphs/kwenta/src/sdk/protocols/perpfutures/protocolSnapshot.ts new file mode 100644 index 0000000000..d9b322e474 --- /dev/null +++ b/subgraphs/kwenta/src/sdk/protocols/perpfutures/protocolSnapshot.ts @@ -0,0 +1,388 @@ +import { BigInt, Bytes, log } from "@graphprotocol/graph-ts"; + +import { TransactionType } from "./enums"; +import { AccountWasActive } from "./account"; +import * as constants from "../../util/constants"; +import { CustomEventType, getUnixDays, getUnixHours } from "../../util/events"; + +import { + _ActivityHelper, + FinancialsDailySnapshot, + UsageMetricsDailySnapshot, + UsageMetricsHourlySnapshot, + DerivPerpProtocol as PerpetualSchema, +} from "../../../../generated/schema"; + +/** + * This file contains the ProtocolSnapshot, which is used to + * make all of the storage changes that occur in the protocol's + * daily and hourly snapshots. + * + * Schema Version: 1.3.0 + * SDK Version: 1.1.0 + * Author(s): + * - @harsh9200 + * - @dhruv-chauhan + */ + +export class ProtocolSnapshot { + protocol: PerpetualSchema; + event: CustomEventType; + dayID: i32; + hourID: i32; + dailyActivityHelper: _ActivityHelper; + hourlyActivityHelper: _ActivityHelper; + + constructor(protocol: PerpetualSchema, event: CustomEventType) { + this.protocol = protocol; + this.event = event; + this.dayID = getUnixDays(event.block); + this.hourID = getUnixHours(event.block); + + this.dailyActivityHelper = initActivityHelper( + Bytes.fromUTF8("daily-".concat(this.dayID.toString())) + ); + this.hourlyActivityHelper = initActivityHelper( + Bytes.fromUTF8("hourly-".concat(this.hourID.toString())) + ); + + this.takeSnapshots(); + } + + addActiveUser(activity: AccountWasActive): void { + this.dailyActivityHelper.activeUsers += activity.daily ? 1 : 0; + this.hourlyActivityHelper.activeUsers += activity.hourly ? 1 : 0; + + this.dailyActivityHelper.save(); + this.hourlyActivityHelper.save(); + } + + addActiveDepositor(activity: AccountWasActive): void { + this.dailyActivityHelper.activeDepositors += activity.daily ? 1 : 0; + this.dailyActivityHelper.save(); + } + + addActiveBorrower(activity: AccountWasActive): void { + this.dailyActivityHelper.activeBorrowers += activity.daily ? 1 : 0; + this.dailyActivityHelper.save(); + } + + addActiveLiquidator(activity: AccountWasActive): void { + this.dailyActivityHelper.activeLiquidators += activity.daily ? 1 : 0; + this.dailyActivityHelper.save(); + } + + addActiveLiquidatee(activity: AccountWasActive): void { + this.dailyActivityHelper.activeLiquidatees += activity.daily ? 1 : 0; + this.dailyActivityHelper.save(); + } + + addTransaction(type: TransactionType): void { + if (type == TransactionType.DEPOSIT) { + this.hourlyActivityHelper.depositCount += 1; + this.dailyActivityHelper.depositCount += 1; + } else if (type == TransactionType.WITHDRAW) { + this.hourlyActivityHelper.withdrawCount += 1; + this.dailyActivityHelper.withdrawCount += 1; + } else if (type == TransactionType.BORROW) { + this.hourlyActivityHelper.borrowCount += 1; + this.dailyActivityHelper.borrowCount += 1; + } else if (type == TransactionType.SWAP) { + this.hourlyActivityHelper.swapCount += 1; + this.dailyActivityHelper.swapCount += 1; + } + + this.hourlyActivityHelper.transactionCount += 1; + this.dailyActivityHelper.transactionCount += 1; + + this.hourlyActivityHelper.save(); + this.dailyActivityHelper.save(); + } + + private takeSnapshots(): void { + if (!this.protocol._lastUpdateTimestamp) { + log.error( + "[isInitialized] cannot create snapshots, protocol: {} not initialized", + [this.protocol.id.toHexString()] + ); + return; + } + + const snapshotDayID = + this.protocol._lastUpdateTimestamp!.toI32() / constants.SECONDS_PER_DAY; + const snapshotHourID = + this.protocol._lastUpdateTimestamp!.toI32() / constants.SECONDS_PER_HOUR; + + if (snapshotDayID != this.dayID) { + this.takeFinancialsDailySnapshot(snapshotDayID); + this.takeUsageDailySnapshot(snapshotDayID); + this.protocol._lastSnapshotDayID = BigInt.fromI32(snapshotDayID); + this.protocol.save(); + } + + if (snapshotHourID != this.hourID) { + this.takeUsageHourlySnapshot(snapshotHourID); + this.protocol._lastSnapshotHourID = BigInt.fromI32(snapshotDayID); + this.protocol.save(); + } + } + + private takeFinancialsDailySnapshot(day: i32): void { + const snapshot = new FinancialsDailySnapshot(Bytes.fromI32(day)); + + const previousSnapshot = FinancialsDailySnapshot.load( + Bytes.fromI32(this.protocol._lastSnapshotDayID!.toI32()) + ); + + snapshot.days = day; + snapshot.protocol = this.protocol.id; + + snapshot.totalValueLockedUSD = this.protocol.totalValueLockedUSD; + + snapshot.dailyLongOpenInterestUSD = this.protocol.longOpenInterestUSD; + snapshot.dailyShortOpenInterestUSD = this.protocol.shortOpenInterestUSD; + snapshot.dailyTotalOpenInterestUSD = this.protocol.totalOpenInterestUSD; + + snapshot.dailyVolumeUSD = previousSnapshot + ? this.protocol.cumulativeVolumeUSD.minus( + previousSnapshot.cumulativeVolumeUSD + ) + : this.protocol.cumulativeVolumeUSD; + snapshot.cumulativeVolumeUSD = this.protocol.cumulativeVolumeUSD; + + snapshot.dailyInflowVolumeUSD = previousSnapshot + ? this.protocol.cumulativeInflowVolumeUSD.minus( + previousSnapshot.cumulativeInflowVolumeUSD + ) + : this.protocol.cumulativeInflowVolumeUSD; + snapshot.dailyClosedInflowVolumeUSD = previousSnapshot + ? this.protocol.cumulativeClosedInflowVolumeUSD.minus( + previousSnapshot.cumulativeClosedInflowVolumeUSD + ) + : this.protocol.cumulativeClosedInflowVolumeUSD; + snapshot.dailyOutflowVolumeUSD = previousSnapshot + ? this.protocol.cumulativeOutflowVolumeUSD.minus( + previousSnapshot.cumulativeOutflowVolumeUSD + ) + : this.protocol.cumulativeOutflowVolumeUSD; + + snapshot.cumulativeInflowVolumeUSD = + this.protocol.cumulativeInflowVolumeUSD; + snapshot.cumulativeClosedInflowVolumeUSD = + this.protocol.cumulativeClosedInflowVolumeUSD; + snapshot.cumulativeOutflowVolumeUSD = + this.protocol.cumulativeOutflowVolumeUSD; + + snapshot.dailySupplySideRevenueUSD = previousSnapshot + ? this.protocol.cumulativeSupplySideRevenueUSD.minus( + previousSnapshot.cumulativeSupplySideRevenueUSD + ) + : this.protocol.cumulativeSupplySideRevenueUSD; + snapshot.dailyProtocolSideRevenueUSD = previousSnapshot + ? this.protocol.cumulativeProtocolSideRevenueUSD.minus( + previousSnapshot.cumulativeProtocolSideRevenueUSD + ) + : this.protocol.cumulativeProtocolSideRevenueUSD; + snapshot.dailyStakeSideRevenueUSD = previousSnapshot + ? this.protocol.cumulativeStakeSideRevenueUSD.minus( + previousSnapshot.cumulativeStakeSideRevenueUSD + ) + : this.protocol.cumulativeStakeSideRevenueUSD; + snapshot.dailyTotalRevenueUSD = previousSnapshot + ? this.protocol.cumulativeTotalRevenueUSD.minus( + previousSnapshot.cumulativeTotalRevenueUSD + ) + : this.protocol.cumulativeTotalRevenueUSD; + + snapshot.cumulativeSupplySideRevenueUSD = + this.protocol.cumulativeSupplySideRevenueUSD; + snapshot.cumulativeStakeSideRevenueUSD = + this.protocol.cumulativeStakeSideRevenueUSD; + snapshot.cumulativeProtocolSideRevenueUSD = + this.protocol.cumulativeProtocolSideRevenueUSD; + snapshot.cumulativeTotalRevenueUSD = + this.protocol.cumulativeTotalRevenueUSD; + + snapshot.dailyEntryPremiumUSD = previousSnapshot + ? this.protocol.cumulativeEntryPremiumUSD.minus( + previousSnapshot.cumulativeEntryPremiumUSD + ) + : this.protocol.cumulativeEntryPremiumUSD; + snapshot.dailyExitPremiumUSD = previousSnapshot + ? this.protocol.cumulativeExitPremiumUSD.minus( + previousSnapshot.cumulativeExitPremiumUSD + ) + : this.protocol.cumulativeExitPremiumUSD; + snapshot.dailyTotalPremiumUSD = previousSnapshot + ? this.protocol.cumulativeTotalPremiumUSD.minus( + previousSnapshot.cumulativeTotalPremiumUSD + ) + : this.protocol.cumulativeTotalPremiumUSD; + + snapshot.cumulativeEntryPremiumUSD = + this.protocol.cumulativeEntryPremiumUSD; + snapshot.cumulativeExitPremiumUSD = this.protocol.cumulativeExitPremiumUSD; + snapshot.cumulativeTotalPremiumUSD = + this.protocol.cumulativeTotalPremiumUSD; + + snapshot.dailyDepositPremiumUSD = previousSnapshot + ? this.protocol.cumulativeDepositPremiumUSD.minus( + previousSnapshot.cumulativeDepositPremiumUSD + ) + : this.protocol.cumulativeDepositPremiumUSD; + snapshot.dailyWithdrawPremiumUSD = previousSnapshot + ? this.protocol.cumulativeWithdrawPremiumUSD.minus( + previousSnapshot.cumulativeWithdrawPremiumUSD + ) + : this.protocol.cumulativeWithdrawPremiumUSD; + snapshot.dailyTotalLiquidityPremiumUSD = previousSnapshot + ? this.protocol.cumulativeTotalLiquidityPremiumUSD.minus( + previousSnapshot.cumulativeTotalLiquidityPremiumUSD + ) + : this.protocol.cumulativeTotalLiquidityPremiumUSD; + + snapshot.cumulativeDepositPremiumUSD = + this.protocol.cumulativeDepositPremiumUSD; + snapshot.cumulativeWithdrawPremiumUSD = + this.protocol.cumulativeWithdrawPremiumUSD; + snapshot.cumulativeTotalLiquidityPremiumUSD = + this.protocol.cumulativeTotalLiquidityPremiumUSD; + + snapshot.save(); + } + + private takeUsageDailySnapshot(day: i32): void { + const activity = initActivityHelper( + Bytes.fromUTF8("daily-".concat(day.toString())) + ); + + const snapshot = new UsageMetricsDailySnapshot(Bytes.fromI32(day)); + const previousSnapshot = UsageMetricsDailySnapshot.load( + Bytes.fromI32(this.protocol._lastSnapshotDayID!.toI32()) + ); + + snapshot.days = day; + snapshot.protocol = this.protocol.id; + + snapshot.dailyActiveUsers = activity.activeUsers; + snapshot.cumulativeUniqueUsers = this.protocol.cumulativeUniqueUsers; + + snapshot.dailyLongPositionCount = previousSnapshot + ? max( + this.protocol.longPositionCount - previousSnapshot.longPositionCount, + 0 + ) + : this.protocol.longPositionCount; + snapshot.longPositionCount = this.protocol.longPositionCount; + + snapshot.dailyShortPositionCount = previousSnapshot + ? max( + this.protocol.shortPositionCount - + previousSnapshot.shortPositionCount, + 0 + ) + : this.protocol.shortPositionCount; + snapshot.shortPositionCount = this.protocol.shortPositionCount; + + snapshot.dailyOpenPositionCount = previousSnapshot + ? max( + this.protocol.openPositionCount - previousSnapshot.openPositionCount, + 0 + ) + : this.protocol.openPositionCount; + snapshot.openPositionCount = this.protocol.openPositionCount; + + snapshot.dailyClosedPositionCount = previousSnapshot + ? this.protocol.closedPositionCount - previousSnapshot.closedPositionCount + : this.protocol.closedPositionCount; + snapshot.closedPositionCount = this.protocol.closedPositionCount; + + snapshot.dailyCumulativePositionCount = previousSnapshot + ? this.protocol.cumulativePositionCount - + previousSnapshot.cumulativePositionCount + : this.protocol.cumulativePositionCount; + snapshot.cumulativePositionCount = this.protocol.cumulativePositionCount; + + snapshot.dailyTransactionCount = activity.transactionCount; + snapshot.dailyDepositCount = activity.depositCount; + snapshot.dailyWithdrawCount = activity.withdrawCount; + snapshot.dailyBorrowCount = activity.borrowCount; + snapshot.dailySwapCount = activity.swapCount; + + snapshot.dailyActiveDepositors = activity.activeDepositors; + snapshot.cumulativeUniqueDepositors = + this.protocol.cumulativeUniqueDepositors; + + snapshot.dailyActiveBorrowers = activity.activeBorrowers; + snapshot.cumulativeUniqueBorrowers = + this.protocol.cumulativeUniqueBorrowers; + + snapshot.dailyActiveLiquidators = activity.activeLiquidators; + snapshot.cumulativeUniqueLiquidators = + this.protocol.cumulativeUniqueLiquidators; + + snapshot.dailyActiveLiquidatees = activity.activeLiquidatees; + snapshot.cumulativeUniqueLiquidatees = + this.protocol.cumulativeUniqueLiquidatees; + + snapshot.dailyCollateralIn = previousSnapshot + ? this.protocol.collateralInCount - + previousSnapshot.cumulativeCollateralIn + : this.protocol.collateralInCount; + snapshot.cumulativeCollateralIn = this.protocol.collateralInCount; + + snapshot.dailyCollateralOut = previousSnapshot + ? this.protocol.collateralOutCount - + previousSnapshot.cumulativeCollateralOut + : this.protocol.collateralOutCount; + snapshot.cumulativeCollateralOut = this.protocol.collateralOutCount; + + snapshot.totalPoolCount = this.protocol.totalPoolCount; + snapshot.save(); + } + + private takeUsageHourlySnapshot(hour: i32): void { + const activity = initActivityHelper( + Bytes.fromUTF8("hourly-".concat(hour.toString())) + ); + const snapshot = new UsageMetricsHourlySnapshot(Bytes.fromI32(hour)); + + snapshot.hours = hour; + snapshot.protocol = this.protocol.id; + + snapshot.hourlyActiveUsers = activity.activeUsers; + snapshot.cumulativeUniqueUsers = this.protocol.cumulativeUniqueUsers; + + snapshot.hourlyTransactionCount = activity.transactionCount; + snapshot.hourlyDepositCount = activity.depositCount; + snapshot.hourlyWithdrawCount = activity.withdrawCount; + snapshot.hourlyBorrowCount = activity.borrowCount; + snapshot.hourlySwapCount = activity.swapCount; + snapshot.save(); + } +} + +export function initActivityHelper(id: Bytes): _ActivityHelper { + let activityHelper = _ActivityHelper.load(id); + + if (!activityHelper) { + activityHelper = new _ActivityHelper(id); + + activityHelper.activeUsers = 0; + activityHelper.activeDepositors = 0; + activityHelper.activeBorrowers = 0; + activityHelper.activeLiquidators = 0; + activityHelper.activeLiquidatees = 0; + + activityHelper.transactionCount = 0; + + activityHelper.depositCount = 0; + activityHelper.withdrawCount = 0; + activityHelper.borrowCount = 0; + activityHelper.swapCount = 0; + + activityHelper.save(); + } + + return activityHelper; +} diff --git a/subgraphs/kwenta/src/sdk/protocols/perpfutures/tokens.ts b/subgraphs/kwenta/src/sdk/protocols/perpfutures/tokens.ts new file mode 100644 index 0000000000..73d7f6d1c4 --- /dev/null +++ b/subgraphs/kwenta/src/sdk/protocols/perpfutures/tokens.ts @@ -0,0 +1,85 @@ +import { Address, Bytes, log } from "@graphprotocol/graph-ts"; + +import { Perpetual } from "./protocol"; +import * as constants from "../../util/constants"; + +import { Token, RewardToken } from "../../../../generated/schema"; + +/** + * This file contains the TokenClass, which acts as + * a wrapper for the Token entity making it easier to + * use in mappings and get info about the token. + * + * Schema Version: 1.3.0 + * SDK Version: 1.1.0 + * Author(s): + * - @harsh9200 + * - @dhruv-chauhan + */ + +export interface TokenInitializer { + getTokenParams(address: Address): TokenParams; +} + +export class TokenParams { + name: string; + symbol: string; + decimals: i32; +} + +export class TokenManager { + protocol: Perpetual; + initializer: TokenInitializer; + + constructor(protocol: Perpetual, init: TokenInitializer) { + this.protocol = protocol; + this.initializer = init; + } + + getOrCreateToken(address: Address): Token { + let token = Token.load(address); + if (!token) { + token = new Token(address); + + const params = this.initializer.getTokenParams(address); + token.name = params.name; + token.symbol = params.symbol; + token.decimals = params.decimals; + token.save(); + } + return token; + } + + getOrCreateTokenFromBytes(address: Bytes): Token { + return this.getOrCreateToken(Address.fromBytes(address)); + } + + getOrCreateRewardToken( + token: Token, + type: constants.RewardTokenType + ): RewardToken { + let id = Bytes.empty(); + if (type == constants.RewardTokenType.BORROW) { + id = id.concatI32(0); + } else if (type == constants.RewardTokenType.DEPOSIT) { + id = id.concatI32(1); + } else if (type == constants.RewardTokenType.STAKE) { + id = id.concatI32(2); + } else { + log.error("Unsupported reward token type", []); + log.critical("", []); + } + + id = id.concat(token.id); + + let rewardToken = RewardToken.load(id); + if (!rewardToken) { + rewardToken = new RewardToken(id); + rewardToken.type = type; + rewardToken.token = token.id; + rewardToken.save(); + } + + return rewardToken; + } +} diff --git a/subgraphs/kwenta/src/sdk/util/arrays.ts b/subgraphs/kwenta/src/sdk/util/arrays.ts new file mode 100644 index 0000000000..566f95545d --- /dev/null +++ b/subgraphs/kwenta/src/sdk/util/arrays.ts @@ -0,0 +1,95 @@ +import { Bytes } from "@graphprotocol/graph-ts"; + +// A function which given 3 arrays of arbitrary types of the same length, +// where the first one holds the reference order, the second one holds the same elements +// as the first but in different order, and the third any arbitrary elements. It will return +// the third array after sorting it according to the order of the first one. +// For example: +// sortArrayByReference(['a', 'c', 'b'], ['a', 'b', 'c'], [1, 2, 3]) => [1, 3, 2] +export function sortArrayByReference( + reference: T[], + array: T[], + toSort: K[] +): K[] { + const sorted: K[] = new Array(); + for (let i = 0; i < reference.length; i++) { + const index = array.indexOf(reference[i]); + sorted.push(toSort[index]); + } + return sorted; +} + +// sortBytesArray will sort an array of Bytes in ascending order +// by comparing their hex string representation. +export function sortBytesArray(array: Bytes[]): Bytes[] { + const toSort = array.map((item) => item.toHexString()); + toSort.sort(); + return toSort.map((item) => Bytes.fromHexString(item)); +} + +export function updateArrayAtIndex(x: T[], item: T, index: i32): T[] { + if (x.length == 0) { + return [item]; + } + if (index == -1 || index > x.length) { + index = x.length; + } + const retval = new Array(); + let i = 0; + while (i < index) { + retval.push(x[i]); + i += 1; + } + retval.push(item); + i += 1; + while (i < x.length) { + retval.push(x[i]); + i += 1; + } + return retval; +} + +export function addToArrayAtIndex(x: T[], item: T, index: i32 = -1): T[] { + if (x.length == 0) { + return [item]; + } + if (index == -1 || index > x.length) { + index = x.length; + } + const retval = new Array(); + let i = 0; + while (i < index) { + retval.push(x[i]); + i += 1; + } + retval.push(item); + while (i < x.length) { + retval.push(x[i]); + i += 1; + } + return retval; +} + +export function addArrays(a: T[], b: T[]): T[] { + const retval = new Array(); + if (a.length == b.length) { + let i = 0; + while (i < a.length) { + retval.push(a[i].plus(b[i])); + i += 1; + } + } + return retval; +} + +export function subtractArrays(a: T[], b: T[]): T[] { + const retval = new Array(); + if (a.length == b.length) { + let i = 0; + while (i < a.length) { + retval.push(a[i].minus(b[i])); + i += 1; + } + } + return retval; +} diff --git a/subgraphs/kwenta/src/sdk/util/constants.ts b/subgraphs/kwenta/src/sdk/util/constants.ts new file mode 100644 index 0000000000..ddb99fe923 --- /dev/null +++ b/subgraphs/kwenta/src/sdk/util/constants.ts @@ -0,0 +1,222 @@ +import { BigDecimal, BigInt } from "@graphprotocol/graph-ts"; + +//////////////////////// +///// Schema Enums ///// +//////////////////////// + +// The network names corresponding to the Network enum in the schema. +// They also correspond to the ones in `dataSource.network()` after converting to lower case. +// See below for a complete list: +// https://thegraph.com/docs/en/hosted-service/what-is-hosted-service/#supported-networks-on-the-hosted-service +export namespace Network { + export const ARBITRUM_ONE = "ARBITRUM_ONE"; + export const AVALANCHE = "AVALANCHE"; + export const AURORA = "AURORA"; + export const BSC = "BSC"; // aka BNB Chain + export const CELO = "CELO"; + export const MAINNET = "MAINNET"; // Ethereum mainnet + export const FANTOM = "FANTOM"; + export const FUSE = "FUSE"; + export const MOONBEAM = "MOONBEAM"; + export const MOONRIVER = "MOONRIVER"; + export const NEAR_MAINNET = "NEAR_MAINNET"; + export const OPTIMISM = "OPTIMISM"; + export const MATIC = "MATIC"; // aka Polygon + export const XDAI = "XDAI"; // aka Gnosis Chain + + // other networks + export const UBIQ = "UBIQ"; + export const SONGBIRD = "SONGBIRD"; + export const ELASTOS = "ELASTOS"; + export const KARDIACHAIN = "KARDIACHAIN"; + export const CRONOS = "CRONOS"; + export const RSK = "RSK"; + export const TELOS = "TELOS"; + export const XDC = "XDC"; + export const ZYX = "ZYX"; + export const CSC = "CSC"; + export const SYSCOIN = "SYSCOIN"; + export const GOCHAIN = "GOCHAIN"; + export const ETHEREUMCLASSIC = "ETHEREUMCLASSIC"; + export const OKEXCHAIN = "OKEXCHAIN"; + export const HOO = "HOO"; + export const METER = "METER"; + export const NOVA_NETWORK = "NOVA_NETWORK"; + export const TOMOCHAIN = "TOMOCHAIN"; + export const VELAS = "VELAS"; + export const THUNDERCORE = "THUNDERCORE"; + export const HECO = "HECO"; + export const XDAIARB = "XDAIARB"; + export const ENERGYWEB = "ENERGYWEB"; + export const HPB = "HPB"; + export const BOBA = "BOBA"; + export const KUCOIN = "KUCOIN"; + export const SHIDEN = "SHIDEN"; + export const THETA = "THETA"; + export const SX = "SX"; + export const CANDLE = "CANDLE"; + export const ASTAR = "ASTAR"; + export const CALLISTO = "CALLISTO"; + export const WANCHAIN = "WANCHAIN"; + export const METIS = "METIS"; + export const ULTRON = "ULTRON"; + export const STEP = "STEP"; + export const DOGECHAIN = "DOGECHAIN"; + export const RONIN = "RONIN"; + export const KAVA = "KAVA"; + export const IOTEX = "IOTEX"; + export const XLC = "XLC"; + export const NAHMII = "NAHMII"; + export const TOMBCHAIN = "TOMBCHAIN"; + export const CANTO = "CANTO"; + export const KLAYTN = "KLAYTN"; + export const EVMOS = "EVMOS"; + export const SMARTBCH = "SMARTBCH"; + export const BITGERT = "BITGERT"; + export const FUSION = "FUSION"; + export const OHO = "OHO"; + export const ARB_NOVA = "ARB_NOVA"; + export const OASIS = "OASIS"; + export const REI = "REI"; + export const REICHAIN = "REICHAIN"; + export const GODWOKEN = "GODWOKEN"; + export const POLIS = "POLIS"; + export const KEKCHAIN = "KEKCHAIN"; + export const VISION = "VISION"; + export const HARMONY = "HARMONY"; + export const PALM = "PALM"; + export const CURIO = "CURIO"; + + export const UNKNOWN_NETWORK = "UNKNOWN_NETWORK"; +} +export type Network = string; + +export namespace ProtocolType { + export const EXCHANGE = "EXCHANGE"; + export const LENDING = "LENDING"; + export const YIELD = "YIELD"; + export const BRIDGE = "BRIDGE"; + export const OPTION = "OPTION"; + export const PERPETUAL = "PERPETUAL"; + export const GENERIC = "GENERIC"; +} + +export namespace VaultFeeType { + export const MANAGEMENT_FEE = "MANAGEMENT_FEE"; + export const PERFORMANCE_FEE = "PERFORMANCE_FEE"; + export const DEPOSIT_FEE = "DEPOSIT_FEE"; + export const WITHDRAWAL_FEE = "WITHDRAWAL_FEE"; +} + +export namespace LiquidityPoolFeeType { + export const FIXED_TRADING_FEE = "FIXED_TRADING_FEE"; + export const TIERED_TRADING_FEE = "TIERED_TRADING_FEE"; + export const DYNAMIC_TRADING_FEE = "DYNAMIC_TRADING_FEE"; + export const FIXED_LP_FEE = "FIXED_LP_FEE"; + export const DYNAMIC_LP_FEE = "DYNAMIC_LP_FEE"; + export const FIXED_PROTOCOL_FEE = "FIXED_PROTOCOL_FEE"; + export const DYNAMIC_PROTOCOL_FEE = "DYNAMIC_PROTOCOL_FEE"; +} +export type LiquidityPoolFeeType = string; + +export namespace RewardTokenType { + export const DEPOSIT = "DEPOSIT"; + export const BORROW = "BORROW"; + export const STAKE = "STAKE"; +} +export type RewardTokenType = string; + +export namespace LendingType { + export const CDP = "CDP"; + export const POOLED = "POOLED"; +} + +export namespace RiskType { + export const GLOBAL = "GLOBAL"; + export const ISOLATED = "ISOLATED"; +} + +export namespace InterestRateType { + export const STABLE = "STABLE"; + export const VARIABLE = "VARIABLE"; + export const FIXED_TERM = "FIXED_TERM"; +} + +export namespace InterestRateSide { + export const LENDER = "LENDER"; + export const BORROWER = "BORROWER"; +} + +export namespace UsageType { + export const DEPOSIT = "DEPOSIT"; + export const WITHDRAW = "WITHDRAW"; + export const SWAP = "SWAP"; +} + +export namespace PositionSide { + export const LONG = "LONG"; + export const SHORT = "SHORT"; +} +export type PositionSide = string; + +////////////////////////////// +///// Ethereum Addresses ///// +////////////////////////////// + +export const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000"; +export const ETH_ADDRESS = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"; + +//////////////////////// +///// Type Helpers ///// +//////////////////////// + +export const DEFAULT_DECIMALS = 18; + +export const USDC_DECIMALS = 6; +export const USDC_DENOMINATOR = BigDecimal.fromString("1000000"); + +export const BIGINT_ZERO = BigInt.fromI32(0); +export const BIGINT_ONE = BigInt.fromI32(1); +export const BIGINT_TWO = BigInt.fromI32(2); +export const BIGINT_HUNDRED = BigInt.fromI32(100); +export const BIGINT_THOUSAND = BigInt.fromI32(1000); +export const BIGINT_TEN_TO_EIGHTEENTH = BigInt.fromString("10").pow(18); +export const BIGINT_MINUS_ONE = BigInt.fromI32(-1); +export const BIGINT_MAX = BigInt.fromString( + "115792089237316195423570985008687907853269984665640564039457584007913129639935" +); + +export const INT_NEGATIVE_ONE = -1 as i32; +export const INT_ZERO = 0 as i32; +export const INT_ONE = 1 as i32; +export const INT_TWO = 2 as i32; +export const INT_FOUR = 4 as i32; + +export const BIGDECIMAL_ZERO = new BigDecimal(BIGINT_ZERO); +export const BIGDECIMAL_ONE = new BigDecimal(BIGINT_ONE); +export const BIGDECIMAL_TWO = new BigDecimal(BIGINT_TWO); +export const BIGDECIMAL_HUNDRED = new BigDecimal(BIGINT_HUNDRED); +export const BIGDECIMAL_MINUS_ONE = new BigDecimal(BIGINT_MINUS_ONE); + +export const MAX_UINT = BigInt.fromI32(2).times(BigInt.fromI32(255)); + +///////////////////// +///// Date/Time ///// +///////////////////// + +export const SECONDS_PER_DAY = 60 * 60 * 24; // 86400 +export const SECONDS_PER_HOUR = 60 * 60; // 3600 +export const SECONDS_PER_DAY_BI = BigInt.fromI32(SECONDS_PER_DAY); +export const SECONDS_PER_HOUR_BI = BigInt.fromI32(SECONDS_PER_HOUR); +export const MS_PER_DAY = new BigDecimal(BigInt.fromI32(24 * 60 * 60 * 1000)); +export const DAYS_PER_YEAR = new BigDecimal(BigInt.fromI32(365)); +export const MS_PER_YEAR = DAYS_PER_YEAR.times( + new BigDecimal(BigInt.fromI32(24 * 60 * 60 * 1000)) +); + +//////////////// +///// Misc ///// +//////////////// + +export const ETH_SYMBOL = "ETH"; +export const ETH_NAME = "Ether"; diff --git a/subgraphs/kwenta/src/sdk/util/events.ts b/subgraphs/kwenta/src/sdk/util/events.ts new file mode 100644 index 0000000000..5c6ee1e4d1 --- /dev/null +++ b/subgraphs/kwenta/src/sdk/util/events.ts @@ -0,0 +1,70 @@ +import { BigInt, Address, Bytes, ethereum } from "@graphprotocol/graph-ts"; +import { + BIGINT_ZERO, + SECONDS_PER_DAY, + SECONDS_PER_HOUR, + ZERO_ADDRESS, +} from "./constants"; + +export class CustomEventType { + block: ethereum.Block; + transaction: ethereum.Transaction; + logIndex: BigInt; + event: ethereum.Event | null; + + constructor() { + this.block = new ethereum.Block( + Bytes.empty(), + Bytes.empty(), + Bytes.empty(), + Address.fromString(ZERO_ADDRESS), + Bytes.empty(), + Bytes.empty(), + Bytes.empty(), + BIGINT_ZERO, + BIGINT_ZERO, + BIGINT_ZERO, + BIGINT_ZERO, + BIGINT_ZERO, + BIGINT_ZERO, + null, + null + ); + this.transaction = new ethereum.Transaction( + Bytes.empty(), + BIGINT_ZERO, + Address.fromString(ZERO_ADDRESS), + null, + BIGINT_ZERO, + BIGINT_ZERO, + BIGINT_ZERO, + Bytes.empty(), + BIGINT_ZERO + ); + this.logIndex = BIGINT_ZERO; + this.event = null; + } + + static initialize( + block: ethereum.Block, + transaction: ethereum.Transaction, + logIndex: BigInt, + event: ethereum.Event | null = null + ): CustomEventType { + const customEvent = new CustomEventType(); + customEvent.block = block; + customEvent.transaction = transaction; + customEvent.logIndex = logIndex; + customEvent.event = event; + + return customEvent; + } +} + +export function getUnixDays(block: ethereum.Block): i32 { + return block.timestamp.toI32() / SECONDS_PER_DAY; +} + +export function getUnixHours(block: ethereum.Block): i32 { + return block.timestamp.toI32() / SECONDS_PER_HOUR; +} diff --git a/subgraphs/kwenta/src/sdk/util/numbers.ts b/subgraphs/kwenta/src/sdk/util/numbers.ts new file mode 100644 index 0000000000..338ca172d8 --- /dev/null +++ b/subgraphs/kwenta/src/sdk/util/numbers.ts @@ -0,0 +1,59 @@ +import { BigDecimal, BigInt } from "@graphprotocol/graph-ts"; + +import { BIGDECIMAL_ZERO } from "./constants"; + +export function bigIntToBigDecimal( + quantity: BigInt, + decimals: i32 = 18 +): BigDecimal { + return quantity.divDecimal( + BigInt.fromI32(10) + .pow(decimals as u8) + .toBigDecimal() + ); +} + +export function bigDecimalToBigInt(input: BigDecimal): BigInt { + const str = input.truncate(0).toString(); + return BigInt.fromString(str); +} + +// returns 10^exp +export function exponentToBigDecimal(exp: i32 = 18): BigDecimal { + let bd = BigDecimal.fromString("1"); + const ten = BigDecimal.fromString("10"); + for (let i = 0; i < exp; i++) { + bd = bd.times(ten); + } + return bd; +} + +export function calculateAverage(prices: BigDecimal[]): BigDecimal { + let sum = BigDecimal.fromString("0"); + for (let i = 0; i < prices.length; i++) { + sum = sum.plus(prices[i]); + } + + return sum.div( + BigDecimal.fromString(BigInt.fromI32(prices.length).toString()) + ); +} + +export function calculateMedian(prices: BigDecimal[]): BigDecimal { + const sorted = prices.sort((a, b) => { + return a.equals(b) ? 0 : a.gt(b) ? 1 : -1; + }); + + const mid = Math.ceil(sorted.length / 2) as i32; + if (sorted.length % 2 == 0) { + return sorted[mid].plus(sorted[mid - 1]).div(BigDecimal.fromString("2")); + } + + return sorted[mid - 1]; +} + +export function safeDivide(a: BigDecimal, b: BigDecimal): BigDecimal { + if (b == BIGDECIMAL_ZERO) return BIGDECIMAL_ZERO; + + return a.div(b); +} diff --git a/subgraphs/kwenta/src/sdk/util/rewards.ts b/subgraphs/kwenta/src/sdk/util/rewards.ts new file mode 100644 index 0000000000..ec9b7c6029 --- /dev/null +++ b/subgraphs/kwenta/src/sdk/util/rewards.ts @@ -0,0 +1,292 @@ +///////////////////// +// VERSION 1.0.3 //// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// The purpose of this program is to dynamically estimate the blocks generated for the 24 HR period following the most recent update. // +// It does so by calculating the moving average block rate for an arbitrary length of time preceding the current block. // +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +import { log, BigDecimal, BigInt, dataSource } from "@graphprotocol/graph-ts"; +import { _CircularBuffer } from "../../../generated/schema"; +import { + Network, + BIGDECIMAL_ZERO, + INT_FOUR, + INT_NEGATIVE_ONE, + INT_ONE, + INT_TWO, + INT_ZERO, +} from "./constants"; + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// WINDOW_SIZE_SECONDS, TIMESTAMP_STORAGE_INTERVALS, and BUFFER_SIZE can be modified. These are just recommended values - 'somewhat' arbitrary. // +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +// The storage interval tells you to only store blocks where the timestamps are separated by at least this amount. +// Increasing this value will mean less blocks stored and less frequently computes blocksSpeed. +export const TIMESTAMP_STORAGE_INTERVAL = 600; + +// The window size determines the range of blocks that you track from the current block minus the window size. +// Window of block time used to calculate the moving average. +// Increasing means less deviation but also less sensitivity to changing block speeds. +export const WINDOW_SIZE_SECONDS = 86400; + +// BUFFER_SIZE determined the size of the array +// Makes the buffer the maximum amount of blocks that can be stored given the block rate and storage interval +// Recommended value is (RATE_IN_SECODNDS / TIMESTAMP_STORAGE_INTERVAL) * 2 - > Round up to nearest even integer +export const BUFFER_SIZE = 288; + +// Add this entity to the schema. +// type _CircularBuffer @entity { +// " 'CIRCULAR_BUFFER' " +// id: ID! + +// " Array of sorted block numbers sorted continuously " +// blocks: [Int!]! + +// " The index in the blocks array which will be used with the newest block to calculate block speed (Usally set to about a day before newest block) " +// windowStartIndex: Int! + +// " The next index in the blocks array that will be replaced with the newest block " +// nextIndex: Int! + +// " This determines the size of the blocks array. Should be set to contain at least a days worth of blocks according to a 1 day window for measuring speed" +// bufferSize: Int! + +// " The current calculated number of blocks per day based on calculated block speed " +// blocksPerDay: BigDecimal! + +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +export const CIRCULAR_BUFFER = "CIRCULAR_BUFFER"; + +// Describes whether the interval for which rewards are emitted is done by block or timestamp +export namespace RewardIntervalType { + export const BLOCK = "BLOCK"; + export const TIMESTAMP = "TIMESTAMP"; +} + +// Forecast period. This gives you the time period that you want to estimate count of blocks per interval, based on moving average block speed. +// 86400 = 1 Day +export const RATE_IN_SECONDS = 86400; +export const RATE_IN_SECONDS_BD = BigDecimal.fromString( + RATE_IN_SECONDS.toString() +); + +// Estimated seconds per block of the protocol +export const STARTING_BLOCKS_PER_DAY = RATE_IN_SECONDS_BD.div( + getStartingBlockRate() +); + +export const WINDOW_SIZE_SECONDS_BD = BigDecimal.fromString( + WINDOW_SIZE_SECONDS.toString() +); + +// Call this function in event handlers frequently enough so that it calls on blocks frequently enough +/** + * @param {BigInt} currentTimestamp - Timestamp for current event + * @param {BigInt} currentBlockNumber - Block nunmber of current event + * @param {BigInt} rewardRate - Rate of reward emissions per reward interval + * @param {BigInt} rewardType - Describes whether rewards are given per block or timestamp + * @returns {BigDecimal} - Returns estimated blocks for specified rate + */ +export function getRewardsPerDay( + currentTimestamp: BigInt, + currentBlockNumber: BigInt, + rewardRate: BigDecimal, + rewardType: string +): BigDecimal { + const circularBuffer = getOrCreateCircularBuffer(); + + // Create entity for the current block + const currentTimestampI32 = currentTimestamp.toI32(); + const currentBlockNumberI32 = currentBlockNumber.toI32(); + + const blocks = circularBuffer.blocks; + + // Interval between index and the index of the start of the window block + const windowWidth = abs( + circularBuffer.windowStartIndex - circularBuffer.nextIndex + ); + if (windowWidth == INT_ZERO) { + if (circularBuffer.nextIndex >= circularBuffer.bufferSize) { + blocks[INT_ZERO] = currentTimestampI32; + blocks[INT_ONE] = currentBlockNumberI32; + circularBuffer.nextIndex = INT_TWO; + } else { + blocks[circularBuffer.nextIndex] = currentTimestampI32; + blocks[circularBuffer.nextIndex + INT_ONE] = currentBlockNumberI32; + circularBuffer.nextIndex += INT_TWO; + } + + circularBuffer.save(); + + // return because there is only 1 reference point. + if (rewardType == RewardIntervalType.TIMESTAMP) { + return rewardRate.times(RATE_IN_SECONDS_BD); + } else { + return circularBuffer.blocksPerDay.times(rewardRate); + } + } + + // Add current timestamp and block numnber to array if new block is at least X blocks later than previously stored. + // Used to save memory and efficiency on array resizing. + let recentSavedTimestamp: i32; + if (circularBuffer.nextIndex == INT_ZERO) { + recentSavedTimestamp = blocks[circularBuffer.bufferSize - INT_TWO]; + } else { + recentSavedTimestamp = blocks[circularBuffer.nextIndex - INT_TWO]; + } + + if ( + currentTimestampI32 - recentSavedTimestamp <= + TIMESTAMP_STORAGE_INTERVAL + ) { + if (rewardType == RewardIntervalType.TIMESTAMP) { + return rewardRate.times(RATE_IN_SECONDS_BD); + } else { + return circularBuffer.blocksPerDay.times(rewardRate); + } + } + + blocks[circularBuffer.nextIndex] = currentTimestampI32; + blocks[circularBuffer.nextIndex + INT_ONE] = currentBlockNumberI32; + if (circularBuffer.nextIndex >= BUFFER_SIZE - INT_TWO) { + circularBuffer.nextIndex = INT_ZERO; + } else { + circularBuffer.nextIndex += INT_TWO; + } + // The timestamp at the start of the window (default 24 hours in seconds). + const startTimestamp = currentTimestampI32 - WINDOW_SIZE_SECONDS; + + // Make sure to still have 2 blocks to calculate rate (This shouldn't happen past the beginning). + while (true) { + if (circularBuffer.nextIndex > circularBuffer.windowStartIndex) { + if ( + circularBuffer.nextIndex - circularBuffer.windowStartIndex <= + INT_FOUR + ) { + break; + } + } else { + if ( + BUFFER_SIZE - + circularBuffer.windowStartIndex + + circularBuffer.nextIndex <= + INT_FOUR + ) { + break; + } + } + const windowIndexBlockTimestamp = blocks[circularBuffer.windowStartIndex]; + + // Shift the start of the window if the current timestamp moves out of desired rate window + if (windowIndexBlockTimestamp < startTimestamp) { + circularBuffer.windowStartIndex = + circularBuffer.windowStartIndex + INT_TWO; + if (circularBuffer.windowStartIndex >= circularBuffer.bufferSize) { + circularBuffer.windowStartIndex = INT_ZERO; + } + } else { + break; + } + } + + // Wideness of the window in seconds. + const windowSecondsCount = BigDecimal.fromString( + (currentTimestampI32 - blocks[circularBuffer.windowStartIndex]).toString() + ); + + // Wideness of the window in blocks. + const windowBlocksCount = BigDecimal.fromString( + ( + currentBlockNumberI32 - blocks[circularBuffer.windowStartIndex + INT_ONE] + ).toString() + ); + + // Estimate block speed for the window in seconds. + const unnormalizedBlockSpeed = + WINDOW_SIZE_SECONDS_BD.div(windowSecondsCount).times(windowBlocksCount); + + // block speed converted to specified rate. + const normalizedBlockSpeed = RATE_IN_SECONDS_BD.div( + WINDOW_SIZE_SECONDS_BD + ).times(unnormalizedBlockSpeed); + + // Update BlockTracker with new values. + circularBuffer.blocksPerDay = normalizedBlockSpeed; + circularBuffer.blocks = blocks; + + circularBuffer.save(); + + if (rewardType == RewardIntervalType.TIMESTAMP) { + return rewardRate.times(RATE_IN_SECONDS_BD); + } else { + return rewardRate.times(circularBuffer.blocksPerDay); + } +} + +function getOrCreateCircularBuffer(): _CircularBuffer { + let circularBuffer = _CircularBuffer.load(CIRCULAR_BUFFER); + + if (!circularBuffer) { + circularBuffer = new _CircularBuffer(CIRCULAR_BUFFER); + + const blocks = new Array(BUFFER_SIZE); + for (let i = INT_ZERO; i < BUFFER_SIZE; i += INT_TWO) { + blocks[i] = INT_NEGATIVE_ONE; + blocks[i + INT_ONE] = INT_NEGATIVE_ONE; + } + + circularBuffer.blocks = blocks; + circularBuffer.windowStartIndex = INT_ZERO; + circularBuffer.nextIndex = INT_ZERO; + circularBuffer.bufferSize = BUFFER_SIZE; + circularBuffer.blocksPerDay = STARTING_BLOCKS_PER_DAY; + + circularBuffer.save(); + } + + return circularBuffer; +} + +function getStartingBlockRate(): BigDecimal { + // Block rates pulled from google searches - rough estimates + + const network = dataSource.network().toUpperCase().replace("-", "_"); + if (network == Network.MAINNET) { + return BigDecimal.fromString("13.39"); + } else if (network == Network.ARBITRUM_ONE) { + return BigDecimal.fromString("15"); + } else if (network == Network.AURORA) { + return BigDecimal.fromString("1.03"); + } else if (network == Network.BSC) { + return BigDecimal.fromString("5"); + } else if (network == Network.CELO) { + return BigDecimal.fromString("5"); + } else if (network == Network.FANTOM) { + return BigDecimal.fromString("1"); + } else if (network == Network.FUSE) { + return BigDecimal.fromString("1"); + } else if (network == Network.OPTIMISM) { + return BigDecimal.fromString("12.5"); + } else if (network == Network.MATIC) { + return BigDecimal.fromString("2"); + } else if (network == Network.XDAI) { + return BigDecimal.fromString("5"); + } else if (network == Network.MOONBEAM) { + return BigDecimal.fromString("13.39"); + } else if (network == Network.MOONRIVER) { + return BigDecimal.fromString("13.39"); + } else if (network == Network.AVALANCHE) { + return BigDecimal.fromString("13.39"); + } else if (network == Network.CRONOS) { + return BigDecimal.fromString("5.5"); + } + + // else if (network == SubgraphNetwork.AVALANCHE) return BigDecimal.fromString("2.5") + // else if (dataSource.network() == "harmony") return BigDecimal.fromString("13.39") + else { + log.warning("getStartingBlockRate(): Network not found", []); + return BIGDECIMAL_ZERO; + } +} diff --git a/subgraphs/kwenta/tsconfig.json b/subgraphs/kwenta/tsconfig.json new file mode 100644 index 0000000000..5c5d17c928 --- /dev/null +++ b/subgraphs/kwenta/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "@graphprotocol/graph-ts/types/tsconfig.base.json", + "include": ["src"] +} From e820bd9124c5a47d541c1f78663a6ca9603c6874 Mon Sep 17 00:00:00 2001 From: Amrit Jain Date: Tue, 22 Aug 2023 00:59:12 +0530 Subject: [PATCH 2/6] fix: remove all the unused code, complete readme --- subgraphs/kwenta/README.md | 65 ++- subgraphs/kwenta/package.json | 4 +- .../kwenta-optimism/configurations.ts | 9 +- .../kwenta/protocols/kwenta/src/constants.ts | 1 - .../kwenta/protocols/kwenta/src/mapping.ts | 1 - subgraphs/kwenta/schema.graphql | 126 +++--- subgraphs/kwenta/src/common/constants.ts | 177 -------- subgraphs/kwenta/src/common/getters.ts | 88 ---- subgraphs/kwenta/src/common/metrics.ts | 139 ------- subgraphs/kwenta/src/common/rewards.ts | 292 -------------- subgraphs/kwenta/src/common/snapshot.ts | 321 --------------- subgraphs/kwenta/src/common/tokens.ts | 188 --------- subgraphs/kwenta/src/common/utils/arrays.ts | 66 --- subgraphs/kwenta/src/common/utils/datetime.ts | 64 --- subgraphs/kwenta/src/common/utils/numbers.ts | 92 ----- subgraphs/kwenta/src/common/utils/strings.ts | 52 --- subgraphs/kwenta/src/mappings/handlers.ts | 42 +- subgraphs/kwenta/src/sdk/protocols/config.ts | 10 +- .../src/sdk/protocols/perpfutures/README.md | 4 +- .../src/sdk/protocols/perpfutures/account.ts | 30 +- .../src/sdk/protocols/perpfutures/pool.ts | 379 +++++++++++++----- .../sdk/protocols/perpfutures/poolSnapshot.ts | 72 ++-- .../src/sdk/protocols/perpfutures/position.ts | 19 +- .../src/sdk/protocols/perpfutures/protocol.ts | 50 ++- .../protocols/perpfutures/protocolSnapshot.ts | 28 +- .../src/sdk/protocols/perpfutures/tokens.ts | 22 +- subgraphs/kwenta/src/sdk/util/constants.ts | 6 + subgraphs/kwenta/src/sdk/util/numbers.ts | 91 ++++- 28 files changed, 681 insertions(+), 1757 deletions(-) delete mode 100644 subgraphs/kwenta/protocols/kwenta/src/constants.ts delete mode 100644 subgraphs/kwenta/protocols/kwenta/src/mapping.ts delete mode 100644 subgraphs/kwenta/src/common/constants.ts delete mode 100644 subgraphs/kwenta/src/common/getters.ts delete mode 100644 subgraphs/kwenta/src/common/metrics.ts delete mode 100644 subgraphs/kwenta/src/common/rewards.ts delete mode 100644 subgraphs/kwenta/src/common/snapshot.ts delete mode 100644 subgraphs/kwenta/src/common/tokens.ts delete mode 100644 subgraphs/kwenta/src/common/utils/arrays.ts delete mode 100644 subgraphs/kwenta/src/common/utils/datetime.ts delete mode 100644 subgraphs/kwenta/src/common/utils/numbers.ts delete mode 100644 subgraphs/kwenta/src/common/utils/strings.ts diff --git a/subgraphs/kwenta/README.md b/subgraphs/kwenta/README.md index f4ce7243a4..37c8302bec 100644 --- a/subgraphs/kwenta/README.md +++ b/subgraphs/kwenta/README.md @@ -1,28 +1,61 @@ -# Template Subgraph +# Kwenta Subgraph ## Calculation Methodology v1.0.0 -### TODO +### Total Value Locked (TVL) -Explain how the main metrics are calculated for this subgraph. +Sum of all the margin deposits -See [Compound](../compound-forks/protocols/compound-v2/README.md) or [Uniswap](../uniswap-forks/protocols/uniswap-v2/README.md) for inspiration. +> TVL of a Pool = ∑ value of all assets to be provided as collateral pool -## Notes +> TVL of the Protocol = ∑ TVL of of all the pools -Any issues, discrepancies, unique logic to report. +### Open Intereest -## Links +> Open Interest = ∑ value of open positions -Links to the relevant sources to learn about this protocol. +Calculated by fetching pool contract market size and skew data -- Protocol: https://uniswap.org/ -- Analytics: https://v2.info.uniswap.org/ -- Docs: https://docs.uniswap.org/protocol/V2/introduction -- Smart contracts: https://github.com/Uniswap/v2-core -- Deployed addresses: https://docs.uniswap.org/protocol/V2/reference/smart-contracts/factory -- Official subgraph: https://github.com/Uniswap/v2-subgraph +> Long Open Interest = (marketSize + marketSkew) / 2 -## Contract Relationship Map (Optional) +> Short Open Interest = (marketSize - marketSkew) / 2 -A map of relationships between contracts and interactions +> Total Open Interest = Long + Short Open Interest + +### Volume + +- Volume: The total cumulative value of all the trades executed + +- Inflow Volume: The total cumulative value of margin deposited +- Outflow Volume: The total cumulative value of margin withdrawn + +### Revenue/Fees + +The protocol take two fees - Keeper Fees and Maker/Takes Fees + +- Keeper Fees: A dynamic fees to execute the trade +- Maker/Taker Fees: Normal Maker/Taker fees they vary depending on the market + +Protocol Side Revenue = Zero + +Supply-Side Revenue = Total Fees (currently Kwenta don't charge any fees) + +Total Revenue = Total Fees + +### Unique Users + +**Count of Unique Addresses which have interacted with the protocol via any transaction:** + +- Margin deposits and withdrawals + +- Position Modified - new, updated or closed + +- Liquidations + +## References and Useful Links + +- Other existing subgraph: https://thegraph.com/hosted-service/subgraph/kwenta/optimism-main + +- Other official and unofficial data sources: https://kwenta.eth.limo/stats/, https://tokenterminal.com/terminal/projects/kwenta + +- Documentation: https://docs.kwenta.io/ diff --git a/subgraphs/kwenta/package.json b/subgraphs/kwenta/package.json index 61abae4e90..b1a28ef84c 100644 --- a/subgraphs/kwenta/package.json +++ b/subgraphs/kwenta/package.json @@ -5,8 +5,8 @@ "prepare:constants": "mustache protocols/${npm_config_protocol}/config/deployments/${npm_config_id}/configurations.json configurations/configure.mustache > configurations/configure.ts" }, "dependencies": { - "@graphprotocol/graph-cli": "0.37.0", - "@graphprotocol/graph-ts": "0.29.0" + "@graphprotocol/graph-cli": "0.55.0", + "@graphprotocol/graph-ts": "0.31.0" }, "devDependencies": { "prettier": "2.7.1", diff --git a/subgraphs/kwenta/protocols/kwenta/config/deployments/kwenta-optimism/configurations.ts b/subgraphs/kwenta/protocols/kwenta/config/deployments/kwenta-optimism/configurations.ts index 4abeaf9b15..305e8b14d6 100644 --- a/subgraphs/kwenta/protocols/kwenta/config/deployments/kwenta-optimism/configurations.ts +++ b/subgraphs/kwenta/protocols/kwenta/config/deployments/kwenta-optimism/configurations.ts @@ -1,10 +1,7 @@ import { Address } from "@graphprotocol/graph-ts"; import { Configurations } from "../../../../../configurations/configurations/interface"; -import { - PROTOCOL_NAME, - PROTOCOL_SLUG, -} from "../../../../../src/common/constants"; + import { Network } from "../../../../../src/sdk/util/constants"; export class KwentaOptimismConfigurations implements Configurations { @@ -12,10 +9,10 @@ export class KwentaOptimismConfigurations implements Configurations { return Network.OPTIMISM; } getProtocolName(): string { - return PROTOCOL_NAME; + return "Kwenta"; } getProtocolSlug(): string { - return PROTOCOL_SLUG; + return "kwenta"; } getFactoryAddress(): Address { return Address.fromString("0x920cf626a271321c151d027030d5d08af699456b"); diff --git a/subgraphs/kwenta/protocols/kwenta/src/constants.ts b/subgraphs/kwenta/protocols/kwenta/src/constants.ts deleted file mode 100644 index 153af33628..0000000000 --- a/subgraphs/kwenta/protocols/kwenta/src/constants.ts +++ /dev/null @@ -1 +0,0 @@ -// protocol specific constants diff --git a/subgraphs/kwenta/protocols/kwenta/src/mapping.ts b/subgraphs/kwenta/protocols/kwenta/src/mapping.ts deleted file mode 100644 index 52d123338a..0000000000 --- a/subgraphs/kwenta/protocols/kwenta/src/mapping.ts +++ /dev/null @@ -1 +0,0 @@ -// protocol handlers and protocol specific mappings diff --git a/subgraphs/kwenta/schema.graphql b/subgraphs/kwenta/schema.graphql index 2595daa89c..1ebbf33b8d 100644 --- a/subgraphs/kwenta/schema.graphql +++ b/subgraphs/kwenta/schema.graphql @@ -1,5 +1,5 @@ # Subgraph Schema: Derivatives Perpetual Futures -# Version: 1.3.0 +# Version: 1.3.3 # See https://github.com/messari/subgraphs/blob/master/docs/SCHEMA.md for details enum Network { @@ -37,7 +37,7 @@ enum ProtocolType { # Will add more } -type Token @entity { +type Token @entity @regularPolling { " Smart contract address of the token " id: Bytes! @@ -68,7 +68,7 @@ enum RewardTokenType { STAKE } -type RewardToken @entity(immutable: true) { +type RewardToken @entity(immutable: true) @regularPolling { " Bytes.fromI32(0|1).concat(rewardTokenAddress), where 0 is for deposit and 1 is for borrow " id: Bytes! @@ -118,7 +118,7 @@ enum LiquidityPoolFeeType { WITHDRAWAL_FEE } -type LiquidityPoolFee @entity { +type LiquidityPoolFee @entity @regularPolling { " { Fee type }-{ Pool address } " id: Bytes! @@ -258,7 +258,7 @@ interface Protocol { financialMetrics: [FinancialsDailySnapshot!]! @derivedFrom(field: "protocol") } -type DerivPerpProtocol implements Protocol @entity { +type DerivPerpProtocol implements Protocol @entity @regularPolling { " Smart contract address of the protocol's main contract (Factory, Registry, etc) " id: Bytes! @@ -425,7 +425,7 @@ type DerivPerpProtocol implements Protocol @entity { ##### Protocol Timeseries ##### ############################### -type UsageMetricsDailySnapshot @entity(immutable: true) { +type UsageMetricsDailySnapshot @entity(immutable: true) @dailySnapshot { " ID is # of days since Unix epoch time " id: Bytes! @@ -524,9 +524,12 @@ type UsageMetricsDailySnapshot @entity(immutable: true) { " Total number of pools " totalPoolCount: Int! + + " Timestamp of this snapshot " + timestamp: BigInt! } -type UsageMetricsHourlySnapshot @entity(immutable: true) { +type UsageMetricsHourlySnapshot @entity(immutable: true) @hourlySnapshot { " { # of hours since Unix epoch time } " id: Bytes! @@ -556,9 +559,12 @@ type UsageMetricsHourlySnapshot @entity(immutable: true) { " Total number of trades (swaps) in an hour " hourlySwapCount: Int! + + " Timestamp of this snapshot " + timestamp: BigInt! } -type FinancialsDailySnapshot @entity(immutable: true) { +type FinancialsDailySnapshot @entity(immutable: true) @dailySnapshot { " ID is # of days since Unix epoch time " id: Bytes! @@ -663,13 +669,16 @@ type FinancialsDailySnapshot @entity(immutable: true) { " All premium paid to enter and exit liquidity pool. " cumulativeTotalLiquidityPremiumUSD: BigDecimal! + + " Timestamp of this snapshot " + timestamp: BigInt! } ############################### ##### Pool-Level Metadata ##### ############################### -type LiquidityPool @entity { +type LiquidityPool @entity @regularPolling { " Smart contract address of the pool " id: Bytes! @@ -717,6 +726,9 @@ type LiquidityPool @entity { " All revenue generated by the liquidity pool, accrued to the protocol. " cumulativeProtocolSideRevenueUSD: BigDecimal! + " All revenue generated by the liquidity pool, accrued to the stakers of governance token. Examples: GMX 30% of trade fees goes to stakers of native token (e.g. GMX stakers) " + cumulativeStakeSideRevenueUSD: BigDecimal! + " All revenue generated by the liquidity pool. " cumulativeTotalRevenueUSD: BigDecimal! @@ -762,6 +774,15 @@ type LiquidityPool @entity { " Notional value of all open positions " totalOpenInterestUSD: BigDecimal! + " Long Open Interest by Token Amount " + longOpenInterest: BigInt! + + " Short Open Interest by Token Amount " + shortOpenInterest: BigInt! + + " Total Open Interest by Token Amount " + totalOpenInterest: BigInt! + " Total number of long positions (not cumulative) " longPositionCount: Int! @@ -861,20 +882,13 @@ type LiquidityPool @entity { " Timestamp of the last time this entity was updated " _lastUpdateTimestamp: BigInt - - longOpenInterest: BigInt! - shortOpenInterest: BigInt! - totalOpenInterest: BigInt! - - marketSize: BigInt - marketSkew: BigInt } ################################# ##### Pool-Level Timeseries ##### ################################# -type LiquidityPoolDailySnapshot @entity { +type LiquidityPoolDailySnapshot @entity(immutable: true) @dailySnapshot { " { Smart contract address of the pool }-{ # of days since Unix epoch time } " id: Bytes! @@ -887,6 +901,9 @@ type LiquidityPoolDailySnapshot @entity { " The pool this snapshot belongs to " pool: LiquidityPool! + " Timestamp of this snapshot " + timestamp: BigInt! + ##### Quantitative Data ##### " Current TVL (Total Value Locked) of this pool " @@ -904,6 +921,12 @@ type LiquidityPoolDailySnapshot @entity { " Daily revenue generated by the liquidity pool, accrued to the protocol. " dailyProtocolSideRevenueUSD: BigDecimal! + " All revenue generated by the liquidity pool, accrued to the stakers of the governance token. Examples: GMX 30% of trade fees goes to stakers of native token (e.g. GMX stakers) " + cumulativeStakeSideRevenueUSD: BigDecimal! + + " Daily revenue generated by the liquidity pool, accrued to the stakers of the governance token. Examples: GMX 30% of trade fees goes to stakers of native token (e.g. GMX stakers)" + dailyStakeSideRevenueUSD: BigDecimal! + " Daily revenue generated by the liquidity pool. " dailyTotalRevenueUSD: BigDecimal! @@ -1090,6 +1113,9 @@ type LiquidityPoolDailySnapshot @entity { " Outflow historical trade notional volume occurred in this pool, in USD, based on value of underlying assets coming outof protocol from trade. " cumulativeOutflowVolumeUSD: BigDecimal! + " Tokens that need to be deposited to take a position in protocol. e.g. WETH and USDC to deposit into the WETH-USDC pool. Array to account for multi-asset pools like Curve and Balancer " + inputTokens: [Token!]! + " Amount of input tokens in the pool. The ordering should be the same as the pool's `inputTokens` field. " inputTokenBalances: [BigInt!]! @@ -1110,16 +1136,9 @@ type LiquidityPoolDailySnapshot @entity { " Per-block reward token emission as of the current block normalized to a day, in USD value. This should be ideally calculated as the theoretical rate instead of the realized amount. " rewardTokenEmissionsUSD: [BigDecimal!] - - longOpenInterest: BigInt! - shortOpenInterest: BigInt! - totalOpenInterest: BigInt! - - marketSize: BigInt - marketSkew: BigInt } -type LiquidityPoolHourlySnapshot @entity { +type LiquidityPoolHourlySnapshot @entity(immutable: true) @hourlySnapshot { " { Smart contract address of the pool }-{ # of hours since Unix epoch time } " id: Bytes! @@ -1132,6 +1151,9 @@ type LiquidityPoolHourlySnapshot @entity { " The pool this snapshot belongs to " pool: LiquidityPool! + " Timestamp of this snapshot " + timestamp: BigInt! + ##### Quantitative Data ##### " Current TVL (Total Value Locked) of this pool " @@ -1149,6 +1171,12 @@ type LiquidityPoolHourlySnapshot @entity { " Hourly revenue generated by the liquidity pool, accrued to the protocol. " hourlyProtocolSideRevenueUSD: BigDecimal! + " All revenue generated by the liquidity pool, accrued to the stakers of the native governance token. Examples: GMX 30% of trade fees goes to stakers of native token (e.g. GMX stakers)" + cumulativeStakeSideRevenueUSD: BigDecimal! + + " Hourly revenue generated by the liquidity pool, accrued to the stakers of the native governance tokens. Examples: GMX 30% of trade fees goes to stakers of native token (e.g. GMX stakers)" + hourlyStakeSideRevenueUSD: BigDecimal! + " All revenue generated by the liquidity pool. " cumulativeTotalRevenueUSD: BigDecimal! @@ -1275,6 +1303,9 @@ type LiquidityPoolHourlySnapshot @entity { " Outflow historical trade notional volume occurred in this pool, in USD " cumulativeOutflowVolumeUSD: BigDecimal! + " Tokens that need to be deposited to take a position in protocol. e.g. WETH and USDC to deposit into the WETH-USDC pool. Array to account for multi-asset pools like Curve and Balancer " + inputTokens: [Token!]! + " Amount of input tokens in the pool. The ordering should be the same as the pool's `inputTokens` field. " inputTokenBalances: [BigInt!]! @@ -1295,13 +1326,6 @@ type LiquidityPoolHourlySnapshot @entity { " Per-block reward token emission as of the current block normalized to a day (not hour), in USD value. This should be ideally calculated as the theoretical rate instead of the realized amount. " rewardTokenEmissionsUSD: [BigDecimal!] - - longOpenInterest: BigInt! - shortOpenInterest: BigInt! - totalOpenInterest: BigInt! - - marketSize: BigInt - marketSkew: BigInt } ################################## @@ -1346,7 +1370,7 @@ interface Event { } "Deposits in liquidity pool" -type Deposit implements Event @entity(immutable: true) { +type Deposit implements Event @entity(immutable: true) @transaction { " deposit-{ Transaction hash }-{ Log index } " id: Bytes! @@ -1394,7 +1418,7 @@ type Deposit implements Event @entity(immutable: true) { } "Withdraw in liquidity pool" -type Withdraw implements Event @entity(immutable: true) { +type Withdraw implements Event @entity(immutable: true) @transaction { " withdraw-{ Transaction hash }-{ Log index }" id: Bytes! @@ -1441,7 +1465,7 @@ type Withdraw implements Event @entity(immutable: true) { pool: LiquidityPool! } -type Borrow implements Event @entity(immutable: true) { +type Borrow implements Event @entity(immutable: true) @transaction { " Borrow-{ Transaction hash }-{ Log index }" id: Bytes! @@ -1486,7 +1510,7 @@ type Borrow implements Event @entity(immutable: true) { } "Collateral In for trading" -type CollateralIn implements Event @entity(immutable: true) { +type CollateralIn implements Event @entity(immutable: true) @transaction { " deposit-{ Transaction hash }-{ Log index } " id: Bytes! @@ -1537,7 +1561,7 @@ type CollateralIn implements Event @entity(immutable: true) { } "Collateral out for trading" -type CollateralOut implements Event @entity(immutable: true) { +type CollateralOut implements Event @entity(immutable: true) @transaction { " withdraw-{ Transaction hash }-{ Log index }" id: Bytes! @@ -1588,7 +1612,7 @@ type CollateralOut implements Event @entity(immutable: true) { } #This only applies to protocols that have a DEX (e.g. DYDX) and not to protocols that use oracle prices (e.g. GMX). -type Swap implements Event @entity(immutable: true) { +type Swap implements Event @entity(immutable: true) @transaction { " swap-{ Transaction hash }-{ Log index } " id: Bytes! @@ -1641,7 +1665,7 @@ type Swap implements Event @entity(immutable: true) { pool: LiquidityPool! } -type Liquidate implements Event @entity(immutable: true) { +type Liquidate implements Event @entity(immutable: true) @transaction { " liquidate-{ Transaction hash }-{ Log index }" id: Bytes! @@ -1693,7 +1717,7 @@ type Liquidate implements Event @entity(immutable: true) { # An account is a unique Ethereum address # Helps to accumulate total unique users -type Account @entity { +type Account @entity @regularPolling { " Address of the account " id: Bytes! @@ -1797,8 +1821,8 @@ enum PositionSide { } # A position is defined as who has what position in the protocol and distribution of longs and shorts at a positional level -type Position @entity { - " { Account address }-{ Pool address }-{ Position Side }-{ Counter } " +type Position @entity @regularPolling { + " { Account address }-{ Pool address }-{ Asset }-{ Position Side }-{ Counter } " id: Bytes! " Account that owns this position " @@ -1885,16 +1909,17 @@ type Position @entity { " Position daily snapshots for open positions " snapshots: [PositionSnapshot!]! @derivedFrom(field: "position") + " Position Open Price " price: BigInt! + " Funding Index at position open " fundingIndex: BigInt! + " Position Size " size: BigInt! - - isClosed: Boolean! } -type PositionSnapshot @entity(immutable: true) { +type PositionSnapshot @entity(immutable: true) @hourlySnapshot { " { Position ID }-{ Transaction hash }-{ Log index } " id: Bytes! @@ -1962,21 +1987,30 @@ type _ActivityHelper @entity { # Helper entity for getting positions type _PositionCounter @entity { - " { Account address }-{ Pool address }-{ Position Side } " + " { Account address }-{ Pool address }-{ Asset }-{ Position Side } " id: Bytes! " Next count " nextCount: Int! } +# Smart Margin Account type _SmartMarginAccount @entity { + "Account Unique ID" id: ID! + + "Owner of the Smart Margin Account" owner: Account! + + " Smart Margin Account Version " version: Bytes! } +# Funding Rate for calculating funding accured type _FundingRate @entity { + "Funding Index" id: Bytes! + "Funding Amount" funding: BigInt! } diff --git a/subgraphs/kwenta/src/common/constants.ts b/subgraphs/kwenta/src/common/constants.ts deleted file mode 100644 index 854e465914..0000000000 --- a/subgraphs/kwenta/src/common/constants.ts +++ /dev/null @@ -1,177 +0,0 @@ -import { BigDecimal, BigInt } from "@graphprotocol/graph-ts"; - -//////////////////// -///// Versions ///// -//////////////////// - -export const PROTOCOL_NAME = "Kwenta"; -export const PROTOCOL_SLUG = "kwenta"; - -//////////////////////// -///// Schema Enums ///// -//////////////////////// - -// The network names corresponding to the Network enum in the schema. -// They also correspond to the ones in `dataSource.network()` after converting to lower case. -// See below for a complete list: -// https://thegraph.com/docs/en/hosted-service/what-is-hosted-service/#supported-networks-on-the-hosted-service -export namespace Network { - export const ARBITRUM_ONE = "ARBITRUM_ONE"; - export const ARWEAVE_MAINNET = "ARWEAVE_MAINNET"; - export const AURORA = "AURORA"; - export const AVALANCHE = "AVALANCHE"; - export const BOBA = "BOBA"; - export const BSC = "BSC"; // aka BNB Chain - export const CELO = "CELO"; - export const COSMOS = "COSMOS"; - export const CRONOS = "CRONOS"; - export const MAINNET = "MAINNET"; // Ethereum mainnet - export const FANTOM = "FANTOM"; - export const FUSE = "FUSE"; - export const HARMONY = "HARMONY"; - export const JUNO = "JUNO"; - export const MOONBEAM = "MOONBEAM"; - export const MOONRIVER = "MOONRIVER"; - export const NEAR_MAINNET = "NEAR_MAINNET"; - export const OPTIMISM = "OPTIMISM"; - export const OSMOSIS = "OSMOSIS"; - export const MATIC = "MATIC"; // aka Polygon - export const XDAI = "XDAI"; // aka Gnosis Chain -} - -export namespace ProtocolType { - export const EXCHANGE = "EXCHANGE"; - export const LENDING = "LENDING"; - export const YIELD = "YIELD"; - export const BRIDGE = "BRIDGE"; - export const GENERIC = "GENERIC"; -} - -export namespace VaultFeeType { - export const MANAGEMENT_FEE = "MANAGEMENT_FEE"; - export const PERFORMANCE_FEE = "PERFORMANCE_FEE"; - export const DEPOSIT_FEE = "DEPOSIT_FEE"; - export const WITHDRAWAL_FEE = "WITHDRAWAL_FEE"; -} - -export namespace LiquidityPoolFeeType { - export const FIXED_TRADING_FEE = "FIXED_TRADING_FEE"; - export const TIERED_TRADING_FEE = "TIERED_TRADING_FEE"; - export const DYNAMIC_TRADING_FEE = "DYNAMIC_TRADING_FEE"; - export const FIXED_LP_FEE = "FIXED_LP_FEE"; - export const DYNAMIC_LP_FEE = "DYNAMIC_LP_FEE"; - export const FIXED_PROTOCOL_FEE = "FIXED_PROTOCOL_FEE"; - export const DYNAMIC_PROTOCOL_FEE = "DYNAMIC_PROTOCOL_FEE"; -} - -export namespace RewardTokenType { - export const DEPOSIT = "DEPOSIT"; - export const BORROW = "BORROW"; -} - -export namespace LendingType { - export const CDP = "CDP"; - export const POOLED = "POOLED"; -} - -export namespace RiskType { - export const GLOBAL = "GLOBAL"; - export const ISOLATED = "ISOLATED"; -} - -export namespace InterestRateType { - export const STABLE = "STABLE"; - export const VARIABLE = "VARIABLE"; - export const FIXED = "FIXED"; -} - -export namespace InterestRateSide { - export const LENDER = "LENDER"; - export const BORROWER = "BORROWER"; -} - -export namespace PositionSide { - export const LENDER = "LENDER"; - export const BORROWER = "BORROWER"; -} - -export namespace UsageType { - export const DEPOSIT = "DEPOSIT"; - export const WITHDRAW = "WITHDRAW"; - export const SWAP = "SWAP"; -} - -////////////////////////////// -///// Ethereum Addresses ///// -////////////////////////////// - -export const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000"; -export const ETH_ADDRESS = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"; - -export const UNISWAP_V2_FACTORY = "0x5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f"; - -export const WETH_ADDRESS = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"; -export const USDC_WETH_PAIR = "0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc"; // created 10008355 -export const DAI_WETH_PAIR = "0xa478c2975ab1ea89e8196811f51a7b7ade33eb11"; // created block 10042267 -export const USDT_WETH_PAIR = "0x0d4a11d5eeaac28ec3f61d100daf4d40471f1852"; // created block 10093341 - -//////////////////////// -///// Type Helpers ///// -//////////////////////// - -export const DEFAULT_DECIMALS = 18; - -export const USDC_DECIMALS = 6; -export const USDC_DENOMINATOR = BigDecimal.fromString("1000000"); - -export const BIGINT_ZERO = BigInt.fromI32(0); -export const BIGINT_ONE = BigInt.fromI32(1); -export const BIGINT_TWO = BigInt.fromI32(2); -export const BIGINT_HUNDRED = BigInt.fromI32(100); -export const BIGINT_THOUSAND = BigInt.fromI32(1000); -export const BIGINT_TEN_TO_EIGHTEENTH = BigInt.fromString("10").pow(18); -export const BIGINT_MAX = BigInt.fromString( - "115792089237316195423570985008687907853269984665640564039457584007913129639935" -); - -export const INT_NEGATIVE_ONE = -1 as i32; -export const INT_ZERO = 0 as i32; -export const INT_ONE = 1 as i32; -export const INT_TWO = 2 as i32; -export const INT_FOUR = 4 as i32; - -export const BIGDECIMAL_ZERO = new BigDecimal(BIGINT_ZERO); -export const BIGDECIMAL_ONE = new BigDecimal(BIGINT_ONE); -export const BIGDECIMAL_TWO = new BigDecimal(BIGINT_TWO); - -export const MAX_UINT = BigInt.fromI32(2).times(BigInt.fromI32(255)); - -///////////////////// -///// Date/Time ///// -///////////////////// - -export const SECONDS_PER_DAY = 60 * 60 * 24; // 86400 -export const SECONDS_PER_HOUR = 60 * 60; // 3600 -export const MS_PER_DAY = new BigDecimal(BigInt.fromI32(24 * 60 * 60 * 1000)); -export const DAYS_PER_YEAR = new BigDecimal(BigInt.fromI32(365)); -export const MS_PER_YEAR = DAYS_PER_YEAR.times( - new BigDecimal(BigInt.fromI32(24 * 60 * 60 * 1000)) -); - -//////////////// -///// Misc ///// -//////////////// - -export const ETH_SYMBOL = "ETH"; -export const ETH_NAME = "Ether"; - -///////////////////////////// -///// Protocol Specific ///// -///////////////////////////// - -export const FACTORY_ADDRESS = "0x920cf626a271321c151d027030d5d08af699456b"; -export const TRADING_FEE = BigDecimal.fromString("3"); -export const PROTOCOL_FEE_TO_ON = BigDecimal.fromString("0.5"); -export const LP_FEE_TO_ON = BigDecimal.fromString("2.5"); -export const PROTOCOL_FEE_TO_OFF = BigDecimal.fromString("0.0"); -export const LP_FEE_TO_OFF = BigDecimal.fromString("3"); diff --git a/subgraphs/kwenta/src/common/getters.ts b/subgraphs/kwenta/src/common/getters.ts deleted file mode 100644 index 1883327b0d..0000000000 --- a/subgraphs/kwenta/src/common/getters.ts +++ /dev/null @@ -1,88 +0,0 @@ -// import { log } from "@graphprotocol/graph-ts" -import { Address } from "@graphprotocol/graph-ts"; -import { - Token, - DexAmmProtocol, - LiquidityPool, - RewardToken, -} from "../../generated/schema"; -import { fetchTokenSymbol, fetchTokenName, fetchTokenDecimals } from "./tokens"; -import { - BIGDECIMAL_ZERO, - Network, - INT_ZERO, - FACTORY_ADDRESS, - ProtocolType, - SECONDS_PER_DAY, - BIGINT_ZERO, - RewardTokenType, - PROTOCOL_NAME, - PROTOCOL_SLUG, -} from "./constants"; -import { Versions } from "../versions"; - -export function getOrCreateToken(tokenAddress: Address): Token { - let token = Token.load(tokenAddress.toHexString()); - // fetch info if null - if (!token) { - token = new Token(tokenAddress.toHexString()); - token.symbol = fetchTokenSymbol(tokenAddress); - token.name = fetchTokenName(tokenAddress); - token.decimals = fetchTokenDecimals(tokenAddress); - token.lastPriceUSD = BIGDECIMAL_ZERO; - token.lastPriceBlockNumber = BIGINT_ZERO; - token.save(); - } - return token; -} - -export function getOrCreateRewardToken(address: Address): RewardToken { - let rewardToken = RewardToken.load(address.toHexString()); - if (rewardToken == null) { - const token = getOrCreateToken(address); - rewardToken = new RewardToken(address.toHexString()); - rewardToken.token = token.id; - rewardToken.type = RewardTokenType.DEPOSIT; - rewardToken.save(); - - return rewardToken as RewardToken; - } - return rewardToken as RewardToken; -} - -export function getLiquidityPool(poolAddress: string): LiquidityPool { - return LiquidityPool.load(poolAddress)!; -} - -/////////////////////////// -///// DexAmm Specific ///// -/////////////////////////// - -export function getOrCreateDex(): DexAmmProtocol { - let protocol = DexAmmProtocol.load(FACTORY_ADDRESS); - - if (!protocol) { - protocol = new DexAmmProtocol(FACTORY_ADDRESS); - protocol.name = PROTOCOL_NAME; - protocol.slug = PROTOCOL_SLUG; - protocol.totalValueLockedUSD = BIGDECIMAL_ZERO; - protocol.cumulativeVolumeUSD = BIGDECIMAL_ZERO; - protocol.cumulativeSupplySideRevenueUSD = BIGDECIMAL_ZERO; - protocol.cumulativeProtocolSideRevenueUSD = BIGDECIMAL_ZERO; - protocol.cumulativeTotalRevenueUSD = BIGDECIMAL_ZERO; - protocol.cumulativeUniqueUsers = INT_ZERO; - protocol.network = Network.MAINNET; - protocol.type = ProtocolType.EXCHANGE; - } - - protocol.schemaVersion = Versions.getSchemaVersion(); - protocol.subgraphVersion = Versions.getSubgraphVersion(); - protocol.methodologyVersion = Versions.getMethodologyVersion(); - protocol.save(); - - return protocol; -} - -export function getDaysSinceEpoch(secondsSinceEpoch: number): string { - return (Math.floor(secondsSinceEpoch / SECONDS_PER_DAY)).toString(); -} diff --git a/subgraphs/kwenta/src/common/metrics.ts b/subgraphs/kwenta/src/common/metrics.ts deleted file mode 100644 index 071c24fd26..0000000000 --- a/subgraphs/kwenta/src/common/metrics.ts +++ /dev/null @@ -1,139 +0,0 @@ -import { Address, ethereum } from "@graphprotocol/graph-ts"; -import { Account, ActiveAccount } from "../../generated/schema"; -import { - INT_ONE, - SECONDS_PER_DAY, - SECONDS_PER_HOUR, - UsageType, -} from "./constants"; -import { - getLiquidityPool, - getOrCreateDex, - getOrCreateFinancialsDailySnapshot, - getOrCreateLiquidityPoolDailySnapshot, - getOrCreateLiquidityPoolHourlySnapshot, - getOrCreateUsageMetricDailySnapshot, - getOrCreateUsageMetricHourlySnapshot, -} from "./getters"; - -// These are meant more as boilerplates that'll be filled out depending on the -// subgraph, and will be different from subgraph to subgraph, hence left -// partially implemented and commented out. -// They are common within a subgraph but not common across different subgraphs. - -// Update FinancialsDailySnapshots entity -export function updateFinancials(event: ethereum.Event): void { - const financialMetricsDaily = getOrCreateFinancialsDailySnapshot(event); - - const protocol = getOrCreateDex(); - - // Update the block number and timestamp to that of the last transaction of that day - financialMetricsDaily.blockNumber = event.block.number; - financialMetricsDaily.timestamp = event.block.timestamp; - financialMetricsDaily.totalValueLockedUSD = protocol.totalValueLockedUSD; - financialMetricsDaily.cumulativeVolumeUSD = protocol.cumulativeVolumeUSD; - - financialMetricsDaily.save(); -} - -// Update usage metrics entities -export function updateUsageMetrics( - event: ethereum.Event, - fromAddress: Address, - usageType: string -): void { - const from = fromAddress.toHexString(); - - const usageMetricsDaily = getOrCreateUsageMetricDailySnapshot(event); - const usageMetricsHourly = getOrCreateUsageMetricHourlySnapshot(event); - - const protocol = getOrCreateDex(); - - // Update the block number and timestamp to that of the last transaction of that day - usageMetricsDaily.blockNumber = event.block.number; - usageMetricsDaily.timestamp = event.block.timestamp; - usageMetricsDaily.dailyTransactionCount += INT_ONE; - - usageMetricsHourly.blockNumber = event.block.number; - usageMetricsHourly.timestamp = event.block.timestamp; - usageMetricsHourly.hourlyTransactionCount += INT_ONE; - - if (usageType == UsageType.DEPOSIT) { - usageMetricsDaily.dailyDepositCount += INT_ONE; - usageMetricsHourly.hourlyDepositCount += INT_ONE; - } else if (usageType == UsageType.WITHDRAW) { - usageMetricsDaily.dailyWithdrawCount += INT_ONE; - usageMetricsHourly.hourlyWithdrawCount += INT_ONE; - } else if (usageType == UsageType.SWAP) { - usageMetricsDaily.dailySwapCount += INT_ONE; - usageMetricsHourly.hourlySwapCount += INT_ONE; - } - - // Number of days since Unix epoch - const day = event.block.timestamp.toI32() / SECONDS_PER_DAY; - const hour = event.block.timestamp.toI32() / SECONDS_PER_HOUR; - - const dayId = day.toString(); - const hourId = hour.toString(); - - // Combine the id and the user address to generate a unique user id for the day - const dailyActiveAccountId = from.concat("-").concat(dayId); - let dailyActiveAccount = ActiveAccount.load(dailyActiveAccountId); - if (!dailyActiveAccount) { - dailyActiveAccount = new ActiveAccount(dailyActiveAccountId); - usageMetricsDaily.dailyActiveUsers += INT_ONE; - dailyActiveAccount.save(); - } - - const hourlyActiveAccountId = from.concat("-").concat(hourId); - let hourlyActiveAccount = ActiveAccount.load(hourlyActiveAccountId); - if (!hourlyActiveAccount) { - hourlyActiveAccount = new ActiveAccount(hourlyActiveAccountId); - usageMetricsHourly.hourlyActiveUsers += INT_ONE; - hourlyActiveAccount.save(); - } - - let account = Account.load(from); - if (!account) { - account = new Account(from); - protocol.cumulativeUniqueUsers += INT_ONE; - account.save(); - } - usageMetricsDaily.cumulativeUniqueUsers = protocol.cumulativeUniqueUsers; - usageMetricsHourly.cumulativeUniqueUsers = protocol.cumulativeUniqueUsers; - - usageMetricsDaily.save(); - usageMetricsHourly.save(); - protocol.save(); -} - -// Update Pool Snapshots entities -export function updatePoolMetrics(event: ethereum.Event): void { - // get or create pool metrics - const poolMetricsDaily = getOrCreateLiquidityPoolDailySnapshot(event); - const poolMetricsHourly = getOrCreateLiquidityPoolHourlySnapshot(event); - - const pool = getLiquidityPool(event.address.toHexString()); - - // Update the block number and timestamp to that of the last transaction of that day - poolMetricsDaily.totalValueLockedUSD = pool.totalValueLockedUSD; - poolMetricsDaily.cumulativeVolumeUSD = pool.cumulativeVolumeUSD; - poolMetricsDaily.inputTokenBalances = pool.inputTokenBalances; - poolMetricsDaily.inputTokenWeights = pool.inputTokenWeights; - poolMetricsDaily.outputTokenSupply = pool.outputTokenSupply; - poolMetricsDaily.outputTokenPriceUSD = pool.outputTokenPriceUSD; - poolMetricsDaily.blockNumber = event.block.number; - poolMetricsDaily.timestamp = event.block.timestamp; - - poolMetricsHourly.totalValueLockedUSD = pool.totalValueLockedUSD; - poolMetricsHourly.cumulativeVolumeUSD = pool.cumulativeVolumeUSD; - poolMetricsHourly.inputTokenBalances = pool.inputTokenBalances; - poolMetricsHourly.inputTokenWeights = pool.inputTokenWeights; - poolMetricsHourly.outputTokenSupply = pool.outputTokenSupply; - poolMetricsHourly.outputTokenPriceUSD = pool.outputTokenPriceUSD; - poolMetricsHourly.blockNumber = event.block.number; - poolMetricsHourly.timestamp = event.block.timestamp; - - poolMetricsDaily.save(); - poolMetricsHourly.save(); -} diff --git a/subgraphs/kwenta/src/common/rewards.ts b/subgraphs/kwenta/src/common/rewards.ts deleted file mode 100644 index 82664376f0..0000000000 --- a/subgraphs/kwenta/src/common/rewards.ts +++ /dev/null @@ -1,292 +0,0 @@ -///////////////////// -// VERSION 1.0.3 //// -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// The purpose of this program is to dynamically estimate the blocks generated for the 24 HR period following the most recent update. // -// It does so by calculating the moving average block rate for an arbitrary length of time preceding the current block. // -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -import { log, BigDecimal, BigInt } from "@graphprotocol/graph-ts"; -import { NetworkConfigs } from "../../configurations/configure"; -import { _CircularBuffer } from "../../generated/schema"; -import { Network } from "./constants"; -import { - BIGDECIMAL_ZERO, - INT_FOUR, - INT_NEGATIVE_ONE, - INT_ONE, - INT_TWO, - INT_ZERO, -} from "./constants"; - -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// WINDOW_SIZE_SECONDS, TIMESTAMP_STORAGE_INTERVALS, and BUFFER_SIZE can be modified. These are just recommended values - 'somewhat' arbitrary. // -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -// The storage interval tells you to only store blocks where the timestamps are separated by at least this amount. -// Increasing this value will mean less blocks stored and less frequently computes blocksSpeed. -export const TIMESTAMP_STORAGE_INTERVAL = 600; - -// The window size determines the range of blocks that you track from the current block minus the window size. -// Window of block time used to calculate the moving average. -// Increasing means less deviation but also less sensitivity to changing block speeds. -export const WINDOW_SIZE_SECONDS = 86400; - -// BUFFER_SIZE determined the size of the array -// Makes the buffer the maximum amount of blocks that can be stored given the block rate and storage interval -// Recommended value is (RATE_IN_SECODNDS / TIMESTAMP_STORAGE_INTERVAL) * 2 - > Round up to nearest even integer -export const BUFFER_SIZE = 288; - -// Add this entity to the schema. -// type _CircularBuffer @entity { -// " 'CIRCULAR_BUFFER' " -// id: ID! - -// " Array of sorted block numbers sorted continuously " -// blocks: [Int!]! - -// " The index in the blocks array which will be used with the newest block to calculate block speed (Usally set to about a day before newest block) " -// windowStartIndex: Int! - -// " The next index in the blocks array that will be replaced with the newest block " -// nextIndex: Int! - -// " This determines the size of the blocks array. Should be set to contain at least a days worth of blocks according to a 1 day window for measuring speed" -// bufferSize: Int! - -// " The current calculated number of blocks per day based on calculated block speed " -// blocksPerDay: BigDecimal! - -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -export const CIRCULAR_BUFFER = "CIRCULAR_BUFFER"; - -// Describes whether the interval for which rewards are emitted is done by block or timestamp -export namespace RewardIntervalType { - export const BLOCK = "BLOCK"; - export const TIMESTAMP = "TIMESTAMP"; -} - -// Forecast period. This gives you the time period that you want to estimate count of blocks per interval, based on moving average block speed. -// 86400 = 1 Day -export const RATE_IN_SECONDS = 86400; -export const RATE_IN_SECONDS_BD = BigDecimal.fromString( - RATE_IN_SECONDS.toString() -); - -// Estimated seconds per block of the protocol -export const STARTING_BLOCKS_PER_DAY = RATE_IN_SECONDS_BD.div( - getStartingBlockRate() -); - -export const WINDOW_SIZE_SECONDS_BD = BigDecimal.fromString( - WINDOW_SIZE_SECONDS.toString() -); - -// Call this function in event handlers frequently enough so that it calls on blocks frequently enough -/** - * @param {BigInt} currentTimestamp - Timestamp for current event - * @param {BigInt} currentBlockNumber - Block nunmber of current event - * @param {BigInt} rewardRate - Rate of reward emissions per reward interval - * @param {BigInt} rewardType - Describes whether rewards are given per block or timestamp - * @returns {BigDecimal} - Returns estimated blocks for specified rate - */ -export function getRewardsPerDay( - currentTimestamp: BigInt, - currentBlockNumber: BigInt, - rewardRate: BigDecimal, - rewardType: string -): BigDecimal { - const circularBuffer = getOrCreateCircularBuffer(); - - // Create entity for the current block - const currentTimestampI32 = currentTimestamp.toI32(); - const currentBlockNumberI32 = currentBlockNumber.toI32(); - - const blocks = circularBuffer.blocks; - - // Interval between index and the index of the start of the window block - const windowWidth = abs( - circularBuffer.windowStartIndex - circularBuffer.nextIndex - ); - if (windowWidth == INT_ZERO) { - if (circularBuffer.nextIndex >= circularBuffer.bufferSize) { - blocks[INT_ZERO] = currentTimestampI32; - blocks[INT_ONE] = currentBlockNumberI32; - circularBuffer.nextIndex = INT_TWO; - } else { - blocks[circularBuffer.nextIndex] = currentTimestampI32; - blocks[circularBuffer.nextIndex + INT_ONE] = currentBlockNumberI32; - circularBuffer.nextIndex += INT_TWO; - } - - circularBuffer.save(); - - // return because there is only 1 reference point. - if (rewardType == RewardIntervalType.TIMESTAMP) { - return rewardRate.times(RATE_IN_SECONDS_BD); - } else { - return circularBuffer.blocksPerDay.times(rewardRate); - } - } - - // Add current timestamp and block numnber to array if new block is at least X blocks later than previously stored. - // Used to save memory and efficiency on array resizing. - let recentSavedTimestamp: i32; - if (circularBuffer.nextIndex == INT_ZERO) { - recentSavedTimestamp = blocks[circularBuffer.bufferSize - INT_TWO]; - } else { - recentSavedTimestamp = blocks[circularBuffer.nextIndex - INT_TWO]; - } - - if ( - currentTimestampI32 - recentSavedTimestamp <= - TIMESTAMP_STORAGE_INTERVAL - ) { - if (rewardType == RewardIntervalType.TIMESTAMP) { - return rewardRate.times(RATE_IN_SECONDS_BD); - } else { - return circularBuffer.blocksPerDay.times(rewardRate); - } - } - - blocks[circularBuffer.nextIndex] = currentTimestampI32; - blocks[circularBuffer.nextIndex + INT_ONE] = currentBlockNumberI32; - if (circularBuffer.nextIndex >= BUFFER_SIZE - INT_TWO) { - circularBuffer.nextIndex = INT_ZERO; - } else { - circularBuffer.nextIndex += INT_TWO; - } - // The timestamp at the start of the window (default 24 hours in seconds). - const startTimestamp = currentTimestampI32 - WINDOW_SIZE_SECONDS; - - // Make sure to still have 2 blocks to calculate rate (This shouldn't happen past the beginning). - while (true) { - if (circularBuffer.nextIndex > circularBuffer.windowStartIndex) { - if ( - circularBuffer.nextIndex - circularBuffer.windowStartIndex <= - INT_FOUR - ) { - break; - } - } else { - if ( - BUFFER_SIZE - - circularBuffer.windowStartIndex + - circularBuffer.nextIndex <= - INT_FOUR - ) { - break; - } - } - const windowIndexBlockTimestamp = blocks[circularBuffer.windowStartIndex]; - - // Shift the start of the window if the current timestamp moves out of desired rate window - if (windowIndexBlockTimestamp < startTimestamp) { - circularBuffer.windowStartIndex = - circularBuffer.windowStartIndex + INT_TWO; - if (circularBuffer.windowStartIndex >= circularBuffer.bufferSize) { - circularBuffer.windowStartIndex = INT_ZERO; - } - } else { - break; - } - } - - // Wideness of the window in seconds. - const windowSecondsCount = BigDecimal.fromString( - (currentTimestampI32 - blocks[circularBuffer.windowStartIndex]).toString() - ); - - // Wideness of the window in blocks. - const windowBlocksCount = BigDecimal.fromString( - ( - currentBlockNumberI32 - blocks[circularBuffer.windowStartIndex + INT_ONE] - ).toString() - ); - - // Estimate block speed for the window in seconds. - const unnormalizedBlockSpeed = - WINDOW_SIZE_SECONDS_BD.div(windowSecondsCount).times(windowBlocksCount); - - // block speed converted to specified rate. - const normalizedBlockSpeed = RATE_IN_SECONDS_BD.div( - WINDOW_SIZE_SECONDS_BD - ).times(unnormalizedBlockSpeed); - - // Update BlockTracker with new values. - circularBuffer.blocksPerDay = normalizedBlockSpeed; - circularBuffer.blocks = blocks; - - circularBuffer.save(); - - if (rewardType == RewardIntervalType.TIMESTAMP) { - return rewardRate.times(RATE_IN_SECONDS_BD); - } else { - return rewardRate.times(circularBuffer.blocksPerDay); - } -} - -function getOrCreateCircularBuffer(): _CircularBuffer { - let circularBuffer = _CircularBuffer.load(CIRCULAR_BUFFER); - - if (!circularBuffer) { - circularBuffer = new _CircularBuffer(CIRCULAR_BUFFER); - - const blocks = new Array(BUFFER_SIZE); - for (let i = INT_ZERO; i < BUFFER_SIZE; i += INT_TWO) { - blocks[i] = INT_NEGATIVE_ONE; - blocks[i + INT_ONE] = INT_NEGATIVE_ONE; - } - - circularBuffer.blocks = blocks; - circularBuffer.windowStartIndex = INT_ZERO; - circularBuffer.nextIndex = INT_ZERO; - circularBuffer.bufferSize = BUFFER_SIZE; - circularBuffer.blocksPerDay = STARTING_BLOCKS_PER_DAY; - - circularBuffer.save(); - } - - return circularBuffer; -} - -function getStartingBlockRate(): BigDecimal { - // Block rates pulled from google searches - rough estimates - - if (NetworkConfigs.getNetwork() == Network.MAINNET) { - return BigDecimal.fromString("13.39"); - } else if (NetworkConfigs.getNetwork() == Network.ARBITRUM_ONE) { - return BigDecimal.fromString("15"); - } else if (NetworkConfigs.getNetwork() == Network.AURORA) { - return BigDecimal.fromString("1.03"); - } else if (NetworkConfigs.getNetwork() == Network.BSC) { - return BigDecimal.fromString("5"); - } else if (NetworkConfigs.getNetwork() == Network.CELO) { - return BigDecimal.fromString("5"); - } else if (NetworkConfigs.getNetwork() == Network.FANTOM) { - return BigDecimal.fromString("1"); - } else if (NetworkConfigs.getNetwork() == Network.FUSE) { - return BigDecimal.fromString("1"); - } else if (NetworkConfigs.getNetwork() == Network.OPTIMISM) { - return BigDecimal.fromString("12.5"); - } else if (NetworkConfigs.getNetwork() == Network.MATIC) { - return BigDecimal.fromString("2"); - } else if (NetworkConfigs.getNetwork() == Network.XDAI) { - return BigDecimal.fromString("5"); - } else if (NetworkConfigs.getNetwork() == Network.MOONBEAM) { - return BigDecimal.fromString("13.39"); - } else if (NetworkConfigs.getNetwork() == Network.MOONRIVER) { - return BigDecimal.fromString("13.39"); - } else if (NetworkConfigs.getNetwork() == Network.AVALANCHE) { - return BigDecimal.fromString("13.39"); - } else if (NetworkConfigs.getNetwork() == Network.CRONOS) { - return BigDecimal.fromString("5.5"); - } - - // else if (network == SubgraphNetwork.AVALANCHE) return BigDecimal.fromString("2.5") - // else if (dataSource.network() == "harmony") return BigDecimal.fromString("13.39") - else { - log.warning("getStartingBlockRate(): Network not found", []); - return BIGDECIMAL_ZERO; - } -} diff --git a/subgraphs/kwenta/src/common/snapshot.ts b/subgraphs/kwenta/src/common/snapshot.ts deleted file mode 100644 index 754ac2c5ad..0000000000 --- a/subgraphs/kwenta/src/common/snapshot.ts +++ /dev/null @@ -1,321 +0,0 @@ -import { Bytes, ethereum } from "@graphprotocol/graph-ts"; -import { SECONDS_PER_DAY, SECONDS_PER_HOUR } from "./constants"; -import { - DexAmmProtocol, - UsageMetricsDailySnapshot, - FinancialsDailySnapshot, - UsageMetricsHourlySnapshot, - LiquidityPoolDailySnapshot, - LiquidityPoolHourlySnapshot, - LiquidityPool, - _ActivityHelper, -} from "../../generated/schema"; - -const ActivityHelperID = Bytes.fromUTF8("_ActivityHelper"); - -export function createProtocolSnapshots( - event: ethereum.Event, - protocol: DexAmmProtocol -): void { - const dayID = event.block.timestamp.toI32() / SECONDS_PER_DAY; - const hourID = event.block.timestamp.toI32() / SECONDS_PER_HOUR; - const snapshotDayID = protocol.lastUpdateTimestamp.toI32() / SECONDS_PER_DAY; - const snapshotHourID = - protocol.lastUpdateTimestamp.toI32() / SECONDS_PER_HOUR; - - if (snapshotDayID != dayID) { - takeFinancialsDailySnapshot(event, protocol, snapshotDayID); - takeUsageDailySnapshot(event, protocol, snapshotDayID); - protocol.lastSnapshotDayID = snapshotDayID; - protocol.save(); - } - if (snapshotHourID != hourID) { - takeUsageHourlySnapshot(event, protocol, snapshotHourID); - protocol.lastSnapshotHourID = snapshotHourID; - protocol.save(); - } -} - -export function createLiquidityPoolSnapshots( - event: ethereum.Event, - pool: LiquidityPool -): void { - const dayID = event.block.timestamp.toI32() / SECONDS_PER_DAY; - const hourID = event.block.timestamp.toI32() / SECONDS_PER_HOUR; - const snapshotDayID = pool.lastUpdateTimestamp.toI32() / SECONDS_PER_DAY; - const snapshotHourID = pool.lastUpdateTimestamp.toI32() / SECONDS_PER_HOUR; - - if (snapshotDayID != dayID) { - takeLiquidityPoolDailySnapshot(event, pool, snapshotDayID); - pool.lastSnapshotDayID = snapshotDayID; - pool.save(); - } - - if (snapshotHourID != hourID) { - takeLiquidityPoolHourlySnapshot(event, pool, snapshotHourID); - pool.lastSnapshotHourID = snapshotHourID; - pool.save(); - } -} - -function takeFinancialsDailySnapshot( - event: ethereum.Event, - protocol: DexAmmProtocol, - day: i32 -): void { - const snapshot = new FinancialsDailySnapshot(Bytes.fromI32(day)); - const previousSnapshot = FinancialsDailySnapshot.load( - protocol.lastSnapshotDayID - ); - - snapshot.day = day; - snapshot.protocol = protocol.id; - snapshot.blockNumber = event.block.number; - snapshot.timestamp = event.block.timestamp; - - // tvl - snapshot.totalValueLockedUSD = protocol.totalValueLockedUSD; - snapshot.protocolControlledValueUSD = protocol.protocolControlledValueUSD; - - // revenues - snapshot.cumulativeSupplySideRevenueUSD = - protocol.cumulativeSupplySideRevenueUSD; - snapshot.cumulativeProtocolSideRevenueUSD = - protocol.cumulativeProtocolSideRevenueUSD; - snapshot.cumulativeTotalRevenueUSD = protocol.cumulativeTotalRevenueUSD; - - // deltas - let supplySideRevenueDelta = snapshot.cumulativeSupplySideRevenueUSD; - let protocolSideRevenueDelta = snapshot.cumulativeProtocolSideRevenueUSD; - let totalRevenueDelta = snapshot.cumulativeTotalRevenueUSD; - - if (previousSnapshot) { - supplySideRevenueDelta = snapshot.cumulativeSupplySideRevenueUSD.minus( - previousSnapshot.cumulativeSupplySideRevenueUSD - ); - protocolSideRevenueDelta = snapshot.cumulativeProtocolSideRevenueUSD.minus( - previousSnapshot.cumulativeProtocolSideRevenueUSD - ); - totalRevenueDelta = snapshot.cumulativeTotalRevenueUSD.minus( - previousSnapshot.cumulativeTotalRevenueUSD - ); - } - snapshot.dailySupplySideRevenueUSD = supplySideRevenueDelta; - snapshot.dailyProtocolSideRevenueUSD = protocolSideRevenueDelta; - snapshot.dailyTotalRevenueUSD = totalRevenueDelta; - - snapshot.save(); -} - -function takeUsageDailySnapshot( - event: ethereum.Event, - protocol: DexAmmProtocol, - day: i32 -): void { - const activity = initActivityHelper(); - - const snapshot = new UsageMetricsDailySnapshot(Bytes.fromI32(day)); - const previousSnapshot = UsageMetricsDailySnapshot.load( - protocol.lastSnapshotDayID - ); - - snapshot.protocol = protocol.id; - snapshot.day = day; - snapshot.blockNumber = event.block.number; - snapshot.timestamp = event.block.timestamp; - - // unique users - snapshot.cumulativeUniqueUsers = protocol.cumulativeUniqueUsers; - snapshot.cumulativeUniqueTransferSenders = - protocol.cumulativeUniqueTransferSenders; - snapshot.cumulativeUniqueTransferReceivers = - protocol.cumulativeUniqueTransferReceivers; - snapshot.cumulativeUniqueLiquidityProviders = - protocol.cumulativeUniqueLiquidityProviders; - snapshot.cumulativeUniqueMessageSenders = - protocol.cumulativeUniqueMessageSenders; - - // daily activity - snapshot.dailyActiveUsers = activity.dailyActiveUsers; - - // transaction counts - snapshot.cumulativeTransactionCount = protocol.cumulativeTransactionCount; - - // misc - snapshot.totalPoolCount = protocol.totalPoolCount; - - // deltas - let transactionDelta = snapshot.cumulativeTransactionCount; - - if (previousSnapshot) { - transactionDelta = - snapshot.cumulativeTransactionCount - - previousSnapshot.cumulativeTransactionCount; - } - snapshot.dailyTransactionCount = transactionDelta; - snapshot.save(); - - activity.dailyActiveUsers = 0; - activity.save(); -} - -function takeUsageHourlySnapshot( - event: ethereum.Event, - protocol: DexAmmProtocol, - hour: i32 -): void { - const activity = initActivityHelper(); - - const snapshot = new UsageMetricsHourlySnapshot(Bytes.fromI32(hour)); - const previousSnapshot = UsageMetricsHourlySnapshot.load( - protocol.lastSnapshotHourID - ); - - snapshot.protocol = protocol.id; - snapshot.hour = hour; - snapshot.blockNumber = event.block.number; - snapshot.timestamp = event.block.timestamp; - - // unique users - snapshot.cumulativeUniqueUsers = protocol.cumulativeUniqueUsers; - - // hourly activity - snapshot.hourlyActiveUsers = activity.hourlyActiveUsers; - - // transaction counts - snapshot.cumulativeTransactionCount = protocol.cumulativeTransactionCount; - - // deltas - let transactionDelta = snapshot.cumulativeTransactionCount; - if (previousSnapshot) { - transactionDelta = - snapshot.cumulativeTransactionCount - - previousSnapshot.cumulativeTransactionCount; - } - snapshot.hourlyTransactionCount = transactionDelta; - snapshot.save(); - - activity.hourlyActiveUsers = 0; - activity.save(); -} - -function takeLiquidityPoolHourlySnapshot( - event: ethereum.Event, - pool: LiquidityPool, - hour: i32 -): void { - const snapshot = new LiquidityPoolHourlySnapshot(pool.id.concatI32(hour)); - const previousSnapshot = LiquidityPoolHourlySnapshot.load( - pool.id.concatI32(pool.lastSnapshotHourID) - ); - - snapshot.hour = hour; - snapshot.protocol = pool.protocol; - snapshot.pool = pool.id; - snapshot.timestamp = event.block.timestamp; - snapshot.blockNumber = event.block.number; - - // tvl and balances - snapshot.totalValueLockedUSD = pool.totalValueLockedUSD; - snapshot.inputTokenBalance = pool.inputTokenBalance; - snapshot.totalLiquidity = pool.totalLiquidity; - snapshot.totalLiquidityUSD = pool.totalLiquidityUSD; - snapshot.stakedLiquidity = pool.stakedLiquidity; - snapshot.rewardTokenEmissions = pool.rewardTokenEmissions; - snapshot.rewardTokenEmissionsUSD = pool.rewardTokenEmissionsUSD; - - // revenues - snapshot.cumulativeSupplySideRevenueUSD = pool.cumulativeSupplySideRevenueUSD; - snapshot.cumulativeProtocolSideRevenueUSD = - pool.cumulativeProtocolSideRevenueUSD; - snapshot.cumulativeTotalRevenueUSD = pool.cumulativeTotalRevenueUSD; - - // deltas - let supplySideRevenueDelta = snapshot.cumulativeSupplySideRevenueUSD; - let protocolSideRevenueDelta = snapshot.cumulativeProtocolSideRevenueUSD; - let totalRevenueDelta = snapshot.cumulativeTotalRevenueUSD; - - if (previousSnapshot) { - supplySideRevenueDelta = snapshot.cumulativeSupplySideRevenueUSD.minus( - previousSnapshot.cumulativeSupplySideRevenueUSD - ); - protocolSideRevenueDelta = snapshot.cumulativeProtocolSideRevenueUSD.minus( - previousSnapshot.cumulativeProtocolSideRevenueUSD - ); - totalRevenueDelta = snapshot.cumulativeTotalRevenueUSD.minus( - previousSnapshot.cumulativeTotalRevenueUSD - ); - } - snapshot.hourlySupplySideRevenueUSD = supplySideRevenueDelta; - snapshot.hourlyProtocolSideRevenueUSD = protocolSideRevenueDelta; - snapshot.hourlyTotalRevenueUSD = totalRevenueDelta; - - snapshot.save(); -} - -function takeLiquidityPoolDailySnapshot( - event: ethereum.Event, - pool: LiquidityPool, - day: i32 -): void { - const snapshot = new LiquidityPoolDailySnapshot(pool.id.concatI32(day)); - const previousSnapshot = LiquidityPoolDailySnapshot.load( - pool.id.concatI32(pool.lastSnapshotDayID) - ); - - snapshot.day = day; - snapshot.protocol = pool.protocol; - snapshot.pool = pool.id; - snapshot.timestamp = event.block.timestamp; - snapshot.blockNumber = event.block.number; - - // tvl and balances - snapshot.totalValueLockedUSD = pool.totalValueLockedUSD; - snapshot.inputTokenBalance = pool.inputTokenBalance; - snapshot.totalLiquidity = pool.totalLiquidity; - snapshot.totalLiquidityUSD = pool.totalLiquidityUSD; - snapshot.stakedLiquidity = pool.stakedLiquidity; - snapshot.rewardTokenEmissions = pool.rewardTokenEmissions; - snapshot.rewardTokenEmissionsUSD = pool.rewardTokenEmissionsUSD; - - // revenues - snapshot.cumulativeSupplySideRevenueUSD = pool.cumulativeSupplySideRevenueUSD; - snapshot.cumulativeProtocolSideRevenueUSD = - pool.cumulativeProtocolSideRevenueUSD; - snapshot.cumulativeTotalRevenueUSD = pool.cumulativeTotalRevenueUSD; - - // deltas - let supplySideRevenueDelta = snapshot.cumulativeSupplySideRevenueUSD; - let protocolSideRevenueDelta = snapshot.cumulativeProtocolSideRevenueUSD; - let totalRevenueDelta = snapshot.cumulativeTotalRevenueUSD; - - if (previousSnapshot) { - supplySideRevenueDelta = snapshot.cumulativeSupplySideRevenueUSD.minus( - previousSnapshot.cumulativeSupplySideRevenueUSD - ); - protocolSideRevenueDelta = snapshot.cumulativeProtocolSideRevenueUSD.minus( - previousSnapshot.cumulativeProtocolSideRevenueUSD - ); - totalRevenueDelta = snapshot.cumulativeTotalRevenueUSD.minus( - previousSnapshot.cumulativeTotalRevenueUSD - ); - } - snapshot.dailySupplySideRevenueUSD = supplySideRevenueDelta; - snapshot.dailyProtocolSideRevenueUSD = protocolSideRevenueDelta; - snapshot.dailyTotalRevenueUSD = totalRevenueDelta; - - snapshot.save(); -} - -function initActivityHelper(): _ActivityHelper { - let helper = _ActivityHelper.load(ActivityHelperID); - if (helper) { - return helper; - } - helper = new _ActivityHelper(ActivityHelperID); - helper.hourlyActiveUsers = 0; - helper.dailyActiveUsers = 0; - - helper.save(); - return helper; -} diff --git a/subgraphs/kwenta/src/common/tokens.ts b/subgraphs/kwenta/src/common/tokens.ts deleted file mode 100644 index 00b6db52a8..0000000000 --- a/subgraphs/kwenta/src/common/tokens.ts +++ /dev/null @@ -1,188 +0,0 @@ -/* eslint-disable prefer-const */ -import { ERC20 } from "../../generated/FuturesMarketManager2/ERC20"; -import { ERC20SymbolBytes } from "../../generated/FuturesMarketManager2/ERC20SymbolBytes"; -import { ERC20NameBytes } from "../../generated/FuturesMarketManager2/ERC20NameBytes"; -import { Address } from "@graphprotocol/graph-ts"; - -export const INVALID_TOKEN_DECIMALS = 0; -export const UNKNOWN_TOKEN_VALUE = "unknown"; - -export function fetchTokenSymbol(tokenAddress: Address): string { - let contract = ERC20.bind(tokenAddress); - let contractSymbolBytes = ERC20SymbolBytes.bind(tokenAddress); - - // try types string and bytes32 for symbol - let symbolValue = UNKNOWN_TOKEN_VALUE; - let symbolResult = contract.try_symbol(); - if (!symbolResult.reverted) { - return symbolResult.value; - } - - // non-standard ERC20 implementation - let symbolResultBytes = contractSymbolBytes.try_symbol(); - if (!symbolResultBytes.reverted) { - // for broken pairs that have no symbol function exposed - if (!isNullEthValue(symbolResultBytes.value.toHexString())) { - symbolValue = symbolResultBytes.value.toString(); - } else { - // try with the static definition - let staticTokenDefinition = - StaticTokenDefinition.fromAddress(tokenAddress); - if (staticTokenDefinition != null) { - symbolValue = staticTokenDefinition.symbol; - } - } - } - - return symbolValue; -} - -export function fetchTokenName(tokenAddress: Address): string { - let contract = ERC20.bind(tokenAddress); - let contractNameBytes = ERC20NameBytes.bind(tokenAddress); - - // try types string and bytes32 for name - let nameValue = UNKNOWN_TOKEN_VALUE; - let nameResult = contract.try_name(); - if (!nameResult.reverted) { - return nameResult.value; - } - - // non-standard ERC20 implementation - let nameResultBytes = contractNameBytes.try_name(); - if (!nameResultBytes.reverted) { - // for broken exchanges that have no name function exposed - if (!isNullEthValue(nameResultBytes.value.toHexString())) { - nameValue = nameResultBytes.value.toString(); - } else { - // try with the static definition - let staticTokenDefinition = - StaticTokenDefinition.fromAddress(tokenAddress); - if (staticTokenDefinition != null) { - nameValue = staticTokenDefinition.name; - } - } - } - - return nameValue; -} - -export function fetchTokenDecimals(tokenAddress: Address): i32 { - let contract = ERC20.bind(tokenAddress); - - // try types uint8 for decimals - let decimalResult = contract.try_decimals(); - if (!decimalResult.reverted) { - let decimalValue = decimalResult.value; - return decimalValue.toI32(); - } - - // try with the static definition - let staticTokenDefinition = StaticTokenDefinition.fromAddress(tokenAddress); - if (staticTokenDefinition != null) { - return staticTokenDefinition.decimals as i32; - } else { - return INVALID_TOKEN_DECIMALS as i32; - } -} - -export function isNullEthValue(value: string): boolean { - return ( - value == - "0x0000000000000000000000000000000000000000000000000000000000000001" - ); -} - -// Initialize a Token Definition with the attributes -class StaticTokenDefinition { - address: Address; - symbol: string; - name: string; - decimals: i32; - - // Initialize a Token Definition with its attributes - constructor(address: Address, symbol: string, name: string, decimals: i32) { - this.address = address; - this.symbol = symbol; - this.name = name; - this.decimals = decimals; - } - - // Get all tokens with a static defintion - static getStaticDefinitions(): Array { - let staticDefinitions = new Array(6); - - // Add DGD - let tokenDGD = new StaticTokenDefinition( - Address.fromString("0xe0b7927c4af23765cb51314a0e0521a9645f0e2a"), - "DGD", - "DGD", - 9 as i32 - ); - staticDefinitions.push(tokenDGD); - - // Add AAVE - let tokenAAVE = new StaticTokenDefinition( - Address.fromString("0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9"), - "AAVE", - "Aave Token", - 18 as i32 - ); - staticDefinitions.push(tokenAAVE); - - // Add LIF - let tokenLIF = new StaticTokenDefinition( - Address.fromString("0xeb9951021698b42e4399f9cbb6267aa35f82d59d"), - "LIF", - "Lif", - 18 as i32 - ); - staticDefinitions.push(tokenLIF); - - // Add SVD - let tokenSVD = new StaticTokenDefinition( - Address.fromString("0xbdeb4b83251fb146687fa19d1c660f99411eefe3"), - "SVD", - "savedroid", - 18 as i32 - ); - staticDefinitions.push(tokenSVD); - - // Add TheDAO - let tokenTheDAO = new StaticTokenDefinition( - Address.fromString("0xbb9bc244d798123fde783fcc1c72d3bb8c189413"), - "TheDAO", - "TheDAO", - 16 as i32 - ); - staticDefinitions.push(tokenTheDAO); - - // Add HPB - let tokenHPB = new StaticTokenDefinition( - Address.fromString("0x38c6a68304cdefb9bec48bbfaaba5c5b47818bb2"), - "HPB", - "HPBCoin", - 18 as i32 - ); - staticDefinitions.push(tokenHPB); - - return staticDefinitions; - } - - // Helper for hardcoded tokens - static fromAddress(tokenAddress: Address): StaticTokenDefinition | null { - let staticDefinitions = this.getStaticDefinitions(); - let tokenAddressHex = tokenAddress.toHexString(); - - // Search the definition using the address - for (let i = 0; i < staticDefinitions.length; i++) { - let staticDefinition = staticDefinitions[i]; - if (staticDefinition.address.toHexString() == tokenAddressHex) { - return staticDefinition; - } - } - - // If not found, return null - return null; - } -} diff --git a/subgraphs/kwenta/src/common/utils/arrays.ts b/subgraphs/kwenta/src/common/utils/arrays.ts deleted file mode 100644 index a542dab8cf..0000000000 --- a/subgraphs/kwenta/src/common/utils/arrays.ts +++ /dev/null @@ -1,66 +0,0 @@ -export function removeFromArrayAtIndex(x: T[], index: i32): T[] { - const retval = new Array(x.length - 1); - let nI = 0; - for (let i = 0; i < x.length; i++) { - if (i != index) { - retval[nI] = x[i]; - nI += 1; - } - } - return retval; -} - -export function addToArrayAtIndex(x: T[], item: T, index: i32 = -1): T[] { - if (x.length == 0) { - return [item]; - } - if (index == -1 || index > x.length) { - index = x.length; - } - const retval = new Array(); - let i = 0; - while (i < index) { - retval.push(x[i]); - i += 1; - } - retval.push(item); - while (i < x.length) { - retval.push(x[i]); - i += 1; - } - return retval; -} - -export function arrayDiff(a: T[], b: T[]): T[] { - let diff: T[] = new Array(); - for (let i: i32 = 0; i < a.length; i++) { - if (b.indexOf(a[i]) == -1) { - diff = diff.concat([a[i]]); - } - } - - return diff; -} - -export function arrayUnique(array: T[]): T[] { - let unique: T[] = new Array(); - for (let i: i32 = 0; i < array.length; i++) { - if (array.indexOf(array[i]) == i) { - unique = unique.concat([array[i]]); - } - } - - return unique; -} - -export function arrayUniqueBy(array: T[], pluck: (item: T) => string): T[] { - const references = array.map((item) => pluck(item)); - let unique: T[] = new Array(); - for (let i: i32 = 0; i < references.length; i++) { - if (references.indexOf(references[i]) == i) { - unique = unique.concat([array[i]]); - } - } - - return unique; -} diff --git a/subgraphs/kwenta/src/common/utils/datetime.ts b/subgraphs/kwenta/src/common/utils/datetime.ts deleted file mode 100644 index 39b600c1e3..0000000000 --- a/subgraphs/kwenta/src/common/utils/datetime.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { BigInt } from "@graphprotocol/graph-ts"; -import { SECONDS_PER_DAY } from "../constants"; - -export const minute = BigInt.fromI32(60); -export const hour = BigInt.fromI32(3600); -export const day = BigInt.fromI32(86400); - -export const one = BigInt.fromI32(1); - -export function getMinuteOpenTime(timestamp: BigInt): BigInt { - const interval = minute; - return getOpenTime(timestamp, interval); -} - -export function getMinuteCloseTime(timestamp: BigInt): BigInt { - return getMinuteOpenTime(timestamp).plus(minute).minus(one); -} - -export function getTenMinuteOpenTime(timestamp: BigInt): BigInt { - const interval = minute.times(BigInt.fromI32(10)); - return getOpenTime(timestamp, interval); -} - -export function getTenMinuteCloseTime(timestamp: BigInt): BigInt { - return getTenMinuteOpenTime(timestamp) - .plus(minute.times(BigInt.fromI32(10))) - .minus(one); -} - -export function getHourOpenTime(timestamp: BigInt): BigInt { - const interval = hour; - return getOpenTime(timestamp, interval); -} - -export function getHourCloseTime(timestamp: BigInt): BigInt { - return getHourOpenTime(timestamp).plus(hour).minus(one); -} - -export function getDayOpenTime(timestamp: BigInt): BigInt { - const interval = day; - return getOpenTime(timestamp, interval); -} - -export function getDayCloseTime(timestamp: BigInt): BigInt { - return getDayOpenTime(timestamp).plus(day).minus(one); -} - -export function getDaysSinceEpoch(secondsSinceEpoch: number): string { - return (Math.floor(secondsSinceEpoch / SECONDS_PER_DAY)).toString(); -} - -// helpers - -export function getOpenTime(timestamp: BigInt, interval: BigInt): BigInt { - const excess = timestamp.mod(interval); - return timestamp.minus(excess); -} - -export function isSameDay(t1: BigInt, t2: BigInt): boolean { - const startOfDay1 = getDayOpenTime(t1); - const startOfDay2 = getDayOpenTime(t2); - - return startOfDay1.equals(startOfDay2); -} diff --git a/subgraphs/kwenta/src/common/utils/numbers.ts b/subgraphs/kwenta/src/common/utils/numbers.ts deleted file mode 100644 index 3d0c09ac73..0000000000 --- a/subgraphs/kwenta/src/common/utils/numbers.ts +++ /dev/null @@ -1,92 +0,0 @@ -import { BigDecimal, BigInt } from "@graphprotocol/graph-ts"; -import { BIGDECIMAL_ONE } from "../constants"; - -export function bigIntToBigDecimal( - quantity: BigInt, - decimals: i32 = 18 -): BigDecimal { - return quantity.divDecimal( - BigInt.fromI32(10) - .pow(decimals as u8) - .toBigDecimal() - ); -} - -// returns 10^exp -export function exponentToBigDecimal(exp: i32): BigDecimal { - let bd = BigDecimal.fromString("1"); - const ten = BigDecimal.fromString("10"); - for (let i = 0; i < exp; i++) { - bd = bd.times(ten); - } - return bd; -} - -// a fast approximation of (1 + rate)^exponent -export function bigDecimalExponential( - rate: BigDecimal, - exponent: BigDecimal -): BigDecimal { - // binomial expansion to obtain (1 + x)^n : (1 + rate)^exponent - // 1 + n *x + (n/2*(n-1))*x**2+(n/6*(n-1)*(n-2))*x**3+(n/12*(n-1)*(n-2)*(n-3))*x**4 - // this is less precise, but more efficient than `powerBigDecimal` when power is big - const firstTerm = exponent.times(rate); - const secondTerm = exponent - .div(BIGDECIMAL_TWO) - .times(exponent.minus(BIGDECIMAL_ONE)) - .times(rate.times(rate)); - const thirdTerm = exponent - .div(BIGDECIMAL_SIX) - .times(exponent.minus(BIGDECIMAL_TWO)) - .times(rate.times(rate).times(rate)); - const fourthTerm = exponent - .div(BIGDECIMAL_TWELVE) - .times(exponent.minus(BIGDECIMAL_THREE)) - .times(rate.times(rate).times(rate).times(rate)); - return firstTerm.plus(secondTerm).plus(thirdTerm).plus(fourthTerm); -} - -export function calculateAverage(prices: BigDecimal[]): BigDecimal { - let sum = BigDecimal.fromString("0"); - for (let i = 0; i < prices.length; i++) { - sum = sum.plus(prices[i]); - } - - return sum.div( - BigDecimal.fromString(BigInt.fromI32(prices.length).toString()) - ); -} - -export function calculateMedian(prices: BigDecimal[]): BigDecimal { - const sorted = prices.sort((a, b) => { - return a.equals(b) ? 0 : a.gt(b) ? 1 : -1; - }); - - const mid = Math.ceil(sorted.length / 2) as i32; - if (sorted.length % 2 == 0) { - return sorted[mid].plus(sorted[mid - 1]).div(BigDecimal.fromString("2")); - } - - return sorted[mid - 1]; -} - -// Ray is 27 decimal Wad is 18 decimal -// These functions were made for the AAVE subgraph. Visit the following link to verify that AAVE's definition for RAY units match what are needed for your protocol -// https://docs.aave.com/developers/v/2.0/glossary - -export function rayToWad(a: BigInt): BigInt { - const halfRatio = BigInt.fromI32(10).pow(9).div(BigInt.fromI32(2)); - return halfRatio.plus(a).div(BigInt.fromI32(10).pow(9)); -} - -export function wadToRay(a: BigInt): BigInt { - const result = a.times(BigInt.fromI32(10).pow(9)); - return result; -} - -export function round(numberToRound: BigDecimal): BigDecimal { - const parsedNumber: number = parseFloat(numberToRound.toString()); - const roundedNumber: number = - Math.ceil((parsedNumber + Number.EPSILON) * 100) / 100; - return BigDecimal.fromString(roundedNumber.toString()); -} diff --git a/subgraphs/kwenta/src/common/utils/strings.ts b/subgraphs/kwenta/src/common/utils/strings.ts deleted file mode 100644 index a55bf872e6..0000000000 --- a/subgraphs/kwenta/src/common/utils/strings.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { BigInt } from "@graphprotocol/graph-ts"; - -export function hexToNumberString(hex: string): string { - let hexNumber = BigInt.fromI32(0); - - if (hex.startsWith("0x")) { - hex = hex.slice(2); - } - - for (let i = 0; i < hex.length; i += 1) { - const character = hex.substr(hex.length - 1 - i, 1); - const digit = parseInt(character, 16) as u8; - if (digit) { - hexNumber = hexNumber.plus( - BigInt.fromI32(digit).times(BigInt.fromI32(16).pow(i as u8)) - ); - } - } - - return hexNumber.toString(); -} - -export function hexToAscii(hex: string): string { - let output = ""; - for (let i = 0; i < hex.length; i += 2) { - const charCode = parseInt(hex.substr(i, 2), 16) as u8; - - if (charCode) { - output += String.fromCharCode(charCode); - } - - // catch cases with charCode outside 32...126, - // in which case it's probably a number... - if (charCode && (charCode < 32 || charCode > 126)) { - return hexToNumberString(hex); - } - } - - return output; -} - -// Converts upper snake case to lower kebab case and appends a hyphen. -// (e.g. "TRADING_FEE" to "trading-fee-"), mainly used to create entity IDs -export function enumToPrefix(snake: string): string { - return snake.toLowerCase().replace("_", "-") + "-"; -} - -// Prefix an ID with a enum string in order to differentiate IDs -// e.g. combine TRADING_FEE and 0x1234 into trading-fee-0x1234 -export function prefixID(enumString: string, ID: string): string { - return enumToPrefix(enumString) + ID; -} diff --git a/subgraphs/kwenta/src/mappings/handlers.ts b/subgraphs/kwenta/src/mappings/handlers.ts index 4bcee98700..73b684e38e 100644 --- a/subgraphs/kwenta/src/mappings/handlers.ts +++ b/subgraphs/kwenta/src/mappings/handlers.ts @@ -12,32 +12,25 @@ import { Address, BigDecimal, BigInt, - Bytes, dataSource, ethereum, log, } from "@graphprotocol/graph-ts"; import { getUsdPrice, getUsdPricePerToken } from "../prices"; -import { - bigDecimalToBigInt, - bigIntToBigDecimal, - safeDivide, -} from "../sdk/util/numbers"; +import { bigIntToBigDecimal } from "../sdk/util/numbers"; import { TokenInitializer, TokenParams, } from "../sdk/protocols/perpfutures/tokens"; import { - BIGDECIMAL_MINUS_ONE, BIGINT_MINUS_ONE, - LiquidityPoolFeeType, PositionSide, + BIGINT_ZERO, + BIGINT_TEN_TO_EIGHTEENTH, + LiquidityPoolFeeType, } from "../sdk/util/constants"; -import { - MarketAdded as MarketAddedEvent, - MarketRemoved, -} from "../../generated/FuturesMarketManager2/FuturesMarketManager"; +import { MarketAdded as MarketAddedEvent } from "../../generated/FuturesMarketManager2/FuturesMarketManager"; import { FundingRecomputed as FundingRecomputedEvent, MarginTransferred as MarginTransferredEvent, @@ -51,17 +44,20 @@ import { } from "../../generated/templates/PerpsV2Market/PerpsV2MarketProxyable"; import { FuturesV1Market, PerpsV2Market } from "../../generated/templates"; import { createTokenAmountArray, getFundingRateId } from "./helpers"; -import { BIGDECIMAL_ZERO, BIGINT_ZERO } from "../common/constants"; import { NewAccount as NewSmartMarginAccountEvent } from "../../generated/SmartMarginFactory1/SmartMarginFactory"; import { Pool } from "../sdk/protocols/perpfutures/pool"; class Pricer implements TokenPricer { - getTokenPrice(token: Token): BigDecimal { + getTokenPrice(token: Token, block: ethereum.Block): BigDecimal { const price = getUsdPricePerToken(Address.fromBytes(token.id)); return price.usdPrice; } - getAmountValueUSD(token: Token, amount: BigInt): BigDecimal { + getAmountValueUSD( + token: Token, + amount: BigInt, + block: ethereum.Block + ): BigDecimal { const _amount = bigIntToBigDecimal(amount, token.decimals); return getUsdPrice(Address.fromBytes(token.id), _amount); } @@ -112,8 +108,8 @@ export function handleV1MarketAdded(event: MarketAddedEvent): void { NetworkConfigs.getSUSDAddress() ); pool.initialize(marketKey, marketKey, [token], null, "chainlink"); - // todo: fees } + // futures v1 market FuturesV1Market.create(event.params.market); } @@ -142,7 +138,9 @@ export function handleV2MarketAdded(event: MarketAddedEvent): void { NetworkConfigs.getSUSDAddress() ); pool.initialize(marketKey, marketKey, [token], null, "chainlink"); - // todo: fees + + // keeper dynamic fees + pool.setPoolFee(LiquidityPoolFeeType.DYNAMIC_LP_FEE, null); } // perps v2 market @@ -302,8 +300,6 @@ export function handlePositionModified(event: PositionModifiedEvent): void { true ); - // fetching market size for testing - const position = positionResponse.position; const newPositionSize = event.params.size; const oldPositionSize = position.getSize(); @@ -330,7 +326,7 @@ export function handlePositionModified(event: PositionModifiedEvent): void { fundingAccrued = currentFunding.funding .minus(previousFunding.funding) .times(oldPositionSize) - .div(BigInt.fromI32(10).pow(18)); + .div(BIGINT_TEN_TO_EIGHTEENTH); } // position closed @@ -338,7 +334,7 @@ export function handlePositionModified(event: PositionModifiedEvent): void { const pnl = event.params.lastPrice .minus(oldPositionPrice) .times(oldPositionSize) - .div(BigInt.fromI32(10).pow(18)) + .div(BIGINT_TEN_TO_EIGHTEENTH) .plus(fundingAccrued) .minus(fees); @@ -363,12 +359,12 @@ export function handlePositionModified(event: PositionModifiedEvent): void { } const volume = event.params.lastPrice .times(newPositionSize) - .div(BigInt.fromI32(10).pow(18)) + .div(BIGINT_TEN_TO_EIGHTEENTH) .abs(); pool.addVolumeByToken(token, volume); } updateOpenInterest(marketAddress, pool, event.params.lastPrice); - pool.addRevenueByToken(token, BIGINT_ZERO, fees); + pool.addRevenueByToken(token, BIGINT_ZERO, fees, BIGINT_ZERO); } /* diff --git a/subgraphs/kwenta/src/sdk/protocols/config.ts b/subgraphs/kwenta/src/sdk/protocols/config.ts index f75004e165..b8f9b2ffab 100644 --- a/subgraphs/kwenta/src/sdk/protocols/config.ts +++ b/subgraphs/kwenta/src/sdk/protocols/config.ts @@ -1,5 +1,5 @@ -import { BigDecimal, BigInt } from "@graphprotocol/graph-ts"; import { Token } from "../../../generated/schema"; +import { BigDecimal, BigInt, ethereum } from "@graphprotocol/graph-ts"; import { Versions } from "../../../../../deployment/context/interface"; export interface ProtocolConfigurer { @@ -40,6 +40,10 @@ export class ProtocolConfig implements ProtocolConfigurer { } export interface TokenPricer { - getTokenPrice(token: Token): BigDecimal; - getAmountValueUSD(token: Token, amount: BigInt): BigDecimal; + getTokenPrice(token: Token, block: ethereum.Block): BigDecimal; + getAmountValueUSD( + token: Token, + amount: BigInt, + block: ethereum.Block + ): BigDecimal; } diff --git a/subgraphs/kwenta/src/sdk/protocols/perpfutures/README.md b/subgraphs/kwenta/src/sdk/protocols/perpfutures/README.md index fdf7a2103a..035ebd6b5c 100644 --- a/subgraphs/kwenta/src/sdk/protocols/perpfutures/README.md +++ b/subgraphs/kwenta/src/sdk/protocols/perpfutures/README.md @@ -1,6 +1,6 @@ -# Perpetual SDK `1.1.0` +# Perpetual SDK `1.1.6` -The perpetual SDK follows the `1.3.0` Derivatives Perpetual Futures schema. +The perpetual SDK follows the `1.3.3` Derivatives Perpetual Futures schema. ## Setup diff --git a/subgraphs/kwenta/src/sdk/protocols/perpfutures/account.ts b/subgraphs/kwenta/src/sdk/protocols/perpfutures/account.ts index 49e8294abf..48475b1fc4 100644 --- a/subgraphs/kwenta/src/sdk/protocols/perpfutures/account.ts +++ b/subgraphs/kwenta/src/sdk/protocols/perpfutures/account.ts @@ -33,11 +33,12 @@ import { * - Making a position * - Making position snapshots * - * Schema Version: 1.3.0 - * SDK Version: 1.1.0 + * Schema Version: 1.3.3 + * SDK Version: 1.1.6 * Author(s): * - @harsh9200 * - @dhruv-chauhan + * - @dmelotik */ class LoadAccountResponse { @@ -139,7 +140,9 @@ export class Account { ); amountUSD = amountUSD.plus( - this.protocol.getTokenPricer().getAmountValueUSD(token, amounts[idx]) + this.protocol + .getTokenPricer() + .getAmountValueUSD(token, amounts[idx], this.protocol.event.block) ); } return amountUSD; @@ -325,13 +328,21 @@ export class Account { swap.amountIn = amountIn; swap.amountInUSD = this.protocol .getTokenPricer() - .getAmountValueUSD(this.tokens.getOrCreateToken(tokenIn), amountIn); + .getAmountValueUSD( + this.tokens.getOrCreateToken(tokenIn), + amountIn, + this.protocol.event.block + ); swap.tokenOut = tokenOut; swap.amountOut = amountOut; swap.amountOutUSD = this.protocol .getTokenPricer() - .getAmountValueUSD(this.tokens.getOrCreateToken(tokenOut), amountOut); + .getAmountValueUSD( + this.tokens.getOrCreateToken(tokenOut), + amountOut, + this.protocol.event.block + ); swap.tradingPair = tradingPair; swap.pool = pool.getBytesID(); @@ -380,7 +391,11 @@ export class Account { borrow.amount = amount; borrow.amountUSD = this.protocol .getTokenPricer() - .getAmountValueUSD(this.tokens.getOrCreateToken(asset), amount); + .getAmountValueUSD( + this.tokens.getOrCreateToken(asset), + amount, + this.protocol.event.block + ); borrow.pool = pool.getBytesID(); borrow.save(); @@ -537,7 +552,8 @@ export class Account { .getTokenPricer() .getAmountValueUSD( this.tokens.getOrCreateToken(collateralToken), - amountLiquidated + amountLiquidated, + this.protocol.event.block ); liquidate.profitUSD = profitUSD; liquidate.pool = pool.getBytesID(); diff --git a/subgraphs/kwenta/src/sdk/protocols/perpfutures/pool.ts b/subgraphs/kwenta/src/sdk/protocols/perpfutures/pool.ts index e20c8c75b7..267bd3fc5c 100644 --- a/subgraphs/kwenta/src/sdk/protocols/perpfutures/pool.ts +++ b/subgraphs/kwenta/src/sdk/protocols/perpfutures/pool.ts @@ -11,7 +11,12 @@ import { Perpetual } from "./protocol"; import { TokenManager } from "./tokens"; import { PoolSnapshot } from "./poolSnapshot"; import * as constants from "../../util/constants"; -import { bigIntToBigDecimal, exponentToBigDecimal } from "../../util/numbers"; +import { + bigIntToBigDecimal, + exponentToBigDecimal, + poolArraySort, + safeDivide, +} from "../../util/numbers"; import { LiquidityPoolFee, @@ -23,11 +28,12 @@ import { * This file contains the PoolManager, which is used to * initialize new pools in the protocol. * - * Schema Version: 1.3.0 - * SDK Version: 1.1.0 + * Schema Version: 1.3.3 + * SDK Version: 1.1.6 * Author(s): * - @harsh9200 * - @dhruv-chauhan + * - @dmelotik */ export class PoolManager { @@ -100,6 +106,7 @@ export class Pool { this.pool.totalValueLockedUSD = constants.BIGDECIMAL_ZERO; this.pool.cumulativeSupplySideRevenueUSD = constants.BIGDECIMAL_ZERO; + this.pool.cumulativeStakeSideRevenueUSD = constants.BIGDECIMAL_ZERO; this.pool.cumulativeProtocolSideRevenueUSD = constants.BIGDECIMAL_ZERO; this.pool.cumulativeTotalRevenueUSD = constants.BIGDECIMAL_ZERO; @@ -177,7 +184,6 @@ export class Pool { this.pool._lastSnapshotDayID = constants.BIGINT_ZERO; this.pool._lastSnapshotHourID = constants.BIGINT_ZERO; this.pool._lastUpdateTimestamp = event.block.timestamp; - this.pool.longOpenInterest = constants.BIGINT_ZERO; this.pool.shortOpenInterest = constants.BIGINT_ZERO; this.pool.totalOpenInterest = constants.BIGINT_ZERO; @@ -274,7 +280,7 @@ export class Pool { } this.setTotalValueLocked(totalValueLockedUSD); - // this.refreshInputTokenWeights(); + this.refreshInputTokenWeights(); } /** @@ -322,32 +328,63 @@ export class Pool { } /** - * Adds a given USD value to the pool and protocol's supplySideRevenue and protocolSideRevenue. It can be a positive or negative amount. + * Adds a given USD value to the pool and protocol stakeSideRevenue. It can be a positive or negative amount. + * Same as for the rest of setters, this is mostly to be called internally by the library. + * But you can use it if you need to. It will also update the protocol's snapshots. + * @param rev {BigDecimal} The value to add to the protocol's protocolSideRevenue. + */ + private addStakeSideRevenueUSD(rev: BigDecimal): void { + this.pool.cumulativeTotalRevenueUSD = + this.pool.cumulativeTotalRevenueUSD.plus(rev); + this.pool.cumulativeStakeSideRevenueUSD = + this.pool.cumulativeStakeSideRevenueUSD.plus(rev); + this.save(); + + this.protocol.addStakeSideRevenueUSD(rev); + } + + /** + * Adds a given USD value to the pool and protocol's supplySideRevenue, protocolSideRevenue, and stakeSideRevenue. + * It can be a positive or negative amount. * Same as for the rest of setters, this is mostly to be called internally by the library. * But you can use it if you need to. It will also update the protocol's snapshots. * @param protocolSide {BigDecimal} The value to add to the protocol's protocolSideRevenue. * @param supplySide {BigDecimal} The value to add to the protocol's supplySideRevenue. + * @param stakeSide {BigDecimal} The value to add to the protocol's stakeSideRevenue. */ - addRevenueUSD(protocolSide: BigDecimal, supplySide: BigDecimal): void { + addRevenueUSD( + protocolSide: BigDecimal, + supplySide: BigDecimal, + stakeSide: BigDecimal + ): void { this.addSupplySideRevenueUSD(supplySide); this.addProtocolSideRevenueUSD(protocolSide); + this.addStakeSideRevenueUSD(stakeSide); } addRevenueByToken( token: TokenSchema, protocolSide: BigInt, - supplySide: BigInt + supplySide: BigInt, + stakeSide: BigInt ): void { - const pAmountUSD = this.protocol.pricer.getAmountValueUSD( + const protocolAmountUSD = this.protocol.pricer.getAmountValueUSD( + token, + protocolSide, + this.protocol.event.block + ); + const supplyAmountUSD = this.protocol.pricer.getAmountValueUSD( token, - protocolSide + supplySide, + this.protocol.event.block ); - const sAmountUSD = this.protocol.pricer.getAmountValueUSD( + const stakeAmountUSD = this.protocol.pricer.getAmountValueUSD( token, - supplySide + stakeSide, + this.protocol.event.block ); - this.addRevenueUSD(pAmountUSD, sAmountUSD); + this.addRevenueUSD(protocolAmountUSD, supplyAmountUSD, stakeAmountUSD); } /** @@ -414,12 +451,31 @@ export class Pool { this.protocol.addWithdrawPremiumUSD(premium); } + addUsdPremium(amountUSD: BigDecimal, transactionType: TransactionType): void { + if (transactionType == TransactionType.DEPOSIT) { + this.addDepositPremiumUSD(amountUSD); + } + if (transactionType == TransactionType.WITHDRAW) { + this.addWithdrawPremiumUSD(amountUSD); + } + if (transactionType == TransactionType.COLLATERAL_IN) { + this.addEntryPremiumUSD(amountUSD); + } + if (transactionType == TransactionType.COLLATERAL_OUT) { + this.addExitPremiumUSD(amountUSD); + } + } + addPremiumByToken( token: TokenSchema, amount: BigInt, transactionType: TransactionType ): void { - const premiumUSD = this.protocol.pricer.getAmountValueUSD(token, amount); + const premiumUSD = this.protocol.pricer.getAmountValueUSD( + token, + amount, + this.protocol.event.block + ); if (transactionType == TransactionType.DEPOSIT) { this.addDepositPremiumUSD(premiumUSD); @@ -436,34 +492,12 @@ export class Pool { } /** - * Adds a given USD value to the pool's long and total openInterestUSD. + * Set the new long and total openInterest amount in the pool + * And update the long and total openInterestUSD. * - * @param amountChangeUSD {BigDecimal} The value to add to the pool's openInterest in USD. + * @param amount {BigInt} The new longOpenInterest Amount + * @param price {BigInt} The last token price */ - - updateLongOpenInterest(amountChange: BigInt, price: BigInt): void { - const longOpenInterest = this.pool.longOpenInterest.plus(amountChange); - const totalOpenInterest = this.pool.totalOpenInterest.plus(amountChange); - - this.pool.totalOpenInterest = totalOpenInterest; - this.pool.longOpenInterest = longOpenInterest; - - const longOpenInterestUSD = bigIntToBigDecimal(longOpenInterest).times( - bigIntToBigDecimal(price) - ); - const totalOpenInterestUSD = bigIntToBigDecimal(totalOpenInterest).times( - bigIntToBigDecimal(price) - ); - const amountChangeUSD = longOpenInterestUSD.minus( - this.pool.longOpenInterestUSD - ); - - this.pool.totalOpenInterestUSD = totalOpenInterestUSD; - this.pool.longOpenInterestUSD = longOpenInterestUSD; - this.save(); - this.protocol.updateLongOpenInterestUSD(amountChangeUSD); - } - setLongOpenInterest(amount: BigInt, price: BigInt): void { const longOpenInterest = amount; const totalOpenInterest = this.pool.totalOpenInterest.plus( @@ -486,9 +520,40 @@ export class Pool { this.pool.totalOpenInterestUSD = totalOpenInterestUSD; this.pool.longOpenInterestUSD = longOpenInterestUSD; this.save(); - this.protocol.updateLongOpenInterestUSD(amountChangeUSD); + this.protocol.updateLongOpenInterestUSD(amountChangeUSD, true); + } + + /** + * Adds a given USD value to the pool's long and total openInterestUSD. + * + * @param amountChangeUSD {BigDecimal} The value to add to the pool's openInterest in USD. + */ + updateLongOpenInterestUSD( + amountChangeUSD: BigDecimal, + isIncrease: bool + ): void { + if (isIncrease) { + this.pool.totalOpenInterestUSD = + this.pool.totalOpenInterestUSD.plus(amountChangeUSD); + this.pool.longOpenInterestUSD = + this.pool.longOpenInterestUSD.plus(amountChangeUSD); + } else { + this.pool.totalOpenInterestUSD = + this.pool.totalOpenInterestUSD.minus(amountChangeUSD); + this.pool.longOpenInterestUSD = + this.pool.longOpenInterestUSD.minus(amountChangeUSD); + } + this.save(); + this.protocol.updateLongOpenInterestUSD(amountChangeUSD, isIncrease); } + /** + * Set the new short and total openInterest amount in the pool + * And update the short and total openInterestUSD. + * + * @param amount {BigInt} The new shortOpenInterest Amount + * @param price {BigInt} The last token price + */ setShortOpenInterest(amount: BigInt, price: BigInt): void { const shortOpenInterest = amount; const totalOpenInterest = this.pool.totalOpenInterest.plus( @@ -510,38 +575,7 @@ export class Pool { this.pool.totalOpenInterestUSD = totalOpenInterestUSD; this.pool.shortOpenInterestUSD = shortOpenInterestUSD; this.save(); - this.protocol.updateShortOpenInterestUSD(amountChangeUSD); - } - - updateShortOpenInterest(amountChange: BigInt, price: BigInt): void { - const shortOpenInterest = this.pool.shortOpenInterest.plus(amountChange); - const totalOpenInterest = this.pool.totalOpenInterest.plus(amountChange); - - this.pool.totalOpenInterest = totalOpenInterest; - this.pool.shortOpenInterest = shortOpenInterest; - const shortOpenInterestUSD = bigIntToBigDecimal(shortOpenInterest).times( - bigIntToBigDecimal(price) - ); - const totalOpenInterestUSD = bigIntToBigDecimal(totalOpenInterest).times( - bigIntToBigDecimal(price) - ); - const amountChangeUSD = shortOpenInterestUSD.minus( - this.pool.shortOpenInterestUSD - ); - - this.pool.totalOpenInterestUSD = totalOpenInterestUSD; - this.pool.shortOpenInterestUSD = shortOpenInterestUSD; - this.save(); - this.protocol.updateShortOpenInterestUSD(amountChangeUSD); - } - updateLongOpenInterestUSD(amountChangeUSD: BigDecimal): void { - this.pool.totalOpenInterestUSD = - this.pool.totalOpenInterestUSD.plus(amountChangeUSD); - this.pool.longOpenInterestUSD = - this.pool.longOpenInterestUSD.plus(amountChangeUSD); - - this.save(); - this.protocol.updateLongOpenInterestUSD(amountChangeUSD); + this.protocol.updateShortOpenInterestUSD(amountChangeUSD, true); } /** @@ -549,14 +583,23 @@ export class Pool { * * @param amountChangeUSD {BigDecimal} The value to add to the pool's openInterest in USD. */ - updateShortOpenInterestUSD(amountChangeUSD: BigDecimal): void { - this.pool.totalOpenInterestUSD = - this.pool.totalOpenInterestUSD.plus(amountChangeUSD); - this.pool.shortOpenInterestUSD = - this.pool.shortOpenInterestUSD.plus(amountChangeUSD); - + updateShortOpenInterestUSD( + amountChangeUSD: BigDecimal, + isIncrease: bool + ): void { + if (isIncrease) { + this.pool.totalOpenInterestUSD = + this.pool.totalOpenInterestUSD.plus(amountChangeUSD); + this.pool.shortOpenInterestUSD = + this.pool.shortOpenInterestUSD.plus(amountChangeUSD); + } else { + this.pool.totalOpenInterestUSD = + this.pool.totalOpenInterestUSD.minus(amountChangeUSD); + this.pool.shortOpenInterestUSD = + this.pool.shortOpenInterestUSD.minus(amountChangeUSD); + } this.save(); - this.protocol.updateShortOpenInterestUSD(amountChangeUSD); + this.protocol.updateShortOpenInterestUSD(amountChangeUSD, isIncrease); } /** @@ -629,9 +672,26 @@ export class Pool { if (!this.pool.outputToken) return; const token = this.tokens.getOrCreateTokenFromBytes(this.pool.outputToken!); - const price = this.protocol.pricer.getTokenPrice(token); + let price = this.protocol.pricer.getTokenPrice( + token, + this.protocol.event.block + ); + + if ( + price.equals(constants.BIGDECIMAL_ZERO) && + !this.pool.outputTokenSupply!.equals(constants.BIGINT_ZERO) + ) { + price = this.pool.totalValueLockedUSD.div( + this.pool + .outputTokenSupply!.toBigDecimal() + .div(constants.BIGINT_TEN_TO_EIGHTEENTH.toBigDecimal()) + ); + } this.pool.outputTokenPriceUSD = price; + token.lastPriceUSD = price; + token.lastPriceBlockNumber = this.protocol.event.block.number; + token.save(); this.save(); } @@ -664,8 +724,11 @@ export class Pool { * @returns The converted amount. */ getInputTokenAmountPrice(token: TokenSchema, amount: BigInt): BigDecimal { - const price = this.protocol.getTokenPricer().getTokenPrice(token); + const price = this.protocol + .getTokenPricer() + .getTokenPrice(token, this.protocol.event.block); token.lastPriceUSD = price; + token.lastPriceBlockNumber = this.protocol.event.block.number; token.save(); return amount.divDecimal(exponentToBigDecimal(token.decimals)).times(price); @@ -688,9 +751,9 @@ export class Pool { ); inputTokenWeights.push( - inputTokenTVL - .div(this.pool.totalValueLockedUSD) - .times(constants.BIGDECIMAL_HUNDRED) + safeDivide(inputTokenTVL, this.pool.totalValueLockedUSD).times( + constants.BIGDECIMAL_HUNDRED + ) ); } @@ -722,13 +785,13 @@ export class Pool { if (amounts.length != this.pool.inputTokenBalances.length) { return; } - const newBalances = addArrays( this.pool.inputTokenBalances, amounts ); this.setInputTokenBalances(newBalances, updateMetrics); } + /** * Sets the pool fundingRate. * @param fundingrate pool funding rate. @@ -738,6 +801,89 @@ export class Pool { this.pool.save(); } + setInputTokens(inputTokens: TokenSchema[]): void { + this.pool.inputTokens = inputTokens.map((token) => token.id); + this.pool.save(); + } + + setInputTokensById(inputTokenIds: Bytes[]): void { + this.pool.inputTokens = inputTokenIds; + this.pool.save(); + } + + tokenExists(token: TokenSchema): bool { + return this.pool.inputTokens.includes(token.id); + } + + addInputToken( + token: TokenSchema, + newTokenBalance: BigInt = constants.BIGINT_ZERO + ): void { + const inputTokens = this.pool.inputTokens; + const inputTokenBalances = this.pool.inputTokenBalances; + const fundingrates = this.pool.fundingrate; + const cumulativeVolumeByTokenAmount = + this.pool.cumulativeVolumeByTokenAmount; + const cumulativeVolumeByTokenUSD = this.pool.cumulativeVolumeByTokenUSD; + const cumulativeInflowVolumeByTokenAmount = + this.pool.cumulativeInflowVolumeByTokenAmount; + const cumulativeInflowVolumeByTokenUSD = + this.pool.cumulativeInflowVolumeByTokenUSD; + const cumulativeClosedInflowVolumeByTokenAmount = + this.pool.cumulativeClosedInflowVolumeByTokenAmount; + const cumulativeClosedInflowVolumeByTokenUSD = + this.pool.cumulativeClosedInflowVolumeByTokenUSD; + const cumulativeOutflowVolumeByTokenAmount = + this.pool.cumulativeOutflowVolumeByTokenAmount; + const cumulativeOutflowVolumeByTokenUSD = + this.pool.cumulativeOutflowVolumeByTokenUSD; + + inputTokens.push(token.id); + inputTokenBalances.push(newTokenBalance); + fundingrates.push(constants.BIGDECIMAL_ZERO); + + cumulativeVolumeByTokenAmount.push(constants.BIGINT_ZERO); + cumulativeVolumeByTokenUSD.push(constants.BIGDECIMAL_ZERO); + cumulativeInflowVolumeByTokenAmount.push(constants.BIGINT_ZERO); + cumulativeInflowVolumeByTokenUSD.push(constants.BIGDECIMAL_ZERO); + cumulativeClosedInflowVolumeByTokenAmount.push(constants.BIGINT_ZERO); + cumulativeClosedInflowVolumeByTokenUSD.push(constants.BIGDECIMAL_ZERO); + cumulativeOutflowVolumeByTokenAmount.push(constants.BIGINT_ZERO); + cumulativeOutflowVolumeByTokenUSD.push(constants.BIGDECIMAL_ZERO); + + poolArraySort( + inputTokens, + inputTokenBalances, + fundingrates, + cumulativeVolumeByTokenAmount, + cumulativeVolumeByTokenUSD, + cumulativeInflowVolumeByTokenAmount, + cumulativeInflowVolumeByTokenUSD, + cumulativeClosedInflowVolumeByTokenAmount, + cumulativeClosedInflowVolumeByTokenUSD, + cumulativeOutflowVolumeByTokenAmount, + cumulativeOutflowVolumeByTokenUSD + ); + + this.pool.inputTokens = inputTokens; + this.pool.fundingrate = fundingrates; + this.pool.cumulativeVolumeByTokenAmount = cumulativeVolumeByTokenAmount; + this.pool.cumulativeVolumeByTokenUSD = cumulativeVolumeByTokenUSD; + this.pool.cumulativeInflowVolumeByTokenAmount = + cumulativeInflowVolumeByTokenAmount; + this.pool.cumulativeInflowVolumeByTokenUSD = + cumulativeInflowVolumeByTokenUSD; + this.pool.cumulativeClosedInflowVolumeByTokenAmount = + cumulativeClosedInflowVolumeByTokenAmount; + this.pool.cumulativeClosedInflowVolumeByTokenUSD = + cumulativeClosedInflowVolumeByTokenUSD; + this.pool.cumulativeOutflowVolumeByTokenAmount = + cumulativeOutflowVolumeByTokenAmount; + this.pool.cumulativeOutflowVolumeByTokenUSD = + cumulativeOutflowVolumeByTokenUSD; + this.pool.save(); + this.setInputTokenBalances(inputTokenBalances, true); + } /** * Sets the rewardTokenEmissions and its USD value for a given reward token. * It will also create the RewardToken entity and add it to the pool rewardTokens array @@ -752,7 +898,11 @@ export class Pool { amount: BigInt ): void { const rToken = this.tokens.getOrCreateRewardToken(token, type); - const amountUSD = this.protocol.pricer.getAmountValueUSD(token, amount); + const amountUSD = this.protocol.pricer.getAmountValueUSD( + token, + amount, + this.protocol.event.block + ); if (!this.pool.rewardTokens) { this.pool.rewardTokens = [rToken.id]; this.pool.rewardTokenEmissionsAmount = [amount]; @@ -882,7 +1032,11 @@ export class Pool { * @param amount The amount of the token */ addVolumeByToken(token: TokenSchema, amount: BigInt): void { - const amountUSD = this.protocol.pricer.getAmountValueUSD(token, amount); + const amountUSD = this.protocol.pricer.getAmountValueUSD( + token, + amount, + this.protocol.event.block + ); const tokenIndex = this.pool.inputTokens.indexOf(token.id); if (tokenIndex == -1) return; @@ -903,6 +1057,37 @@ export class Pool { this.addVolume(amountUSD); } + /** + * Adds the volume of a given input token by its amount and its USD value. + * It will also add the amount to the total volume of the pool and the protocol + * @param token The input token + * @param amount The amount of the token + */ + addCumulativeVolumeByTokenAmount(token: TokenSchema, amount: BigInt): void { + const amountUSD = this.protocol.pricer.getAmountValueUSD( + token, + amount, + this.protocol.event.block + ); + + const tokenIndex = this.pool.inputTokens.indexOf(token.id); + if (tokenIndex == -1) return; + + const cumulativeVolumeByTokenAmount = + this.pool.cumulativeVolumeByTokenAmount; + const cumulativeVolumeByTokenUSD = this.pool.cumulativeVolumeByTokenUSD; + + cumulativeVolumeByTokenAmount[tokenIndex] = + cumulativeVolumeByTokenAmount[tokenIndex].plus(amount); + cumulativeVolumeByTokenUSD[tokenIndex] = + cumulativeVolumeByTokenUSD[tokenIndex].plus(amountUSD); + + this.pool.cumulativeVolumeByTokenUSD = cumulativeVolumeByTokenUSD; + this.pool.cumulativeVolumeByTokenAmount = cumulativeVolumeByTokenAmount; + + this.save(); + } + /** * Adds the inflow volume of a given input token by its amount and its USD value. * It will also add the amount to the total inflow volume of the pool and the protocol @@ -910,7 +1095,11 @@ export class Pool { * @param amount The amount of the token */ addInflowVolumeByToken(token: TokenSchema, amount: BigInt): void { - const amountUSD = this.protocol.pricer.getAmountValueUSD(token, amount); + const amountUSD = this.protocol.pricer.getAmountValueUSD( + token, + amount, + this.protocol.event.block + ); const tokenIndex = this.pool.inputTokens.indexOf(token.id); if (tokenIndex == -1) return; @@ -941,7 +1130,11 @@ export class Pool { * @param amount The amount of the token */ addOutflowVolumeByToken(token: TokenSchema, amount: BigInt): void { - const amountUSD = this.protocol.pricer.getAmountValueUSD(token, amount); + const amountUSD = this.protocol.pricer.getAmountValueUSD( + token, + amount, + this.protocol.event.block + ); const tokenIndex = this.pool.inputTokens.indexOf(token.id); if (tokenIndex == -1) return; @@ -972,7 +1165,11 @@ export class Pool { * @param amount The amount of the token */ addClosedInflowVolumeByToken(token: TokenSchema, amount: BigInt): void { - const amountUSD = this.protocol.pricer.getAmountValueUSD(token, amount); + const amountUSD = this.protocol.pricer.getAmountValueUSD( + token, + amount, + this.protocol.event.block + ); const tokenIndex = this.pool.inputTokens.indexOf(token.id); if (tokenIndex == -1) return; diff --git a/subgraphs/kwenta/src/sdk/protocols/perpfutures/poolSnapshot.ts b/subgraphs/kwenta/src/sdk/protocols/perpfutures/poolSnapshot.ts index 81383f7a91..2b01d7ca6d 100644 --- a/subgraphs/kwenta/src/sdk/protocols/perpfutures/poolSnapshot.ts +++ b/subgraphs/kwenta/src/sdk/protocols/perpfutures/poolSnapshot.ts @@ -15,11 +15,12 @@ import { * This file contains the PoolSnapshot, which is used to * make all of the storage changes that occur in the pool daily and hourly snapshots. * - * Schema Version: 1.3.0 - * SDK Version: 1.1.0 + * Schema Version: 1.3.3 + * SDK Version: 1.1.6 * Author(s): * - @harsh9200 * - @dhruv-chauhan + * - @dmelotik */ export class PoolSnapshot { @@ -65,10 +66,10 @@ export class PoolSnapshot { } private isInitialized(): boolean { - // log.error( - // "[isInitialized] cannot create snapshots, pool: {} not initialized", - // [this.pool.id.toHexString()] - // ); + log.error( + "[isInitialized] cannot create snapshots, pool: {} not initialized", + [this.pool.id.toHexString()] + ); return this.pool._lastSnapshotDayID && this.pool._lastSnapshotHourID && @@ -89,6 +90,7 @@ export class PoolSnapshot { snapshot.hours = hour; snapshot.pool = this.pool.id; snapshot.protocol = this.pool.protocol; + snapshot.timestamp = this.event.block.timestamp; snapshot.totalValueLockedUSD = this.pool.totalValueLockedUSD; @@ -108,6 +110,14 @@ export class PoolSnapshot { ) : snapshot.cumulativeProtocolSideRevenueUSD; + snapshot.cumulativeStakeSideRevenueUSD = + this.pool.cumulativeStakeSideRevenueUSD; + snapshot.hourlyStakeSideRevenueUSD = previousSnapshot + ? snapshot.cumulativeStakeSideRevenueUSD.minus( + previousSnapshot.cumulativeStakeSideRevenueUSD + ) + : snapshot.cumulativeStakeSideRevenueUSD; + snapshot.cumulativeTotalRevenueUSD = this.pool.cumulativeTotalRevenueUSD; snapshot.hourlyTotalRevenueUSD = previousSnapshot ? snapshot.cumulativeTotalRevenueUSD.minus( @@ -264,6 +274,7 @@ export class PoolSnapshot { ) : snapshot.cumulativeOutflowVolumeUSD; + snapshot.inputTokens = this.pool.inputTokens; snapshot.inputTokenBalances = this.pool.inputTokenBalances; snapshot.inputTokenWeights = this.pool.inputTokenWeights; snapshot.outputTokenSupply = this.pool.outputTokenSupply; @@ -272,12 +283,6 @@ export class PoolSnapshot { snapshot.rewardTokenEmissionsAmount = this.pool.rewardTokenEmissionsAmount; snapshot.rewardTokenEmissionsUSD = this.pool.rewardTokenEmissionsUSD; - snapshot.marketSize = this.pool.marketSize; - snapshot.marketSkew = this.pool.marketSkew; - - snapshot.longOpenInterest = this.pool.longOpenInterest; - snapshot.shortOpenInterest = this.pool.shortOpenInterest; - snapshot.totalOpenInterest = this.pool.totalOpenInterest; snapshot.save(); } @@ -292,6 +297,7 @@ export class PoolSnapshot { snapshot.days = day; snapshot.pool = this.pool.id; snapshot.protocol = this.pool.protocol; + snapshot.timestamp = this.event.block.timestamp; snapshot.totalValueLockedUSD = this.pool.totalValueLockedUSD; @@ -311,6 +317,14 @@ export class PoolSnapshot { ) : snapshot.cumulativeProtocolSideRevenueUSD; + snapshot.cumulativeStakeSideRevenueUSD = + this.pool.cumulativeStakeSideRevenueUSD; + snapshot.dailyStakeSideRevenueUSD = previousSnapshot + ? snapshot.cumulativeStakeSideRevenueUSD.minus( + previousSnapshot.cumulativeStakeSideRevenueUSD + ) + : snapshot.cumulativeStakeSideRevenueUSD; + snapshot.cumulativeTotalRevenueUSD = this.pool.cumulativeTotalRevenueUSD; snapshot.dailyTotalRevenueUSD = previousSnapshot ? snapshot.cumulativeTotalRevenueUSD.minus( @@ -470,35 +484,22 @@ export class PoolSnapshot { snapshot.cumulativeUniqueUsers = this.pool.cumulativeUniqueUsers; const dailyActivityHelper = initActivityHelper( - Bytes.fromUTF8("daily-".concat(this.dayID.toString())) + Bytes.fromUTF8( + constants.ActivityInterval.DAILY.concat("-").concat(day.toString()) + ) ); snapshot.dailyActiveUsers = dailyActivityHelper.activeUsers; + snapshot.dailyActiveDepositors = dailyActivityHelper.activeDepositors; + snapshot.dailyActiveBorrowers = dailyActivityHelper.activeBorrowers; + snapshot.dailyActiveLiquidators = dailyActivityHelper.activeLiquidators; + snapshot.dailyActiveLiquidatees = dailyActivityHelper.activeLiquidatees; snapshot.cumulativeUniqueDepositors = this.pool.cumulativeUniqueDepositors; - snapshot.dailyActiveDepositors = previousSnapshot - ? snapshot.cumulativeUniqueDepositors - - previousSnapshot.cumulativeUniqueDepositors - : snapshot.cumulativeUniqueDepositors; - snapshot.cumulativeUniqueBorrowers = this.pool.cumulativeUniqueBorrowers; - snapshot.dailyActiveBorrowers = previousSnapshot - ? snapshot.cumulativeUniqueBorrowers - - previousSnapshot.cumulativeUniqueBorrowers - : snapshot.cumulativeUniqueBorrowers; - snapshot.cumulativeUniqueLiquidators = this.pool.cumulativeUniqueLiquidators; - snapshot.dailyActiveLiquidators = previousSnapshot - ? snapshot.cumulativeUniqueLiquidators - - previousSnapshot.cumulativeUniqueLiquidators - : snapshot.cumulativeUniqueLiquidators; - snapshot.cumulativeUniqueLiquidatees = this.pool.cumulativeUniqueLiquidatees; - snapshot.dailyActiveLiquidatees = previousSnapshot - ? snapshot.cumulativeUniqueLiquidatees - - previousSnapshot.cumulativeUniqueLiquidatees - : snapshot.cumulativeUniqueLiquidatees; snapshot.longPositionCount = this.pool.longPositionCount; snapshot.dailyLongPositionCount = previousSnapshot @@ -529,6 +530,7 @@ export class PoolSnapshot { previousSnapshot.cumulativePositionCount : snapshot.cumulativePositionCount; + snapshot.inputTokens = this.pool.inputTokens; snapshot.inputTokenBalances = this.pool.inputTokenBalances; snapshot.inputTokenWeights = this.pool.inputTokenWeights; snapshot.outputTokenSupply = this.pool.outputTokenSupply; @@ -536,11 +538,7 @@ export class PoolSnapshot { snapshot.stakedOutputTokenAmount = this.pool.stakedOutputTokenAmount; snapshot.rewardTokenEmissionsAmount = this.pool.rewardTokenEmissionsAmount; snapshot.rewardTokenEmissionsUSD = this.pool.rewardTokenEmissionsUSD; - snapshot.marketSize = this.pool.marketSize; - snapshot.marketSkew = this.pool.marketSkew; - snapshot.longOpenInterest = this.pool.longOpenInterest; - snapshot.shortOpenInterest = this.pool.shortOpenInterest; - snapshot.totalOpenInterest = this.pool.totalOpenInterest; + snapshot.save(); } } diff --git a/subgraphs/kwenta/src/sdk/protocols/perpfutures/position.ts b/subgraphs/kwenta/src/sdk/protocols/perpfutures/position.ts index ff7a2d28a6..d975e652df 100644 --- a/subgraphs/kwenta/src/sdk/protocols/perpfutures/position.ts +++ b/subgraphs/kwenta/src/sdk/protocols/perpfutures/position.ts @@ -19,11 +19,12 @@ import { PositionModified } from "../../../../generated/templates/FuturesV1Marke * make all of the storage changes that occur in the position and * its corresponding snapshots. * - * Schema Version: 1.3.0 - * SDK Version: 1.1.0 + * Schema Version: 1.3.3 + * SDK Version: 1.1.6 * Author(s): * - @harsh9200 * - @dhruv-chauhan + * - @dmelotik */ class LoadPositionResponse { position: Position; @@ -101,7 +102,7 @@ export class PositionManager { let entity = PositionSchema.load(positionId); // if entity.hashClosed is not null that means last position is closed, and we have to open a new position - if (entity != null && entity.isClosed) { + if (entity != null && !!entity.hashClosed) { positionId = this.getPositionId(pool, account, false); entity = null; @@ -137,7 +138,6 @@ export class PositionManager { entity.price = eventPosition.params.lastPrice; entity.fundingIndex = eventPosition.params.fundingIndex; entity.size = eventPosition.params.size; - entity.isClosed = false; entity.save(); } @@ -218,7 +218,6 @@ export class Position { this.position.hashClosed = event.transaction.hash; this.position.blockNumberClosed = event.block.number; this.position.timestampClosed = event.block.timestamp; - this.position.isClosed = true; this.save(); this.account.closePosition(this.position.side); @@ -276,7 +275,7 @@ export class Position { this.position.balance = amount; this.position.balanceUSD = this.protocol .getTokenPricer() - .getAmountValueUSD(token, amount); + .getAmountValueUSD(token, amount, this.protocol.event.block); this.save(); } @@ -289,7 +288,7 @@ export class Position { this.position.collateralBalance = amount; this.position.collateralBalanceUSD = this.protocol .getTokenPricer() - .getAmountValueUSD(token, amount); + .getAmountValueUSD(token, amount, this.protocol.event.block); this.save(); } @@ -301,7 +300,7 @@ export class Position { setBalanceClosed(token: Token, amount: BigInt): void { this.position.closeBalanceUSD = this.protocol .getTokenPricer() - .getAmountValueUSD(token, amount); + .getAmountValueUSD(token, amount, this.protocol.event.block); this.save(); } @@ -313,7 +312,7 @@ export class Position { setCollateralBalanceClosed(token: Token, amount: BigInt): void { this.position.closeCollateralBalanceUSD = this.protocol .getTokenPricer() - .getAmountValueUSD(token, amount); + .getAmountValueUSD(token, amount, this.protocol.event.block); this.save(); } @@ -325,7 +324,7 @@ export class Position { setRealisedPnlClosed(token: Token, amount: BigInt): void { this.position.realisedPnlUSD = this.protocol .getTokenPricer() - .getAmountValueUSD(token, amount); + .getAmountValueUSD(token, amount, this.protocol.event.block); this.save(); } diff --git a/subgraphs/kwenta/src/sdk/protocols/perpfutures/protocol.ts b/subgraphs/kwenta/src/sdk/protocols/perpfutures/protocol.ts index acdcdfb36c..2f4b6fd8f3 100644 --- a/subgraphs/kwenta/src/sdk/protocols/perpfutures/protocol.ts +++ b/subgraphs/kwenta/src/sdk/protocols/perpfutures/protocol.ts @@ -19,11 +19,12 @@ import { DerivPerpProtocol as PerpetualSchema } from "../../../../generated/sche * This file contains the Perpetual class, which is used to * make all of the storage changes that occur in a protocol. * - * Schema Version: 1.3.0 - * SDK Version: 1.1.0 + * Schema Version: 1.3.3 + * SDK Version: 1.1.6 * Author(s): * - @harsh9200 * - @dhruv-chauhan + * - @dmelotik */ /** @@ -203,7 +204,9 @@ export class Perpetual { * @param amount {BigDecimal} The value to add to the protocol's TVL. */ addTotalValueLocked(amount: BigDecimal): void { - this.setTotalValueLocked(this.protocol.totalValueLockedUSD.plus(amount)); + const tvl = this.protocol.totalValueLockedUSD.plus(amount); + + this.setTotalValueLocked(tvl); } /** @@ -369,12 +372,21 @@ export class Perpetual { * * @param amountChangeUSD {BigDecimal} The value to add to the protocol's openInterest in USD. */ - updateLongOpenInterestUSD(amountChangeUSD: BigDecimal): void { - this.protocol.totalOpenInterestUSD = - this.protocol.totalOpenInterestUSD.plus(amountChangeUSD); - this.protocol.longOpenInterestUSD = - this.protocol.longOpenInterestUSD.plus(amountChangeUSD); - + updateLongOpenInterestUSD( + amountChangeUSD: BigDecimal, + isIncrease: bool + ): void { + if (isIncrease) { + this.protocol.totalOpenInterestUSD = + this.protocol.totalOpenInterestUSD.plus(amountChangeUSD); + this.protocol.longOpenInterestUSD = + this.protocol.longOpenInterestUSD.plus(amountChangeUSD); + } else { + this.protocol.totalOpenInterestUSD = + this.protocol.totalOpenInterestUSD.minus(amountChangeUSD); + this.protocol.longOpenInterestUSD = + this.protocol.longOpenInterestUSD.minus(amountChangeUSD); + } this.save(); } @@ -383,11 +395,21 @@ export class Perpetual { * * @param amountChangeUSD {BigDecimal} The value to add to the protocol's openInterest in USD. */ - updateShortOpenInterestUSD(amountChangeUSD: BigDecimal): void { - this.protocol.totalOpenInterestUSD = - this.protocol.totalOpenInterestUSD.plus(amountChangeUSD); - this.protocol.shortOpenInterestUSD = - this.protocol.shortOpenInterestUSD.plus(amountChangeUSD); + updateShortOpenInterestUSD( + amountChangeUSD: BigDecimal, + isIncrease: bool + ): void { + if (isIncrease) { + this.protocol.totalOpenInterestUSD = + this.protocol.totalOpenInterestUSD.plus(amountChangeUSD); + this.protocol.shortOpenInterestUSD = + this.protocol.shortOpenInterestUSD.plus(amountChangeUSD); + } else { + this.protocol.totalOpenInterestUSD = + this.protocol.totalOpenInterestUSD.minus(amountChangeUSD); + this.protocol.shortOpenInterestUSD = + this.protocol.shortOpenInterestUSD.minus(amountChangeUSD); + } this.save(); } diff --git a/subgraphs/kwenta/src/sdk/protocols/perpfutures/protocolSnapshot.ts b/subgraphs/kwenta/src/sdk/protocols/perpfutures/protocolSnapshot.ts index d9b322e474..244f8743c0 100644 --- a/subgraphs/kwenta/src/sdk/protocols/perpfutures/protocolSnapshot.ts +++ b/subgraphs/kwenta/src/sdk/protocols/perpfutures/protocolSnapshot.ts @@ -18,11 +18,12 @@ import { * make all of the storage changes that occur in the protocol's * daily and hourly snapshots. * - * Schema Version: 1.3.0 - * SDK Version: 1.1.0 + * Schema Version: 1.3.3 + * SDK Version: 1.1.6 * Author(s): * - @harsh9200 * - @dhruv-chauhan + * - @dmelotik */ export class ProtocolSnapshot { @@ -40,10 +41,18 @@ export class ProtocolSnapshot { this.hourID = getUnixHours(event.block); this.dailyActivityHelper = initActivityHelper( - Bytes.fromUTF8("daily-".concat(this.dayID.toString())) + Bytes.fromUTF8( + constants.ActivityInterval.DAILY.concat("-").concat( + this.dayID.toString() + ) + ) ); this.hourlyActivityHelper = initActivityHelper( - Bytes.fromUTF8("hourly-".concat(this.hourID.toString())) + Bytes.fromUTF8( + constants.ActivityInterval.HOURLY.concat("-").concat( + this.hourID.toString() + ) + ) ); this.takeSnapshots(); @@ -136,6 +145,7 @@ export class ProtocolSnapshot { snapshot.days = day; snapshot.protocol = this.protocol.id; + snapshot.timestamp = this.event.block.timestamp; snapshot.totalValueLockedUSD = this.protocol.totalValueLockedUSD; @@ -253,7 +263,9 @@ export class ProtocolSnapshot { private takeUsageDailySnapshot(day: i32): void { const activity = initActivityHelper( - Bytes.fromUTF8("daily-".concat(day.toString())) + Bytes.fromUTF8( + constants.ActivityInterval.DAILY.concat("-").concat(day.toString()) + ) ); const snapshot = new UsageMetricsDailySnapshot(Bytes.fromI32(day)); @@ -263,6 +275,7 @@ export class ProtocolSnapshot { snapshot.days = day; snapshot.protocol = this.protocol.id; + snapshot.timestamp = this.event.block.timestamp; snapshot.dailyActiveUsers = activity.activeUsers; snapshot.cumulativeUniqueUsers = this.protocol.cumulativeUniqueUsers; @@ -343,12 +356,15 @@ export class ProtocolSnapshot { private takeUsageHourlySnapshot(hour: i32): void { const activity = initActivityHelper( - Bytes.fromUTF8("hourly-".concat(hour.toString())) + Bytes.fromUTF8( + constants.ActivityInterval.HOURLY.concat("-").concat(hour.toString()) + ) ); const snapshot = new UsageMetricsHourlySnapshot(Bytes.fromI32(hour)); snapshot.hours = hour; snapshot.protocol = this.protocol.id; + snapshot.timestamp = this.event.block.timestamp; snapshot.hourlyActiveUsers = activity.activeUsers; snapshot.cumulativeUniqueUsers = this.protocol.cumulativeUniqueUsers; diff --git a/subgraphs/kwenta/src/sdk/protocols/perpfutures/tokens.ts b/subgraphs/kwenta/src/sdk/protocols/perpfutures/tokens.ts index 73d7f6d1c4..21ec0fbbfc 100644 --- a/subgraphs/kwenta/src/sdk/protocols/perpfutures/tokens.ts +++ b/subgraphs/kwenta/src/sdk/protocols/perpfutures/tokens.ts @@ -1,4 +1,10 @@ -import { Address, Bytes, log } from "@graphprotocol/graph-ts"; +import { + Address, + BigDecimal, + Bytes, + ethereum, + log, +} from "@graphprotocol/graph-ts"; import { Perpetual } from "./protocol"; import * as constants from "../../util/constants"; @@ -10,8 +16,8 @@ import { Token, RewardToken } from "../../../../generated/schema"; * a wrapper for the Token entity making it easier to * use in mappings and get info about the token. * - * Schema Version: 1.3.0 - * SDK Version: 1.1.0 + * Schema Version: 1.3.3 + * SDK Version: 1.1.6 * Author(s): * - @harsh9200 * - @dhruv-chauhan @@ -50,6 +56,16 @@ export class TokenManager { return token; } + updateTokenPrice( + token: Token, + usdPrice: BigDecimal, + block: ethereum.Block + ): void { + token.lastPriceUSD = usdPrice; + token.lastPriceBlockNumber = block.number; + token.save(); + } + getOrCreateTokenFromBytes(address: Bytes): Token { return this.getOrCreateToken(Address.fromBytes(address)); } diff --git a/subgraphs/kwenta/src/sdk/util/constants.ts b/subgraphs/kwenta/src/sdk/util/constants.ts index ddb99fe923..185e7bf83d 100644 --- a/subgraphs/kwenta/src/sdk/util/constants.ts +++ b/subgraphs/kwenta/src/sdk/util/constants.ts @@ -126,6 +126,11 @@ export namespace RewardTokenType { } export type RewardTokenType = string; +export namespace ActivityInterval { + export const HOURLY = "HOURLY"; + export const DAILY = "DAILY"; +} + export namespace LendingType { export const CDP = "CDP"; export const POOLED = "POOLED"; @@ -178,6 +183,7 @@ export const USDC_DENOMINATOR = BigDecimal.fromString("1000000"); export const BIGINT_ZERO = BigInt.fromI32(0); export const BIGINT_ONE = BigInt.fromI32(1); export const BIGINT_TWO = BigInt.fromI32(2); +export const BIGINT_TEN = BigInt.fromI32(10); export const BIGINT_HUNDRED = BigInt.fromI32(100); export const BIGINT_THOUSAND = BigInt.fromI32(1000); export const BIGINT_TEN_TO_EIGHTEENTH = BigInt.fromString("10").pow(18); diff --git a/subgraphs/kwenta/src/sdk/util/numbers.ts b/subgraphs/kwenta/src/sdk/util/numbers.ts index 338ca172d8..b1d8692590 100644 --- a/subgraphs/kwenta/src/sdk/util/numbers.ts +++ b/subgraphs/kwenta/src/sdk/util/numbers.ts @@ -1,16 +1,17 @@ -import { BigDecimal, BigInt } from "@graphprotocol/graph-ts"; +import { BigDecimal, BigInt, Bytes } from "@graphprotocol/graph-ts"; -import { BIGDECIMAL_ZERO } from "./constants"; +import { + BIGDECIMAL_ZERO, + BIGINT_TEN, + DEFAULT_DECIMALS, + INT_TWO, +} from "./constants"; export function bigIntToBigDecimal( quantity: BigInt, - decimals: i32 = 18 + decimals: i32 = DEFAULT_DECIMALS ): BigDecimal { - return quantity.divDecimal( - BigInt.fromI32(10) - .pow(decimals as u8) - .toBigDecimal() - ); + return quantity.divDecimal(BIGINT_TEN.pow(decimals as u8).toBigDecimal()); } export function bigDecimalToBigInt(input: BigDecimal): BigInt { @@ -19,7 +20,7 @@ export function bigDecimalToBigInt(input: BigDecimal): BigInt { } // returns 10^exp -export function exponentToBigDecimal(exp: i32 = 18): BigDecimal { +export function exponentToBigDecimal(exp: i32 = DEFAULT_DECIMALS): BigDecimal { let bd = BigDecimal.fromString("1"); const ten = BigDecimal.fromString("10"); for (let i = 0; i < exp; i++) { @@ -46,7 +47,9 @@ export function calculateMedian(prices: BigDecimal[]): BigDecimal { const mid = Math.ceil(sorted.length / 2) as i32; if (sorted.length % 2 == 0) { - return sorted[mid].plus(sorted[mid - 1]).div(BigDecimal.fromString("2")); + return sorted[mid] + .plus(sorted[mid - 1]) + .div(BigDecimal.fromString(INT_TWO.toString())); } return sorted[mid - 1]; @@ -57,3 +60,71 @@ export function safeDivide(a: BigDecimal, b: BigDecimal): BigDecimal { return a.div(b); } + +export function poolArraySort( + ref: Array, + arr1: Array, + arr2: Array, + arr3: Array, + arr4: Array, + arr5: Array, + arr6: Array, + arr7: Array, + arr8: Array, + arr9: Array, + arr10: Array +): void { + if ( + ref.length != arr1.length || + ref.length != arr2.length || + ref.length != arr3.length || + ref.length != arr4.length || + ref.length != arr5.length || + ref.length != arr6.length || + ref.length != arr7.length || + ref.length != arr8.length || + ref.length != arr9.length || + ref.length != arr10.length + ) { + // cannot sort + return; + } + + const sorter: Array> = []; + for (let i = 0; i < ref.length; i++) { + sorter[i] = [ + ref[i].toHexString(), + arr1[i].toString(), + arr2[i].toString(), + arr3[i].toString(), + arr4[i].toString(), + arr5[i].toString(), + arr6[i].toString(), + arr7[i].toString(), + arr8[i].toString(), + arr9[i].toString(), + arr10[i].toString(), + ]; + } + + sorter.sort(function (a: Array, b: Array): i32 { + if (a[0] < b[0]) { + return -1; + } + return 1; + }); + + for (let i = 0; i < sorter.length; i++) { + ref[i] = Bytes.fromHexString(sorter[i][0]); + arr1[i] = BigInt.fromString(sorter[i][1]); + arr2[i] = BigDecimal.fromString(sorter[i][2]); + arr3[i] = BigInt.fromString(sorter[i][3]); + arr4[i] = BigDecimal.fromString(sorter[i][4]); + arr5[i] = BigInt.fromString(sorter[i][5]); + arr6[i] = BigDecimal.fromString(sorter[i][6]); + arr7[i] = BigInt.fromString(sorter[i][7]); + arr8[i] = BigDecimal.fromString(sorter[i][8]); + arr9[i] = BigInt.fromString(sorter[i][9]); + arr10[i] = BigDecimal.fromString(sorter[i][10]); + } +} From db861e2e9a7ac97c992935acbbfa0c5e03a33c94 Mon Sep 17 00:00:00 2001 From: Amrit Jain Date: Wed, 6 Sep 2023 16:14:30 +0530 Subject: [PATCH 3/6] feat: fix lint issues, collateralIn/Out, premium --- deployment/deployment.json | 2 +- subgraphs/kwenta/README.md | 4 + .../kwenta-optimism/configurations.json | 1 - .../config/templates/kwenta.template.yaml | 129 +---------- subgraphs/kwenta/src/mappings/handlers.ts | 205 ++++-------------- subgraphs/kwenta/src/mappings/helpers.ts | 100 ++++++++- .../kwenta/src/prices/config/arbitrum.ts | 1 + subgraphs/kwenta/src/prices/config/aurora.ts | 1 + .../kwenta/src/prices/config/avalanche.ts | 1 + subgraphs/kwenta/src/prices/config/bsc.ts | 1 + subgraphs/kwenta/src/prices/config/celo.ts | 1 + subgraphs/kwenta/src/prices/config/cronos.ts | 1 + subgraphs/kwenta/src/prices/config/fantom.ts | 1 + subgraphs/kwenta/src/prices/config/fuse.ts | 1 + subgraphs/kwenta/src/prices/config/gnosis.ts | 1 + subgraphs/kwenta/src/prices/config/harmony.ts | 1 + subgraphs/kwenta/src/prices/config/mainnet.ts | 1 + .../kwenta/src/prices/config/moonbeam.ts | 1 + .../kwenta/src/prices/config/optimism.ts | 1 + subgraphs/kwenta/src/prices/config/polygon.ts | 1 + .../kwenta/src/prices/config/template.ts | 1 + .../kwenta/src/prices/routers/CurveRouter.ts | 1 + .../src/prices/routers/UniswapForksRouter.ts | 1 + .../src/sdk/protocols/perpfutures/position.ts | 12 +- 24 files changed, 168 insertions(+), 302 deletions(-) diff --git a/deployment/deployment.json b/deployment/deployment.json index 5fc63f7c76..cf510d8714 100644 --- a/deployment/deployment.json +++ b/deployment/deployment.json @@ -8825,7 +8825,7 @@ "network": "optimism", "status": "dev", "versions": { - "schema": "1.2.1", + "schema": "1.3.3", "subgraph": "1.0.0", "methodology": "1.0.0" }, diff --git a/subgraphs/kwenta/README.md b/subgraphs/kwenta/README.md index 37c8302bec..ad97f45bba 100644 --- a/subgraphs/kwenta/README.md +++ b/subgraphs/kwenta/README.md @@ -59,3 +59,7 @@ Total Revenue = Total Fees - Other official and unofficial data sources: https://kwenta.eth.limo/stats/, https://tokenterminal.com/terminal/projects/kwenta - Documentation: https://docs.kwenta.io/ + +## Note + +We are only tracking v2 markets because v1 markets are deprecated and have almost no liquidity, and the current method to calculate open interest is not supported by v1 markets diff --git a/subgraphs/kwenta/protocols/kwenta/config/deployments/kwenta-optimism/configurations.json b/subgraphs/kwenta/protocols/kwenta/config/deployments/kwenta-optimism/configurations.json index a6a9ddbdd6..a32a9bec4a 100644 --- a/subgraphs/kwenta/protocols/kwenta/config/deployments/kwenta-optimism/configurations.json +++ b/subgraphs/kwenta/protocols/kwenta/config/deployments/kwenta-optimism/configurations.json @@ -1,7 +1,6 @@ { "deployment": "KWENTA_OPTIMISM", "network": "optimism", - "marketManagerV1": [], "marketManagerV2": [ { "name": "FuturesMarketManager2", diff --git a/subgraphs/kwenta/protocols/kwenta/config/templates/kwenta.template.yaml b/subgraphs/kwenta/protocols/kwenta/config/templates/kwenta.template.yaml index 5d3572ece3..1d25793110 100644 --- a/subgraphs/kwenta/protocols/kwenta/config/templates/kwenta.template.yaml +++ b/subgraphs/kwenta/protocols/kwenta/config/templates/kwenta.template.yaml @@ -10,64 +10,6 @@ graft: block: {{graftStartBlock}} # Block number {{/graftEnabled}} dataSources: - {{#marketManagerV1}} - - kind: ethereum/contract - name: {{ name }} - network: {{ network }} - source: - address: "{{ address }}" - abi: FuturesMarketManager - startBlock: {{ startBlock }} - mapping: - kind: ethereum/events - apiVersion: 0.0.7 - language: wasm/assemblyscript - entities: - - DerivPerpProtocol - abis: - - name: FuturesMarket - file: ./abis/kwenta/FuturesMarket.json - - name: FuturesMarketManager - file: ./abis/kwenta/FuturesMarketManager.json - - - ########################################### - ############## Price Oracle ############### - ########################################### - # ERC20 - - name: _ERC20 - file: ./abis/Prices/ERC20.json - # Curve Contracts - - name: CurvePool - file: ./abis/Prices/Curve/Pool.json - - name: CurveRegistry - file: ./abis/Prices/Curve/Registry.json - - name: CalculationsCurve - file: ./abis/Prices/Calculations/Curve.json - # YearnLens Contracts - - name: YearnLensContract - file: ./abis/Prices/YearnLens.json - # Aave Oracle Contract - - name: AaveOracleContract - file: ./abis/Prices/AaveOracle.json - # SushiSwap Contracts - - name: CalculationsSushiSwap - file: ./abis/Prices/Calculations/SushiSwap.json - # ChainLink Contracts - - name: ChainLinkContract - file: ./abis/Prices/ChainLink.json - # Uniswap Contracts - - name: UniswapRouter - file: ./abis/Prices/Uniswap/Router.json - - name: UniswapFactory - file: ./abis/Prices/Uniswap/Factory.json - - name: UniswapPair - file: ./abis/Prices/Uniswap/Pair.json - eventHandlers: - - event: 'MarketAdded(address,indexed bytes32,indexed bytes32)' - handler: 'handleV1MarketAdded' - file: ./src/mappings/handlers.ts - {{/marketManagerV1}} {{#marketManagerV2}} - kind: ethereum/contract name: {{ name }} @@ -123,7 +65,7 @@ dataSources: file: ./abis/Prices/Uniswap/Pair.json eventHandlers: - event: 'MarketAdded(address,indexed bytes32,indexed bytes32)' - handler: 'handleV2MarketAdded' + handler: 'handleMarketAdded' file: ./src/mappings/handlers.ts {{/marketManagerV2}} {{#smartMarginFactory}} @@ -151,67 +93,6 @@ dataSources: templates: - - kind: ethereum/contract - name: FuturesV1Market - network: {{ network }} - source: - abi: FuturesMarket - mapping: - kind: ethereum/events - apiVersion: 0.0.7 - language: wasm/assemblyscript - entities: - - LiquidityPool - abis: - - name: FuturesMarket - file: ./abis/kwenta/FuturesMarket.json - - - - ########################################### - ############## Price Oracle ############### - ########################################### - # ERC20 - - name: _ERC20 - file: ./abis/Prices/ERC20.json - # Curve Contracts - - name: CurvePool - file: ./abis/Prices/Curve/Pool.json - - name: CurveRegistry - file: ./abis/Prices/Curve/Registry.json - - name: CalculationsCurve - file: ./abis/Prices/Calculations/Curve.json - # YearnLens Contracts - - name: YearnLensContract - file: ./abis/Prices/YearnLens.json - # Aave Oracle Contract - - name: AaveOracleContract - file: ./abis/Prices/AaveOracle.json - # SushiSwap Contracts - - name: CalculationsSushiSwap - file: ./abis/Prices/Calculations/SushiSwap.json - # ChainLink Contracts - - name: ChainLinkContract - file: ./abis/Prices/ChainLink.json - # Uniswap Contracts - - name: UniswapRouter - file: ./abis/Prices/Uniswap/Router.json - - name: UniswapFactory - file: ./abis/Prices/Uniswap/Factory.json - - name: UniswapPair - file: ./abis/Prices/Uniswap/Pair.json - eventHandlers: - - event: 'MarginTransferred(indexed address,int256)' - handler: 'handleMarginTransferred' - - event: 'PositionModified(indexed uint256,indexed address,uint256,int256,int256,uint256,uint256,uint256)' - handler: 'handlePositionModified' - - event: 'PositionLiquidated(indexed uint256,indexed address,indexed address,int256,uint256,uint256)' - handler: 'handlePositionLiquidated' - - event: 'FundingRecomputed(int256,uint256,uint256)' - handler: 'handleFundingRecomputed' - # - event: 'ParameterUpdated(bytes32,bytes32,uint256)' - # handler: handleParameterUpdated - file: ./src/mappings/handlers.ts - kind: ethereum/contract name: PerpsV2Market network: {{ network }} @@ -262,14 +143,10 @@ templates: eventHandlers: - event: 'MarginTransferred(indexed address,int256)' handler: 'handleMarginTransferred' - - event: 'PositionModified(indexed uint256,indexed address,uint256,int256,int256,uint256,uint256,uint256)' - handler: 'handlePositionModified' - event: 'PositionModified(indexed uint256,indexed address,uint256,int256,int256,uint256,uint256,uint256,int256)' - handler: 'handlePositionModifiedV2' - - event: 'PositionLiquidated(uint256,address,address,int256,uint256,uint256)' - handler: 'handlePositionLiquidated' + handler: 'handlePositionModified' - event: 'PositionLiquidated(uint256,address,address,int256,uint256,uint256,uint256,uint256)' - handler: 'handlePositionLiquidatedV2' + handler: 'handlePositionLiquidated' - event: 'FundingRecomputed(int256,int256,uint256,uint256)' handler: 'handleFundingRecomputed' file: ./src/mappings/handlers.ts \ No newline at end of file diff --git a/subgraphs/kwenta/src/mappings/handlers.ts b/subgraphs/kwenta/src/mappings/handlers.ts index 73b684e38e..37e57e37d7 100644 --- a/subgraphs/kwenta/src/mappings/handlers.ts +++ b/subgraphs/kwenta/src/mappings/handlers.ts @@ -28,27 +28,27 @@ import { PositionSide, BIGINT_ZERO, BIGINT_TEN_TO_EIGHTEENTH, - LiquidityPoolFeeType, } from "../sdk/util/constants"; import { MarketAdded as MarketAddedEvent } from "../../generated/FuturesMarketManager2/FuturesMarketManager"; import { - FundingRecomputed as FundingRecomputedEvent, + PositionLiquidated1 as PositionLiquidatedEvent, + PositionModified1 as PositionModifiedEvent, MarginTransferred as MarginTransferredEvent, - PositionLiquidated as PositionLiquidatedEvent, - PositionModified as PositionModifiedEvent, -} from "../../generated/templates/FuturesV1Market/FuturesMarket"; -import { - PerpsV2MarketProxyable, - PositionLiquidated1 as PositionLiquidatedV2Event, - PositionModified1 as PositionModifiedV2Event, + FundingRecomputed as FundingRecomputedEvent, } from "../../generated/templates/PerpsV2Market/PerpsV2MarketProxyable"; -import { FuturesV1Market, PerpsV2Market } from "../../generated/templates"; -import { createTokenAmountArray, getFundingRateId } from "./helpers"; +import { PerpsV2Market } from "../../generated/templates"; +import { + createTokenAmountArray, + getFundingRateId, + updateOpenInterest, + liquidation, +} from "./helpers"; import { NewAccount as NewSmartMarginAccountEvent } from "../../generated/SmartMarginFactory1/SmartMarginFactory"; -import { Pool } from "../sdk/protocols/perpfutures/pool"; +import { TransactionType } from "../sdk/protocols/perpfutures/enums"; class Pricer implements TokenPricer { getTokenPrice(token: Token, block: ethereum.Block): BigDecimal { + log.info("Block: {}", [block.number.toString()]); const price = getUsdPricePerToken(Address.fromBytes(token.id)); return price.usdPrice; } @@ -58,6 +58,7 @@ class Pricer implements TokenPricer { amount: BigInt, block: ethereum.Block ): BigDecimal { + log.info("Block: {}", [block.number.toString()]); const _amount = bigIntToBigDecimal(amount, token.decimals); return getUsdPrice(Address.fromBytes(token.id), _amount); } @@ -86,40 +87,10 @@ const conf = new ProtocolConfig( ); /* - This function is called when a new v1 market added - We just checks if it is a v1 market, and then stores it -*/ -export function handleV1MarketAdded(event: MarketAddedEvent): void { - const marketKey = event.params.marketKey.toString(); - const sdk = SDK.initializeFromEvent( - conf, - new Pricer(), - new TokenInit(), - event - ); - - // check that it's a v1 market before adding - if (marketKey.startsWith("s") && !marketKey.endsWith("PERP")) { - log.info("New V1 market added: {}", [marketKey]); - - const pool = sdk.Pools.loadPool(event.params.market); - if (!pool.isInitialized) { - const token = sdk.Tokens.getOrCreateToken( - NetworkConfigs.getSUSDAddress() - ); - pool.initialize(marketKey, marketKey, [token], null, "chainlink"); - } - - // futures v1 market - FuturesV1Market.create(event.params.market); - } -} - -/* - This function is called when a new v2 market added - We just checks if it is a v2 market, and then stores it + This function is called when a new market added + We just checks if it is a market, and then stores it */ -export function handleV2MarketAdded(event: MarketAddedEvent): void { +export function handleMarketAdded(event: MarketAddedEvent): void { const marketKey = event.params.marketKey.toString(); const sdk = SDK.initializeFromEvent( conf, @@ -130,7 +101,7 @@ export function handleV2MarketAdded(event: MarketAddedEvent): void { // check that it's a v1 market before adding if (marketKey.endsWith("PERP")) { - log.info("New V2 market added: {}", [marketKey]); + log.info("New market added: {}", [marketKey]); const pool = sdk.Pools.loadPool(event.params.market); if (!pool.isInitialized) { @@ -138,9 +109,6 @@ export function handleV2MarketAdded(event: MarketAddedEvent): void { NetworkConfigs.getSUSDAddress() ); pool.initialize(marketKey, marketKey, [token], null, "chainlink"); - - // keeper dynamic fees - pool.setPoolFee(LiquidityPoolFeeType.DYNAMIC_LP_FEE, null); } // perps v2 market @@ -216,8 +184,6 @@ export function handleMarginTransferred(event: MarginTransferredEvent): void { if (marginDelta.lt(BIGINT_ZERO)) { account.withdraw(pool, amounts, BIGINT_ZERO); - pool.addOutflowVolumeByToken(token, marginDelta.abs()); - pool.addInputTokenBalances( amounts.map((amount) => amount.times(BIGINT_MINUS_ONE)) ); @@ -305,6 +271,8 @@ export function handlePositionModified(event: PositionModifiedEvent): void { const oldPositionSize = position.getSize(); const oldPositionPrice = position.getPrice(); + const margin = event.params.margin; + const amounts = createTokenAmountArray(pool, [token], [margin]); let fundingAccrued = BIGINT_ZERO; let currentFundingRate = BIGINT_ZERO; @@ -338,24 +306,35 @@ export function handlePositionModified(event: PositionModifiedEvent): void { .plus(fundingAccrued) .minus(fees); - const totalMarginRemaining = event.params.margin; - position.setBalanceClosed(token, totalMarginRemaining); - position.setCollateralBalanceClosed(token, totalMarginRemaining); + account.collateralOut(pool, position.getBytesID(), amounts, BIGINT_ZERO); + + position.setBalanceClosed(token, margin); + position.setCollateralBalanceClosed(token, margin); position.setRealisedPnlUsdClosed(bigIntToBigDecimal(pnl)); position.setFundingrateClosed(bigIntToBigDecimal(currentFundingRate)); + position.addCollateralOutCount(); position.closePosition(); + + pool.addPremiumByToken(token, fees, TransactionType.COLLATERAL_OUT); + pool.addOutflowVolumeByToken(token, margin); } else { const totalMarginRemaining = event.params.margin; const positionTotalPrice = event.params.lastPrice.times(newPositionSize); const leverage = positionTotalPrice.div(totalMarginRemaining); + account.collateralIn(pool, position.getBytesID(), amounts, BIGINT_ZERO); + position.setBalance(token, totalMarginRemaining); position.setCollateralBalance(token, totalMarginRemaining); position.setPrice(event.params.lastPrice); position.setSize(event.params.size); position.setFundingIndex(event.params.fundingIndex); position.setLeverage(bigIntToBigDecimal(leverage)); + position.addCollateralInCount(); + + pool.addPremiumByToken(token, fees, TransactionType.COLLATERAL_IN); + pool.addInflowVolumeByToken(token, margin); } const volume = event.params.lastPrice .times(newPositionSize) @@ -367,125 +346,25 @@ export function handlePositionModified(event: PositionModifiedEvent): void { pool.addRevenueByToken(token, BIGINT_ZERO, fees, BIGINT_ZERO); } -/* - This function is fired when a position is modified in v2 markets, - everything else similar to v1 market position modified event -*/ -export function handlePositionModifiedV2(event: PositionModifiedV2Event): void { - const v1Params = event.parameters.filter((value) => { - return value.name !== "skew"; - }); - - const v1Event = new PositionModifiedEvent( - event.address, - event.logIndex, - event.transactionLogIndex, - event.logType, - event.block, - event.transaction, - v1Params, - event.receipt - ); - handlePositionModified(v1Event); -} - /* - This function is fired when a position is liquidated in v1 market + This function is fired when a position is liquidated */ export function handlePositionLiquidated(event: PositionLiquidatedEvent): void { - liquidation( - event, - event.params.account, - event.params.liquidator, - event.params.fee - ); -} - -/* - This function is fired when a position is liquidated in v2 market -*/ -export function handlePositionLiquidatedV2( - event: PositionLiquidatedV2Event -): void { const totalFee = event.params.flaggerFee .plus(event.params.liquidatorFee) .plus(event.params.stakersFee); - - liquidation(event, event.params.account, event.params.liquidator, totalFee); -} - -// common liquidation logic -function liquidation( - event: ethereum.Event, - sendingAccount: Address, - liquidator: Address, - totalFees: BigInt -): void { const sdk = SDK.initializeFromEvent( conf, new Pricer(), new TokenInit(), event ); - const pool = sdk.Pools.loadPool(dataSource.address()); - const smartMarginAccount = _SmartMarginAccount.load(sendingAccount.toHex()); - const accountAddress = smartMarginAccount - ? Address.fromBytes(smartMarginAccount.owner) - : sendingAccount; - - const loadAccountResponse = sdk.Accounts.loadAccount(accountAddress); - const account = loadAccountResponse.account; - if (loadAccountResponse.isNewUser) { - const protocol = sdk.Protocol; - protocol.addUser(); - pool.addUser(); - } - const token = sdk.Tokens.getOrCreateToken(NetworkConfigs.getSUSDAddress()); - - const position = sdk.Positions.loadLastPosition(pool, account, token, token); - if (position != null) { - const pnl = position - .getRealisedPnlUsd() - .minus(bigIntToBigDecimal(totalFees)); - account.liquidate( - pool, - Address.fromBytes(token.id), - Address.fromBytes(token.id), - position.position.collateralBalance, - liquidator, - accountAddress, - position.getBytesID(), - pnl - ); - position.addLiquidationCount(); - position.setBalanceClosed(token, BIGINT_ZERO); - position.setCollateralBalanceClosed(token, BIGINT_ZERO); - position.setRealisedPnlUsdClosed(pnl); - position.closePosition(); - } -} - -function updateOpenInterest( - marketAddress: Address, - pool: Pool, - lastPrice: BigInt -): void { - const contract = PerpsV2MarketProxyable.bind(marketAddress); - const marketSizeCall = contract.try_marketSize(); - const marketSkewCall = contract.try_marketSkew(); - let marketSize = BIGINT_ZERO; - let marketSkew = BIGINT_ZERO; - if (!marketSizeCall.reverted && !marketSkewCall.reverted) { - marketSize = marketSizeCall.value; - marketSkew = marketSkewCall.value; - } - - const shortOpenInterstAmount = marketSize - .minus(marketSkew) - .div(BigInt.fromI32(2)); - const longOpenInterstAmount = marketSize - .plus(marketSkew) - .div(BigInt.fromI32(2)); - pool.setLongOpenInterest(longOpenInterstAmount, lastPrice); - pool.setShortOpenInterest(shortOpenInterstAmount, lastPrice); + liquidation( + event, + event.params.account, + event.params.liquidator, + totalFee, + event.params.stakersFee, + sdk + ); } diff --git a/subgraphs/kwenta/src/mappings/helpers.ts b/subgraphs/kwenta/src/mappings/helpers.ts index a2de6688af..b36f09c09b 100644 --- a/subgraphs/kwenta/src/mappings/helpers.ts +++ b/subgraphs/kwenta/src/mappings/helpers.ts @@ -1,9 +1,23 @@ -import { BigInt, Bytes } from "@graphprotocol/graph-ts"; +import { + Address, + BigInt, + Bytes, + dataSource, + ethereum, +} from "@graphprotocol/graph-ts"; import { Pool } from "../sdk/protocols/perpfutures/pool"; import { BIGINT_ZERO } from "../sdk/util/constants"; -import { Token } from "../../generated/schema"; +import { + Token, + _FundingRate, + _SmartMarginAccount, +} from "../../generated/schema"; +import { SDK } from "../sdk/protocols/perpfutures"; +import { NetworkConfigs } from "../../configurations/configure"; +import { bigIntToBigDecimal } from "../sdk/util/numbers"; +import { PerpsV2MarketProxyable } from "../../generated/templates/PerpsV2Market/PerpsV2MarketProxyable"; export function createTokenAmountArray( pool: Pool, @@ -32,3 +46,85 @@ export function getFundingRateId(pool: Pool, fundingIndex: BigInt): Bytes { .concat(Bytes.fromUTF8("-")) .concat(Bytes.fromByteArray(Bytes.fromBigInt(fundingIndex))); } + +export function liquidation( + event: ethereum.Event, + sendingAccount: Address, + liquidator: Address, + totalFees: BigInt, + stakerFees: BigInt, + sdk: SDK +): void { + const pool = sdk.Pools.loadPool(dataSource.address()); + const smartMarginAccount = _SmartMarginAccount.load(sendingAccount.toHex()); + const accountAddress = smartMarginAccount + ? Address.fromBytes(smartMarginAccount.owner) + : sendingAccount; + + const loadAccountResponse = sdk.Accounts.loadAccount(accountAddress); + const account = loadAccountResponse.account; + if (loadAccountResponse.isNewUser) { + const protocol = sdk.Protocol; + protocol.addUser(); + pool.addUser(); + } + const token = sdk.Tokens.getOrCreateToken(NetworkConfigs.getSUSDAddress()); + + const position = sdk.Positions.loadLastPosition(pool, account); + if (position != null) { + let fundingRate = BIGINT_ZERO; + + const positionFunding = _FundingRate.load( + getFundingRateId(pool, position.getFundingIndex()) + ); + if (positionFunding != null) { + fundingRate = positionFunding.funding; + } + const pnl = position + .getRealisedPnlUsd() + .minus(bigIntToBigDecimal(totalFees)); + account.liquidate( + pool, + Address.fromBytes(token.id), + Address.fromBytes(token.id), + position.position.collateralBalance, + liquidator, + accountAddress, + position.getBytesID(), + pnl + ); + position.addLiquidationCount(); + position.setBalanceClosed(token, BIGINT_ZERO); + position.setCollateralBalanceClosed(token, BIGINT_ZERO); + position.setRealisedPnlUsdClosed(pnl); + position.setFundingrateClosed(bigIntToBigDecimal(fundingRate)); + + position.closePosition(); + pool.addClosedInflowVolumeByToken(token, stakerFees); + } +} + +export function updateOpenInterest( + marketAddress: Address, + pool: Pool, + lastPrice: BigInt +): void { + const contract = PerpsV2MarketProxyable.bind(marketAddress); + const marketSizeCall = contract.try_marketSize(); + const marketSkewCall = contract.try_marketSkew(); + let marketSize = BIGINT_ZERO; + let marketSkew = BIGINT_ZERO; + if (!marketSizeCall.reverted && !marketSkewCall.reverted) { + marketSize = marketSizeCall.value; + marketSkew = marketSkewCall.value; + } + + const shortOpenInterstAmount = marketSize + .minus(marketSkew) + .div(BigInt.fromI32(2)); + const longOpenInterstAmount = marketSize + .plus(marketSkew) + .div(BigInt.fromI32(2)); + pool.setLongOpenInterest(longOpenInterstAmount, lastPrice); + pool.setShortOpenInterest(shortOpenInterstAmount, lastPrice); +} diff --git a/subgraphs/kwenta/src/prices/config/arbitrum.ts b/subgraphs/kwenta/src/prices/config/arbitrum.ts index 2c0b11099c..dd5815120c 100644 --- a/subgraphs/kwenta/src/prices/config/arbitrum.ts +++ b/subgraphs/kwenta/src/prices/config/arbitrum.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-magic-numbers, @typescript-eslint/no-unused-vars */ import { Address, BigInt } from "@graphprotocol/graph-ts"; import { Configurations, OracleContract } from "../common/types"; diff --git a/subgraphs/kwenta/src/prices/config/aurora.ts b/subgraphs/kwenta/src/prices/config/aurora.ts index 833b94911b..8baf3fdc86 100644 --- a/subgraphs/kwenta/src/prices/config/aurora.ts +++ b/subgraphs/kwenta/src/prices/config/aurora.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-magic-numbers, @typescript-eslint/no-unused-vars */ import { Address, BigInt } from "@graphprotocol/graph-ts"; import { Configurations, OracleContract } from "../common/types"; diff --git a/subgraphs/kwenta/src/prices/config/avalanche.ts b/subgraphs/kwenta/src/prices/config/avalanche.ts index f012ea6af4..2bdf3fb97b 100644 --- a/subgraphs/kwenta/src/prices/config/avalanche.ts +++ b/subgraphs/kwenta/src/prices/config/avalanche.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-magic-numbers, @typescript-eslint/no-unused-vars */ import { Address, BigInt } from "@graphprotocol/graph-ts"; import { Configurations, OracleContract } from "../common/types"; diff --git a/subgraphs/kwenta/src/prices/config/bsc.ts b/subgraphs/kwenta/src/prices/config/bsc.ts index db5cb1d2b1..c61cdce480 100644 --- a/subgraphs/kwenta/src/prices/config/bsc.ts +++ b/subgraphs/kwenta/src/prices/config/bsc.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-magic-numbers, @typescript-eslint/no-unused-vars */ import * as constants from "../common/constants"; import { Address, BigInt } from "@graphprotocol/graph-ts"; import { Configurations, OracleContract } from "../common/types"; diff --git a/subgraphs/kwenta/src/prices/config/celo.ts b/subgraphs/kwenta/src/prices/config/celo.ts index 035dcf448b..40f8475a92 100644 --- a/subgraphs/kwenta/src/prices/config/celo.ts +++ b/subgraphs/kwenta/src/prices/config/celo.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-magic-numbers, @typescript-eslint/no-unused-vars */ import { Address, BigInt } from "@graphprotocol/graph-ts"; import { Configurations, OracleContract } from "../common/types"; diff --git a/subgraphs/kwenta/src/prices/config/cronos.ts b/subgraphs/kwenta/src/prices/config/cronos.ts index f0be429d49..804a968e00 100644 --- a/subgraphs/kwenta/src/prices/config/cronos.ts +++ b/subgraphs/kwenta/src/prices/config/cronos.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-magic-numbers, @typescript-eslint/no-unused-vars */ import { Address, BigInt } from "@graphprotocol/graph-ts"; import { Configurations, OracleContract } from "../common/types"; diff --git a/subgraphs/kwenta/src/prices/config/fantom.ts b/subgraphs/kwenta/src/prices/config/fantom.ts index c43f5497a7..4c56c3c145 100644 --- a/subgraphs/kwenta/src/prices/config/fantom.ts +++ b/subgraphs/kwenta/src/prices/config/fantom.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-magic-numbers, @typescript-eslint/no-unused-vars */ import { Address, BigInt } from "@graphprotocol/graph-ts"; import { Configurations, OracleContract } from "../common/types"; diff --git a/subgraphs/kwenta/src/prices/config/fuse.ts b/subgraphs/kwenta/src/prices/config/fuse.ts index eee170f6a5..8515add327 100644 --- a/subgraphs/kwenta/src/prices/config/fuse.ts +++ b/subgraphs/kwenta/src/prices/config/fuse.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-magic-numbers, @typescript-eslint/no-unused-vars */ import { Address, BigInt } from "@graphprotocol/graph-ts"; import { Configurations, OracleContract } from "../common/types"; diff --git a/subgraphs/kwenta/src/prices/config/gnosis.ts b/subgraphs/kwenta/src/prices/config/gnosis.ts index 7e326f9717..a63419ab88 100644 --- a/subgraphs/kwenta/src/prices/config/gnosis.ts +++ b/subgraphs/kwenta/src/prices/config/gnosis.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-magic-numbers, @typescript-eslint/no-unused-vars */ import { Address, BigInt } from "@graphprotocol/graph-ts"; import { Configurations, OracleContract } from "../common/types"; diff --git a/subgraphs/kwenta/src/prices/config/harmony.ts b/subgraphs/kwenta/src/prices/config/harmony.ts index 39d4b0b16c..bc4997cfaa 100644 --- a/subgraphs/kwenta/src/prices/config/harmony.ts +++ b/subgraphs/kwenta/src/prices/config/harmony.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-magic-numbers, @typescript-eslint/no-unused-vars */ import { Address, BigInt } from "@graphprotocol/graph-ts"; import { Configurations, OracleContract } from "../common/types"; diff --git a/subgraphs/kwenta/src/prices/config/mainnet.ts b/subgraphs/kwenta/src/prices/config/mainnet.ts index 4614a69788..eff3e0d6c4 100644 --- a/subgraphs/kwenta/src/prices/config/mainnet.ts +++ b/subgraphs/kwenta/src/prices/config/mainnet.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-magic-numbers, @typescript-eslint/no-unused-vars */ import { Address, BigInt } from "@graphprotocol/graph-ts"; import { Configurations, OracleContract } from "../common/types"; diff --git a/subgraphs/kwenta/src/prices/config/moonbeam.ts b/subgraphs/kwenta/src/prices/config/moonbeam.ts index f3009cdb3c..1c1893801e 100644 --- a/subgraphs/kwenta/src/prices/config/moonbeam.ts +++ b/subgraphs/kwenta/src/prices/config/moonbeam.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-magic-numbers, @typescript-eslint/no-unused-vars */ import { Address, BigInt } from "@graphprotocol/graph-ts"; import { Configurations, OracleContract } from "../common/types"; diff --git a/subgraphs/kwenta/src/prices/config/optimism.ts b/subgraphs/kwenta/src/prices/config/optimism.ts index a270efacc3..4b46ec094c 100644 --- a/subgraphs/kwenta/src/prices/config/optimism.ts +++ b/subgraphs/kwenta/src/prices/config/optimism.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-magic-numbers, @typescript-eslint/no-unused-vars */ import { Address, BigInt } from "@graphprotocol/graph-ts"; import { Configurations, OracleContract } from "../common/types"; diff --git a/subgraphs/kwenta/src/prices/config/polygon.ts b/subgraphs/kwenta/src/prices/config/polygon.ts index c8d174fdf9..35f3f0eb35 100644 --- a/subgraphs/kwenta/src/prices/config/polygon.ts +++ b/subgraphs/kwenta/src/prices/config/polygon.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-magic-numbers, @typescript-eslint/no-unused-vars */ import { BigInt, Address } from "@graphprotocol/graph-ts"; import { Configurations, OracleContract } from "../common/types"; diff --git a/subgraphs/kwenta/src/prices/config/template.ts b/subgraphs/kwenta/src/prices/config/template.ts index 1916693083..36645a0067 100644 --- a/subgraphs/kwenta/src/prices/config/template.ts +++ b/subgraphs/kwenta/src/prices/config/template.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-magic-numbers, @typescript-eslint/no-unused-vars */ import * as constants from "../common/constants"; import { Address, BigInt } from "@graphprotocol/graph-ts"; import { Configurations, OracleContract } from "../common/types"; diff --git a/subgraphs/kwenta/src/prices/routers/CurveRouter.ts b/subgraphs/kwenta/src/prices/routers/CurveRouter.ts index 77801cd97b..2426532d84 100644 --- a/subgraphs/kwenta/src/prices/routers/CurveRouter.ts +++ b/subgraphs/kwenta/src/prices/routers/CurveRouter.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-magic-numbers, @typescript-eslint/no-unused-vars */ import { getUsdPricePerToken } from ".."; import * as utils from "../common/utils"; import * as constants from "../common/constants"; diff --git a/subgraphs/kwenta/src/prices/routers/UniswapForksRouter.ts b/subgraphs/kwenta/src/prices/routers/UniswapForksRouter.ts index d3a3cffd00..beed2cd46a 100644 --- a/subgraphs/kwenta/src/prices/routers/UniswapForksRouter.ts +++ b/subgraphs/kwenta/src/prices/routers/UniswapForksRouter.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-magic-numbers, @typescript-eslint/no-unused-vars */ import * as utils from "../common/utils"; import * as constants from "../common/constants"; import { CustomPriceType } from "../common/types"; diff --git a/subgraphs/kwenta/src/sdk/protocols/perpfutures/position.ts b/subgraphs/kwenta/src/sdk/protocols/perpfutures/position.ts index d975e652df..29e100fb00 100644 --- a/subgraphs/kwenta/src/sdk/protocols/perpfutures/position.ts +++ b/subgraphs/kwenta/src/sdk/protocols/perpfutures/position.ts @@ -1,4 +1,4 @@ -import { BigDecimal, BigInt, Bytes, log } from "@graphprotocol/graph-ts"; +import { BigDecimal, BigInt, Bytes } from "@graphprotocol/graph-ts"; import { Pool } from "./pool"; import { Account } from "./account"; @@ -12,8 +12,7 @@ import { _PositionCounter, Position as PositionSchema, } from "../../../../generated/schema"; -import { PositionModified } from "../../../../generated/templates/FuturesV1Market/FuturesMarket"; - +import { PositionModified1 as PositionModified } from "../../../../generated/templates/PerpsV2Market/PerpsV2MarketProxyable"; /** * This file contains the Position class, which is used to * make all of the storage changes that occur in the position and @@ -68,12 +67,7 @@ export class PositionManager { .concat(Bytes.fromUTF8("-")) .concatI32(positionCounter.nextCount); } - loadLastPosition( - pool: Pool, - account: Account, - asset: Token, - collateral: Token - ): Position | null { + loadLastPosition(pool: Pool, account: Account): Position | null { const positionId = this.getPositionId(pool, account, true); const entity = PositionSchema.load(positionId); if (entity != null) { From 23a07ebb7a5c63fe3fa283d1b97d1ac67af6b9ec Mon Sep 17 00:00:00 2001 From: Amrit Jain Date: Sat, 9 Sep 2023 11:37:13 +0530 Subject: [PATCH 4/6] feat: add fees --- .../abis/kwenta/PerpsV2MarketSettings.json | 1638 +++++++++++++++++ .../kwenta-optimism/configurations.json | 17 + .../config/templates/kwenta.template.yaml | 23 +- subgraphs/kwenta/schema.graphql | 25 + subgraphs/kwenta/src/mappings/handlers.ts | 54 +- subgraphs/kwenta/src/mappings/helpers.ts | 11 + subgraphs/kwenta/src/sdk/util/constants.ts | 30 +- 7 files changed, 1792 insertions(+), 6 deletions(-) create mode 100644 subgraphs/kwenta/abis/kwenta/PerpsV2MarketSettings.json diff --git a/subgraphs/kwenta/abis/kwenta/PerpsV2MarketSettings.json b/subgraphs/kwenta/abis/kwenta/PerpsV2MarketSettings.json new file mode 100644 index 0000000000..73e99c9346 --- /dev/null +++ b/subgraphs/kwenta/abis/kwenta/PerpsV2MarketSettings.json @@ -0,0 +1,1638 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "address", + "name": "_resolver", + "type": "address" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes32", + "name": "name", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "destination", + "type": "address" + } + ], + "name": "CacheUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "keeperFee", + "type": "uint256" + } + ], + "name": "KeeperLiquidationFeeUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "bps", + "type": "uint256" + } + ], + "name": "LiquidationBufferRatioUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "bps", + "type": "uint256" + } + ], + "name": "LiquidationFeeRatioUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "sUSD", + "type": "uint256" + } + ], + "name": "MaxKeeperFeeUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "minMargin", + "type": "uint256" + } + ], + "name": "MinInitialMarginUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "sUSD", + "type": "uint256" + } + ], + "name": "MinKeeperFeeUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldOwner", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnerChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnerNominated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "marketKey", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "parameter", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "ParameterUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "marketKey", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "parameter", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "value", + "type": "bytes32" + } + ], + "name": "ParameterUpdatedBytes32", + "type": "event" + }, + { + "constant": true, + "inputs": [], + "name": "CONTRACT_NAME", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + } + ], + "name": "delayedOrderConfirmWindow", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isResolverCached", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "keeperLiquidationFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + } + ], + "name": "liquidationBufferRatio", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "liquidationFeeRatio", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + } + ], + "name": "liquidationPremiumMultiplier", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + } + ], + "name": "makerFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + } + ], + "name": "makerFeeDelayedOrder", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + } + ], + "name": "makerFeeOffchainDelayedOrder", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + } + ], + "name": "maxDelayTimeDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + } + ], + "name": "maxFundingVelocity", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "maxKeeperFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + } + ], + "name": "maxLeverage", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + } + ], + "name": "maxLiquidationDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + } + ], + "name": "maxMarketValue", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + } + ], + "name": "maxPD", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + } + ], + "name": "minDelayTimeDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "minInitialMargin", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "minKeeperFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + } + ], + "name": "nextPriceConfirmWindow", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + } + ], + "name": "nominateNewOwner", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "nominatedOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + } + ], + "name": "offchainDelayedOrderMaxAge", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + } + ], + "name": "offchainDelayedOrderMinAge", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + } + ], + "name": "offchainMarketKey", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + } + ], + "name": "offchainPriceDivergence", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + } + ], + "name": "parameters", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "takerFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "makerFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "takerFeeDelayedOrder", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "makerFeeDelayedOrder", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "takerFeeOffchainDelayedOrder", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "makerFeeOffchainDelayedOrder", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxLeverage", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxMarketValue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxFundingVelocity", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "skewScale", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nextPriceConfirmWindow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "delayedOrderConfirmWindow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minDelayTimeDelta", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxDelayTimeDelta", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "offchainDelayedOrderMinAge", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "offchainDelayedOrderMaxAge", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "offchainMarketKey", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "offchainPriceDivergence", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidationPremiumMultiplier", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidationBufferRatio", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxLiquidationDelta", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxPD", + "type": "uint256" + } + ], + "internalType": "struct IPerpsV2MarketSettings.Parameters", + "name": "", + "type": "tuple" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "rebuildCache", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "resolver", + "outputs": [ + { + "internalType": "contract AddressResolver", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "resolverAddressesRequired", + "outputs": [ + { + "internalType": "bytes32[]", + "name": "addresses", + "type": "bytes32[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_delayedOrderConfirmWindow", + "type": "uint256" + } + ], + "name": "setDelayedOrderConfirmWindow", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "_keeperFee", + "type": "uint256" + } + ], + "name": "setKeeperLiquidationFee", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_ratio", + "type": "uint256" + } + ], + "name": "setLiquidationBufferRatio", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "_ratio", + "type": "uint256" + } + ], + "name": "setLiquidationFeeRatio", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_liquidationPremiumMultiplier", + "type": "uint256" + } + ], + "name": "setLiquidationPremiumMultiplier", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_makerFee", + "type": "uint256" + } + ], + "name": "setMakerFee", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_makerFeeDelayedOrder", + "type": "uint256" + } + ], + "name": "setMakerFeeDelayedOrder", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_makerFeeOffchainDelayedOrder", + "type": "uint256" + } + ], + "name": "setMakerFeeOffchainDelayedOrder", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_maxDelayTimeDelta", + "type": "uint256" + } + ], + "name": "setMaxDelayTimeDelta", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_maxFundingVelocity", + "type": "uint256" + } + ], + "name": "setMaxFundingVelocity", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "_sUSD", + "type": "uint256" + } + ], + "name": "setMaxKeeperFee", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_maxLeverage", + "type": "uint256" + } + ], + "name": "setMaxLeverage", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_maxLiquidationDelta", + "type": "uint256" + } + ], + "name": "setMaxLiquidationDelta", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_maxMarketValue", + "type": "uint256" + } + ], + "name": "setMaxMarketValue", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_maxPD", + "type": "uint256" + } + ], + "name": "setMaxPD", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_minDelayTimeDelta", + "type": "uint256" + } + ], + "name": "setMinDelayTimeDelta", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "_minMargin", + "type": "uint256" + } + ], + "name": "setMinInitialMargin", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "_sUSD", + "type": "uint256" + } + ], + "name": "setMinKeeperFee", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_nextPriceConfirmWindow", + "type": "uint256" + } + ], + "name": "setNextPriceConfirmWindow", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_offchainDelayedOrderMaxAge", + "type": "uint256" + } + ], + "name": "setOffchainDelayedOrderMaxAge", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_offchainDelayedOrderMinAge", + "type": "uint256" + } + ], + "name": "setOffchainDelayedOrderMinAge", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "_offchainMarketKey", + "type": "bytes32" + } + ], + "name": "setOffchainMarketKey", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_offchainPriceDivergence", + "type": "uint256" + } + ], + "name": "setOffchainPriceDivergence", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "takerFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "makerFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "takerFeeDelayedOrder", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "makerFeeDelayedOrder", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "takerFeeOffchainDelayedOrder", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "makerFeeOffchainDelayedOrder", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxLeverage", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxMarketValue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxFundingVelocity", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "skewScale", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nextPriceConfirmWindow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "delayedOrderConfirmWindow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minDelayTimeDelta", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxDelayTimeDelta", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "offchainDelayedOrderMinAge", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "offchainDelayedOrderMaxAge", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "offchainMarketKey", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "offchainPriceDivergence", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidationPremiumMultiplier", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidationBufferRatio", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxLiquidationDelta", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxPD", + "type": "uint256" + } + ], + "internalType": "struct IPerpsV2MarketSettings.Parameters", + "name": "_parameters", + "type": "tuple" + } + ], + "name": "setParameters", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_skewScale", + "type": "uint256" + } + ], + "name": "setSkewScale", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_takerFee", + "type": "uint256" + } + ], + "name": "setTakerFee", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_takerFeeDelayedOrder", + "type": "uint256" + } + ], + "name": "setTakerFeeDelayedOrder", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_takerFeeOffchainDelayedOrder", + "type": "uint256" + } + ], + "name": "setTakerFeeOffchainDelayedOrder", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + } + ], + "name": "skewScale", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + } + ], + "name": "takerFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + } + ], + "name": "takerFeeDelayedOrder", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", + "name": "_marketKey", + "type": "bytes32" + } + ], + "name": "takerFeeOffchainDelayedOrder", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } +] diff --git a/subgraphs/kwenta/protocols/kwenta/config/deployments/kwenta-optimism/configurations.json b/subgraphs/kwenta/protocols/kwenta/config/deployments/kwenta-optimism/configurations.json index a32a9bec4a..d237170e69 100644 --- a/subgraphs/kwenta/protocols/kwenta/config/deployments/kwenta-optimism/configurations.json +++ b/subgraphs/kwenta/protocols/kwenta/config/deployments/kwenta-optimism/configurations.json @@ -25,6 +25,23 @@ "startBlock": 92005505 } ], + "marketSettings": [ + { + "name": "PerpsV2MarketSettings1", + "address": "0xd442Dc2Ac1f3cA1C86C8329246e47Ca0C91D0471", + "startBlock": 52456606 + }, + { + "name": "PerpsV2MarketSettings2", + "address": "0x09793Aad1518B8d8CC72FDd356479E3CBa7B4Ad1", + "startBlock": 71308622 + }, + { + "name": "PerpsV2MarketSettings3", + "address": "0x649F44CAC3276557D03223Dbf6395Af65b11c11c", + "startBlock": 86524289 + } + ], "graftEnabled": false, "subgraphId": "QmfHRGh3tC4yb2bBRn5A6ctytG32Jwfi9eNo76EFjiWyrf", "graftStartBlock": 15217959 diff --git a/subgraphs/kwenta/protocols/kwenta/config/templates/kwenta.template.yaml b/subgraphs/kwenta/protocols/kwenta/config/templates/kwenta.template.yaml index 1d25793110..a647448f92 100644 --- a/subgraphs/kwenta/protocols/kwenta/config/templates/kwenta.template.yaml +++ b/subgraphs/kwenta/protocols/kwenta/config/templates/kwenta.template.yaml @@ -91,7 +91,28 @@ dataSources: file: ./src/mappings/handlers.ts {{/smartMarginFactory}} - + {{#marketSettings}} + - kind: ethereum/contract + name: {{ name }} + network: {{ network }} + source: + address: "{{ address }}" + abi: PerpsV2MarketSettings + startBlock: {{ startBlock }} + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + entities: + - DerivPerpProtocol + abis: + - name: PerpsV2MarketSettings + file: ./abis/kwenta/PerpsV2MarketSettings.json + eventHandlers: + - event: 'ParameterUpdated(indexed bytes32,indexed bytes32,uint256)' + handler: 'handleParameterUpdated' + file: ./src/mappings/handlers.ts + {{/marketSettings}} templates: - kind: ethereum/contract name: PerpsV2Market diff --git a/subgraphs/kwenta/schema.graphql b/subgraphs/kwenta/schema.graphql index 1ebbf33b8d..1640bad0b3 100644 --- a/subgraphs/kwenta/schema.graphql +++ b/subgraphs/kwenta/schema.graphql @@ -116,6 +116,24 @@ enum LiquidityPoolFeeType { " One-time fee charged by the protocol (e.g. GMX charges a fee from certain pools with withdrawing) during withdrawal, in percentages of the withdrawal token " WITHDRAWAL_FEE + + " Fee charged by Kwenta from Taker Orders " + DYNAMIC_TAKER_FEE + + " Fee charged by Kwenta from Taker Delayed Orders " + DYNAMIC_TAKER_DELAYED_FEE + + " Fee charged by Kwenta from Taker Delayed Offchain Orders " + DYNAMIC_TAKER_DELAYED_OFFCHAIN_FEE + + " Fee charged by Kwenta from Maker Orders " + DYNAMIC_MAKER_FEE + + " Fee charged by Kwenta from Maker Delayed Orders " + DYNAMIC_MAKER_DELAYED_FEE + + " Fee charged by Kwenta from Maker Delayed Offchain Orders " + DYNAMIC_MAKER_DELAYED_OFFCHAIN_FEE } type LiquidityPoolFee @entity @regularPolling { @@ -2014,3 +2032,10 @@ type _FundingRate @entity { "Funding Amount" funding: BigInt! } + +type _MarketKey @entity { + "Market Key" + id: Bytes! + + market: LiquidityPool! +} diff --git a/subgraphs/kwenta/src/mappings/handlers.ts b/subgraphs/kwenta/src/mappings/handlers.ts index 37e57e37d7..93d8fcdc78 100644 --- a/subgraphs/kwenta/src/mappings/handlers.ts +++ b/subgraphs/kwenta/src/mappings/handlers.ts @@ -6,6 +6,7 @@ import { _SmartMarginAccount, Token, _FundingRate, + _MarketKey, } from "../../generated/schema"; import { _ERC20 } from "../../generated/FuturesMarketManager2/_ERC20"; import { @@ -28,6 +29,9 @@ import { PositionSide, BIGINT_ZERO, BIGINT_TEN_TO_EIGHTEENTH, + LiquidityPoolFeeType, + ParameterKeys, + BIGDECIMAL_ZERO, } from "../sdk/util/constants"; import { MarketAdded as MarketAddedEvent } from "../../generated/FuturesMarketManager2/FuturesMarketManager"; import { @@ -42,8 +46,12 @@ import { getFundingRateId, updateOpenInterest, liquidation, + loadMarketKey, } from "./helpers"; import { NewAccount as NewSmartMarginAccountEvent } from "../../generated/SmartMarginFactory1/SmartMarginFactory"; + +import { ParameterUpdated as ParameterUpdatedEvent } from "../../generated/PerpsV2MarketSettings1/PerpsV2MarketSettings"; + import { TransactionType } from "../sdk/protocols/perpfutures/enums"; class Pricer implements TokenPricer { @@ -91,7 +99,6 @@ const conf = new ProtocolConfig( We just checks if it is a market, and then stores it */ export function handleMarketAdded(event: MarketAddedEvent): void { - const marketKey = event.params.marketKey.toString(); const sdk = SDK.initializeFromEvent( conf, new Pricer(), @@ -100,10 +107,10 @@ export function handleMarketAdded(event: MarketAddedEvent): void { ); // check that it's a v1 market before adding - if (marketKey.endsWith("PERP")) { - log.info("New market added: {}", [marketKey]); - + if (event.params.marketKey.toString().endsWith("PERP")) { const pool = sdk.Pools.loadPool(event.params.market); + const marketKey = loadMarketKey(event.params.marketKey, pool).toString(); + if (!pool.isInitialized) { const token = sdk.Tokens.getOrCreateToken( NetworkConfigs.getSUSDAddress() @@ -111,6 +118,26 @@ export function handleMarketAdded(event: MarketAddedEvent): void { pool.initialize(marketKey, marketKey, [token], null, "chainlink"); } + pool.setPoolFee(LiquidityPoolFeeType.DYNAMIC_TAKER_FEE, BIGDECIMAL_ZERO); + pool.setPoolFee( + LiquidityPoolFeeType.DYNAMIC_TAKER_DELAYED_FEE, + BIGDECIMAL_ZERO + ); + pool.setPoolFee( + LiquidityPoolFeeType.DYNAMIC_TAKER_DELAYED_OFFCHAIN_FEE, + BIGDECIMAL_ZERO + ); + pool.setPoolFee(LiquidityPoolFeeType.DYNAMIC_MAKER_FEE, null); + pool.setPoolFee(LiquidityPoolFeeType.DYNAMIC_MAKER_DELAYED_FEE, null); + pool.setPoolFee( + LiquidityPoolFeeType.DYNAMIC_MAKER_DELAYED_OFFCHAIN_FEE, + BIGDECIMAL_ZERO + ); + pool.setPoolFee( + LiquidityPoolFeeType.DYNAMIC_MAKER_DELAYED_OFFCHAIN_FEE, + BIGDECIMAL_ZERO + ); + // perps v2 market PerpsV2Market.create(event.params.market); } @@ -368,3 +395,22 @@ export function handlePositionLiquidated(event: PositionLiquidatedEvent): void { sdk ); } + +export function handleParameterUpdated(event: ParameterUpdatedEvent): void { + const sdk = SDK.initializeFromEvent( + conf, + new Pricer(), + new TokenInit(), + event + ); + + const marketKey = _MarketKey.load(event.params.marketKey); + if (marketKey != null) { + const paramKey = event.params.parameter.toString(); + const poolFee = ParameterKeys.get(paramKey); + if (poolFee != null) { + const market = sdk.Pools.loadPool(marketKey.market); + market.setPoolFee(poolFee!, bigIntToBigDecimal(event.params.value)); + } + } +} diff --git a/subgraphs/kwenta/src/mappings/helpers.ts b/subgraphs/kwenta/src/mappings/helpers.ts index b36f09c09b..96eac206e9 100644 --- a/subgraphs/kwenta/src/mappings/helpers.ts +++ b/subgraphs/kwenta/src/mappings/helpers.ts @@ -12,6 +12,7 @@ import { BIGINT_ZERO } from "../sdk/util/constants"; import { Token, _FundingRate, + _MarketKey, _SmartMarginAccount, } from "../../generated/schema"; import { SDK } from "../sdk/protocols/perpfutures"; @@ -128,3 +129,13 @@ export function updateOpenInterest( pool.setLongOpenInterest(longOpenInterstAmount, lastPrice); pool.setShortOpenInterest(shortOpenInterstAmount, lastPrice); } + +export function loadMarketKey(marketKey: Bytes, pool: Pool): Bytes { + let marketKeyEntity = _MarketKey.load(marketKey); + if (marketKeyEntity == null) { + marketKeyEntity = new _MarketKey(marketKey); + } + marketKeyEntity.market = pool.getBytesID(); + marketKeyEntity.save(); + return marketKeyEntity.id; +} diff --git a/subgraphs/kwenta/src/sdk/util/constants.ts b/subgraphs/kwenta/src/sdk/util/constants.ts index 185e7bf83d..3ca8c0090b 100644 --- a/subgraphs/kwenta/src/sdk/util/constants.ts +++ b/subgraphs/kwenta/src/sdk/util/constants.ts @@ -1,4 +1,4 @@ -import { BigDecimal, BigInt } from "@graphprotocol/graph-ts"; +import { BigDecimal, BigInt, TypedMap } from "@graphprotocol/graph-ts"; //////////////////////// ///// Schema Enums ///// @@ -116,9 +116,37 @@ export namespace LiquidityPoolFeeType { export const DYNAMIC_LP_FEE = "DYNAMIC_LP_FEE"; export const FIXED_PROTOCOL_FEE = "FIXED_PROTOCOL_FEE"; export const DYNAMIC_PROTOCOL_FEE = "DYNAMIC_PROTOCOL_FEE"; + export const DYNAMIC_TAKER_FEE = "DYNAMIC_TAKER_FEE"; + export const DYNAMIC_TAKER_DELAYED_FEE = "DYNAMIC_TAKER_DELAYED_FEE"; + export const DYNAMIC_TAKER_DELAYED_OFFCHAIN_FEE = + "DYNAMIC_TAKER_DELAYED_OFFCHAIN_FEE"; + export const DYNAMIC_MAKER_FEE = "DYNAMIC_MAKER_FEE"; + export const DYNAMIC_MAKER_DELAYED_FEE = "DYNAMIC_MAKER_DELAYED_FEE"; + export const DYNAMIC_MAKER_DELAYED_OFFCHAIN_FEE = + "DYNAMIC_MAKER_DELAYED_OFFCHAIN_FEE"; } export type LiquidityPoolFeeType = string; +export const ParameterKeys = new TypedMap(); +ParameterKeys.set("takerFee", LiquidityPoolFeeType.DYNAMIC_TAKER_FEE); +ParameterKeys.set( + "takerFeeDelayedOrder", + LiquidityPoolFeeType.DYNAMIC_TAKER_DELAYED_FEE +); +ParameterKeys.set( + "takerFeeOffchainDelayedOrder", + LiquidityPoolFeeType.DYNAMIC_TAKER_DELAYED_OFFCHAIN_FEE +); +ParameterKeys.set("makerFee", LiquidityPoolFeeType.DYNAMIC_MAKER_FEE); +ParameterKeys.set( + "makerFeeDelayedOrder", + LiquidityPoolFeeType.DYNAMIC_MAKER_DELAYED_FEE +); +ParameterKeys.set( + "makerFeeOffchainDelayedOrder", + LiquidityPoolFeeType.DYNAMIC_MAKER_DELAYED_OFFCHAIN_FEE +); + export namespace RewardTokenType { export const DEPOSIT = "DEPOSIT"; export const BORROW = "BORROW"; From 72bba6e440f77bf479fcb213d231434ca805e1d6 Mon Sep 17 00:00:00 2001 From: Amrit Jain Date: Thu, 12 Oct 2023 19:55:17 +0530 Subject: [PATCH 5/6] fix: smart margin account id type --- subgraphs/kwenta/schema.graphql | 2 +- subgraphs/kwenta/src/mappings/handlers.ts | 6 +++--- subgraphs/kwenta/src/mappings/helpers.ts | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/subgraphs/kwenta/schema.graphql b/subgraphs/kwenta/schema.graphql index 1640bad0b3..567dae08c9 100644 --- a/subgraphs/kwenta/schema.graphql +++ b/subgraphs/kwenta/schema.graphql @@ -2015,7 +2015,7 @@ type _PositionCounter @entity { # Smart Margin Account type _SmartMarginAccount @entity { "Account Unique ID" - id: ID! + id: Bytes! "Owner of the Smart Margin Account" owner: Account! diff --git a/subgraphs/kwenta/src/mappings/handlers.ts b/subgraphs/kwenta/src/mappings/handlers.ts index 93d8fcdc78..c989d81c3b 100644 --- a/subgraphs/kwenta/src/mappings/handlers.ts +++ b/subgraphs/kwenta/src/mappings/handlers.ts @@ -152,7 +152,7 @@ export function handleNewAccountSmartMargin( ): void { // create a new entity to store the cross-margin account owner const smAccountAddress = event.params.account as Address; - let smartMarginAccount = _SmartMarginAccount.load(smAccountAddress.toHex()); + let smartMarginAccount = _SmartMarginAccount.load(smAccountAddress); const sdk = SDK.initializeFromEvent( conf, new Pricer(), @@ -160,7 +160,7 @@ export function handleNewAccountSmartMargin( event ); if (smartMarginAccount == null) { - smartMarginAccount = new _SmartMarginAccount(smAccountAddress.toHex()); + smartMarginAccount = new _SmartMarginAccount(smAccountAddress); const loadAccountResponse = sdk.Accounts.loadAccount(event.params.creator); if (loadAccountResponse.isNewUser) { @@ -260,7 +260,7 @@ export function handlePositionModified(event: PositionModifiedEvent): void { const isClose = event.params.size.isZero(); const sendingAccount = event.params.account; - const smartMarginAccount = _SmartMarginAccount.load(sendingAccount.toHex()); + const smartMarginAccount = _SmartMarginAccount.load(sendingAccount); const accountAddress = smartMarginAccount ? Address.fromBytes(smartMarginAccount.owner) diff --git a/subgraphs/kwenta/src/mappings/helpers.ts b/subgraphs/kwenta/src/mappings/helpers.ts index 96eac206e9..1972bd7d4b 100644 --- a/subgraphs/kwenta/src/mappings/helpers.ts +++ b/subgraphs/kwenta/src/mappings/helpers.ts @@ -57,7 +57,7 @@ export function liquidation( sdk: SDK ): void { const pool = sdk.Pools.loadPool(dataSource.address()); - const smartMarginAccount = _SmartMarginAccount.load(sendingAccount.toHex()); + const smartMarginAccount = _SmartMarginAccount.load(sendingAccount); const accountAddress = smartMarginAccount ? Address.fromBytes(smartMarginAccount.owner) : sendingAccount; From b4fc6bb4001e571fef5fea00409fbe9e276c6111 Mon Sep 17 00:00:00 2001 From: Amrit Jain Date: Wed, 1 Nov 2023 19:11:28 +0530 Subject: [PATCH 6/6] fix: dailyActiveLiquidators --- .../kwenta/src/sdk/protocols/perpfutures/account.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/subgraphs/kwenta/src/sdk/protocols/perpfutures/account.ts b/subgraphs/kwenta/src/sdk/protocols/perpfutures/account.ts index 48475b1fc4..c6f81d4c35 100644 --- a/subgraphs/kwenta/src/sdk/protocols/perpfutures/account.ts +++ b/subgraphs/kwenta/src/sdk/protocols/perpfutures/account.ts @@ -158,7 +158,10 @@ export class Account { return true; } - private trackActivity(activityType: ActivityType): void { + private trackActivity( + activityType: ActivityType, + liquidator: Address | null = null + ): void { const days = getUnixDays(this.event.block); const hours = getUnixHours(this.event.block); @@ -170,8 +173,10 @@ export class Account { hourly: this.isActiveByActivityID(Bytes.fromUTF8(generalHourlyID)), }; - const typeHourlyID = `${this.account.id.toHexString()}-hourly-${hours}-${activityType}`; - const typeDailyID = `${this.account.id.toHexString()}-daily-${days}-${activityType}`; + let accountId = this.account.id.toHexString(); + if (liquidator) accountId = liquidator.toHexString(); + const typeHourlyID = `${accountId}-hourly-${hours}-${activityType}`; + const typeDailyID = `${accountId}-daily-${days}-${activityType}`; const typeActivity: AccountWasActive = { daily: this.isActiveByActivityID(Bytes.fromUTF8(typeDailyID)), @@ -655,7 +660,7 @@ export class Account { entity!.liquidateCount += 1; entity!.save(); - this.trackActivity(ActivityType.LIQUIDATOR); + this.trackActivity(ActivityType.LIQUIDATOR, liquidator); } /**