diff --git a/src/adaptors/stellaswap-v3/abis/BeefyCLMStrategy.json b/src/adaptors/stellaswap-v3/abis/BeefyCLMStrategy.json new file mode 100644 index 0000000000..aea86eedb0 --- /dev/null +++ b/src/adaptors/stellaswap-v3/abis/BeefyCLMStrategy.json @@ -0,0 +1,938 @@ +[ + { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, + { + "inputs": [ + { "internalType": "address", "name": "target", "type": "address" } + ], + "name": "AddressEmptyCode", + "type": "error" + }, + { + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "AddressInsufficientBalance", + "type": "error" + }, + { "inputs": [], "name": "FailedInnerCall", "type": "error" }, + { "inputs": [], "name": "InvalidEntry", "type": "error" }, + { "inputs": [], "name": "InvalidInput", "type": "error" }, + { "inputs": [], "name": "InvalidOutput", "type": "error" }, + { "inputs": [], "name": "NotAuthorized", "type": "error" }, + { "inputs": [], "name": "NotCalm", "type": "error" }, + { "inputs": [], "name": "NotManager", "type": "error" }, + { "inputs": [], "name": "NotPool", "type": "error" }, + { "inputs": [], "name": "NotStrategist", "type": "error" }, + { "inputs": [], "name": "NotVault", "type": "error" }, + { "inputs": [], "name": "OverLimit", "type": "error" }, + { + "inputs": [ + { "internalType": "address", "name": "token", "type": "address" } + ], + "name": "SafeERC20FailedOperation", + "type": "error" + }, + { "inputs": [], "name": "StrategyPaused", "type": "error" }, + { "inputs": [], "name": "TooMuchSlippage", "type": "error" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "callFeeAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "beefyFeeAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "strategistFeeAmount", + "type": "uint256" + } + ], + "name": "ChargedFees", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "feeMain0", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "feeMain1", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "feeAlt0", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "feeAlt1", + "type": "uint256" + } + ], + "name": "ClaimedFees", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "fee0", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "fee1", + "type": "uint256" + } + ], + "name": "Harvest", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Paused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "int56", + "name": "maxTickDeviation", + "type": "int56" + } + ], + "name": "SetDeviation", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes", + "name": "path", + "type": "bytes" + } + ], + "name": "SetLpToken0ToNativePath", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes", + "name": "path", + "type": "bytes" + } + ], + "name": "SetLpToken1ToNativePath", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "int24", + "name": "oldWidth", + "type": "int24" + }, + { + "indexed": false, + "internalType": "int24", + "name": "width", + "type": "int24" + } + ], + "name": "SetPositionWidth", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "quoter", + "type": "address" + } + ], + "name": "SetQuoter", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "feeId", + "type": "uint256" + } + ], + "name": "SetStratFeeId", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "strategist", + "type": "address" + } + ], + "name": "SetStrategist", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint32", + "name": "oldInterval", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "interval", + "type": "uint32" + } + ], + "name": "SetTwapInterval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "unirouter", + "type": "address" + } + ], + "name": "SetUnirouter", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "bal0", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "bal1", + "type": "uint256" + } + ], + "name": "TVL", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Unpaused", + "type": "event" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "amount0", "type": "uint256" }, + { "internalType": "uint256", "name": "amount1", "type": "uint256" }, + { "internalType": "bytes", "name": "", "type": "bytes" } + ], + "name": "algebraMintCallback", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "balances", + "outputs": [ + { "internalType": "uint256", "name": "token0Bal", "type": "uint256" }, + { "internalType": "uint256", "name": "token1Bal", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "balancesOfPool", + "outputs": [ + { "internalType": "uint256", "name": "token0Bal", "type": "uint256" }, + { "internalType": "uint256", "name": "token1Bal", "type": "uint256" }, + { "internalType": "uint256", "name": "mainAmount0", "type": "uint256" }, + { "internalType": "uint256", "name": "mainAmount1", "type": "uint256" }, + { "internalType": "uint256", "name": "altAmount0", "type": "uint256" }, + { "internalType": "uint256", "name": "altAmount1", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "balancesOfThis", + "outputs": [ + { "internalType": "uint256", "name": "token0Bal", "type": "uint256" }, + { "internalType": "uint256", "name": "token1Bal", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "beefyFeeConfig", + "outputs": [ + { "internalType": "contract IFeeConfig", "name": "", "type": "address" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "beefyFeeRecipient", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "beforeAction", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "claimEarnings", + "outputs": [ + { "internalType": "uint256", "name": "fee0", "type": "uint256" }, + { "internalType": "uint256", "name": "fee1", "type": "uint256" }, + { "internalType": "uint256", "name": "feeAlt0", "type": "uint256" }, + { "internalType": "uint256", "name": "feeAlt1", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "currentTick", + "outputs": [{ "internalType": "int24", "name": "tick", "type": "int24" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "depositFee", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "factory", + "outputs": [ + { + "internalType": "contract IStrategyFactory", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "fees0", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "fees1", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAllFees", + "outputs": [ + { + "components": [ + { + "components": [ + { "internalType": "uint256", "name": "total", "type": "uint256" }, + { "internalType": "uint256", "name": "beefy", "type": "uint256" }, + { "internalType": "uint256", "name": "call", "type": "uint256" }, + { + "internalType": "uint256", + "name": "strategist", + "type": "uint256" + }, + { "internalType": "string", "name": "label", "type": "string" }, + { "internalType": "bool", "name": "active", "type": "bool" } + ], + "internalType": "struct IFeeConfig.FeeCategory", + "name": "performance", + "type": "tuple" + }, + { "internalType": "uint256", "name": "deposit", "type": "uint256" }, + { "internalType": "uint256", "name": "withdraw", "type": "uint256" } + ], + "internalType": "struct IFeeConfig.AllFees", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getKeys", + "outputs": [ + { "internalType": "bytes32", "name": "keyMain", "type": "bytes32" }, + { "internalType": "bytes32", "name": "keyAlt", "type": "bytes32" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getStratFeeId", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_callFeeRecipient", + "type": "address" + } + ], + "name": "harvest", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "harvest", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_pool", "type": "address" }, + { "internalType": "address", "name": "_quoter", "type": "address" }, + { "internalType": "int24", "name": "_positionWidth", "type": "int24" }, + { + "internalType": "bytes", + "name": "_lpToken0ToNativePath", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "_lpToken1ToNativePath", + "type": "bytes" + }, + { + "components": [ + { "internalType": "address", "name": "vault", "type": "address" }, + { "internalType": "address", "name": "unirouter", "type": "address" }, + { + "internalType": "address", + "name": "strategist", + "type": "address" + }, + { "internalType": "address", "name": "factory", "type": "address" } + ], + "internalType": "struct StratFeeManagerInitializable.CommonAddresses", + "name": "_commonAddresses", + "type": "tuple" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "isCalm", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "keeper", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lastHarvest", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lastPositionAdjustment", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lockedProfit", + "outputs": [ + { "internalType": "uint256", "name": "locked0", "type": "uint256" }, + { "internalType": "uint256", "name": "locked1", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lpToken0", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lpToken0ToNative", + "outputs": [ + { "internalType": "address[]", "name": "", "type": "address[]" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lpToken0ToNativePath", + "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lpToken0ToNativePrice", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "lpToken1", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lpToken1ToNative", + "outputs": [ + { "internalType": "address[]", "name": "", "type": "address[]" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lpToken1ToNativePath", + "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lpToken1ToNativePrice", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "maxTickDeviation", + "outputs": [{ "internalType": "int56", "name": "", "type": "int56" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "moveTicks", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "native", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_minAmount0", "type": "uint256" }, + { "internalType": "uint256", "name": "_minAmount1", "type": "uint256" } + ], + "name": "panic", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pool", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "positionAlt", + "outputs": [ + { "internalType": "int24", "name": "tickLower", "type": "int24" }, + { "internalType": "int24", "name": "tickUpper", "type": "int24" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "positionMain", + "outputs": [ + { "internalType": "int24", "name": "tickLower", "type": "int24" }, + { "internalType": "int24", "name": "tickUpper", "type": "int24" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "positionWidth", + "outputs": [{ "internalType": "int24", "name": "", "type": "int24" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "price", + "outputs": [ + { "internalType": "uint256", "name": "_price", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "quoter", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "range", + "outputs": [ + { "internalType": "uint256", "name": "lowerPrice", "type": "uint256" }, + { "internalType": "uint256", "name": "upperPrice", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "retireVault", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "int56", "name": "_maxDeviation", "type": "int56" } + ], + "name": "setDeviation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "bytes", "name": "_path", "type": "bytes" }], + "name": "setLpToken0ToNativePath", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "bytes", "name": "_path", "type": "bytes" }], + "name": "setLpToken1ToNativePath", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "int24", "name": "_width", "type": "int24" }], + "name": "setPositionWidth", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_feeId", "type": "uint256" } + ], + "name": "setStratFeeId", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_strategist", "type": "address" } + ], + "name": "setStrategist", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint32", "name": "_interval", "type": "uint32" } + ], + "name": "setTwapInterval", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_unirouter", "type": "address" } + ], + "name": "setUnirouter", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "sqrtPrice", + "outputs": [ + { "internalType": "uint160", "name": "sqrtPriceX96", "type": "uint160" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "strategist", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "swapFee", + "outputs": [ + { "internalType": "uint256", "name": "fee", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalLocked0", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalLocked1", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "newOwner", "type": "address" } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "twap", + "outputs": [ + { "internalType": "int56", "name": "twapTick", "type": "int56" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "twapInterval", + "outputs": [{ "internalType": "uint32", "name": "", "type": "uint32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "unirouter", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "unpause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "vault", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_amount0", "type": "uint256" }, + { "internalType": "uint256", "name": "_amount1", "type": "uint256" } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "withdrawFee", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + } +] diff --git a/src/adaptors/stellaswap-v3/abis/BeefyCLMVault.json b/src/adaptors/stellaswap-v3/abis/BeefyCLMVault.json new file mode 100644 index 0000000000..1b0649ed0e --- /dev/null +++ b/src/adaptors/stellaswap-v3/abis/BeefyCLMVault.json @@ -0,0 +1,479 @@ +[ + { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, + { "inputs": [], "name": "NoShares", "type": "error" }, + { "inputs": [], "name": "NotEnoughTokens", "type": "error" }, + { "inputs": [], "name": "TooMuchSlippage", "type": "error" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "fee0", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "fee1", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "EIP712DomainChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "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" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + } + ], + "name": "Withdraw", + "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": "balances", + "outputs": [ + { "internalType": "uint256", "name": "amount0", "type": "uint256" }, + { "internalType": "uint256", "name": "amount1", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_amount0", "type": "uint256" }, + { "internalType": "uint256", "name": "_amount1", "type": "uint256" }, + { "internalType": "uint256", "name": "_minShares", "type": "uint256" } + ], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "eip712Domain", + "outputs": [ + { "internalType": "bytes1", "name": "fields", "type": "bytes1" }, + { "internalType": "string", "name": "name", "type": "string" }, + { "internalType": "string", "name": "version", "type": "string" }, + { "internalType": "uint256", "name": "chainId", "type": "uint256" }, + { + "internalType": "address", + "name": "verifyingContract", + "type": "address" + }, + { "internalType": "bytes32", "name": "salt", "type": "bytes32" }, + { "internalType": "uint256[]", "name": "extensions", "type": "uint256[]" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_token", "type": "address" } + ], + "name": "inCaseTokensGetStuck", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "addedValue", "type": "uint256" } + ], + "name": "increaseAllowance", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_strategy", "type": "address" }, + { "internalType": "string", "name": "_name", "type": "string" }, + { "internalType": "string", "name": "_symbol", "type": "string" } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "isCalm", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" } + ], + "name": "nonces", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" }, + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "value", "type": "uint256" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "name": "permit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_amount0", "type": "uint256" }, + { "internalType": "uint256", "name": "_amount1", "type": "uint256" } + ], + "name": "previewDeposit", + "outputs": [ + { "internalType": "uint256", "name": "shares", "type": "uint256" }, + { "internalType": "uint256", "name": "amount0", "type": "uint256" }, + { "internalType": "uint256", "name": "amount1", "type": "uint256" }, + { "internalType": "uint256", "name": "fee0", "type": "uint256" }, + { "internalType": "uint256", "name": "fee1", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_shares", "type": "uint256" } + ], + "name": "previewWithdraw", + "outputs": [ + { "internalType": "uint256", "name": "amount0", "type": "uint256" }, + { "internalType": "uint256", "name": "amount1", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "strategy", + "outputs": [ + { + "internalType": "contract IStrategyConcLiq", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "swapFee", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transfer", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "from", "type": "address" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transferFrom", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "newOwner", "type": "address" } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "want", + "outputs": [ + { "internalType": "address", "name": "_want", "type": "address" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "wants", + "outputs": [ + { "internalType": "address", "name": "token0", "type": "address" }, + { "internalType": "address", "name": "token1", "type": "address" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_shares", "type": "uint256" }, + { "internalType": "uint256", "name": "_minAmount0", "type": "uint256" }, + { "internalType": "uint256", "name": "_minAmount1", "type": "uint256" } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_minAmount0", "type": "uint256" }, + { "internalType": "uint256", "name": "_minAmount1", "type": "uint256" } + ], + "name": "withdrawAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/src/adaptors/stellaswap-v3/abis/OffchainRewarder.json b/src/adaptors/stellaswap-v3/abis/OffchainRewarder.json new file mode 100644 index 0000000000..a83e04b0cc --- /dev/null +++ b/src/adaptors/stellaswap-v3/abis/OffchainRewarder.json @@ -0,0 +1,537 @@ +[ + { "inputs": [], "name": "InvalidLengths", "type": "error" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isNative", + "type": "bool" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "startTimestamp", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "endTimestamp", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "rewardPerSec", + "type": "uint256" + } + ], + "name": "AddRewardInfo", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Claimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Recovered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes32", + "name": "merkleRoot", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "string", + "name": "ipfsHash", + "type": "string" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "rewardTime", + "type": "uint256" + } + ], + "name": "TreeUpdated", + "type": "event" + }, + { + "inputs": [], + "name": "EPOCH_DURATION", + "outputs": [{ "internalType": "uint32", "name": "", "type": "uint32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "REWARD_REGISTRY", + "outputs": [ + { + "internalType": "contract IRewardRegistry", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint32", "name": "startTimestamp", "type": "uint32" }, + { "internalType": "uint32", "name": "endTimestamp", "type": "uint32" } + ], + "name": "_getRewardsBetweenTimestamps", + "outputs": [ + { + "components": [ + { + "internalType": "contract IERC20", + "name": "token", + "type": "address" + }, + { "internalType": "bool", "name": "isNative", "type": "bool" }, + { + "internalType": "uint32", + "name": "startTimestamp", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "endTimestamp", + "type": "uint32" + }, + { + "internalType": "uint256", + "name": "rewardPerSec", + "type": "uint256" + } + ], + "internalType": "struct RewarderV2.RewardInfo[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "contract IERC20", "name": "token", "type": "address" }, + { "internalType": "bool", "name": "_isNative", "type": "bool" }, + { "internalType": "uint32", "name": "_startTimestamp", "type": "uint32" }, + { "internalType": "uint32", "name": "_endTimestamp", "type": "uint32" }, + { "internalType": "uint256", "name": "_rewardPerSec", "type": "uint256" } + ], + "name": "addRewardInfo", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address[]", "name": "users", "type": "address[]" }, + { "internalType": "address[]", "name": "tokens", "type": "address[]" }, + { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" }, + { "internalType": "bool[]", "name": "isNative", "type": "bool[]" }, + { "internalType": "bytes32[][]", "name": "proofs", "type": "bytes32[][]" } + ], + "name": "claim", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "", "type": "address" }, + { "internalType": "address", "name": "", "type": "address" } + ], + "name": "claimed", + "outputs": [ + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { "internalType": "uint48", "name": "timestamp", "type": "uint48" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getActiveRewards", + "outputs": [ + { + "components": [ + { + "internalType": "contract IERC20", + "name": "token", + "type": "address" + }, + { "internalType": "bool", "name": "isNative", "type": "bool" }, + { + "internalType": "uint32", + "name": "startTimestamp", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "endTimestamp", + "type": "uint32" + }, + { + "internalType": "uint256", + "name": "rewardPerSec", + "type": "uint256" + } + ], + "internalType": "struct RewarderV2.RewardInfo[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMerkleRoot", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getRewardForNextEpoch", + "outputs": [ + { + "components": [ + { + "internalType": "contract IERC20", + "name": "token", + "type": "address" + }, + { "internalType": "bool", "name": "isNative", "type": "bool" }, + { + "internalType": "uint32", + "name": "startTimestamp", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "endTimestamp", + "type": "uint32" + }, + { + "internalType": "uint256", + "name": "rewardPerSec", + "type": "uint256" + } + ], + "internalType": "struct RewarderV2.RewardInfo[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint32", "name": "epoch", "type": "uint32" }], + "name": "getRewardForTimestamp", + "outputs": [ + { + "components": [ + { + "internalType": "contract IERC20", + "name": "token", + "type": "address" + }, + { "internalType": "bool", "name": "isNative", "type": "bool" }, + { + "internalType": "uint32", + "name": "startTimestamp", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "endTimestamp", + "type": "uint32" + }, + { + "internalType": "uint256", + "name": "rewardPerSec", + "type": "uint256" + } + ], + "internalType": "struct RewarderV2.RewardInfo[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint32", "name": "startTimestamp", "type": "uint32" } + ], + "name": "getRewardsAfterEpoch", + "outputs": [ + { + "components": [ + { + "internalType": "contract IERC20", + "name": "token", + "type": "address" + }, + { "internalType": "bool", "name": "isNative", "type": "bool" }, + { + "internalType": "uint32", + "name": "startTimestamp", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "endTimestamp", + "type": "uint32" + }, + { + "internalType": "uint256", + "name": "rewardPerSec", + "type": "uint256" + } + ], + "internalType": "struct RewarderV2.RewardInfo[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint32", "name": "startTimestamp", "type": "uint32" }, + { "internalType": "uint32", "name": "endTimestamp", "type": "uint32" } + ], + "name": "getRewardsBetweenEpochs", + "outputs": [ + { + "components": [ + { + "internalType": "contract IERC20", + "name": "token", + "type": "address" + }, + { "internalType": "bool", "name": "isNative", "type": "bool" }, + { + "internalType": "uint32", + "name": "startTimestamp", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "endTimestamp", + "type": "uint32" + }, + { + "internalType": "uint256", + "name": "rewardPerSec", + "type": "uint256" + } + ], + "internalType": "struct RewarderV2.RewardInfo[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint32", "name": "timestamp", "type": "uint32" } + ], + "name": "getRoundedTimestamp", + "outputs": [{ "internalType": "uint32", "name": "", "type": "uint32" }], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IRewardRegistry", + "name": "_registry", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "lastRewardTimestamp", + "outputs": [{ "internalType": "uint32", "name": "", "type": "uint32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lastRewardUpdateTime", + "outputs": [{ "internalType": "uint32", "name": "", "type": "uint32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lastTree", + "outputs": [ + { "internalType": "bytes32", "name": "merkleRoot", "type": "bytes32" }, + { "internalType": "string", "name": "ipfsHash", "type": "string" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lastTreeUpdate", + "outputs": [{ "internalType": "uint48", "name": "", "type": "uint48" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_token", "type": "address" }, + { "internalType": "address", "name": "_to", "type": "address" }, + { "internalType": "uint256", "name": "_amount", "type": "uint256" }, + { "internalType": "bool", "name": "isNative", "type": "bool" } + ], + "name": "recover", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "reportPeriodElapsed", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "name": "rewardInfo", + "outputs": [ + { "internalType": "contract IERC20", "name": "token", "type": "address" }, + { "internalType": "bool", "name": "isNative", "type": "bool" }, + { "internalType": "uint32", "name": "startTimestamp", "type": "uint32" }, + { "internalType": "uint32", "name": "endTimestamp", "type": "uint32" }, + { "internalType": "uint256", "name": "rewardPerSec", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardInfoLength", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardStartTime", + "outputs": [{ "internalType": "uint32", "name": "", "type": "uint32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "tree", + "outputs": [ + { "internalType": "bytes32", "name": "merkleRoot", "type": "bytes32" }, + { "internalType": "string", "name": "ipfsHash", "type": "string" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "_merkleRoot", "type": "bytes32" }, + { "internalType": "string", "name": "_ipfsHash", "type": "string" } + ], + "name": "updateTree", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/src/adaptors/stellaswap-v3/abis/OffchainRewarderRegistry.json b/src/adaptors/stellaswap-v3/abis/OffchainRewarderRegistry.json new file mode 100644 index 0000000000..792741add7 --- /dev/null +++ b/src/adaptors/stellaswap-v3/abis/OffchainRewarderRegistry.json @@ -0,0 +1,661 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "poolAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "rewarder", + "type": "address" + } + ], + "name": "PoolAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "inputs": [], + "name": "ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "OPERATOR_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TRUSTED_UPDATER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "poolAddress", + "type": "address" + }, + { + "internalType": "contract IRewarder", + "name": "rewarder", + "type": "address" + } + ], + "name": "addPool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "positionManager", + "type": "string" + } + ], + "name": "addPositionManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "poolId", + "type": "uint256" + } + ], + "name": "getPoolAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPoolCount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "poolAddress", + "type": "address" + } + ], + "name": "getPoolId", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "poolAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "positionManagerId", + "type": "uint256" + } + ], + "name": "getPoolPMVaultByAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "poolId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "positionManagerId", + "type": "uint256" + } + ], + "name": "getPoolPMVaultById", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "poolId", + "type": "uint256" + } + ], + "name": "getPoolRewarder", + "outputs": [ + { + "internalType": "contract IRewarder", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "positionManagerId", + "type": "uint256" + } + ], + "name": "getPositionManager", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPositionManagerCount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + } + ], + "name": "isOperator", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "poolId", + "type": "uint256" + } + ], + "name": "isPoolPaused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + } + ], + "name": "isTrutedUpdater", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "poolId", + "type": "uint256" + } + ], + "name": "pausePool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "poolPositionManagers", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "pools", + "outputs": [ + { + "internalType": "address", + "name": "pool", + "type": "address" + }, + { + "internalType": "contract IRewarder", + "name": "rewarder", + "type": "address" + }, + { + "internalType": "bool", + "name": "isPaused", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "positionManagers", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "poolAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "positionManagerId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "vaultAddress", + "type": "address" + } + ], + "name": "setPoolPositionManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "poolId", + "type": "uint256" + }, + { + "internalType": "contract IRewarder", + "name": "rewarder", + "type": "address" + } + ], + "name": "setPoolRewarder", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "poolId", + "type": "uint256" + } + ], + "name": "unpausePool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] \ No newline at end of file diff --git a/src/adaptors/stellaswap-v3/abis/eternal-virtual-pool.json b/src/adaptors/stellaswap-v3/abis/eternal-virtual-pool.json new file mode 100644 index 0000000000..72d32d5344 --- /dev/null +++ b/src/adaptors/stellaswap-v3/abis/eternal-virtual-pool.json @@ -0,0 +1,418 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "_farmingCenterAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "_farmingAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "_pool", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "token0Amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "token1Amount", + "type": "uint256" + } + ], + "name": "addRewards", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "currentTimestamp", + "type": "uint32" + }, + { + "internalType": "int24", + "name": "bottomTick", + "type": "int24" + }, + { + "internalType": "int24", + "name": "topTick", + "type": "int24" + }, + { + "internalType": "int128", + "name": "liquidityDelta", + "type": "int128" + }, + { + "internalType": "int24", + "name": "currentTick", + "type": "int24" + } + ], + "name": "applyLiquidityDeltaToPosition", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int24", + "name": "nextTick", + "type": "int24" + }, + { + "internalType": "bool", + "name": "zeroToOne", + "type": "bool" + } + ], + "name": "cross", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "currentLiquidity", + "outputs": [ + { + "internalType": "uint128", + "name": "", + "type": "uint128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "farmingAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "farmingCenterAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int24", + "name": "bottomTick", + "type": "int24" + }, + { + "internalType": "int24", + "name": "topTick", + "type": "int24" + } + ], + "name": "getInnerRewardsGrowth", + "outputs": [ + { + "internalType": "uint256", + "name": "rewardGrowthInside0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rewardGrowthInside1", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int24", + "name": "bottomTick", + "type": "int24" + }, + { + "internalType": "int24", + "name": "topTick", + "type": "int24" + } + ], + "name": "getInnerSecondsPerLiquidity", + "outputs": [ + { + "internalType": "uint160", + "name": "innerSecondsSpentPerLiquidity", + "type": "uint160" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "globalSecondsPerLiquidityCumulative", + "outputs": [ + { + "internalType": "uint160", + "name": "", + "type": "uint160" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "globalTick", + "outputs": [ + { + "internalType": "int24", + "name": "", + "type": "int24" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "currentTimestamp", + "type": "uint32" + } + ], + "name": "increaseCumulative", + "outputs": [ + { + "internalType": "enum IAlgebraVirtualPool.Status", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "pool", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "prevTimestamp", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardRate0", + "outputs": [ + { + "internalType": "uint128", + "name": "", + "type": "uint128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardRate1", + "outputs": [ + { + "internalType": "uint128", + "name": "", + "type": "uint128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardReserve0", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardReserve1", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint128", + "name": "rate0", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "rate1", + "type": "uint128" + } + ], + "name": "setRates", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int24", + "name": "", + "type": "int24" + } + ], + "name": "ticks", + "outputs": [ + { + "internalType": "uint128", + "name": "liquidityTotal", + "type": "uint128" + }, + { + "internalType": "int128", + "name": "liquidityDelta", + "type": "int128" + }, + { + "internalType": "uint256", + "name": "outerFeeGrowth0Token", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "outerFeeGrowth1Token", + "type": "uint256" + }, + { + "internalType": "int56", + "name": "outerTickCumulative", + "type": "int56" + }, + { + "internalType": "uint160", + "name": "outerSecondsPerLiquidity", + "type": "uint160" + }, + { + "internalType": "uint32", + "name": "outerSecondsSpent", + "type": "uint32" + }, + { + "internalType": "bool", + "name": "initialized", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "timeOutside", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalRewardGrowth0", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalRewardGrowth1", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } + ] \ No newline at end of file diff --git a/src/adaptors/stellaswap-v3/abis/farming-center.json b/src/adaptors/stellaswap-v3/abis/farming-center.json new file mode 100644 index 0000000000..38cceb858b --- /dev/null +++ b/src/adaptors/stellaswap-v3/abis/farming-center.json @@ -0,0 +1,1092 @@ +[ + { + "inputs": [ + { + "internalType": "contract IAlgebraLimitFarming", + "name": "_limitFarming", + "type": "address" + }, + { + "internalType": "contract IAlgebraEternalFarming", + "name": "_eternalFarming", + "type": "address" + }, + { + "internalType": "contract INonfungiblePositionManager", + "name": "_nonfungiblePositionManager", + "type": "address" + }, + { + "internalType": "contract IFarmingCenterVault", + "name": "_farmingCenterVault", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "oldOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "DepositTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PERMIT_TYPEHASH", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "WNativeToken", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "baseURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20Minimal", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amountRequestedIncentive", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountRequestedEternal", + "type": "uint256" + } + ], + "name": "claimReward", + "outputs": [ + { + "internalType": "uint256", + "name": "reward", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint128", + "name": "amount0Max", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "amount1Max", + "type": "uint128" + } + ], + "internalType": "struct INonfungiblePositionManager.CollectParams", + "name": "params", + "type": "tuple" + } + ], + "name": "collect", + "outputs": [ + { + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "contract IERC20Minimal", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "contract IERC20Minimal", + "name": "bonusRewardToken", + "type": "address" + }, + { + "internalType": "contract IAlgebraPool", + "name": "pool", + "type": "address" + }, + { + "internalType": "uint256", + "name": "startTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "endTime", + "type": "uint256" + } + ], + "internalType": "struct IIncentiveKey.IncentiveKey", + "name": "key", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "collectRewards", + "outputs": [ + { + "internalType": "uint256", + "name": "reward", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "bonusReward", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IAlgebraPool", + "name": "pool", + "type": "address" + }, + { + "internalType": "address", + "name": "newVirtualPool", + "type": "address" + } + ], + "name": "connectVirtualPool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int24", + "name": "nextTick", + "type": "int24" + }, + { + "internalType": "bool", + "name": "zeroToOne", + "type": "bool" + } + ], + "name": "cross", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "deposits", + "outputs": [ + { + "internalType": "uint256", + "name": "L2TokenId", + "type": "uint256" + }, + { + "internalType": "uint32", + "name": "numberOfFarms", + "type": "uint32" + }, + { + "internalType": "bool", + "name": "inLimitFarming", + "type": "bool" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "contract IERC20Minimal", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "contract IERC20Minimal", + "name": "bonusRewardToken", + "type": "address" + }, + { + "internalType": "contract IAlgebraPool", + "name": "pool", + "type": "address" + }, + { + "internalType": "uint256", + "name": "startTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "endTime", + "type": "uint256" + } + ], + "internalType": "struct IIncentiveKey.IncentiveKey", + "name": "key", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokensLocked", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isLimit", + "type": "bool" + } + ], + "name": "enterFarming", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "eternalFarming", + "outputs": [ + { + "internalType": "contract IAlgebraEternalFarming", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "contract IERC20Minimal", + "name": "rewardToken", + "type": "address" + }, + { + "internalType": "contract IERC20Minimal", + "name": "bonusRewardToken", + "type": "address" + }, + { + "internalType": "contract IAlgebraPool", + "name": "pool", + "type": "address" + }, + { + "internalType": "uint256", + "name": "startTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "endTime", + "type": "uint256" + } + ], + "internalType": "struct IIncentiveKey.IncentiveKey", + "name": "key", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isLimit", + "type": "bool" + } + ], + "name": "exitFarming", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "farmingCenterVault", + "outputs": [ + { + "internalType": "contract IFarmingCenterVault", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "blockTimestamp", + "type": "uint32" + } + ], + "name": "increaseCumulative", + "outputs": [ + { + "internalType": "enum IAlgebraVirtualPool.Status", + "name": "status", + "type": "uint8" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "l2Nfts", + "outputs": [ + { + "internalType": "uint96", + "name": "nonce", + "type": "uint96" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "limitFarming", + "outputs": [ + { + "internalType": "contract IAlgebraLimitFarming", + "name": "", + "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": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nonfungiblePositionManager", + "outputs": [ + { + "internalType": "contract INonfungiblePositionManager", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "onERC721Received", + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "permit", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "refundNativeToken", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amountMinimum", + "type": "uint256" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + } + ], + "name": "sweepToken", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "tokenByIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "tokenOfOwnerByIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "tokenURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amountMinimum", + "type": "uint256" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + } + ], + "name": "unwrapWNativeToken", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "pool", + "type": "address" + } + ], + "name": "virtualPoolAddresses", + "outputs": [ + { + "internalType": "address", + "name": "limitVP", + "type": "address" + }, + { + "internalType": "address", + "name": "eternalVP", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "withdrawToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } +] diff --git a/src/adaptors/stellaswap-v3/abis/nftPositionManager.json b/src/adaptors/stellaswap-v3/abis/nftPositionManager.json new file mode 100644 index 0000000000..68b82072f3 --- /dev/null +++ b/src/adaptors/stellaswap-v3/abis/nftPositionManager.json @@ -0,0 +1,1236 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "_factory", + "type": "address" + }, + { + "internalType": "address", + "name": "_WNativeToken", + "type": "address" + }, + { + "internalType": "address", + "name": "_tokenDescriptor_", + "type": "address" + }, + { + "internalType": "address", + "name": "_poolDeployer", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + } + ], + "name": "Collect", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "liquidity", + "type": "uint128" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + } + ], + "name": "DecreaseLiquidity", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "liquidity", + "type": "uint128" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "actualLiquidity", + "type": "uint128" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "pool", + "type": "address" + } + ], + "name": "IncreaseLiquidity", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PERMIT_TYPEHASH", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "WNativeToken", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount0Owed", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1Owed", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "algebraMintCallback", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "baseURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint128", + "name": "amount0Max", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "amount1Max", + "type": "uint128" + } + ], + "internalType": "struct INonfungiblePositionManager.CollectParams", + "name": "params", + "type": "tuple" + } + ], + "name": "collect", + "outputs": [ + { + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token0", + "type": "address" + }, + { + "internalType": "address", + "name": "token1", + "type": "address" + }, + { + "internalType": "uint160", + "name": "sqrtPriceX96", + "type": "uint160" + } + ], + "name": "createAndInitializePoolIfNecessary", + "outputs": [ + { + "internalType": "address", + "name": "pool", + "type": "address" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint128", + "name": "liquidity", + "type": "uint128" + }, + { + "internalType": "uint256", + "name": "amount0Min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1Min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + } + ], + "internalType": "struct INonfungiblePositionManager.DecreaseLiquidityParams", + "name": "params", + "type": "tuple" + } + ], + "name": "decreaseLiquidity", + "outputs": [ + { + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "factory", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount0Desired", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1Desired", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount0Min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1Min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + } + ], + "internalType": "struct INonfungiblePositionManager.IncreaseLiquidityParams", + "name": "params", + "type": "tuple" + } + ], + "name": "increaseLiquidity", + "outputs": [ + { + "internalType": "uint128", + "name": "liquidity", + "type": "uint128" + }, + { + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "token0", + "type": "address" + }, + { + "internalType": "address", + "name": "token1", + "type": "address" + }, + { + "internalType": "int24", + "name": "tickLower", + "type": "int24" + }, + { + "internalType": "int24", + "name": "tickUpper", + "type": "int24" + }, + { + "internalType": "uint256", + "name": "amount0Desired", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1Desired", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount0Min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1Min", + "type": "uint256" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + } + ], + "internalType": "struct INonfungiblePositionManager.MintParams", + "name": "params", + "type": "tuple" + } + ], + "name": "mint", + "outputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint128", + "name": "liquidity", + "type": "uint128" + }, + { + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "multicall", + "outputs": [ + { + "internalType": "bytes[]", + "name": "results", + "type": "bytes[]" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "permit", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "poolDeployer", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "positions", + "outputs": [ + { + "internalType": "uint96", + "name": "nonce", + "type": "uint96" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "address", + "name": "token0", + "type": "address" + }, + { + "internalType": "address", + "name": "token1", + "type": "address" + }, + { + "internalType": "int24", + "name": "tickLower", + "type": "int24" + }, + { + "internalType": "int24", + "name": "tickUpper", + "type": "int24" + }, + { + "internalType": "uint128", + "name": "liquidity", + "type": "uint128" + }, + { + "internalType": "uint256", + "name": "feeGrowthInside0LastX128", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "feeGrowthInside1LastX128", + "type": "uint256" + }, + { + "internalType": "uint128", + "name": "tokensOwed0", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "tokensOwed1", + "type": "uint128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "refundNativeToken", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "selfPermit", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "selfPermitAllowed", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "selfPermitAllowedIfNecessary", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "selfPermitIfNecessary", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amountMinimum", + "type": "uint256" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + } + ], + "name": "sweepToken", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "tokenByIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "tokenOfOwnerByIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "tokenURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amountMinimum", + "type": "uint256" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + } + ], + "name": "unwrapWNativeToken", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } +] \ No newline at end of file diff --git a/src/adaptors/stellaswap-v3/abis/pool.json b/src/adaptors/stellaswap-v3/abis/pool.json new file mode 100644 index 0000000000..d58fe64552 --- /dev/null +++ b/src/adaptors/stellaswap-v3/abis/pool.json @@ -0,0 +1,1041 @@ +[ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "int24", + "name": "bottomTick", + "type": "int24" + }, + { + "indexed": true, + "internalType": "int24", + "name": "topTick", + "type": "int24" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "liquidityAmount", + "type": "uint128" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + } + ], + "name": "Burn", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": true, + "internalType": "int24", + "name": "bottomTick", + "type": "int24" + }, + { + "indexed": true, + "internalType": "int24", + "name": "topTick", + "type": "int24" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "amount0", + "type": "uint128" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "amount1", + "type": "uint128" + } + ], + "name": "Collect", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "communityFee0New", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "communityFee1New", + "type": "uint8" + } + ], + "name": "CommunityFee", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "fee", + "type": "uint16" + } + ], + "name": "Fee", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "paid0", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "paid1", + "type": "uint256" + } + ], + "name": "Flash", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "virtualPoolAddress", + "type": "address" + } + ], + "name": "Incentive", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint160", + "name": "price", + "type": "uint160" + }, + { + "indexed": false, + "internalType": "int24", + "name": "tick", + "type": "int24" + } + ], + "name": "Initialize", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint32", + "name": "liquidityCooldown", + "type": "uint32" + } + ], + "name": "LiquidityCooldown", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "int24", + "name": "bottomTick", + "type": "int24" + }, + { + "indexed": true, + "internalType": "int24", + "name": "topTick", + "type": "int24" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "liquidityAmount", + "type": "uint128" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + } + ], + "name": "Mint", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": false, + "internalType": "int256", + "name": "amount0", + "type": "int256" + }, + { + "indexed": false, + "internalType": "int256", + "name": "amount1", + "type": "int256" + }, + { + "indexed": false, + "internalType": "uint160", + "name": "price", + "type": "uint160" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "liquidity", + "type": "uint128" + }, + { + "indexed": false, + "internalType": "int24", + "name": "tick", + "type": "int24" + } + ], + "name": "Swap", + "type": "event" + }, + { + "inputs": [], + "name": "activeIncentive", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int24", + "name": "bottomTick", + "type": "int24" + }, + { + "internalType": "int24", + "name": "topTick", + "type": "int24" + }, + { + "internalType": "uint128", + "name": "amount", + "type": "uint128" + } + ], + "name": "burn", + "outputs": [ + { + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "int24", + "name": "bottomTick", + "type": "int24" + }, + { + "internalType": "int24", + "name": "topTick", + "type": "int24" + }, + { + "internalType": "uint128", + "name": "amount0Requested", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "amount1Requested", + "type": "uint128" + } + ], + "name": "collect", + "outputs": [ + { + "internalType": "uint128", + "name": "amount0", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "amount1", + "type": "uint128" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "dataStorageOperator", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "factory", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "flash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int24", + "name": "bottomTick", + "type": "int24" + }, + { + "internalType": "int24", + "name": "topTick", + "type": "int24" + } + ], + "name": "getInnerCumulatives", + "outputs": [ + { + "internalType": "int56", + "name": "innerTickCumulative", + "type": "int56" + }, + { + "internalType": "uint160", + "name": "innerSecondsSpentPerLiquidity", + "type": "uint160" + }, + { + "internalType": "uint32", + "name": "innerSecondsSpent", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32[]", + "name": "secondsAgos", + "type": "uint32[]" + } + ], + "name": "getTimepoints", + "outputs": [ + { + "internalType": "int56[]", + "name": "tickCumulatives", + "type": "int56[]" + }, + { + "internalType": "uint160[]", + "name": "secondsPerLiquidityCumulatives", + "type": "uint160[]" + }, + { + "internalType": "uint112[]", + "name": "volatilityCumulatives", + "type": "uint112[]" + }, + { + "internalType": "uint256[]", + "name": "volumePerAvgLiquiditys", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "globalState", + "outputs": [ + { + "internalType": "uint160", + "name": "price", + "type": "uint160" + }, + { + "internalType": "int24", + "name": "tick", + "type": "int24" + }, + { + "internalType": "uint16", + "name": "fee", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "timepointIndex", + "type": "uint16" + }, + { + "internalType": "uint8", + "name": "communityFeeToken0", + "type": "uint8" + }, + { + "internalType": "uint8", + "name": "communityFeeToken1", + "type": "uint8" + }, + { + "internalType": "bool", + "name": "unlocked", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint160", + "name": "initialPrice", + "type": "uint160" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "liquidity", + "outputs": [ + { + "internalType": "uint128", + "name": "", + "type": "uint128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "liquidityCooldown", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxLiquidityPerTick", + "outputs": [ + { + "internalType": "uint128", + "name": "", + "type": "uint128" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "int24", + "name": "bottomTick", + "type": "int24" + }, + { + "internalType": "int24", + "name": "topTick", + "type": "int24" + }, + { + "internalType": "uint128", + "name": "liquidityDesired", + "type": "uint128" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "mint", + "outputs": [ + { + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + }, + { + "internalType": "uint128", + "name": "liquidityActual", + "type": "uint128" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "positions", + "outputs": [ + { + "internalType": "uint128", + "name": "liquidity", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "lastLiquidityAddTimestamp", + "type": "uint32" + }, + { + "internalType": "uint256", + "name": "innerFeeGrowth0Token", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "innerFeeGrowth1Token", + "type": "uint256" + }, + { + "internalType": "uint128", + "name": "fees0", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "fees1", + "type": "uint128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "communityFee0", + "type": "uint8" + }, + { + "internalType": "uint8", + "name": "communityFee1", + "type": "uint8" + } + ], + "name": "setCommunityFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "virtualPoolAddress", + "type": "address" + } + ], + "name": "setIncentive", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "newLiquidityCooldown", + "type": "uint32" + } + ], + "name": "setLiquidityCooldown", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "bool", + "name": "zeroToOne", + "type": "bool" + }, + { + "internalType": "int256", + "name": "amountRequired", + "type": "int256" + }, + { + "internalType": "uint160", + "name": "limitSqrtPrice", + "type": "uint160" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "swap", + "outputs": [ + { + "internalType": "int256", + "name": "amount0", + "type": "int256" + }, + { + "internalType": "int256", + "name": "amount1", + "type": "int256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "bool", + "name": "zeroToOne", + "type": "bool" + }, + { + "internalType": "int256", + "name": "amountRequired", + "type": "int256" + }, + { + "internalType": "uint160", + "name": "limitSqrtPrice", + "type": "uint160" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "swapSupportingFeeOnInputTokens", + "outputs": [ + { + "internalType": "int256", + "name": "amount0", + "type": "int256" + }, + { + "internalType": "int256", + "name": "amount1", + "type": "int256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "tickSpacing", + "outputs": [ + { + "internalType": "int24", + "name": "", + "type": "int24" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int16", + "name": "", + "type": "int16" + } + ], + "name": "tickTable", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int24", + "name": "", + "type": "int24" + } + ], + "name": "ticks", + "outputs": [ + { + "internalType": "uint128", + "name": "liquidityTotal", + "type": "uint128" + }, + { + "internalType": "int128", + "name": "liquidityDelta", + "type": "int128" + }, + { + "internalType": "uint256", + "name": "outerFeeGrowth0Token", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "outerFeeGrowth1Token", + "type": "uint256" + }, + { + "internalType": "int56", + "name": "outerTickCumulative", + "type": "int56" + }, + { + "internalType": "uint160", + "name": "outerSecondsPerLiquidity", + "type": "uint160" + }, + { + "internalType": "uint32", + "name": "outerSecondsSpent", + "type": "uint32" + }, + { + "internalType": "bool", + "name": "initialized", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "timepoints", + "outputs": [ + { + "internalType": "bool", + "name": "initialized", + "type": "bool" + }, + { + "internalType": "uint32", + "name": "blockTimestamp", + "type": "uint32" + }, + { + "internalType": "int56", + "name": "tickCumulative", + "type": "int56" + }, + { + "internalType": "uint160", + "name": "secondsPerLiquidityCumulative", + "type": "uint160" + }, + { + "internalType": "uint88", + "name": "volatilityCumulative", + "type": "uint88" + }, + { + "internalType": "int24", + "name": "averageTick", + "type": "int24" + }, + { + "internalType": "uint144", + "name": "volumePerLiquidityCumulative", + "type": "uint144" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "token0", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "token1", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalFeeGrowth0Token", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalFeeGrowth1Token", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } +] \ No newline at end of file diff --git a/src/adaptors/stellaswap-v3/clients.js b/src/adaptors/stellaswap-v3/clients.js new file mode 100644 index 0000000000..40af49c6d5 --- /dev/null +++ b/src/adaptors/stellaswap-v3/clients.js @@ -0,0 +1,5 @@ +const KEY = "89ee4bac17c0a4b5c8f359d9b50b3abe" +const API = `https://gateway.thegraph.com/api/${KEY}` +exports.pulsarBlocks = `${API}/subgraphs/id/HaSkCZY1wcFLLaQE4xHksnHH9VPiLm6i63xAc1kze4Jp`; +exports.pulsar = `${API}/subgraphs/id/G7GRSbr917k92izqozMjNspBqRWp2U91xsj8q6bq8oyH`; +exports.pulsarFarming = `${API}/subgraphs/id/8ym6MbzW8UgYWoyCRkZrWV44YHmgS4ZxUmhv8kyNNSsn`; diff --git a/src/adaptors/stellaswap-v3/index.js b/src/adaptors/stellaswap-v3/index.js new file mode 100644 index 0000000000..08d4534287 --- /dev/null +++ b/src/adaptors/stellaswap-v3/index.js @@ -0,0 +1,126 @@ +const { request, gql } = require('graphql-request'); +const BigNumber = require('bignumber.js'); +const sdk = require('@defillama/sdk'); +const utils = require('../utils'); +const { pulsar } = require('./clients'); +const { queryPools, queryPrior } = require('./queries'); +const { updateFarmsRewardsApr, updatePoolsApr } = require('./offchain-service'); +const { + getPreviousBlockNumber, + getPositionsOfPool, + getAmounts, +} = require('./utils'); + +const topLvl = async (chainString, timestamp, url) => { + const balanceCalls = []; + const prevBlockNumber = await getPreviousBlockNumber() + + let data = (await request(url, queryPools)).pools + const dataPrior = (await request(url, queryPrior.replace('', prevBlockNumber))).pools; + + for (const pool of data) { + balanceCalls.push({ + target: pool.token0.id, + params: pool.id, + }); + balanceCalls.push({ + target: pool.token1.id, + params: pool.id, + }); + } + + const tokenBalances = await sdk.api.abi.multiCall({ + abi: 'erc20:balanceOf', + calls: balanceCalls, + chain: chainString, + permitFailure: true, + }); + + data = data.map((p) => { + const x = tokenBalances.output.filter((i) => i.input.params[0] === p.id); + return { + ...p, + reserve0: (parseFloat(x.find((i) => i.input.target === p.token0.id)?.output || 0) / Math.pow(10, p.token0.decimals)), + reserve1: (parseFloat(x.find((i) => i.input.target === p.token1.id)?.output || 0) / Math.pow(10, p.token1.decimals)), + }; + }); + + data = await utils.tvl(data, chainString); + + const poolsFees = {}; + const poolsCurrentTvl = {}; + + for (const pool of data) { + const currentFeesInToken0 = new BigNumber(pool.feesToken0).plus(new BigNumber(pool.feesToken1).times(new BigNumber(pool.token0Price))); + const priorData = dataPrior.find(dp => dp.id === pool.id); + const priorFeesInToken0 = priorData ? new BigNumber(priorData.feesToken0).plus(new BigNumber(priorData.feesToken1).times(new BigNumber(priorData.token0Price))) : new BigNumber(0); + const feesIn24Hours = currentFeesInToken0.minus(priorFeesInToken0); + + poolsFees[pool.id] = feesIn24Hours; + poolsCurrentTvl[pool.id] = new BigNumber(0); + const positionsJson = await getPositionsOfPool(pool.id); + for (const position of positionsJson) { + const currentTick = new BigNumber(pool.tick); + const { amount0, amount1 } = getAmounts( + new BigNumber(position.liquidity), + new BigNumber(position.tickLower.tickIdx), + new BigNumber(position.tickUpper.tickIdx), + currentTick, + ); + const adjustedAmount0 = amount0 / Math.pow(10, position.token0.decimals); + const adjustedAmount1 = amount1 / Math.pow(10, position.token1.decimals); + poolsCurrentTvl[pool.id] += adjustedAmount0 + (adjustedAmount1 * parseFloat(pool.token0Price)); + } + } + + const poolsFarmApr = await updateFarmsRewardsApr(); + const poolsAPRObj = await updatePoolsApr(); + + const poolsAPR = {}; + const poolsRewardTokens = {}; // Add this to store reward tokens for each pool + + const poolsBaseAPR = poolsAPRObj; + + for (const pool of data) { + const apr = poolsBaseAPR[pool.id] ? new BigNumber(poolsBaseAPR[pool.id]) : new BigNumber(0); + poolsAPR[pool.id] = apr; + + const rewardTokens = apr.isNaN() || apr.eq(0) ? [] : [pool.token0.id, pool.token1.id]; + poolsRewardTokens[pool.id] = rewardTokens; // Store reward tokens for each pool + } + + data = data.map((p) => { + const tvl = p.poolDayData[0]?.tvlUSD || 0; + if (tvl > 30000) { + const baseAPR = poolsAPR[p.id] ? poolsAPR[p.id].toNumber() : 0; + const rewardsAPR = poolsFarmApr.pools[p.id]?.apr.toNumber() || 0; + const rewardTokens = poolsRewardTokens[p.id]; + + return { + pool: p.id, + chain: utils.formatChain(chainString), + project: 'stellaswap-v3', + symbol: `${p.token0.symbol}-${p.token1.symbol}`, + tvlUsd: parseFloat(tvl), + apyBase: baseAPR, + apyReward: rewardsAPR, + rewardTokens: rewardTokens, + underlyingTokens: [p.token0.id, p.token1.id], + url: `https://app.stellaswap.com/pulsar/add/${p.token0.id}/${p.token1.id}`, + }; + } + }).filter(p => p); + + return data; +}; + +const main = async (timestamp = null) => { + const data = await Promise.all([topLvl('moonbeam', timestamp, pulsar)]); + return data.flat().filter((p) => utils.keepFinite(p)); +}; + +module.exports = { + timetravel: false, + apy: main, + url: 'https://stellaswap.com/', +}; diff --git a/src/adaptors/stellaswap-v3/offchain-service.js b/src/adaptors/stellaswap-v3/offchain-service.js new file mode 100644 index 0000000000..f42bf1ff35 --- /dev/null +++ b/src/adaptors/stellaswap-v3/offchain-service.js @@ -0,0 +1,321 @@ +const gql = require('graphql-request'); +const BigNumber = require('bignumber.js'); +const ethers = require('ethers'); +const { request } = require('graphql-request'); +const sdk = require('@defillama/sdk'); + +const RewarderRegistryABI = require('./abis/OffchainRewarderRegistry.json'); +const RewarderABI = require('./abis/OffchainRewarder.json'); +const BeefyVaultABI = require('./abis/BeefyCLMVault.json'); +const BeefyStrategyABI = require('./abis/BeefyCLMStrategy.json'); +const AlgebraPoolABI = require('./abis/pool.json'); + +const { pulsar, pulsarFarming, pulsarBlocks } = require('./clients'); +const utils = require('./utils'); + +const REWARD_REGISTRY = '0x0e4cAEf48De8FEc07b7dfeae8D73848Aaa8be0cB'; +const RPC_URL = 'https://api-moonbeam.dwellir.com/5e6927bb-9acb-466f-a45e-4df46b29b82b'; + +const OffchainService = { + getEtherProvider() { + const provider = new ethers.providers.JsonRpcProvider(RPC_URL); + return provider; + }, + + async getTokenInfoByAddress(tokenAddress) { + return await utils.getTokenInfoByAddress(tokenAddress); + }, + + isActive(position) { + const currentTick = +position.pool.tick; + return (+position.tickLower.tickIdx <= currentTick) && (currentTick < +position.tickUpper.tickIdx); + }, + + isActiveStatic(currentTick, tickLower, tickUpper) { + if (((tickLower) <= currentTick) && (currentTick < tickUpper)) { + return true; + } + return false; + }, + + async getPoolsViaMulticall(length) { + const balanceCalls = []; + for (let index = 0; index < length; index += 1) { + balanceCalls.push({ + target: REWARD_REGISTRY, + params: [index] + }); + } + + const results = await sdk.api.abi.multiCall({ + abi: RewarderRegistryABI.find(abi => abi.name === 'pools'), + calls: balanceCalls, + chain: 'moonbeam', + permitFailure: true, + }); + + const mappedResults = results.output.map(result => ({ + pool: result.output[0], + rewarder: result.output[1], + isPaused: result.output[2], + })); + + return mappedResults; + }, + + async getAllPools() { + try { + const rewarderRegistry = new ethers.Contract(REWARD_REGISTRY, RewarderRegistryABI, this.getEtherProvider()); + const registryPoolCount = await rewarderRegistry.getPoolCount(); + const poolsViaMC = await this.getPoolsViaMulticall(+registryPoolCount); + return poolsViaMC; + } catch (error) { + console.log(error); + } + return []; + }, + + async getPositionManagersViaMulticall(length) { + const balanceCalls = []; + for (let index = 0; index < length; index += 1) { + balanceCalls.push({ + target: REWARD_REGISTRY, + params: [index] + }); + } + + const results = await sdk.api.abi.multiCall({ + abi: RewarderRegistryABI.find(abi => abi.name === 'positionManagers'), + calls: balanceCalls, + chain: 'moonbeam', + permitFailure: true, + }); + + const mappedResults = results.output.map(result => ({ + index: result.input.params[0], + almKEY: result.output[0], + })); + + return mappedResults; + }, + + async getAllPositionManagers() { + try { + const rewarderRegistry = new ethers.Contract(REWARD_REGISTRY, RewarderRegistryABI, this.getEtherProvider()); + const almCount = await rewarderRegistry.getPositionManagerCount(); + const almsViaMC = await this.getPositionManagersViaMulticall(+almCount); + return almsViaMC; + } catch (error) { + console.log(error); + } + return []; + }, + + async getBeefyPosition(pool, vault) { + const beefyVault = new ethers.Contract(vault, BeefyVaultABI, this.getEtherProvider()); + + const strategyAddr = await beefyVault.strategy(); + const beefyStrategy = new ethers.Contract(strategyAddr, BeefyStrategyABI, this.getEtherProvider()); + + const positionKeys = await beefyStrategy.getKeys(); + + const positionMain = await beefyStrategy.positionMain(); + + const positionAlt = await beefyStrategy.positionAlt(); + + const algebraPool = new ethers.Contract(pool, AlgebraPoolABI, this.getEtherProvider()); + + const poolGlobalState = await algebraPool.globalState(); + + const positionMainStats = await algebraPool.positions(positionKeys.keyMain); + + const positionAltStats = await algebraPool.positions(positionKeys.keyAlt); + + const minimalPositions = []; + let totalLiq = new BigNumber('0'); + + if (this.isActiveStatic(poolGlobalState.tick, positionMain.tickLower, positionMain.tickUpper)) { + totalLiq = totalLiq.plus(positionMainStats.liquidity); + minimalPositions.push({ + id: '6669697089', + liquidity: positionMainStats.liquidity, + tickLower: { + __typename: 'Tick', + tickIdx: positionMain.tickLower.toString(), + }, + tickUpper: { + __typename: 'Tick', + tickIdx: positionMain.tickUpper.toString(), + }, + pool, + }); + } + + if (this.isActiveStatic(poolGlobalState.tick, positionAlt.tickLower, positionAlt.tickUpper)) { + totalLiq = totalLiq.plus(positionAltStats.liquidity); + minimalPositions.push({ + id: '6669697088', + liquidity: positionAltStats.liquidity, + tickLower: { + __typename: 'Tick', + tickIdx: positionAlt.tickLower.toString(), + }, + tickUpper: { + __typename: 'Tick', + tickIdx: positionAlt.tickUpper.toString(), + }, + pool, + }); + } + + if (totalLiq.gt(0)) { + return minimalPositions; + } + + return []; + }, +}; + +let poolsAPRObj = {}; + +const updatePoolsApr = async () => { + const poolsJson = await utils.getCurrentPoolsInfo(); + const poolsTick = {}; + const poolsCurrentTvl = {}; + const poolsFees = {}; + + for (const pool of poolsJson) { + poolsTick[pool.id] = (+pool.tick); + poolsCurrentTvl[pool.id] = 0; + if (poolsFees[pool.id] === undefined) { + poolsFees[pool.id] = (+pool.feesToken0); + } else { + poolsFees[pool.id] += (+pool.feesToken0); + } + poolsFees[pool.id] += pool.feesToken1 * (+pool.token0Price); + + const positionsJson = await utils.getPositionsOfPool(pool.id); + for (const position of positionsJson) { + const currentTick = poolsTick[position.pool.id]; + if (((+position.tickLower.tickIdx) < currentTick) && (currentTick < (+position.tickUpper.tickIdx))) { + let { amount0, amount1 } = utils.getAmounts( + (+position.liquidity), + (+position.tickLower.tickIdx), + (+position.tickUpper.tickIdx), + currentTick, + ); + amount0 /= (10 ** (+position.token0.decimals)); + amount1 /= (10 ** (+position.token1.decimals)); + poolsCurrentTvl[position.pool.id] += amount0; + poolsCurrentTvl[position.pool.id] += amount1 * (+position.pool.token0Price); + } + } + } + + const poolsAPR = {}; + for (const pool of poolsJson) { + if (poolsCurrentTvl[pool.id] !== 0) { + poolsAPR[pool.id] = (((poolsFees[pool.id] * 365).toFixed(2) / (poolsCurrentTvl[pool.id])) * 100); + } else { + poolsAPR[pool.id] = 0; + } + } + poolsAPR.updatedAt = (Date.now() / 1000).toFixed(0); + poolsAPRObj = poolsAPR; + return poolsAPRObj; +}; + +const updateFarmsRewardsApr = async () => { + const pools = await OffchainService.getAllPools(); + const alms = await OffchainService.getAllPositionManagers(); + + const farmingObj = { + pools: {}, + updatedAt: 0, + }; + + for (const pool of pools) { + try { + if (pool.isPaused) { + console.log('Ignoring Pool', pool.pool, 'its paused'); + continue; // ignoring paused pools. + } + const rewarder = new ethers.Contract(pool.rewarder, RewarderABI, OffchainService.getEtherProvider()); + const activeRewards = await rewarder.getActiveRewards(); + if (activeRewards.length <= 0) { + continue; + } + let positions = await utils.getPositionsOfPool(pool.pool.toLowerCase()); + positions = positions.filter((p) => OffchainService.isActive(p)); + + if (alms.length > 0) { + for (const alm of alms) { + const rewarderRegistry = new ethers.Contract(REWARD_REGISTRY, RewarderRegistryABI, OffchainService.getEtherProvider()); + const vault = await rewarderRegistry.getPoolPMVaultByAddress(pool.pool, alm.index); + if (vault.toLowerCase() !== ethers.constants.AddressZero.toLowerCase()) { + if (alm.almKEY === 'BEEFY') { + const beefyPositions = await OffchainService.getBeefyPosition(pool.pool, vault); + positions = [...positions, ...beefyPositions]; + } + } + } + } + let totalNativeAmount = 0.0; + for (const position of positions) { + const { amount0, amount1 } = utils.getAmounts( + (+position.liquidity), + (+position.tickLower.tickIdx), + (+position.tickUpper.tickIdx), + (+position.pool.tick), + ); + + totalNativeAmount += (amount0 * (+position.pool.token0.derivedMatic)) / 10 ** (+position.pool.token0.decimals); + + totalNativeAmount += (amount1 * (+position.pool.token1.derivedMatic)) / 10 ** (+position.pool.token1.decimals); + } + + let totalNativeReward = new BigNumber('0'); + + const tokenRewardsMap = {}; + for (const rewardToken of activeRewards) { + const tokenInfo = (await OffchainService.getTokenInfoByAddress(rewardToken.token.toLowerCase()))[0]; + const tokenRPS = new BigNumber(rewardToken.rewardPerSec.toString()); + const tokenGLMRPrice = new BigNumber((tokenInfo.derivedMatic)); + const tokenDecimals = new BigNumber(10 ** (+tokenInfo.decimals)); + const glmrPerSecond = tokenRPS.times(tokenGLMRPrice).dividedBy(tokenDecimals); + totalNativeReward = totalNativeReward.plus(glmrPerSecond); + tokenRewardsMap[rewardToken.token.toLowerCase()] = { + ...tokenInfo, + tokenRPS: tokenRPS.toString(), + glmrPerSecond: glmrPerSecond.toString(), + apr: glmrPerSecond.dividedBy(new BigNumber(totalNativeAmount)).times(86400 * 365 * 100) + }; + } + + let apr = 0; + if (totalNativeAmount > 0) { + apr = totalNativeReward.dividedBy(new BigNumber(totalNativeAmount)).times(86400 * 365 * 100); + } + + farmingObj.pools[pool.pool.toLowerCase()] = { + apr, + totalNativeAmount, + totalNativeReward, + tokenRewards: tokenRewardsMap, + }; + } catch (error) { + console.log(error); + } + } + + farmingObj.updatedAt = (Date.now() / 1000).toFixed(0); + farmingAPRObjGlobal = farmingObj; + + return farmingAPRObjGlobal; + +}; + +module.exports = { + updatePoolsApr, + updateFarmsRewardsApr, +}; diff --git a/src/adaptors/stellaswap-v3/queries.js b/src/adaptors/stellaswap-v3/queries.js new file mode 100644 index 0000000000..853c1efefa --- /dev/null +++ b/src/adaptors/stellaswap-v3/queries.js @@ -0,0 +1,164 @@ +const { gql } = require('graphql-request'); + +const _50 = 50 // fetch first 50 records +const aprDelta = 259200; +const blockDelta = 60; +const previousDate = Math.floor(Date.now() / 1000) - aprDelta; + +exports.queryPools = gql + `{ + pools(first: ${_50}, orderBy: totalValueLockedUSD, orderDirection: desc) { + id + poolDayData(first: 1000, orderBy: date, orderDirection: desc) { + tvlUSD + volumeUSD + untrackedVolumeUSD + date + } + volumeUSD + token0 { + id + symbol + decimals + } + token1 { + id + symbol + decimals + } + totalValueLockedToken0 + totalValueLockedToken1 + totalValueLockedUSD + feesUSD + feesToken0 + feesToken1 + token0Price + token1Price + tick + liquidity + } + }` + +exports.queryPrior = gql + `{ + pools(first: ${_50}, block: { number: }, orderBy: id) { + feesToken0 + feesToken1 + id + token0 { + name + decimals + } + token1 { + name + decimals + } + token0Price + tick + liquidity + } + }` + +exports.queryBlock = gql + `{ + blocks( + first: 1 + orderBy: timestamp + orderDirection: desc + where: { timestamp_lt: ${previousDate}, timestamp_gt: ${previousDate - blockDelta} } + ) { + number + } + }` + +exports.queryPositions = gql + `{ + positions(first: 1000, where: { liquidity_gt: 0, pool: "" }) { + id + owner + tickLower{ + tickIdx + } + tickUpper{ + tickIdx + } + liquidity + depositedToken0 + depositedToken1 + token0{ + decimals + } + token1{ + decimals + } + pool{ + id + token0Price + tick + token0{ + name + decimals + derivedMatic + } + token1{ + name + decimals + derivedMatic + } + } + } + }`; + +exports.queryFarming = gql + `{ + eternalFarmings{ + id + rewardToken + bonusRewardToken + rewardRate + bonusRewardRate + pool + } + }` + +exports.queryDeposits = gql + `{ + deposits(first: ${_50}, where: {eternalFarming: ""}){ + id + } + }` + +exports.queryTokens = gql + `{ + tokens(where: {id: ""}){ + derivedMatic + decimals + } + }` + +exports.queryPositionsViaIds = gql + `{ + positions(first: ${_50}, where: {id_in: }){ + id + liquidity + tickLower{ + tickIdx + } + tickUpper{ + tickIdx + } + pool{ + token0{ + name + decimals + derivedMatic + } + token1{ + name + decimals + derivedMatic + } + tick + } + } + }` \ No newline at end of file diff --git a/src/adaptors/stellaswap-v3/utils.js b/src/adaptors/stellaswap-v3/utils.js new file mode 100644 index 0000000000..f620cfc417 --- /dev/null +++ b/src/adaptors/stellaswap-v3/utils.js @@ -0,0 +1,162 @@ +const BigNumber = require('bignumber.js'); +const { gql, request } = require('graphql-request'); +const { pulsar, pulsarFarming, pulsarBlocks } = require('./clients') + +const { + queryBlock, + queryPositions, + queryFarming, + queryDeposits, + queryTokens, + queryPositionsViaIds +} = require('./queries') + +const tickToSqrtPrice = (tick) => { + // return new BigNumber(Math.sqrt(1.0001 ** tick)); + return Math.sqrt(1.0001 ** tick); + +}; + +exports.getPreviousBlockNumber = async () => { + const startBlock = 2649799; + const response = (await request(pulsarBlocks, queryBlock)) + const blockNumber = response.blocks[0]?.number === undefined ? startBlock : response.blocks[0]?.number; + return blockNumber; +}; + +exports.getPositionsOfPool = async (poolId) => { + const result = []; + let i = 0; + while (true) { + const positions = (await request(pulsar, queryPositions.replace('', poolId))) + result.push(...positions.positions); + if (positions.positions.length < 1000) { + break; + } + i += 1; + } + return result; +}; + +exports.getAmounts = (liquidity, tickLower, tickUpper, currentTick) => { + const currentPrice = tickToSqrtPrice(currentTick); + const lowerPrice = tickToSqrtPrice(tickLower); + const upperPrice = tickToSqrtPrice(tickUpper); + + let amount1; let amount0; + if (currentPrice < lowerPrice) { + amount1 = 0; + amount0 = liquidity * (1 / lowerPrice - 1 / upperPrice); + } else if ((lowerPrice <= currentPrice) && (currentPrice <= upperPrice)) { + amount1 = liquidity * (currentPrice - lowerPrice); + amount0 = liquidity * (1 / currentPrice - 1 / upperPrice); + } else { + amount1 = liquidity * (upperPrice - lowerPrice); + amount0 = 0; + } + return { amount0, amount1 }; +}; + +exports.getEternalFarmingInfo = async () => { + const eternalFarmings = await request(pulsarFarming, queryFarming); + return eternalFarmings.eternalFarmings; +}; + +exports.getPositionsInEternalFarming = async (farmingId) => { + const result = []; + let i = 0; + while (true) { + const positions = (await request(pulsarFarming, queryDeposits.replace('', farmingId))) + result.push(...positions.deposits); + if (positions.deposits.length < 1000) { + break; + } + i += 1; + } + return result; +}; + +exports.getTokenInfoByAddress = async (tokenAddress) => { + const tokens = (await request(pulsar, queryTokens.replace('', tokenAddress))) + return tokens.tokens; +}; + +exports.getPositionsById = async (tokenIds) => { + tokenIds = tokenIds.map((tokenId) => tokenId.id); + const result = []; + let i = 0; + while (true) { + const positions = (await request(pulsar, queryPositionsViaIds.replace('', JSON.stringify(tokenIds)))) + result.push(...positions.positions); + if (positions.positions.length < 1000) { + break; + } + i += 1; + } + return result; +}; + +exports.getCurrentPoolsInfo = async () => { + const prevBlockNumber = await exports.getPreviousBlockNumber(); + const queryString = ` + { + pools(block: {number: ${prevBlockNumber}}, first: 1000, orderBy: id) { + feesToken0 + feesToken1 + id + token0 { + name + } + token1 { + name + } + token0Price + tick + liquidity + } + } + `; + const previousPools = await request(pulsar, gql`${queryString}`); + const poolsJsonPrevious = {}; + for (const pool of previousPools.pools) { + poolsJsonPrevious[pool.id] = { feesToken0: pool.feesToken0, feesToken1: pool.feesToken1 }; + } + + const queryStringNew = `{ + pools(first: 1000, orderBy: id) { + feesToken0 + feesToken1 + id + token0 { + name + symbol + decimals + } + token1 { + name + symbol + decimals + } + token0Price + tick + liquidity + } + }`; + const pools = await request(pulsar, gql`${queryStringNew}`); + + const poolsJson = []; + for (const pool of pools.pools) { + poolsJson.push({ ...pool }); + } + + for (let i = 0; i < poolsJson.length; i += 1) { + try { + poolsJson[i].feesToken0 = (+poolsJson[i].feesToken0) - (+poolsJsonPrevious[poolsJson[i].id].feesToken0); + poolsJson[i].feesToken1 = (+poolsJson[i].feesToken1) - (+poolsJsonPrevious[poolsJson[i].id].feesToken1); + } catch (error) { + poolsJson[i].feesToken0 = (+poolsJson[i].feesToken0); + poolsJson[i].feesToken1 = (+poolsJson[i].feesToken1); + } + } + return poolsJson; +}; \ No newline at end of file