From 77bee3ef894a1dd5249118271b46d20701098b1a Mon Sep 17 00:00:00 2001 From: 0xtekgrinder <0xtekgrinder@protonmail.com> Date: Wed, 13 Sep 2023 16:36:17 -0400 Subject: [PATCH 1/6] feat: liquis yield adapter --- src/adaptors/liquis/abis/BalancerToken.json | 672 +++++++++ src/adaptors/liquis/abis/Booster.json | 915 ++++++++++++ src/adaptors/liquis/abis/BunniHub.json | 812 +++++++++++ src/adaptors/liquis/abis/BunniLens.json | 118 ++ src/adaptors/liquis/abis/GaugeController.json | 825 +++++++++++ src/adaptors/liquis/abis/LiquidityGauge.json | 1229 +++++++++++++++++ src/adaptors/liquis/abis/OptionsOracle.json | 225 +++ src/adaptors/liquis/abis/TokenAdmin.json | 390 ++++++ src/adaptors/liquis/abis/Vault.json | 918 ++++++++++++ src/adaptors/liquis/abis/ViewHelper.json | 647 +++++++++ src/adaptors/liquis/abis/VirtualPool.json | 274 ++++ src/adaptors/liquis/index.js | 704 ++++++++++ 12 files changed, 7729 insertions(+) create mode 100644 src/adaptors/liquis/abis/BalancerToken.json create mode 100644 src/adaptors/liquis/abis/Booster.json create mode 100644 src/adaptors/liquis/abis/BunniHub.json create mode 100644 src/adaptors/liquis/abis/BunniLens.json create mode 100644 src/adaptors/liquis/abis/GaugeController.json create mode 100644 src/adaptors/liquis/abis/LiquidityGauge.json create mode 100644 src/adaptors/liquis/abis/OptionsOracle.json create mode 100644 src/adaptors/liquis/abis/TokenAdmin.json create mode 100644 src/adaptors/liquis/abis/Vault.json create mode 100644 src/adaptors/liquis/abis/ViewHelper.json create mode 100644 src/adaptors/liquis/abis/VirtualPool.json create mode 100644 src/adaptors/liquis/index.js diff --git a/src/adaptors/liquis/abis/BalancerToken.json b/src/adaptors/liquis/abis/BalancerToken.json new file mode 100644 index 0000000000..5c9e9ee493 --- /dev/null +++ b/src/adaptors/liquis/abis/BalancerToken.json @@ -0,0 +1,672 @@ +[ + { + "inputs": [ + { + "components": [ + { + "internalType": "contract IVault", + "name": "vault", + "type": "address" + }, + { "internalType": "string", "name": "name", "type": "string" }, + { "internalType": "string", "name": "symbol", "type": "string" }, + { + "internalType": "contract IERC20", + "name": "token0", + "type": "address" + }, + { + "internalType": "contract IERC20", + "name": "token1", + "type": "address" + }, + { + "internalType": "uint256", + "name": "normalizedWeight0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "normalizedWeight1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "swapFeePercentage", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "pauseWindowDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "bufferPeriodDuration", + "type": "uint256" + }, + { "internalType": "bool", "name": "oracleEnabled", "type": "bool" }, + { "internalType": "address", "name": "owner", "type": "address" } + ], + "internalType": "struct WeightedPool2Tokens.NewPoolParams", + "name": "params", + "type": "tuple" + } + ], + "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": false, + "internalType": "bool", + "name": "enabled", + "type": "bool" + } + ], + "name": "OracleEnabledChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bool", + "name": "paused", + "type": "bool" + } + ], + "name": "PausedStateChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "swapFeePercentage", + "type": "uint256" + } + ], + "name": "SwapFeePercentageChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" }, + { "internalType": "address", "name": "spender", "type": "address" } + ], + "name": "allowance", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "approve", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "balanceOf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "decreaseApproval", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "enableOracle", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes4", "name": "selector", "type": "bytes4" } + ], + "name": "getActionId", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAuthorizer", + "outputs": [ + { "internalType": "contract IAuthorizer", "name": "", "type": "address" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getInvariant", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getLargestSafeQueryWindow", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "getLastInvariant", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum IPriceOracle.Variable", + "name": "variable", + "type": "uint8" + } + ], + "name": "getLatest", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMiscData", + "outputs": [ + { "internalType": "int256", "name": "logInvariant", "type": "int256" }, + { "internalType": "int256", "name": "logTotalSupply", "type": "int256" }, + { + "internalType": "uint256", + "name": "oracleSampleCreationTimestamp", + "type": "uint256" + }, + { "internalType": "uint256", "name": "oracleIndex", "type": "uint256" }, + { "internalType": "bool", "name": "oracleEnabled", "type": "bool" }, + { + "internalType": "uint256", + "name": "swapFeePercentage", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getNormalizedWeights", + "outputs": [ + { "internalType": "uint256[]", "name": "", "type": "uint256[]" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getOwner", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "enum IPriceOracle.Variable", + "name": "variable", + "type": "uint8" + }, + { "internalType": "uint256", "name": "ago", "type": "uint256" } + ], + "internalType": "struct IPriceOracle.OracleAccumulatorQuery[]", + "name": "queries", + "type": "tuple[]" + } + ], + "name": "getPastAccumulators", + "outputs": [ + { "internalType": "int256[]", "name": "results", "type": "int256[]" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPausedState", + "outputs": [ + { "internalType": "bool", "name": "paused", "type": "bool" }, + { + "internalType": "uint256", + "name": "pauseWindowEndTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "bufferPeriodEndTime", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPoolId", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getRate", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "index", "type": "uint256" } + ], + "name": "getSample", + "outputs": [ + { "internalType": "int256", "name": "logPairPrice", "type": "int256" }, + { "internalType": "int256", "name": "accLogPairPrice", "type": "int256" }, + { "internalType": "int256", "name": "logBptPrice", "type": "int256" }, + { "internalType": "int256", "name": "accLogBptPrice", "type": "int256" }, + { "internalType": "int256", "name": "logInvariant", "type": "int256" }, + { "internalType": "int256", "name": "accLogInvariant", "type": "int256" }, + { "internalType": "uint256", "name": "timestamp", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getSwapFeePercentage", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "enum IPriceOracle.Variable", + "name": "variable", + "type": "uint8" + }, + { "internalType": "uint256", "name": "secs", "type": "uint256" }, + { "internalType": "uint256", "name": "ago", "type": "uint256" } + ], + "internalType": "struct IPriceOracle.OracleAverageQuery[]", + "name": "queries", + "type": "tuple[]" + } + ], + "name": "getTimeWeightedAverage", + "outputs": [ + { "internalType": "uint256[]", "name": "results", "type": "uint256[]" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTotalSamples", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "getVault", + "outputs": [ + { "internalType": "contract IVault", "name": "", "type": "address" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "increaseApproval", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" } + ], + "name": "nonces", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "poolId", "type": "bytes32" }, + { "internalType": "address", "name": "sender", "type": "address" }, + { "internalType": "address", "name": "recipient", "type": "address" }, + { "internalType": "uint256[]", "name": "balances", "type": "uint256[]" }, + { + "internalType": "uint256", + "name": "lastChangeBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "protocolSwapFeePercentage", + "type": "uint256" + }, + { "internalType": "bytes", "name": "userData", "type": "bytes" } + ], + "name": "onExitPool", + "outputs": [ + { "internalType": "uint256[]", "name": "", "type": "uint256[]" }, + { "internalType": "uint256[]", "name": "", "type": "uint256[]" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "poolId", "type": "bytes32" }, + { "internalType": "address", "name": "sender", "type": "address" }, + { "internalType": "address", "name": "recipient", "type": "address" }, + { "internalType": "uint256[]", "name": "balances", "type": "uint256[]" }, + { + "internalType": "uint256", + "name": "lastChangeBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "protocolSwapFeePercentage", + "type": "uint256" + }, + { "internalType": "bytes", "name": "userData", "type": "bytes" } + ], + "name": "onJoinPool", + "outputs": [ + { "internalType": "uint256[]", "name": "amountsIn", "type": "uint256[]" }, + { + "internalType": "uint256[]", + "name": "dueProtocolFeeAmounts", + "type": "uint256[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "enum IVault.SwapKind", + "name": "kind", + "type": "uint8" + }, + { + "internalType": "contract IERC20", + "name": "tokenIn", + "type": "address" + }, + { + "internalType": "contract IERC20", + "name": "tokenOut", + "type": "address" + }, + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { "internalType": "bytes32", "name": "poolId", "type": "bytes32" }, + { + "internalType": "uint256", + "name": "lastChangeBlock", + "type": "uint256" + }, + { "internalType": "address", "name": "from", "type": "address" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "bytes", "name": "userData", "type": "bytes" } + ], + "internalType": "struct IPoolSwapStructs.SwapRequest", + "name": "request", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "balanceTokenIn", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceTokenOut", + "type": "uint256" + } + ], + "name": "onSwap", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" }, + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "value", "type": "uint256" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "name": "permit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "poolId", "type": "bytes32" }, + { "internalType": "address", "name": "sender", "type": "address" }, + { "internalType": "address", "name": "recipient", "type": "address" }, + { "internalType": "uint256[]", "name": "balances", "type": "uint256[]" }, + { + "internalType": "uint256", + "name": "lastChangeBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "protocolSwapFeePercentage", + "type": "uint256" + }, + { "internalType": "bytes", "name": "userData", "type": "bytes" } + ], + "name": "queryExit", + "outputs": [ + { "internalType": "uint256", "name": "bptIn", "type": "uint256" }, + { "internalType": "uint256[]", "name": "amountsOut", "type": "uint256[]" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "poolId", "type": "bytes32" }, + { "internalType": "address", "name": "sender", "type": "address" }, + { "internalType": "address", "name": "recipient", "type": "address" }, + { "internalType": "uint256[]", "name": "balances", "type": "uint256[]" }, + { + "internalType": "uint256", + "name": "lastChangeBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "protocolSwapFeePercentage", + "type": "uint256" + }, + { "internalType": "bytes", "name": "userData", "type": "bytes" } + ], + "name": "queryJoin", + "outputs": [ + { "internalType": "uint256", "name": "bptOut", "type": "uint256" }, + { "internalType": "uint256[]", "name": "amountsIn", "type": "uint256[]" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "bool", "name": "paused", "type": "bool" }], + "name": "setPaused", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "swapFeePercentage", + "type": "uint256" + } + ], + "name": "setSwapFeePercentage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "recipient", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transfer", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "sender", "type": "address" }, + { "internalType": "address", "name": "recipient", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transferFrom", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/src/adaptors/liquis/abis/Booster.json b/src/adaptors/liquis/abis/Booster.json new file mode 100644 index 0000000000..bf07793e97 --- /dev/null +++ b/src/adaptors/liquis/abis/Booster.json @@ -0,0 +1,915 @@ +[ + { + "inputs": [ + { "internalType": "address", "name": "_staker", "type": "address" }, + { "internalType": "address", "name": "_minter", "type": "address" }, + { "internalType": "address", "name": "_crv", "type": "address" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newArbitrator", + "type": "address" + } + ], + "name": "ArbitratorUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "poolid", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Deposited", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "rewardFactory", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "stashFactory", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "tokenFactory", + "type": "address" + } + ], + "name": "FactoriesUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "feeDistro", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "active", + "type": "bool" + } + ], + "name": "FeeInfoChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "feeDistro", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "lockFees", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "feeToken", + "type": "address" + } + ], + "name": "FeeInfoUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newFeeManager", + "type": "address" + } + ], + "name": "FeeManagerUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "lockIncentive", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "stakerIncentive", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "earmarkIncentive", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "platformFee", + "type": "uint256" + } + ], + "name": "FeesUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnerUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "lpToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "gauge", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "rewardPool", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "stash", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "pid", + "type": "uint256" + } + ], + "name": "PoolAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newPoolManager", + "type": "address" + } + ], + "name": "PoolManagerUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "poolId", + "type": "uint256" + } + ], + "name": "PoolShutdown", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "lockRewards", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "stakerRewards", + "type": "address" + } + ], + "name": "RewardContractsUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newTreasury", + "type": "address" + } + ], + "name": "TreasuryUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "votingContract", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "active", + "type": "bool" + } + ], + "name": "UpdateVotingContract", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newVoteDelegate", + "type": "address" + } + ], + "name": "VoteDelegateUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newVoteManager", + "type": "address" + } + ], + "name": "VoteManagerUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "poolid", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdrawn", + "type": "event" + }, + { + "inputs": [], + "name": "FEE_DENOMINATOR", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MaxFees", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "REWARD_MULTIPLIER_DENOMINATOR", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_lptoken", "type": "address" }, + { "internalType": "address", "name": "_gauge", "type": "address" }, + { "internalType": "uint256", "name": "_stashVersion", "type": "uint256" } + ], + "name": "addPool", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "bridgeDelegate", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_pid", "type": "uint256" }, + { "internalType": "address", "name": "_gauge", "type": "address" } + ], + "name": "claimRewards", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "crv", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_pid", "type": "uint256" }, + { "internalType": "uint256", "name": "_amount", "type": "uint256" }, + { "internalType": "bool", "name": "_stake", "type": "bool" } + ], + "name": "deposit", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_pid", "type": "uint256" }, + { "internalType": "bool", "name": "_stake", "type": "bool" } + ], + "name": "depositAll", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_amount", "type": "uint256" } + ], + "name": "distributeL2Fees", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_feeToken", "type": "address" } + ], + "name": "earmarkFees", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "earmarkIncentive", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_pid", "type": "uint256" } + ], + "name": "earmarkRewards", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "feeManager", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "feeTokens", + "outputs": [ + { "internalType": "address", "name": "distro", "type": "address" }, + { "internalType": "address", "name": "rewards", "type": "address" }, + { "internalType": "bool", "name": "active", "type": "bool" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "gaugeMap", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "getRewardMultipliers", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "isShutdown", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "name": "l2FeesHistory", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lockIncentive", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lockRewards", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minter", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "platformFee", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "name": "poolInfo", + "outputs": [ + { "internalType": "address", "name": "lptoken", "type": "address" }, + { "internalType": "address", "name": "token", "type": "address" }, + { "internalType": "address", "name": "gauge", "type": "address" }, + { "internalType": "address", "name": "crvRewards", "type": "address" }, + { "internalType": "address", "name": "stash", "type": "address" }, + { "internalType": "bool", "name": "shutdown", "type": "bool" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "poolLength", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "poolManager", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardArbitrator", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_pid", "type": "uint256" }, + { "internalType": "address", "name": "_address", "type": "address" }, + { "internalType": "uint256", "name": "_amount", "type": "uint256" } + ], + "name": "rewardClaimed", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "rewardFactory", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_arb", "type": "address" } + ], + "name": "setArbitrator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_bridgeDelegate", + "type": "address" + } + ], + "name": "setBridgeDelegate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_delegateContract", + "type": "address" + }, + { "internalType": "address", "name": "_delegate", "type": "address" }, + { "internalType": "bytes32", "name": "_space", "type": "bytes32" } + ], + "name": "setDelegate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_rfactory", "type": "address" }, + { "internalType": "address", "name": "_sfactory", "type": "address" }, + { "internalType": "address", "name": "_tfactory", "type": "address" } + ], + "name": "setFactories", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_feeToken", "type": "address" }, + { "internalType": "address", "name": "_feeDistro", "type": "address" } + ], + "name": "setFeeInfo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_feeM", "type": "address" } + ], + "name": "setFeeManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_lockFees", "type": "uint256" }, + { "internalType": "uint256", "name": "_stakerFees", "type": "uint256" }, + { "internalType": "uint256", "name": "_callerFees", "type": "uint256" }, + { "internalType": "uint256", "name": "_platform", "type": "uint256" } + ], + "name": "setFees", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_pid", "type": "uint256" } + ], + "name": "setGaugeRedirect", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_owner", "type": "address" } + ], + "name": "setOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_poolM", "type": "address" } + ], + "name": "setPoolManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_rewards", "type": "address" }, + { "internalType": "address", "name": "_stakerRewards", "type": "address" } + ], + "name": "setRewardContracts", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "rewardContract", + "type": "address" + }, + { "internalType": "uint256", "name": "multiplier", "type": "uint256" } + ], + "name": "setRewardMultiplier", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_treasury", "type": "address" } + ], + "name": "setTreasury", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "_hash", "type": "bytes32" } + ], + "name": "setVote", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_voteDelegate", "type": "address" } + ], + "name": "setVoteDelegate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_voteManager", "type": "address" } + ], + "name": "setVoteManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_pid", "type": "uint256" } + ], + "name": "shutdownPool", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "shutdownSystem", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "staker", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "stakerIncentive", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "stakerRewards", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "stashFactory", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "tokenFactory", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "treasury", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_feeToken", "type": "address" }, + { "internalType": "bool", "name": "_active", "type": "bool" } + ], + "name": "updateFeeInfo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_votingContract", + "type": "address" + }, + { "internalType": "bool", "name": "_active", "type": "bool" } + ], + "name": "updateVotingContract", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "validVotingContracts", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_voteId", "type": "uint256" }, + { + "internalType": "address", + "name": "_votingAddress", + "type": "address" + }, + { "internalType": "bool", "name": "_support", "type": "bool" } + ], + "name": "vote", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "voteDelegate", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address[]", "name": "_gauge", "type": "address[]" }, + { "internalType": "uint256[]", "name": "_weight", "type": "uint256[]" } + ], + "name": "voteGaugeWeight", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "voteManager", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_pid", "type": "uint256" }, + { "internalType": "uint256", "name": "_amount", "type": "uint256" } + ], + "name": "withdraw", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_pid", "type": "uint256" } + ], + "name": "withdrawAll", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_pid", "type": "uint256" }, + { "internalType": "uint256", "name": "_amount", "type": "uint256" }, + { "internalType": "address", "name": "_to", "type": "address" } + ], + "name": "withdrawTo", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/src/adaptors/liquis/abis/BunniHub.json b/src/adaptors/liquis/abis/BunniHub.json new file mode 100644 index 0000000000..3e70e2a2fa --- /dev/null +++ b/src/adaptors/liquis/abis/BunniHub.json @@ -0,0 +1,812 @@ +[ + { + "inputs": [ + { + "internalType": "contract IUniswapV3Factory", + "name": "factory_", + "type": "address" + }, + { + "internalType": "address", + "name": "owner_", + "type": "address" + }, + { + "internalType": "uint256", + "name": "protocolFee_", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "T", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "bunniKeyHash", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "liquidity", + "type": "uint128" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + } + ], + "name": "Compound", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "bunniKeyHash", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "liquidity", + "type": "uint128" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract IBunniToken", + "name": "token", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "bunniKeyHash", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "contract IUniswapV3Pool", + "name": "pool", + "type": "address" + }, + { + "indexed": false, + "internalType": "int24", + "name": "tickLower", + "type": "int24" + }, + { + "indexed": false, + "internalType": "int24", + "name": "tickUpper", + "type": "int24" + } + ], + "name": "NewBunni", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnerUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + } + ], + "name": "PayProtocolFee", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newProtocolFee", + "type": "uint256" + } + ], + "name": "SetProtocolFee", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "bunniKeyHash", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "liquidity", + "type": "uint128" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "Withdraw", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "contract IUniswapV3Pool", + "name": "pool", + "type": "address" + }, + { + "internalType": "int24", + "name": "tickLower", + "type": "int24" + }, + { + "internalType": "int24", + "name": "tickUpper", + "type": "int24" + } + ], + "internalType": "struct BunniKey", + "name": "key", + "type": "tuple" + } + ], + "name": "compound", + "outputs": [ + { + "internalType": "uint128", + "name": "addedLiquidity", + "type": "uint128" + }, + { + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "contract IUniswapV3Pool", + "name": "pool", + "type": "address" + }, + { + "internalType": "int24", + "name": "tickLower", + "type": "int24" + }, + { + "internalType": "int24", + "name": "tickUpper", + "type": "int24" + } + ], + "internalType": "struct BunniKey", + "name": "key", + "type": "tuple" + } + ], + "name": "deployBunniToken", + "outputs": [ + { + "internalType": "contract IBunniToken", + "name": "token", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "contract IUniswapV3Pool", + "name": "pool", + "type": "address" + }, + { + "internalType": "int24", + "name": "tickLower", + "type": "int24" + }, + { + "internalType": "int24", + "name": "tickUpper", + "type": "int24" + } + ], + "internalType": "struct BunniKey", + "name": "key", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "amount0Desired", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1Desired", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount0Min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1Min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + } + ], + "internalType": "struct IBunniHub.DepositParams", + "name": "params", + "type": "tuple" + } + ], + "name": "deposit", + "outputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "internalType": "uint128", + "name": "addedLiquidity", + "type": "uint128" + }, + { + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "factory", + "outputs": [ + { + "internalType": "contract IUniswapV3Factory", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "contract IUniswapV3Pool", + "name": "pool", + "type": "address" + }, + { + "internalType": "int24", + "name": "tickLower", + "type": "int24" + }, + { + "internalType": "int24", + "name": "tickUpper", + "type": "int24" + } + ], + "internalType": "struct BunniKey", + "name": "key", + "type": "tuple" + } + ], + "name": "getBunniToken", + "outputs": [ + { + "internalType": "contract IBunniToken", + "name": "token", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "multicall", + "outputs": [ + { + "internalType": "bytes[]", + "name": "results", + "type": "bytes[]" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "protocolFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "selfPermit", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "selfPermitAllowed", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "selfPermitAllowedIfNecessary", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "selfPermitIfNecessary", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "setOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "setProtocolFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20[]", + "name": "tokenList", + "type": "address[]" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + } + ], + "name": "sweepTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount0Owed", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1Owed", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "uniswapV3MintCallback", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "contract IUniswapV3Pool", + "name": "pool", + "type": "address" + }, + { + "internalType": "int24", + "name": "tickLower", + "type": "int24" + }, + { + "internalType": "int24", + "name": "tickUpper", + "type": "int24" + } + ], + "internalType": "struct BunniKey", + "name": "key", + "type": "tuple" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount0Min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1Min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + } + ], + "internalType": "struct IBunniHub.WithdrawParams", + "name": "params", + "type": "tuple" + } + ], + "name": "withdraw", + "outputs": [ + { + "internalType": "uint128", + "name": "removedLiquidity", + "type": "uint128" + }, + { + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/src/adaptors/liquis/abis/BunniLens.json b/src/adaptors/liquis/abis/BunniLens.json new file mode 100644 index 0000000000..b493afba9c --- /dev/null +++ b/src/adaptors/liquis/abis/BunniLens.json @@ -0,0 +1,118 @@ +[ + { + "inputs": [ + { + "internalType": "contract IBunniHub", + "name": "hub_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "T", + "type": "error" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "contract IUniswapV3Pool", + "name": "pool", + "type": "address" + }, + { + "internalType": "int24", + "name": "tickLower", + "type": "int24" + }, + { + "internalType": "int24", + "name": "tickUpper", + "type": "int24" + } + ], + "internalType": "struct BunniKey", + "name": "key", + "type": "tuple" + } + ], + "name": "getReserves", + "outputs": [ + { + "internalType": "uint112", + "name": "reserve0", + "type": "uint112" + }, + { + "internalType": "uint112", + "name": "reserve1", + "type": "uint112" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "hub", + "outputs": [ + { + "internalType": "contract IBunniHub", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "contract IUniswapV3Pool", + "name": "pool", + "type": "address" + }, + { + "internalType": "int24", + "name": "tickLower", + "type": "int24" + }, + { + "internalType": "int24", + "name": "tickUpper", + "type": "int24" + } + ], + "internalType": "struct BunniKey", + "name": "key", + "type": "tuple" + } + ], + "name": "pricePerFullShare", + "outputs": [ + { + "internalType": "uint128", + "name": "liquidity", + "type": "uint128" + }, + { + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } +] diff --git a/src/adaptors/liquis/abis/GaugeController.json b/src/adaptors/liquis/abis/GaugeController.json new file mode 100644 index 0000000000..eaee92db1f --- /dev/null +++ b/src/adaptors/liquis/abis/GaugeController.json @@ -0,0 +1,825 @@ +[ + { + "name": "AddType", + "inputs": [ + { + "name": "name", + "type": "string", + "indexed": false + }, + { + "name": "type_id", + "type": "int128", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "NewTypeWeight", + "inputs": [ + { + "name": "type_id", + "type": "int128", + "indexed": false + }, + { + "name": "time", + "type": "uint256", + "indexed": false + }, + { + "name": "weight", + "type": "uint256", + "indexed": false + }, + { + "name": "total_weight", + "type": "uint256", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "NewGaugeWeight", + "inputs": [ + { + "name": "gauge_address", + "type": "address", + "indexed": false + }, + { + "name": "time", + "type": "uint256", + "indexed": false + }, + { + "name": "weight", + "type": "uint256", + "indexed": false + }, + { + "name": "total_weight", + "type": "uint256", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "VoteForGauge", + "inputs": [ + { + "name": "time", + "type": "uint256", + "indexed": false + }, + { + "name": "user", + "type": "address", + "indexed": false + }, + { + "name": "gauge_addr", + "type": "address", + "indexed": false + }, + { + "name": "weight", + "type": "uint256", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "NewGauge", + "inputs": [ + { + "name": "addr", + "type": "address", + "indexed": false + }, + { + "name": "gauge_type", + "type": "int128", + "indexed": false + }, + { + "name": "weight", + "type": "uint256", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "NewPendingAdmin", + "inputs": [ + { + "name": "new_pending_admin", + "type": "address", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "NewAdmin", + "inputs": [ + { + "name": "new_admin", + "type": "address", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "stateMutability": "nonpayable", + "type": "constructor", + "inputs": [ + { + "name": "_voting_escrow", + "type": "address" + }, + { + "name": "_admin", + "type": "address" + } + ], + "outputs": [] + }, + { + "stateMutability": "view", + "type": "function", + "name": "token", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "voting_escrow", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "gauge_exists", + "inputs": [ + { + "name": "_addr", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "bool" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "gauge_types", + "inputs": [ + { + "name": "_addr", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "int128" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "add_gauge", + "inputs": [ + { + "name": "addr", + "type": "address" + }, + { + "name": "gauge_type", + "type": "int128" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "add_gauge", + "inputs": [ + { + "name": "addr", + "type": "address" + }, + { + "name": "gauge_type", + "type": "int128" + }, + { + "name": "weight", + "type": "uint256" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "checkpoint", + "inputs": [], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "checkpoint_gauge", + "inputs": [ + { + "name": "addr", + "type": "address" + } + ], + "outputs": [] + }, + { + "stateMutability": "view", + "type": "function", + "name": "gauge_relative_weight", + "inputs": [ + { + "name": "addr", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "gauge_relative_weight", + "inputs": [ + { + "name": "addr", + "type": "address" + }, + { + "name": "time", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "gauge_relative_weight_write", + "inputs": [ + { + "name": "addr", + "type": "address" + }, + { + "name": "time", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "add_type", + "inputs": [ + { + "name": "_name", + "type": "string" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "add_type", + "inputs": [ + { + "name": "_name", + "type": "string" + }, + { + "name": "weight", + "type": "uint256" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "change_type_weight", + "inputs": [ + { + "name": "type_id", + "type": "int128" + }, + { + "name": "weight", + "type": "uint256" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "change_gauge_weight", + "inputs": [ + { + "name": "addr", + "type": "address" + }, + { + "name": "weight", + "type": "uint256" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "vote_for_many_gauge_weights", + "inputs": [ + { + "name": "_gauge_addrs", + "type": "address[8]" + }, + { + "name": "_user_weight", + "type": "uint256[8]" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "vote_for_gauge_weights", + "inputs": [ + { + "name": "_gauge_addr", + "type": "address" + }, + { + "name": "_user_weight", + "type": "uint256" + } + ], + "outputs": [] + }, + { + "stateMutability": "view", + "type": "function", + "name": "get_gauge_weight", + "inputs": [ + { + "name": "addr", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "get_type_weight", + "inputs": [ + { + "name": "type_id", + "type": "int128" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "get_total_weight", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "get_weights_sum_per_type", + "inputs": [ + { + "name": "type_id", + "type": "int128" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "change_pending_admin", + "inputs": [ + { + "name": "new_pending_admin", + "type": "address" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "claim_admin", + "inputs": [], + "outputs": [] + }, + { + "stateMutability": "view", + "type": "function", + "name": "pending_admin", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "admin", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "n_gauge_types", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "int128" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "n_gauges", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "int128" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "gauge_type_names", + "inputs": [ + { + "name": "arg0", + "type": "int128" + } + ], + "outputs": [ + { + "name": "", + "type": "string" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "gauges", + "inputs": [ + { + "name": "arg0", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "address" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "vote_user_slopes", + "inputs": [ + { + "name": "arg0", + "type": "address" + }, + { + "name": "arg1", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "tuple", + "components": [ + { + "name": "slope", + "type": "uint256" + }, + { + "name": "power", + "type": "uint256" + }, + { + "name": "end", + "type": "uint256" + } + ] + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "vote_user_power", + "inputs": [ + { + "name": "arg0", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "last_user_vote", + "inputs": [ + { + "name": "arg0", + "type": "address" + }, + { + "name": "arg1", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "points_weight", + "inputs": [ + { + "name": "arg0", + "type": "address" + }, + { + "name": "arg1", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "tuple", + "components": [ + { + "name": "bias", + "type": "uint256" + }, + { + "name": "slope", + "type": "uint256" + } + ] + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "time_weight", + "inputs": [ + { + "name": "arg0", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "points_sum", + "inputs": [ + { + "name": "arg0", + "type": "int128" + }, + { + "name": "arg1", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "tuple", + "components": [ + { + "name": "bias", + "type": "uint256" + }, + { + "name": "slope", + "type": "uint256" + } + ] + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "time_sum", + "inputs": [ + { + "name": "arg0", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "points_total", + "inputs": [ + { + "name": "arg0", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "time_total", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "points_type_weight", + "inputs": [ + { + "name": "arg0", + "type": "int128" + }, + { + "name": "arg1", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "time_type_weight", + "inputs": [ + { + "name": "arg0", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + } +] diff --git a/src/adaptors/liquis/abis/LiquidityGauge.json b/src/adaptors/liquis/abis/LiquidityGauge.json new file mode 100644 index 0000000000..7f3a098ca9 --- /dev/null +++ b/src/adaptors/liquis/abis/LiquidityGauge.json @@ -0,0 +1,1229 @@ +[ + { + "name": "Deposit", + "inputs": [ + { + "name": "provider", + "type": "address", + "indexed": true + }, + { + "name": "value", + "type": "uint256", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "Withdraw", + "inputs": [ + { + "name": "provider", + "type": "address", + "indexed": true + }, + { + "name": "value", + "type": "uint256", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "UpdateLiquidityLimit", + "inputs": [ + { + "name": "user", + "type": "address", + "indexed": true + }, + { + "name": "original_balance", + "type": "uint256", + "indexed": false + }, + { + "name": "original_supply", + "type": "uint256", + "indexed": false + }, + { + "name": "working_balance", + "type": "uint256", + "indexed": false + }, + { + "name": "working_supply", + "type": "uint256", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "Transfer", + "inputs": [ + { + "name": "_from", + "type": "address", + "indexed": true + }, + { + "name": "_to", + "type": "address", + "indexed": true + }, + { + "name": "_value", + "type": "uint256", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "Approval", + "inputs": [ + { + "name": "_owner", + "type": "address", + "indexed": true + }, + { + "name": "_spender", + "type": "address", + "indexed": true + }, + { + "name": "_value", + "type": "uint256", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "RewardDistributorUpdated", + "inputs": [ + { + "name": "reward_token", + "type": "address", + "indexed": true + }, + { + "name": "distributor", + "type": "address", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "RelativeWeightCapChanged", + "inputs": [ + { + "name": "new_relative_weight_cap", + "type": "uint256", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "NewPendingAdmin", + "inputs": [ + { + "name": "new_pending_admin", + "type": "address", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "NewAdmin", + "inputs": [ + { + "name": "new_admin", + "type": "address", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "NewTokenlessProduction", + "inputs": [ + { + "name": "new_tokenless_production", + "type": "uint8", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "stateMutability": "nonpayable", + "type": "constructor", + "inputs": [ + { + "name": "minter", + "type": "address" + }, + { + "name": "uniswap_poor_oracle", + "type": "address" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "deposit", + "inputs": [ + { + "name": "_value", + "type": "uint256" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "deposit", + "inputs": [ + { + "name": "_value", + "type": "uint256" + }, + { + "name": "_addr", + "type": "address" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "deposit", + "inputs": [ + { + "name": "_value", + "type": "uint256" + }, + { + "name": "_addr", + "type": "address" + }, + { + "name": "_claim_rewards", + "type": "bool" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "withdraw", + "inputs": [ + { + "name": "_value", + "type": "uint256" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "withdraw", + "inputs": [ + { + "name": "_value", + "type": "uint256" + }, + { + "name": "_claim_rewards", + "type": "bool" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "claim_rewards", + "inputs": [], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "claim_rewards", + "inputs": [ + { + "name": "_addr", + "type": "address" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "claim_rewards", + "inputs": [ + { + "name": "_addr", + "type": "address" + }, + { + "name": "_receiver", + "type": "address" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "transferFrom", + "inputs": [ + { + "name": "_from", + "type": "address" + }, + { + "name": "_to", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "bool" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "transfer", + "inputs": [ + { + "name": "_to", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "bool" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "approve", + "inputs": [ + { + "name": "_spender", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "bool" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "permit", + "inputs": [ + { + "name": "_owner", + "type": "address" + }, + { + "name": "_spender", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + }, + { + "name": "_deadline", + "type": "uint256" + }, + { + "name": "_v", + "type": "uint8" + }, + { + "name": "_r", + "type": "bytes32" + }, + { + "name": "_s", + "type": "bytes32" + } + ], + "outputs": [ + { + "name": "", + "type": "bool" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "increaseAllowance", + "inputs": [ + { + "name": "_spender", + "type": "address" + }, + { + "name": "_added_value", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "bool" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "decreaseAllowance", + "inputs": [ + { + "name": "_spender", + "type": "address" + }, + { + "name": "_subtracted_value", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "bool" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "user_checkpoint", + "inputs": [ + { + "name": "addr", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "bool" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "set_rewards_receiver", + "inputs": [ + { + "name": "_receiver", + "type": "address" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "kick", + "inputs": [ + { + "name": "addr", + "type": "address" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "deposit_reward_token", + "inputs": [ + { + "name": "_reward_token", + "type": "address" + }, + { + "name": "_amount", + "type": "uint256" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "add_reward", + "inputs": [ + { + "name": "_reward_token", + "type": "address" + }, + { + "name": "_distributor", + "type": "address" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "set_reward_distributor", + "inputs": [ + { + "name": "_reward_token", + "type": "address" + }, + { + "name": "_distributor", + "type": "address" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "makeGaugePermissionless", + "inputs": [], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "killGauge", + "inputs": [], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "unkillGauge", + "inputs": [], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "change_pending_admin", + "inputs": [ + { + "name": "new_pending_admin", + "type": "address" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "claim_admin", + "inputs": [], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "set_tokenless_production", + "inputs": [ + { + "name": "new_tokenless_production", + "type": "uint8" + } + ], + "outputs": [] + }, + { + "stateMutability": "view", + "type": "function", + "name": "claimed_reward", + "inputs": [ + { + "name": "_addr", + "type": "address" + }, + { + "name": "_token", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "claimable_reward", + "inputs": [ + { + "name": "_user", + "type": "address" + }, + { + "name": "_reward_token", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "claimable_tokens", + "inputs": [ + { + "name": "addr", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "integrate_checkpoint", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "future_epoch_time", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "inflation_rate", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "decimals", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "version", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "string" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "allowance", + "inputs": [ + { + "name": "owner", + "type": "address" + }, + { + "name": "spender", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "is_killed", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "bool" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "initialize", + "inputs": [ + { + "name": "_lp_token", + "type": "address" + }, + { + "name": "relative_weight_cap", + "type": "uint256" + }, + { + "name": "_voting_escrow_delegation", + "type": "address" + }, + { + "name": "_admin", + "type": "address" + }, + { + "name": "_position_key", + "type": "bytes32" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "setRelativeWeightCap", + "inputs": [ + { + "name": "relative_weight_cap", + "type": "uint256" + } + ], + "outputs": [] + }, + { + "stateMutability": "view", + "type": "function", + "name": "getRelativeWeightCap", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "getCappedRelativeWeight", + "inputs": [ + { + "name": "time", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "pure", + "type": "function", + "name": "getMaxRelativeWeightCap", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "tokenless_production", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint8" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "pending_admin", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "admin", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "voting_escrow_delegation", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "balanceOf", + "inputs": [ + { + "name": "arg0", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "totalSupply", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "name", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "string" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "symbol", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "string" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "DOMAIN_SEPARATOR", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "bytes32" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "nonces", + "inputs": [ + { + "name": "arg0", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "lp_token", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "gauge_state", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint8" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "position_key", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "bytes32" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "reward_count", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "reward_data", + "inputs": [ + { + "name": "arg0", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "tuple", + "components": [ + { + "name": "token", + "type": "address" + }, + { + "name": "distributor", + "type": "address" + }, + { + "name": "period_finish", + "type": "uint256" + }, + { + "name": "rate", + "type": "uint256" + }, + { + "name": "last_update", + "type": "uint256" + }, + { + "name": "integral", + "type": "uint256" + } + ] + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "rewards_receiver", + "inputs": [ + { + "name": "arg0", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "address" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "reward_integral_for", + "inputs": [ + { + "name": "arg0", + "type": "address" + }, + { + "name": "arg1", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "working_balances", + "inputs": [ + { + "name": "arg0", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "working_supply", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "integrate_inv_supply_of", + "inputs": [ + { + "name": "arg0", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "integrate_checkpoint_of", + "inputs": [ + { + "name": "arg0", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "integrate_fraction", + "inputs": [ + { + "name": "arg0", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "period", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "int128" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "reward_tokens", + "inputs": [ + { + "name": "arg0", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "address" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "period_timestamp", + "inputs": [ + { + "name": "arg0", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "integrate_inv_supply", + "inputs": [ + { + "name": "arg0", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + } +] diff --git a/src/adaptors/liquis/abis/OptionsOracle.json b/src/adaptors/liquis/abis/OptionsOracle.json new file mode 100644 index 0000000000..5cb26c9c0c --- /dev/null +++ b/src/adaptors/liquis/abis/OptionsOracle.json @@ -0,0 +1,225 @@ +[ + { + "inputs": [ + { + "internalType": "contract IBalancerTwapOracle", + "name": "balancerTwapOracle_", + "type": "address" + }, + { + "internalType": "address", + "name": "owner_", + "type": "address" + }, + { + "internalType": "uint16", + "name": "multiplier_", + "type": "uint16" + }, + { + "internalType": "uint56", + "name": "secs_", + "type": "uint56" + }, + { + "internalType": "uint56", + "name": "ago_", + "type": "uint56" + }, + { + "internalType": "uint128", + "name": "minPrice_", + "type": "uint128" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "BalancerOracle__TWAPOracleNotReady", + "type": "error" + }, + { + "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": "uint16", + "name": "multiplier", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "uint56", + "name": "secs", + "type": "uint56" + }, + { + "indexed": false, + "internalType": "uint56", + "name": "ago", + "type": "uint56" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "minPrice", + "type": "uint128" + } + ], + "name": "SetParams", + "type": "event" + }, + { + "inputs": [], + "name": "ago", + "outputs": [ + { + "internalType": "uint56", + "name": "", + "type": "uint56" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "balancerTwapOracle", + "outputs": [ + { + "internalType": "contract IBalancerTwapOracle", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "price", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minPrice", + "outputs": [ + { + "internalType": "uint128", + "name": "", + "type": "uint128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "multiplier", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "secs", + "outputs": [ + { + "internalType": "uint56", + "name": "", + "type": "uint56" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "multiplier_", + "type": "uint16" + }, + { + "internalType": "uint56", + "name": "secs_", + "type": "uint56" + }, + { + "internalType": "uint56", + "name": "ago_", + "type": "uint56" + }, + { + "internalType": "uint128", + "name": "minPrice_", + "type": "uint128" + } + ], + "name": "setParams", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/src/adaptors/liquis/abis/TokenAdmin.json b/src/adaptors/liquis/abis/TokenAdmin.json new file mode 100644 index 0000000000..efab4125bb --- /dev/null +++ b/src/adaptors/liquis/abis/TokenAdmin.json @@ -0,0 +1,390 @@ +[ + { + "inputs": [ + { + "internalType": "contract IERC20Mintable", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "rate", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "supply", + "type": "uint256" + } + ], + "name": "MiningParametersUpdated", + "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" + }, + { + "inputs": [], + "name": "INITIAL_RATE", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "RATE_DENOMINATOR", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "RATE_REDUCTION_COEFFICIENT", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "RATE_REDUCTION_TIME", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "activate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "available_supply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "futureEpochTimeWrite", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "future_epoch_time_write", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getAvailableSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getFutureEpochTime", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getInflationRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMiningEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getStartEpochSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getStartEpochTime", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getToken", + "outputs": [ + { + "internalType": "contract IERC20Mintable", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "start", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "end", + "type": "uint256" + } + ], + "name": "mintableInTimeframe", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "start", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "end", + "type": "uint256" + } + ], + "name": "mintable_in_timeframe", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "startEpochTimeWrite", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "start_epoch_time_write", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "updateMiningParameters", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "update_mining_parameters", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/src/adaptors/liquis/abis/Vault.json b/src/adaptors/liquis/abis/Vault.json new file mode 100644 index 0000000000..03668f92a5 --- /dev/null +++ b/src/adaptors/liquis/abis/Vault.json @@ -0,0 +1,918 @@ +[ + { + "inputs": [ + { + "internalType": "contract IAuthorizer", + "name": "authorizer", + "type": "address" + }, + { "internalType": "contract IWETH", "name": "weth", "type": "address" }, + { + "internalType": "uint256", + "name": "pauseWindowDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "bufferPeriodDuration", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract IAuthorizer", + "name": "newAuthorizer", + "type": "address" + } + ], + "name": "AuthorizerChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract IERC20", + "name": "token", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "ExternalBalanceTransfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract IFlashLoanRecipient", + "name": "recipient", + "type": "address" + }, + { + "indexed": true, + "internalType": "contract IERC20", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "feeAmount", + "type": "uint256" + } + ], + "name": "FlashLoan", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "contract IERC20", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "int256", + "name": "delta", + "type": "int256" + } + ], + "name": "InternalBalanceChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bool", + "name": "paused", + "type": "bool" + } + ], + "name": "PausedStateChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "poolId", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "liquidityProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract IERC20[]", + "name": "tokens", + "type": "address[]" + }, + { + "indexed": false, + "internalType": "int256[]", + "name": "deltas", + "type": "int256[]" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "protocolFeeAmounts", + "type": "uint256[]" + } + ], + "name": "PoolBalanceChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "poolId", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "assetManager", + "type": "address" + }, + { + "indexed": true, + "internalType": "contract IERC20", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "int256", + "name": "cashDelta", + "type": "int256" + }, + { + "indexed": false, + "internalType": "int256", + "name": "managedDelta", + "type": "int256" + } + ], + "name": "PoolBalanceManaged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "poolId", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "poolAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "enum IVault.PoolSpecialization", + "name": "specialization", + "type": "uint8" + } + ], + "name": "PoolRegistered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "relayer", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "RelayerApprovalChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "poolId", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "contract IERC20", + "name": "tokenIn", + "type": "address" + }, + { + "indexed": true, + "internalType": "contract IERC20", + "name": "tokenOut", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountIn", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountOut", + "type": "uint256" + } + ], + "name": "Swap", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "poolId", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "contract IERC20[]", + "name": "tokens", + "type": "address[]" + } + ], + "name": "TokensDeregistered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "poolId", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "contract IERC20[]", + "name": "tokens", + "type": "address[]" + }, + { + "indexed": false, + "internalType": "address[]", + "name": "assetManagers", + "type": "address[]" + } + ], + "name": "TokensRegistered", + "type": "event" + }, + { + "inputs": [], + "name": "WETH", + "outputs": [ + { "internalType": "contract IWETH", "name": "", "type": "address" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum IVault.SwapKind", + "name": "kind", + "type": "uint8" + }, + { + "components": [ + { "internalType": "bytes32", "name": "poolId", "type": "bytes32" }, + { + "internalType": "uint256", + "name": "assetInIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "assetOutIndex", + "type": "uint256" + }, + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { "internalType": "bytes", "name": "userData", "type": "bytes" } + ], + "internalType": "struct IVault.BatchSwapStep[]", + "name": "swaps", + "type": "tuple[]" + }, + { + "internalType": "contract IAsset[]", + "name": "assets", + "type": "address[]" + }, + { + "components": [ + { "internalType": "address", "name": "sender", "type": "address" }, + { + "internalType": "bool", + "name": "fromInternalBalance", + "type": "bool" + }, + { + "internalType": "address payable", + "name": "recipient", + "type": "address" + }, + { + "internalType": "bool", + "name": "toInternalBalance", + "type": "bool" + } + ], + "internalType": "struct IVault.FundManagement", + "name": "funds", + "type": "tuple" + }, + { "internalType": "int256[]", "name": "limits", "type": "int256[]" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" } + ], + "name": "batchSwap", + "outputs": [ + { "internalType": "int256[]", "name": "assetDeltas", "type": "int256[]" } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "poolId", "type": "bytes32" }, + { + "internalType": "contract IERC20[]", + "name": "tokens", + "type": "address[]" + } + ], + "name": "deregisterTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "poolId", "type": "bytes32" }, + { "internalType": "address", "name": "sender", "type": "address" }, + { + "internalType": "address payable", + "name": "recipient", + "type": "address" + }, + { + "components": [ + { + "internalType": "contract IAsset[]", + "name": "assets", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "minAmountsOut", + "type": "uint256[]" + }, + { "internalType": "bytes", "name": "userData", "type": "bytes" }, + { + "internalType": "bool", + "name": "toInternalBalance", + "type": "bool" + } + ], + "internalType": "struct IVault.ExitPoolRequest", + "name": "request", + "type": "tuple" + } + ], + "name": "exitPool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IFlashLoanRecipient", + "name": "recipient", + "type": "address" + }, + { + "internalType": "contract IERC20[]", + "name": "tokens", + "type": "address[]" + }, + { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" }, + { "internalType": "bytes", "name": "userData", "type": "bytes" } + ], + "name": "flashLoan", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes4", "name": "selector", "type": "bytes4" } + ], + "name": "getActionId", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAuthorizer", + "outputs": [ + { "internalType": "contract IAuthorizer", "name": "", "type": "address" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getDomainSeparator", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "user", "type": "address" }, + { + "internalType": "contract IERC20[]", + "name": "tokens", + "type": "address[]" + } + ], + "name": "getInternalBalance", + "outputs": [ + { "internalType": "uint256[]", "name": "balances", "type": "uint256[]" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "user", "type": "address" } + ], + "name": "getNextNonce", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPausedState", + "outputs": [ + { "internalType": "bool", "name": "paused", "type": "bool" }, + { + "internalType": "uint256", + "name": "pauseWindowEndTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "bufferPeriodEndTime", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "poolId", "type": "bytes32" } + ], + "name": "getPool", + "outputs": [ + { "internalType": "address", "name": "", "type": "address" }, + { + "internalType": "enum IVault.PoolSpecialization", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "poolId", "type": "bytes32" }, + { "internalType": "contract IERC20", "name": "token", "type": "address" } + ], + "name": "getPoolTokenInfo", + "outputs": [ + { "internalType": "uint256", "name": "cash", "type": "uint256" }, + { "internalType": "uint256", "name": "managed", "type": "uint256" }, + { + "internalType": "uint256", + "name": "lastChangeBlock", + "type": "uint256" + }, + { "internalType": "address", "name": "assetManager", "type": "address" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "poolId", "type": "bytes32" } + ], + "name": "getPoolTokens", + "outputs": [ + { + "internalType": "contract IERC20[]", + "name": "tokens", + "type": "address[]" + }, + { "internalType": "uint256[]", "name": "balances", "type": "uint256[]" }, + { + "internalType": "uint256", + "name": "lastChangeBlock", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getProtocolFeesCollector", + "outputs": [ + { + "internalType": "contract ProtocolFeesCollector", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "user", "type": "address" }, + { "internalType": "address", "name": "relayer", "type": "address" } + ], + "name": "hasApprovedRelayer", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "poolId", "type": "bytes32" }, + { "internalType": "address", "name": "sender", "type": "address" }, + { "internalType": "address", "name": "recipient", "type": "address" }, + { + "components": [ + { + "internalType": "contract IAsset[]", + "name": "assets", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "maxAmountsIn", + "type": "uint256[]" + }, + { "internalType": "bytes", "name": "userData", "type": "bytes" }, + { + "internalType": "bool", + "name": "fromInternalBalance", + "type": "bool" + } + ], + "internalType": "struct IVault.JoinPoolRequest", + "name": "request", + "type": "tuple" + } + ], + "name": "joinPool", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "enum IVault.PoolBalanceOpKind", + "name": "kind", + "type": "uint8" + }, + { "internalType": "bytes32", "name": "poolId", "type": "bytes32" }, + { + "internalType": "contract IERC20", + "name": "token", + "type": "address" + }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "internalType": "struct IVault.PoolBalanceOp[]", + "name": "ops", + "type": "tuple[]" + } + ], + "name": "managePoolBalance", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "enum IVault.UserBalanceOpKind", + "name": "kind", + "type": "uint8" + }, + { + "internalType": "contract IAsset", + "name": "asset", + "type": "address" + }, + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { "internalType": "address", "name": "sender", "type": "address" }, + { + "internalType": "address payable", + "name": "recipient", + "type": "address" + } + ], + "internalType": "struct IVault.UserBalanceOp[]", + "name": "ops", + "type": "tuple[]" + } + ], + "name": "manageUserBalance", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum IVault.SwapKind", + "name": "kind", + "type": "uint8" + }, + { + "components": [ + { "internalType": "bytes32", "name": "poolId", "type": "bytes32" }, + { + "internalType": "uint256", + "name": "assetInIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "assetOutIndex", + "type": "uint256" + }, + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { "internalType": "bytes", "name": "userData", "type": "bytes" } + ], + "internalType": "struct IVault.BatchSwapStep[]", + "name": "swaps", + "type": "tuple[]" + }, + { + "internalType": "contract IAsset[]", + "name": "assets", + "type": "address[]" + }, + { + "components": [ + { "internalType": "address", "name": "sender", "type": "address" }, + { + "internalType": "bool", + "name": "fromInternalBalance", + "type": "bool" + }, + { + "internalType": "address payable", + "name": "recipient", + "type": "address" + }, + { + "internalType": "bool", + "name": "toInternalBalance", + "type": "bool" + } + ], + "internalType": "struct IVault.FundManagement", + "name": "funds", + "type": "tuple" + } + ], + "name": "queryBatchSwap", + "outputs": [{ "internalType": "int256[]", "name": "", "type": "int256[]" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum IVault.PoolSpecialization", + "name": "specialization", + "type": "uint8" + } + ], + "name": "registerPool", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "poolId", "type": "bytes32" }, + { + "internalType": "contract IERC20[]", + "name": "tokens", + "type": "address[]" + }, + { + "internalType": "address[]", + "name": "assetManagers", + "type": "address[]" + } + ], + "name": "registerTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IAuthorizer", + "name": "newAuthorizer", + "type": "address" + } + ], + "name": "setAuthorizer", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "bool", "name": "paused", "type": "bool" }], + "name": "setPaused", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "sender", "type": "address" }, + { "internalType": "address", "name": "relayer", "type": "address" }, + { "internalType": "bool", "name": "approved", "type": "bool" } + ], + "name": "setRelayerApproval", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { "internalType": "bytes32", "name": "poolId", "type": "bytes32" }, + { + "internalType": "enum IVault.SwapKind", + "name": "kind", + "type": "uint8" + }, + { + "internalType": "contract IAsset", + "name": "assetIn", + "type": "address" + }, + { + "internalType": "contract IAsset", + "name": "assetOut", + "type": "address" + }, + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { "internalType": "bytes", "name": "userData", "type": "bytes" } + ], + "internalType": "struct IVault.SingleSwap", + "name": "singleSwap", + "type": "tuple" + }, + { + "components": [ + { "internalType": "address", "name": "sender", "type": "address" }, + { + "internalType": "bool", + "name": "fromInternalBalance", + "type": "bool" + }, + { + "internalType": "address payable", + "name": "recipient", + "type": "address" + }, + { + "internalType": "bool", + "name": "toInternalBalance", + "type": "bool" + } + ], + "internalType": "struct IVault.FundManagement", + "name": "funds", + "type": "tuple" + }, + { "internalType": "uint256", "name": "limit", "type": "uint256" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" } + ], + "name": "swap", + "outputs": [ + { + "internalType": "uint256", + "name": "amountCalculated", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { "stateMutability": "payable", "type": "receive" } +] diff --git a/src/adaptors/liquis/abis/ViewHelper.json b/src/adaptors/liquis/abis/ViewHelper.json new file mode 100644 index 0000000000..b41aa88e98 --- /dev/null +++ b/src/adaptors/liquis/abis/ViewHelper.json @@ -0,0 +1,647 @@ +[ + { + "inputs": [], + "name": "balancerVault", + "outputs": [ + { + "internalType": "contract IBalancerVault", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_amount", "type": "uint256" } + ], + "name": "convertLitToLiq", + "outputs": [ + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_cvxCrvRewards", "type": "address" } + ], + "name": "getCvxCrvRewards", + "outputs": [ + { + "components": [ + { "internalType": "uint256", "name": "pid", "type": "uint256" }, + { "internalType": "address", "name": "lptoken", "type": "address" }, + { "internalType": "address", "name": "token", "type": "address" }, + { "internalType": "address", "name": "gauge", "type": "address" }, + { + "internalType": "address", + "name": "crvRewards", + "type": "address" + }, + { "internalType": "address", "name": "stash", "type": "address" }, + { "internalType": "bool", "name": "shutdown", "type": "bool" }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { "internalType": "address", "name": "uniV3Pool", "type": "address" }, + { + "internalType": "address[]", + "name": "poolTokens", + "type": "address[]" + }, + { "internalType": "int24[]", "name": "ticks", "type": "int24[]" }, + { + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "periodFinish", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rewardRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rewardPerTokenStored", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "queuedRewards", + "type": "uint256" + } + ], + "internalType": "struct LiquisViewHelpers.RewardsData", + "name": "rewardsData", + "type": "tuple" + }, + { + "components": [ + { "internalType": "address", "name": "addr", "type": "address" }, + { + "internalType": "address", + "name": "rewardsToken", + "type": "address" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "periodFinish", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rewardRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rewardPerTokenStored", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "queuedRewards", + "type": "uint256" + } + ], + "internalType": "struct LiquisViewHelpers.RewardsData", + "name": "rewardsData", + "type": "tuple" + } + ], + "internalType": "struct LiquisViewHelpers.ExtraRewards[]", + "name": "extraRewards", + "type": "tuple[]" + } + ], + "internalType": "struct LiquisViewHelpers.Pool", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "pool", "type": "uint256" }, + { "internalType": "address", "name": "booster", "type": "address" }, + { "internalType": "address", "name": "token", "type": "address" } + ], + "name": "getEarmarkingReward", + "outputs": [ + { "internalType": "uint256", "name": "pending", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_locker", "type": "address" } + ], + "name": "getLocker", + "outputs": [ + { + "components": [ + { "internalType": "uint256", "name": "epoch", "type": "uint256" }, + { + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lockedSupply", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "periodFinish", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rewardRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rewardPerTokenStored", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "queuedRewards", + "type": "uint256" + } + ], + "internalType": "struct LiquisViewHelpers.RewardsData", + "name": "rewardsData", + "type": "tuple" + } + ], + "internalType": "struct LiquisViewHelpers.Locker", + "name": "locker", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_locker", "type": "address" }, + { "internalType": "address", "name": "_account", "type": "address" } + ], + "name": "getLockerAccount", + "outputs": [ + { + "components": [ + { "internalType": "address", "name": "addr", "type": "address" }, + { "internalType": "uint256", "name": "total", "type": "uint256" }, + { + "internalType": "uint256", + "name": "unlockable", + "type": "uint256" + }, + { "internalType": "uint256", "name": "locked", "type": "uint256" }, + { + "internalType": "uint256", + "name": "nextUnlockIndex", + "type": "uint256" + }, + { + "internalType": "uint128", + "name": "rewardPerTokenPaid", + "type": "uint128" + }, + { "internalType": "uint128", "name": "rewards", "type": "uint128" }, + { "internalType": "address", "name": "delegate", "type": "address" }, + { "internalType": "uint256", "name": "votes", "type": "uint256" }, + { + "components": [ + { + "internalType": "uint112", + "name": "amount", + "type": "uint112" + }, + { + "internalType": "uint32", + "name": "unlockTime", + "type": "uint32" + } + ], + "internalType": "struct LiqLocker.LockedBalance[]", + "name": "lockData", + "type": "tuple[]" + }, + { + "components": [ + { "internalType": "address", "name": "token", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "internalType": "struct LiqLocker.EarnedData[]", + "name": "claimableRewards", + "type": "tuple[]" + } + ], + "internalType": "struct LiquisViewHelpers.LockerAccount", + "name": "lockerAccount", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256[]", "name": "pools", "type": "uint256[]" }, + { "internalType": "address", "name": "booster", "type": "address" }, + { "internalType": "address", "name": "token", "type": "address" } + ], + "name": "getMultipleEarmarkingRewards", + "outputs": [ + { "internalType": "uint256[]", "name": "pendings", "type": "uint256[]" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { "internalType": "address", "name": "lptoken", "type": "address" }, + { "internalType": "address", "name": "token", "type": "address" }, + { "internalType": "address", "name": "gauge", "type": "address" }, + { + "internalType": "address", + "name": "crvRewards", + "type": "address" + }, + { "internalType": "address", "name": "stash", "type": "address" }, + { "internalType": "bool", "name": "shutdown", "type": "bool" } + ], + "internalType": "struct IBooster.PoolInfo", + "name": "poolInfo", + "type": "tuple" + }, + { "internalType": "uint256", "name": "_pid", "type": "uint256" } + ], + "name": "getPool", + "outputs": [ + { + "components": [ + { "internalType": "uint256", "name": "pid", "type": "uint256" }, + { "internalType": "address", "name": "lptoken", "type": "address" }, + { "internalType": "address", "name": "token", "type": "address" }, + { "internalType": "address", "name": "gauge", "type": "address" }, + { + "internalType": "address", + "name": "crvRewards", + "type": "address" + }, + { "internalType": "address", "name": "stash", "type": "address" }, + { "internalType": "bool", "name": "shutdown", "type": "bool" }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { "internalType": "address", "name": "uniV3Pool", "type": "address" }, + { + "internalType": "address[]", + "name": "poolTokens", + "type": "address[]" + }, + { "internalType": "int24[]", "name": "ticks", "type": "int24[]" }, + { + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "periodFinish", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rewardRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rewardPerTokenStored", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "queuedRewards", + "type": "uint256" + } + ], + "internalType": "struct LiquisViewHelpers.RewardsData", + "name": "rewardsData", + "type": "tuple" + }, + { + "components": [ + { "internalType": "address", "name": "addr", "type": "address" }, + { + "internalType": "address", + "name": "rewardsToken", + "type": "address" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "periodFinish", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rewardRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rewardPerTokenStored", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "queuedRewards", + "type": "uint256" + } + ], + "internalType": "struct LiquisViewHelpers.RewardsData", + "name": "rewardsData", + "type": "tuple" + } + ], + "internalType": "struct LiquisViewHelpers.ExtraRewards[]", + "name": "extraRewards", + "type": "tuple[]" + } + ], + "internalType": "struct LiquisViewHelpers.Pool", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_rewardPool", "type": "address" }, + { "internalType": "uint256", "name": "_pid", "type": "uint256" }, + { "internalType": "address", "name": "_account", "type": "address" } + ], + "name": "getPoolBalances", + "outputs": [ + { + "components": [ + { "internalType": "uint256", "name": "pid", "type": "uint256" }, + { "internalType": "uint256", "name": "earned", "type": "uint256" }, + { + "internalType": "uint256[]", + "name": "extraRewardsEarned", + "type": "uint256[]" + }, + { "internalType": "uint256", "name": "staked", "type": "uint256" } + ], + "internalType": "struct LiquisViewHelpers.PoolBalances", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_booster", "type": "address" } + ], + "name": "getPools", + "outputs": [ + { + "components": [ + { "internalType": "uint256", "name": "pid", "type": "uint256" }, + { "internalType": "address", "name": "lptoken", "type": "address" }, + { "internalType": "address", "name": "token", "type": "address" }, + { "internalType": "address", "name": "gauge", "type": "address" }, + { + "internalType": "address", + "name": "crvRewards", + "type": "address" + }, + { "internalType": "address", "name": "stash", "type": "address" }, + { "internalType": "bool", "name": "shutdown", "type": "bool" }, + { + "internalType": "address", + "name": "rewardToken", + "type": "address" + }, + { "internalType": "address", "name": "uniV3Pool", "type": "address" }, + { + "internalType": "address[]", + "name": "poolTokens", + "type": "address[]" + }, + { "internalType": "int24[]", "name": "ticks", "type": "int24[]" }, + { + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "periodFinish", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rewardRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rewardPerTokenStored", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "queuedRewards", + "type": "uint256" + } + ], + "internalType": "struct LiquisViewHelpers.RewardsData", + "name": "rewardsData", + "type": "tuple" + }, + { + "components": [ + { "internalType": "address", "name": "addr", "type": "address" }, + { + "internalType": "address", + "name": "rewardsToken", + "type": "address" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "periodFinish", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastUpdateTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rewardRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rewardPerTokenStored", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "queuedRewards", + "type": "uint256" + } + ], + "internalType": "struct LiquisViewHelpers.RewardsData", + "name": "rewardsData", + "type": "tuple" + } + ], + "internalType": "struct LiquisViewHelpers.ExtraRewards[]", + "name": "extraRewards", + "type": "tuple[]" + } + ], + "internalType": "struct LiquisViewHelpers.Pool[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_booster", "type": "address" }, + { "internalType": "address", "name": "_account", "type": "address" } + ], + "name": "getPoolsBalances", + "outputs": [ + { + "components": [ + { "internalType": "uint256", "name": "pid", "type": "uint256" }, + { "internalType": "uint256", "name": "earned", "type": "uint256" }, + { + "internalType": "uint256[]", + "name": "extraRewardsEarned", + "type": "uint256[]" + }, + { "internalType": "uint256", "name": "staked", "type": "uint256" } + ], + "internalType": "struct LiquisViewHelpers.PoolBalances[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address[]", "name": "_addresses", "type": "address[]" } + ], + "name": "getTokens", + "outputs": [ + { + "components": [ + { "internalType": "address", "name": "addr", "type": "address" }, + { "internalType": "uint8", "name": "decimals", "type": "uint8" }, + { "internalType": "string", "name": "symbol", "type": "string" }, + { "internalType": "string", "name": "name", "type": "string" } + ], + "internalType": "struct LiquisViewHelpers.Token[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "liq", + "outputs": [ + { + "internalType": "contract IERC20Detailed", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } +] diff --git a/src/adaptors/liquis/abis/VirtualPool.json b/src/adaptors/liquis/abis/VirtualPool.json new file mode 100644 index 0000000000..31ede7aa03 --- /dev/null +++ b/src/adaptors/liquis/abis/VirtualPool.json @@ -0,0 +1,274 @@ +[ + { + "inputs": [ + { "internalType": "address", "name": "deposit_", "type": "address" }, + { "internalType": "address", "name": "reward_", "type": "address" }, + { "internalType": "address", "name": "op_", "type": "address" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "reward", + "type": "uint256" + } + ], + "name": "RewardAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "reward", + "type": "uint256" + } + ], + "name": "RewardPaid", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Staked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdrawn", + "type": "event" + }, + { + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "balanceOf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "currentRewards", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "deposits", + "outputs": [ + { "internalType": "contract IDeposit", "name": "", "type": "address" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "duration", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "earned", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "name": "epochRewards", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_account", "type": "address" } + ], + "name": "getReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "historicalRewards", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lastTimeRewardApplicable", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lastUpdateTime", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "newRewardRatio", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "operator", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "periodFinish", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_rewards", "type": "uint256" } + ], + "name": "queueNewRewards", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "queuedRewards", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardPerToken", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardPerTokenStored", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardRate", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardToken", + "outputs": [ + { "internalType": "contract IERC20", "name": "", "type": "address" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "rewards", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_account", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "stake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "userRewardPerTokenPaid", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_account", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/src/adaptors/liquis/index.js b/src/adaptors/liquis/index.js new file mode 100644 index 0000000000..e8a18965a2 --- /dev/null +++ b/src/adaptors/liquis/index.js @@ -0,0 +1,704 @@ +const sdk = require('@defillama/sdk'); +const utils = require('../utils'); +const superagent = require('superagent'); +const { request, gql } = require('graphql-request'); + +const hub = '0xb5087f95643a9a4069471a28d32c569d9bd57fe4'; +const lens = '0xb73f303472c4fd4ff3b9f59ce0f9b13e47fbfd19'; +const zeroAddress = '0x0000000000000000000000000000000000000000'; +const weth = '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'; +const bal = '0xba100000625a3754423978a60c9317c58a424e3D'; + +const lit80weth20 = { + ethereum: '0x9232a548DD9E81BaC65500b5e0d918F8Ba93675C', +}; + +const voterProxy = { + ethereum: '0x37aeB332D6E57112f1BFE36923a7ee670Ee9278b', +}; + +const viewHelper = { + ethereum: '0xD58dd6deF2d0e8E16ffc537c7f269719e19b9fE4', +}; + +const booster = { + ethereum: '0x631e58246A88c3957763e1469cb52f93BC1dDCF2', +}; + +const admin = { + ethereum: '0x4cc39af0d46b0f66fd33778c6629a696bdc310a0', +}; + +const controller = { + ethereum: '0x901c8aa6a61f74ac95e7f397e22a0ac7c1242218', +}; + +const lit = { + ethereum: '0xfd0205066521550D7d7AB19DA8F72bb004b4C341', +}; + +const liq = { + ethereum: '0xD82fd4D6D62f89A1E50b1db69AD19932314aa408', +}; + +const veLit = { + ethereum: '0xf17d23136B4FeAd139f54fB766c8795faae09660', +}; + +const liqLIT = { + ethereum: '0x03C6F0Ca0363652398abfb08d154F114e61c4Ad8', +}; + +const olit = { + ethereum: '0x627fee87d0d9d2c55098a06ac805db8f98b158aa', +}; + +const oracle = { + ethereum: '0x9d43ccb1ad7e0081cc8a8f1fd54d16e54a637e30', +}; + +const balVirtualPool = { + ethereum: '0x85C0DB72927cf20896ED1332a14C4e2818C1ebA9', +}; + +const wethVirtualPool = { + ethereum: '0x271B96395f53fb14cDD41C654ef15e83DE57dEDf', +}; + +const litLiqStaker = { + ethereum: '0x7Ea6930a9487ce8d039f7cC89432435E6D5AcB23', +}; + +const hubABI = require('./abis/BunniHub.json'); +const lensABI = require('./abis/BunniLens.json'); +const adminABI = require('./abis/TokenAdmin.json'); +const gaugeABI = require('./abis/LiquidityGauge.json'); +const controllerABI = require('./abis/GaugeController.json'); +const oracleABI = require('./abis/OptionsOracle.json'); +const boosterABI = require('./abis/Booster.json'); +const viewHelperABI = require('./abis/ViewHelper.json'); +const virtualPoolABI = require('./abis/VirtualPool.json'); +const balancerTokenABI = require('./abis/BalancerToken.json'); +const vaultABI = require('./abis/Vault.json'); +const { default: bunni } = require('../bunni'); + +const baseUrl = 'https://api.thegraph.com/subgraphs/name/bunniapp'; +const chains = { + ethereum: `${baseUrl}/bunni-mainnet`, +}; + +const query = gql` + { + bunniTokens(first: 1000, block: {number: }) { + address + liquidity + pool { + fee + tick + liquidity + totalFeesToken0 + totalFeesToken1 + totalVolumeToken0 + totalVolumeToken1 + } + } + } +`; + +const queryPrior = gql` + { + pools(first: 1000, block: {number: }) { + address + totalFeesToken0 + totalFeesToken1 + totalVolumeToken0 + totalVolumeToken1 + } + } +`; + +const apy = (apr, num_periods) => { + const periodic_rate = apr / num_periods / 100; + const apy = Math.pow(1 + periodic_rate, num_periods) - 1; + return apy * 100; +}; + +const liqLitPool = async (chain, olitprice, liqprice) => { + const keys = [weth, bal, lit[chain]] + .map((token) => `${chain}:${token}`) + .join(','); + const prices = ( + await superagent.get(`https://coins.llama.fi/prices/current/${keys}`) + ).body.coins; + const balPrice = prices[`${chain}:${bal}`].price; + const wethPrice = prices[`${chain}:${weth}`].price; + + // Compute tvl + let tvlUsd = 0; + let liqLitPrice = 0; + const { output: veLitTotalSupply } = await sdk.api.erc20.totalSupply({ + target: veLit[chain], + }); + const { output: veBalance } = await sdk.api.erc20.balanceOf({ + target: veLit[chain], + owner: voterProxy[chain], + }); + const liqRatio = veBalance / veLitTotalSupply; + const balancerToken = lit80weth20[chain]; + const owner = veLit[chain]; + const lpSupply = ( + await sdk.api.abi.call({ abi: 'erc20:totalSupply', target: balancerToken }) + )?.output; + const lpTokens = ( + await sdk.api.abi.call({ + abi: 'erc20:balanceOf', + target: balancerToken, + params: owner, + }) + )?.output; + const ratio = lpTokens / lpSupply; + const poolId = ( + await sdk.api.abi.call({ + abi: balancerTokenABI.find((n) => n.name == 'getPoolId'), + target: balancerToken, + }) + )?.output; + const vault = ( + await sdk.api.abi.call({ + abi: balancerTokenABI.find((n) => n.name == 'getVault'), + target: balancerToken, + }) + )?.output; + const pools = ( + await sdk.api.abi.call({ + abi: vaultABI.find((n) => n.name == 'getPoolTokens'), + target: vault, + params: poolId, + }) + )?.output; + pools.tokens.forEach((v, i) => { + liqLitPrice += + (prices[`${chain}:${v}`].price * (pools.balances[i] / 1e18)) / + (lpSupply / 1e18); + tvlUsd += + (pools.balances[i] / 1e18) * + prices[`${chain}:${v}`].price * + ratio * + liqRatio; + }); + + const balRate = ( + await sdk.api.abi.call({ + target: balVirtualPool[chain], + abi: virtualPoolABI.find((n) => n.name === 'rewardRate'), + chain: chain, + }) + )?.output; + const wethRate = ( + await sdk.api.abi.call({ + target: wethVirtualPool[chain], + abi: virtualPoolABI.find((n) => n.name === 'rewardRate'), + chain: chain, + }) + )?.output; + const olitRate = ( + await sdk.api.abi.call({ + target: litLiqStaker[chain], + abi: virtualPoolABI.find((n) => n.name === 'rewardRate'), + chain: chain, + }) + )?.output; + const liqrate = ( + await sdk.api.abi.call({ + target: viewHelper[chain], + abi: viewHelperABI.find((n) => n.name === 'convertLitToLiq'), + params: [olitRate], + chain: chain, + }) + )?.output; + + const balAmount = (balRate / 1e18) * 60 * 60 * 24 * 365; + const wethAmount = (wethRate / 1e18) * 60 * 60 * 24 * 365; + const olitAmount = (olitRate / 1e18) * 60 * 60 * 24 * 365; + const liqAmount = (liqrate / 1e18) * 60 * 60 * 24 * 365; + + const balUsd = balAmount * balPrice; + const wethUsd = wethAmount * wethPrice; + const olitUsd = olitAmount * olitprice; + const liqUsd = liqAmount * liqprice; + + const apyBase = ((balUsd + wethUsd) / liqLitPrice + olitUsd / tvlUsd) * 100; + const apyReward = (liqUsd / tvlUsd) * 100; + + return { + pool: liqLIT[chain], + chain: utils.formatChain(chain), + project: 'liquis', + symbol: 'LIQLIT', + tvlUsd, + apyBase, + apyReward, + rewardTokens: [liq[chain]], + underlyingTokens: [lit[chain], weth], + url: `https://www.liquis.app/liqlit`, + }; +}; + +const topLvl = async (chainString, url, timestamp) => { + try { + const [block, blockPrior] = await utils.getBlocks(chainString, timestamp, [ + url, + ]); + + let [ + dataNowSubgraph, + dataNow, + dataPriorSubgraph, + dataPrior, + { output: protocolFee }, + { output: inflationRate }, + { output: multiplier }, + ] = await Promise.all([ + request(url, query.replace('', block)), + sdk.api.abi.call({ + target: viewHelper[chainString], + abi: viewHelperABI.find((n) => n.name === 'getPools'), + params: [booster[chainString]], + chain: chainString, + block, + }), + request(url, queryPrior.replace('', blockPrior)), + sdk.api.abi.call({ + target: viewHelper[chainString], + abi: viewHelperABI.find((n) => n.name === 'getPools'), + params: [booster[chainString]], + chain: chainString, + block: blockPrior, + }), + sdk.api.abi.call({ + target: hub, + abi: hubABI.find((n) => n.name === 'protocolFee'), + chain: chainString, + }), + + admin[chainString] && + sdk.api.abi.call({ + target: admin[chainString], + abi: adminABI.find((n) => n.name === 'rate'), + chain: chainString, + }), + oracle[chainString] && + sdk.api.abi.call({ + target: oracle[chainString], + abi: oracleABI.find((n) => n.name === 'multiplier'), + chain: chainString, + }), + ]); + + dataNow = dataNow.output.map((b) => ({ + ...b, + ...dataNowSubgraph.bunniTokens.find( + (t) => t.address.toLowerCase() === b.lptoken.toLowerCase() + ), + })); + dataPrior = dataPrior.output.map((b) => ({ + ...b, + ...dataPriorSubgraph.pools.find( + (p) => p.address.toLowerCase() === b.uniV3Pool.toLowerCase() + ), + })); + + dataNow = dataNow + .filter((b) => !b.shutdown) + .filter((b) => b.token != liqLIT[chainString]); + dataPrior = dataPrior + .filter((b) => !b.shutdown) + .filter((b) => b.token != liqLIT[chainString]); + + protocolFee = protocolFee / 1e18; + inflationRate = inflationRate ? inflationRate / 1e18 : null; + multiplier = multiplier ? multiplier / 10000 : null; + + // create a list of unique tokens + let tokens = dataNow.reduce((tokens, b) => { + if (!tokens.includes(b.poolTokens[0])) tokens.push(b.poolTokens[0]); + if (!tokens.includes(b.poolTokens[1])) tokens.push(b.poolTokens[1]); + return tokens; + }, []); + + // add LIT to the token list (used for calculating oLIT price) + if (lit[chainString] && !tokens.includes(lit[chainString])) + tokens.push(lit[chainString]); + + // add LIQ to the token list + if (liq[chainString] && !tokens.includes(liq[chainString])) + tokens.push(liq[chainString]); + + // create of list of gauges + const gauges = dataNow.reduce((gauges, b) => { + if (b.gauge) gauges.push(b.gauge); + return gauges; + }, []); + + const week = 604800 * 1000; + const this_period_timestamp = (Math.floor(Date.now() / week) * week) / 1000; + + const [ + { output: veLITBalance }, + { output: veLITotalSupply }, + { output: tokenSymbols }, + { output: tokenDecimals }, + { output: poolTotalSupplies }, + { output: reserves }, + { output: shares }, + { output: gaugesWorkingSupply }, + { output: gaugesTotalSupply }, + { output: gaugesWorkingBalance }, + { output: gaugesUserLiquidity }, + { output: gaugesTokenlessProduction }, + { output: gaugesIsKilled }, + { output: gaugesRelativeWeight }, + { output: gaugesExists }, + ] = await Promise.all([ + sdk.api.abi.call({ + target: veLit[chainString], + abi: 'erc20:balanceOf', + params: [voterProxy[chainString]], + chain: chainString, + }), + sdk.api.abi.call({ + target: veLit[chainString], + abi: 'erc20:totalSupply', + chain: chainString, + }), + sdk.api.abi.multiCall({ + abi: 'erc20:symbol', + calls: tokens.map((token) => ({ target: token })), + chain: chainString, + }), + sdk.api.abi.multiCall({ + abi: 'erc20:decimals', + calls: tokens.map((token) => ({ target: token })), + chain: chainString, + }), + sdk.api.abi.multiCall({ + abi: 'erc20:totalSupply', + calls: dataNow.map((token) => ({ target: token.lptoken })), + chain: chainString, + }), + sdk.api.abi.multiCall({ + abi: lensABI.find((n) => n.name === 'getReserves'), + target: lens, + calls: dataNow.map((b) => ({ + params: [ + { pool: b.uniV3Pool, tickLower: b.ticks[0], tickUpper: b.ticks[1] }, + ], + })), + chain: chainString, + }), + sdk.api.abi.multiCall({ + abi: lensABI.find((n) => n.name === 'pricePerFullShare'), + target: lens, + calls: dataNow.map((b) => ({ + params: [ + { pool: b.uniV3Pool, tickLower: b.ticks[0], tickUpper: b.ticks[1] }, + ], + })), + chain: chainString, + }), + gauges.length && + sdk.api.abi.multiCall({ + abi: gaugeABI.find((n) => n.name === 'working_supply'), + calls: gauges.map((gauge) => ({ target: gauge })), + chain: chainString, + }), + gauges.length && + sdk.api.abi.multiCall({ + abi: gaugeABI.find((n) => n.name === 'totalSupply'), + calls: gauges.map((gauge) => ({ target: gauge })), + chain: chainString, + }), + gauges.length && + sdk.api.abi.multiCall({ + abi: gaugeABI.find((n) => n.name === 'working_balances'), + calls: gauges.map((gauge) => ({ + target: gauge, + params: [voterProxy[chainString]], + })), + chain: chainString, + }), + gauges.length && + sdk.api.abi.multiCall({ + abi: gaugeABI.find((n) => n.name === 'balanceOf'), + calls: gauges.map((gauge) => ({ + target: gauge, + params: [voterProxy[chainString]], + })), + chain: chainString, + }), + gauges.length && + sdk.api.abi.multiCall({ + abi: gaugeABI.find((n) => n.name === 'tokenless_production'), + calls: gauges.map((gauge) => ({ target: gauge })), + chain: chainString, + }), + gauges.length && + sdk.api.abi.multiCall({ + abi: gaugeABI.find((n) => n.name === 'is_killed'), + calls: gauges.map((gauge) => ({ target: gauge })), + chain: chainString, + }), + gauges.length && + sdk.api.abi.multiCall({ + abi: gaugeABI.find((n) => n.name === 'getCappedRelativeWeight'), + calls: gauges.map((gauge) => ({ + target: gauge, + params: [this_period_timestamp], + })), + chain: chainString, + }), + gauges.length && + sdk.api.abi.multiCall({ + abi: controllerABI.find((n) => n.name === 'gauge_exists'), + target: controller[chainString], + calls: gauges.map((gauge) => ({ params: [gauge] })), + chain: chainString, + }), + ]); + + // fetch token prices + const keys = tokens.map((token) => `${chainString}:${token}`).join(','); + const prices = ( + await superagent.get(`https://coins.llama.fi/prices/current/${keys}`) + ).body.coins; + + // calculate the price of oLIT + let optionPrice = 0; + if (lit[chainString]) { + const litPrice = prices[`${chainString}:${lit[chainString]}`] + ? prices[`${chainString}:${lit[chainString]}`].price + : 0; + optionPrice = litPrice * multiplier; + } + + const liqPrice = prices[`${chainString}:${liq[chainString]}`] + ? prices[`${chainString}:${liq[chainString]}`].price + : 0; + + let poolData = []; + poolData.push(liqLitPool(chainString, optionPrice, liqPrice)); + poolData = poolData.concat( + dataNow.map(async (b) => { + // reserve info + const reserve = reserves.find( + (r) => + r.input.params[0].pool == b.uniV3Pool && + r.input.params[0].tickLower == b.ticks[0] && + r.input.params[0].tickUpper == b.ticks[1] + ).output; + + // share info + const share = shares.find( + (s) => + s.input.params[0].pool == b.uniV3Pool && + s.input.params[0].tickLower == b.ticks[0] && + s.input.params[0].tickUpper == b.ticks[1] + ).output; + + // token0 info + const token0Decimals = tokenDecimals.find( + (d) => d.input.target == b.poolTokens[0] + ).output; + const token0Price = prices[`${chainString}:${b.poolTokens[0]}`] + ? prices[`${chainString}:${b.poolTokens[0]}`].price + : 0; + const token0Redeem = share.amount0 / Math.pow(10, token0Decimals); + const token0Reserve = reserve.reserve0 / Math.pow(10, token0Decimals); + const token0Symbol = tokenSymbols.find( + (s) => s.input.target == b.poolTokens[0] + ).output; + + // token1 info + const token1Decimals = tokenDecimals.find( + (d) => d.input.target == b.poolTokens[1] + ).output; + const token1Price = prices[`${chainString}:${b.poolTokens[1]}`] + ? prices[`${chainString}:${b.poolTokens[1]}`].price + : 0; + const token1Redeem = share.amount1 / Math.pow(10, token1Decimals); + const token1Reserve = reserve.reserve1 / Math.pow(10, token1Decimals); + const token1Symbol = tokenSymbols.find( + (s) => s.input.target == b.poolTokens[1] + ).output; + + // calculate swap fee apr + let baseApr = 0; + + const tickLower = parseInt(b.ticks[0]); + const tickUpper = parseInt(b.ticks[1]); + const tick = parseInt(b.pool.tick); + const poolTotalSupply = poolTotalSupplies.find( + (t) => t.input.target == b.lptoken + ).output; + let tvl = + poolTotalSupply == 0 + ? 0 + : (token0Reserve * token0Price + token1Reserve * token1Price) * + (b.totalSupply / b.liquidity); + + if (b.pool.liquidity > 0 && tickLower <= tick && tick <= tickUpper) { + const prior = dataPrior.find( + (d) => d.address.toLowerCase() === b.uniV3Pool.toLowerCase() + ); + + if (prior) { + const fee0 = + ((b.pool.totalFeesToken0 - prior.totalFeesToken0) / + Math.pow(10, token0Decimals)) * + token0Price; + const fee1 = + ((b.pool.totalFeesToken1 - prior.totalFeesToken1) / + Math.pow(10, token1Decimals)) * + token1Price; + const fee = Math.min(fee0, fee1) * 365; + + baseApr = + ((fee * parseInt(b.liquidity)) / + parseInt(b.pool.liquidity) / + (token0Reserve * token0Price + token1Reserve * token1Price)) * + (1 - protocolFee) * + 100; + } + } + + // calculate reward apr + let rewardApr = null; + let rewardTokens = null; + + if (b.gauge) { + const exists = gaugesExists.find( + (g) => g.input.params[0].toLowerCase() == b.gauge.toLowerCase() + )?.output; + const killed = gaugesIsKilled.find( + (g) => g.input.target.toLowerCase() == b.gauge.toLowerCase() + )?.output; + + // we only care about gauges that have been whitelisted and have not been killed + if (exists && !killed) { + const relativeWeight = + gaugesRelativeWeight.find( + (g) => g.input.target.toLowerCase() == b.gauge.toLowerCase() + )?.output / 1e18; + const tokenlessProduction = + gaugesTokenlessProduction.find( + (g) => g.input.target.toLowerCase() == b.gauge.toLowerCase() + )?.output / 1e18; + const workingSupply = + gaugesWorkingSupply.find( + (g) => g.input.target.toLowerCase() == b.gauge.toLowerCase() + )?.output / 1e18; + const workingBalance = + gaugesWorkingBalance.find( + (g) => g.input.target.toLowerCase() == b.gauge.toLowerCase() + )?.output / 1e18; + const totalSupply = + gaugesTotalSupply.find( + (g) => g.input.target.toLowerCase() == b.gauge.toLowerCase() + )?.output / 1e18; + const userLiquidity = + gaugesUserLiquidity.find( + (g) => g.input.target.toLowerCase() == b.gauge.toLowerCase() + )?.output / 1e18; + const veLitBalance = veLITBalance / 1e18; + const veLitTotalSupply = veLITotalSupply / 1e18; + const relativeInflation = inflationRate * relativeWeight; + + // we only care about gauges that receive rewards (ie those that receive votes) + if (relativeInflation > 0 && workingBalance > 0) { + const t = tokenlessProduction / 100; + const T = 1 - t; + const l = userLiquidity; + const L = + (b.liquidity / 1e18) * (veLitBalance / veLitTotalSupply); + const working_balance = Math.min(t * l + T * L, l); + + // calculate the working supply + const working_ratio = workingSupply / totalSupply; + const new_total_liquidity = b.liquidity / 1e18 - totalSupply; + const new_working_supply = working_ratio * new_total_liquidity; + + const working_supply = + workingSupply + + new_working_supply - + workingBalance + + working_balance; + if (working_supply > 0) { + const bunniPrice = + token0Redeem * token0Price + token1Redeem * token1Price; + + const userSupplyUsd = userLiquidity * bunniPrice; + const userAnnualReward = + ((relativeInflation * 86400 * 365) / working_supply) * + working_balance; + const userAnnualRewardUSD = userAnnualReward * optionPrice; + + const userAnnualLiqReward = ( + await sdk.api.abi.call({ + target: viewHelper[chainString], + abi: viewHelperABI.find( + (n) => n.name === 'convertLitToLiq' + ), + params: [userAnnualReward.toFixed(0)], + chain: chainString, + }) + )?.output; + const userAnnualLiqRewardUSD = userAnnualLiqReward * liqPrice; + + rewardApr = + (userAnnualRewardUSD / userSupplyUsd) * 100 * 0.75 + + (userAnnualLiqRewardUSD / userSupplyUsd) * 100; + rewardTokens = [olit[chainString], liq[chainString]]; + } + } + } + } + + return { + pool: b.token, + chain: utils.formatChain(chainString), + project: 'liquis', + symbol: `${token0Symbol}-${token1Symbol}`, + tvlUsd: tvl, + apyBase: apy(baseApr, 365), + ...(rewardApr && { apyReward: rewardApr }), + ...(rewardTokens && { rewardTokens: rewardTokens }), + underlyingTokens: [b.poolTokens[0], b.poolTokens[1]], + poolMeta: `${parseInt(b.pool.fee) / 10000}%, tickLower: ${ + b.ticks[0] + }, tickUpper: ${b.ticks[1]}`, + url: `https://www.liquis.app/stake/${b.crvRewards}`, + }; + }) + ); + + poolData = await Promise.all(poolData); + return poolData; + } catch (e) { + console.log(e); + return []; + } +}; + +const main = async (timestamp = null) => { + const data = []; + for (const [chain, url] of Object.entries(chains)) { + data.push(await topLvl(chain, url, timestamp)); + } + return data.flat().filter((p) => utils.keepFinite(p)); +}; + +module.exports = { + timetravel: false, + apy: main, + url: `https://www.liquis.app/stake`, +}; From 040b75f42609704fd742cc044e04e2edd251bde6 Mon Sep 17 00:00:00 2001 From: 0xtekgrinder <0xtekgrinder@protonmail.com> Date: Thu, 14 Sep 2023 11:07:11 -0400 Subject: [PATCH 2/6] fix: liqLIT apr is now calculated based on tvl --- src/adaptors/liquis/index.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/adaptors/liquis/index.js b/src/adaptors/liquis/index.js index e8a18965a2..eae1e6320a 100644 --- a/src/adaptors/liquis/index.js +++ b/src/adaptors/liquis/index.js @@ -135,7 +135,6 @@ const liqLitPool = async (chain, olitprice, liqprice) => { // Compute tvl let tvlUsd = 0; - let liqLitPrice = 0; const { output: veLitTotalSupply } = await sdk.api.erc20.totalSupply({ target: veLit[chain], }); @@ -177,9 +176,6 @@ const liqLitPool = async (chain, olitprice, liqprice) => { }) )?.output; pools.tokens.forEach((v, i) => { - liqLitPrice += - (prices[`${chain}:${v}`].price * (pools.balances[i] / 1e18)) / - (lpSupply / 1e18); tvlUsd += (pools.balances[i] / 1e18) * prices[`${chain}:${v}`].price * @@ -227,7 +223,7 @@ const liqLitPool = async (chain, olitprice, liqprice) => { const olitUsd = olitAmount * olitprice; const liqUsd = liqAmount * liqprice; - const apyBase = ((balUsd + wethUsd) / liqLitPrice + olitUsd / tvlUsd) * 100; + const apyBase = (balUsd / tvlUsd + wethUsd / tvlUsd + olitUsd / tvlUsd) * 100; const apyReward = (liqUsd / tvlUsd) * 100; return { From 0ac222b946c5f270c1a820ab0f76164f9bb57bfe Mon Sep 17 00:00:00 2001 From: 0xtekgrinder <0xtekgrinder@protonmail.com> Date: Thu, 14 Sep 2023 11:17:26 -0400 Subject: [PATCH 3/6] refactor: set oLit to apyReward --- src/adaptors/liquis/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/adaptors/liquis/index.js b/src/adaptors/liquis/index.js index eae1e6320a..2e4e229190 100644 --- a/src/adaptors/liquis/index.js +++ b/src/adaptors/liquis/index.js @@ -223,8 +223,8 @@ const liqLitPool = async (chain, olitprice, liqprice) => { const olitUsd = olitAmount * olitprice; const liqUsd = liqAmount * liqprice; - const apyBase = (balUsd / tvlUsd + wethUsd / tvlUsd + olitUsd / tvlUsd) * 100; - const apyReward = (liqUsd / tvlUsd) * 100; + const apyBase = (balUsd / tvlUsd + wethUsd / tvlUsd) * 100; + const apyReward = (liqUsd / tvlUsd + olitUsd / tvlUsd) * 100; return { pool: liqLIT[chain], From ca5c51440d73d2f2203e84c3d48b5d54a85002ee Mon Sep 17 00:00:00 2001 From: 0xtekgrinder <0xtekgrinder@protonmail.com> Date: Thu, 14 Sep 2023 12:27:56 -0400 Subject: [PATCH 4/6] feat: add oLit to rewardTokens --- src/adaptors/liquis/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/adaptors/liquis/index.js b/src/adaptors/liquis/index.js index 2e4e229190..68a83a60e6 100644 --- a/src/adaptors/liquis/index.js +++ b/src/adaptors/liquis/index.js @@ -234,7 +234,7 @@ const liqLitPool = async (chain, olitprice, liqprice) => { tvlUsd, apyBase, apyReward, - rewardTokens: [liq[chain]], + rewardTokens: [liq[chain], olit[chain]], underlyingTokens: [lit[chain], weth], url: `https://www.liquis.app/liqlit`, }; From 3f2bf1ebebb3a13c07eba6f80d088f783696f907 Mon Sep 17 00:00:00 2001 From: 0xtekgrinder <0xtekgrinder@protonmail.com> Date: Fri, 15 Sep 2023 13:15:07 -0400 Subject: [PATCH 5/6] fix: compute only the stakes liqLIT --- src/adaptors/liquis/index.js | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/adaptors/liquis/index.js b/src/adaptors/liquis/index.js index 68a83a60e6..07d1825548 100644 --- a/src/adaptors/liquis/index.js +++ b/src/adaptors/liquis/index.js @@ -9,6 +9,10 @@ const zeroAddress = '0x0000000000000000000000000000000000000000'; const weth = '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'; const bal = '0xba100000625a3754423978a60c9317c58a424e3D'; +const rewardPool = { + ethereum: '0x7Ea6930a9487ce8d039f7cC89432435E6D5AcB23', +}; + const lit80weth20 = { ethereum: '0x9232a548DD9E81BaC65500b5e0d918F8Ba93675C', }; @@ -135,14 +139,9 @@ const liqLitPool = async (chain, olitprice, liqprice) => { // Compute tvl let tvlUsd = 0; - const { output: veLitTotalSupply } = await sdk.api.erc20.totalSupply({ - target: veLit[chain], - }); - const { output: veBalance } = await sdk.api.erc20.balanceOf({ - target: veLit[chain], - owner: voterProxy[chain], + const { output: veBalance } = await sdk.api.erc20.totalSupply({ + target: rewardPool[chain], }); - const liqRatio = veBalance / veLitTotalSupply; const balancerToken = lit80weth20[chain]; const owner = veLit[chain]; const lpSupply = ( @@ -155,7 +154,6 @@ const liqLitPool = async (chain, olitprice, liqprice) => { params: owner, }) )?.output; - const ratio = lpTokens / lpSupply; const poolId = ( await sdk.api.abi.call({ abi: balancerTokenABI.find((n) => n.name == 'getPoolId'), @@ -177,10 +175,9 @@ const liqLitPool = async (chain, olitprice, liqprice) => { )?.output; pools.tokens.forEach((v, i) => { tvlUsd += - (pools.balances[i] / 1e18) * - prices[`${chain}:${v}`].price * - ratio * - liqRatio; + (pools.balances[i] / lpSupply) * + (veBalance / 1e18) * + prices[`${chain}:${v}`].price; }); const balRate = ( @@ -223,7 +220,7 @@ const liqLitPool = async (chain, olitprice, liqprice) => { const olitUsd = olitAmount * olitprice; const liqUsd = liqAmount * liqprice; - const apyBase = (balUsd / tvlUsd + wethUsd / tvlUsd) * 100; + const apyBase = (balUsd / tvlUsd + wethUsd / tvlUsd) * 100; const apyReward = (liqUsd / tvlUsd + olitUsd / tvlUsd) * 100; return { From 7682ba19f570ca0d9bc74a4447aebe958da17015 Mon Sep 17 00:00:00 2001 From: 0xtekgrinder <0xtekgrinder@protonmail.com> Date: Fri, 22 Sep 2023 16:00:37 -0400 Subject: [PATCH 6/6] fix: liquis LIQ APR now doesn't count fees of olit APR --- src/adaptors/liquis/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/adaptors/liquis/index.js b/src/adaptors/liquis/index.js index 07d1825548..a1e45c719f 100644 --- a/src/adaptors/liquis/index.js +++ b/src/adaptors/liquis/index.js @@ -641,7 +641,7 @@ const topLvl = async (chainString, url, timestamp) => { abi: viewHelperABI.find( (n) => n.name === 'convertLitToLiq' ), - params: [userAnnualReward.toFixed(0)], + params: [(userAnnualReward * 0.75).toFixed(0)], chain: chainString, }) )?.output;