From ce40834855e948d702c4ae4e1166606a0a8175ad Mon Sep 17 00:00:00 2001 From: Aakib Date: Tue, 12 Aug 2025 14:19:50 +0530 Subject: [PATCH] Consider referral from launchpad and dex as well --- abis/HyperpieRouter.json | 1295 ++++++++++++++++++++++++++++++++++++ abis/LaunchpadStorage.json | 831 +++++++++++++++++++++++ abis/MEMELaunchpad.json | 1081 ++++++++++++++++++++++++++++++ src/memeDropsReferral.ts | 27 + subgraph.yaml | 62 +- 5 files changed, 3295 insertions(+), 1 deletion(-) create mode 100644 abis/HyperpieRouter.json create mode 100644 abis/LaunchpadStorage.json create mode 100644 abis/MEMELaunchpad.json create mode 100644 src/memeDropsReferral.ts diff --git a/abis/HyperpieRouter.json b/abis/HyperpieRouter.json new file mode 100644 index 0000000..7bc5db4 --- /dev/null +++ b/abis/HyperpieRouter.json @@ -0,0 +1,1295 @@ +[ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "ExcessiveInputAmount", + "type": "error" + }, + { + "inputs": [], + "name": "Expired", + "type": "error" + }, + { + "inputs": [], + "name": "InsufficientAmount", + "type": "error" + }, + { + "inputs": [], + "name": "InsufficientInputAmount", + "type": "error" + }, + { + "inputs": [], + "name": "InsufficientLiquidity", + "type": "error" + }, + { + "inputs": [], + "name": "InsufficientOutputAmount", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidAmount", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidAmountIn", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidAmountInMin", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidAmountOut", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidAmountOutMin", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidConfig", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidDeadline", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidFactory", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidPair", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidPath", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidRoute", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidToken", + "type": "error" + }, + { + "inputs": [], + "name": "NativeTransferFailed", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyWETH", + "type": "error" + }, + { + "inputs": [], + "name": "SameAddresses", + "type": "error" + }, + { + "inputs": [], + "name": "TransferFailed", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddressNotAllowed", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "pair", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "tokenA", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "tokenB", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountA", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountB", + "type": "uint256" + } + ], + "name": "AddedLiquidity", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "pair", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "tokenA", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "tokenB", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountA", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountB", + "type": "uint256" + } + ], + "name": "RemovedLiquidity", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "fromToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "toToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountIn", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountOut", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "Swapped", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "defaultFactory", + "type": "address" + } + ], + "name": "UpdatedDefaultFactory", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "hyperpieConfig", + "type": "address" + } + ], + "name": "UpdatedHyperpieConfig", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_referral", + "type": "address" + } + ], + "name": "UserReferralSet", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenA", + "type": "address" + }, + { + "internalType": "address", + "name": "tokenB", + "type": "address" + }, + { + "internalType": "bool", + "name": "stable", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "amountADesired", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountBDesired", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountAMin", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountBMin", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + } + ], + "name": "addLiquidity", + "outputs": [ + { + "internalType": "uint256", + "name": "amountA", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountB", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidity", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "bool", + "name": "stable", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "amountTokenDesired", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountTokenMin", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountNativeMin", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + } + ], + "name": "addLiquidityNative", + "outputs": [ + { + "internalType": "uint256", + "name": "amountToken", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountNative", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidity", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "defaultFactory", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amountIn", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "fromToken", + "type": "address" + }, + { + "internalType": "address", + "name": "toToken", + "type": "address" + }, + { + "internalType": "bool", + "name": "stable", + "type": "bool" + }, + { + "internalType": "address", + "name": "factory", + "type": "address" + } + ], + "internalType": "struct IHyperpieRouter.Route[]", + "name": "routes", + "type": "tuple[]" + } + ], + "name": "getAmountsOut", + "outputs": [ + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenA", + "type": "address" + }, + { + "internalType": "address", + "name": "tokenB", + "type": "address" + }, + { + "internalType": "bool", + "name": "isStable", + "type": "bool" + } + ], + "name": "getReserves", + "outputs": [ + { + "internalType": "uint256", + "name": "reserveA", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "reserveB", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "hyperpieConfig", + "outputs": [ + { + "internalType": "contract IHyperpieConfig", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_defaultFactory", + "type": "address" + }, + { + "internalType": "address", + "name": "_wNative", + "type": "address" + }, + { + "internalType": "address", + "name": "_hyperpieConfig", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenA", + "type": "address" + }, + { + "internalType": "address", + "name": "tokenB", + "type": "address" + }, + { + "internalType": "bool", + "name": "isStable", + "type": "bool" + } + ], + "name": "pairFor", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenA", + "type": "address" + }, + { + "internalType": "address", + "name": "tokenB", + "type": "address" + }, + { + "internalType": "bool", + "name": "stable", + "type": "bool" + }, + { + "internalType": "address", + "name": "_factory", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amountADesired", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountBDesired", + "type": "uint256" + } + ], + "name": "quoteAddLiquidity", + "outputs": [ + { + "internalType": "uint256", + "name": "amountA", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountB", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidity", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amountA", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "reserveA", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "reserveB", + "type": "uint256" + } + ], + "name": "quoteLiquidity", + "outputs": [ + { + "internalType": "uint256", + "name": "amountB", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenA", + "type": "address" + }, + { + "internalType": "address", + "name": "tokenB", + "type": "address" + }, + { + "internalType": "bool", + "name": "stable", + "type": "bool" + }, + { + "internalType": "address", + "name": "_factory", + "type": "address" + }, + { + "internalType": "uint256", + "name": "liquidity", + "type": "uint256" + } + ], + "name": "quoteRemoveLiquidity", + "outputs": [ + { + "internalType": "uint256", + "name": "amountA", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountB", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenA", + "type": "address" + }, + { + "internalType": "address", + "name": "tokenB", + "type": "address" + }, + { + "internalType": "bool", + "name": "stable", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "liquidity", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountAMin", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountBMin", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + } + ], + "name": "removeLiquidity", + "outputs": [ + { + "internalType": "uint256", + "name": "amountA", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountB", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "bool", + "name": "stable", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "liquidity", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountTokenMin", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountNativeMin", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + } + ], + "name": "removeLiquidityNative", + "outputs": [ + { + "internalType": "uint256", + "name": "amountToken", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountNative", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenA", + "type": "address" + }, + { + "internalType": "address", + "name": "tokenB", + "type": "address" + } + ], + "name": "sortTokens", + "outputs": [ + { + "internalType": "address", + "name": "token0", + "type": "address" + }, + { + "internalType": "address", + "name": "token1", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amountOutMin", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "fromToken", + "type": "address" + }, + { + "internalType": "address", + "name": "toToken", + "type": "address" + }, + { + "internalType": "bool", + "name": "stable", + "type": "bool" + }, + { + "internalType": "address", + "name": "factory", + "type": "address" + } + ], + "internalType": "struct IHyperpieRouter.Route[]", + "name": "routes", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + } + ], + "name": "swapExactNativeForTokens", + "outputs": [ + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amountOutMin", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "fromToken", + "type": "address" + }, + { + "internalType": "address", + "name": "toToken", + "type": "address" + }, + { + "internalType": "bool", + "name": "stable", + "type": "bool" + }, + { + "internalType": "address", + "name": "factory", + "type": "address" + } + ], + "internalType": "struct IHyperpieRouter.Route[]", + "name": "routes", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "address", + "name": "referral", + "type": "address" + } + ], + "name": "swapExactNativeForTokensWithReferral", + "outputs": [ + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amountIn", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountOutMin", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "fromToken", + "type": "address" + }, + { + "internalType": "address", + "name": "toToken", + "type": "address" + }, + { + "internalType": "bool", + "name": "stable", + "type": "bool" + }, + { + "internalType": "address", + "name": "factory", + "type": "address" + } + ], + "internalType": "struct IHyperpieRouter.Route[]", + "name": "routes", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + } + ], + "name": "swapExactTokensForNative", + "outputs": [ + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amountIn", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountOutMin", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "fromToken", + "type": "address" + }, + { + "internalType": "address", + "name": "toToken", + "type": "address" + }, + { + "internalType": "bool", + "name": "stable", + "type": "bool" + }, + { + "internalType": "address", + "name": "factory", + "type": "address" + } + ], + "internalType": "struct IHyperpieRouter.Route[]", + "name": "routes", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "address", + "name": "referral", + "type": "address" + } + ], + "name": "swapExactTokensForNativeWithReferral", + "outputs": [ + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amountIn", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountOutMin", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "fromToken", + "type": "address" + }, + { + "internalType": "address", + "name": "toToken", + "type": "address" + }, + { + "internalType": "bool", + "name": "stable", + "type": "bool" + }, + { + "internalType": "address", + "name": "factory", + "type": "address" + } + ], + "internalType": "struct IHyperpieRouter.Route[]", + "name": "routes", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + } + ], + "name": "swapExactTokensForTokens", + "outputs": [ + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amountIn", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountOutMin", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "address", + "name": "fromToken", + "type": "address" + }, + { + "internalType": "address", + "name": "toToken", + "type": "address" + }, + { + "internalType": "bool", + "name": "stable", + "type": "bool" + }, + { + "internalType": "address", + "name": "factory", + "type": "address" + } + ], + "internalType": "struct IHyperpieRouter.Route[]", + "name": "routes", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "address", + "name": "referral", + "type": "address" + } + ], + "name": "swapExactTokensForTokensWithReferral", + "outputs": [ + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_hyperpieConfig", + "type": "address" + } + ], + "name": "updateConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_defaultFactory", + "type": "address" + } + ], + "name": "updateDefaultFactory", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "wNative", + "outputs": [ + { + "internalType": "contract IWETH", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } +] \ No newline at end of file diff --git a/abis/LaunchpadStorage.json b/abis/LaunchpadStorage.json new file mode 100644 index 0000000..314cb3c --- /dev/null +++ b/abis/LaunchpadStorage.json @@ -0,0 +1,831 @@ +[ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "DepositTokenNotSet", + "type": "error" + }, + { + "inputs": [], + "name": "FeeTooHigh", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidCurveType", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidIndex", + "type": "error" + }, + { + "inputs": [], + "name": "MaxCreatorBuyAmountTooHigh", + "type": "error" + }, + { + "inputs": [], + "name": "ReferralCannotBeSelf", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddressNotAllowed", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "_curveType", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "address", + "name": "_curveCalculator", + "type": "address" + } + ], + "name": "CurveCalculatorSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "targetRaise", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "initialPrice", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "coefficient", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalTokensForBondingCurve", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "initialX", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "initialY", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isSupported", + "type": "bool" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "curveType", + "type": "uint256" + } + ], + "name": "DepositTokenInfoUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isSupported", + "type": "bool" + } + ], + "name": "DepositTokenUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_feePercent", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "_feeDestination", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "_isTradingFee", + "type": "bool" + } + ], + "name": "FeeInfoAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_index", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_feePercent", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "_feeDestination", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "_isTradingFee", + "type": "bool" + } + ], + "name": "FeePercentSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_maxCreatorBuyAmountPercentage", + "type": "uint256" + } + ], + "name": "MaxCreatorBuyAmountPercentageSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_feePercent", + "type": "uint256" + } + ], + "name": "TokenCreatorFeeSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_hyperpieConfig", + "type": "address" + } + ], + "name": "UpdatedHyperpieConfig", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_referral", + "type": "address" + } + ], + "name": "UserReferralSet", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_feePercent", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_feeDestination", + "type": "address" + }, + { + "internalType": "bool", + "name": "_isTradingFee", + "type": "bool" + } + ], + "name": "addFeeInfo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "allDepositTokens", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "allPoolCreationFeeInfos", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "feePercent", + "type": "uint256" + }, + { + "internalType": "address", + "name": "feeDestination", + "type": "address" + } + ], + "internalType": "struct ILaunchpadStorage.FeeInfo[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "allTradingFeeInfos", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "feePercent", + "type": "uint256" + }, + { + "internalType": "address", + "name": "feeDestination", + "type": "address" + } + ], + "internalType": "struct ILaunchpadStorage.FeeInfo[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "name": "curveCalculators", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_curveType", + "type": "uint8" + }, + { + "internalType": "address", + "name": "_depositToken", + "type": "address" + } + ], + "name": "getDepositTokenInfo", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "depositTokenAmountTarget", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "initialMemeTokenPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "coefficient", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "bondingCurveMemeTokenSupply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "initialX", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "initialY", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isSupported", + "type": "bool" + } + ], + "internalType": "struct ILaunchpadStorage.MemeDepositTokenInfo", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getDepositTokensLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "hyperpieConfig", + "outputs": [ + { + "internalType": "contract IHyperpieConfig", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_hyperpieConfig", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "maxCreatorBuyAmountPercentage", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "memeDepositTokenInfo", + "outputs": [ + { + "internalType": "uint256", + "name": "depositTokenAmountTarget", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "initialMemeTokenPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "coefficient", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "bondingCurveMemeTokenSupply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "initialX", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "initialY", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isSupported", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "poolCreationFeeInfos", + "outputs": [ + { + "internalType": "uint256", + "name": "feePercent", + "type": "uint256" + }, + { + "internalType": "address", + "name": "feeDestination", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_memeToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_memeTokenAmount", + "type": "uint256" + } + ], + "name": "quoteBuyDepositTokenAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "depositTokenAmount", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_curveType", + "type": "uint8" + }, + { + "internalType": "address", + "name": "_curveCalculator", + "type": "address" + } + ], + "name": "setCurveCalculator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_depositToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_targetRaise", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_initialPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_coefficient", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_totalTokensForBondingCurve", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_initialX", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_initialY", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_isSupported", + "type": "bool" + }, + { + "internalType": "uint8", + "name": "_curveType", + "type": "uint8" + } + ], + "name": "setDepositTokenInfo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_index", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_feePercent", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_feeDestination", + "type": "address" + }, + { + "internalType": "bool", + "name": "_isTradingFee", + "type": "bool" + } + ], + "name": "setFeeInfo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_maxCreatorBuyAmountPercentage", + "type": "uint256" + } + ], + "name": "setMaxCreatorBuyAmountPercentage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_feePercent", + "type": "uint256" + } + ], + "name": "setTokenCreatorFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_referral", + "type": "address" + } + ], + "name": "setUserReferral", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "tokenCreatorFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalPoolCreationFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalTradingFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "tradingFeeInfos", + "outputs": [ + { + "internalType": "uint256", + "name": "feePercent", + "type": "uint256" + }, + { + "internalType": "address", + "name": "feeDestination", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_hyperpieConfig", + "type": "address" + } + ], + "name": "updateConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_depositToken", + "type": "address" + }, + { + "internalType": "uint8", + "name": "_curveType", + "type": "uint8" + }, + { + "internalType": "bool", + "name": "_isSupported", + "type": "bool" + } + ], + "name": "updateSupportedDepositToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] \ No newline at end of file diff --git a/abis/MEMELaunchpad.json b/abis/MEMELaunchpad.json new file mode 100644 index 0000000..fe87341 --- /dev/null +++ b/abis/MEMELaunchpad.json @@ -0,0 +1,1081 @@ +[ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "InsufficientMemeTokenBalance", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyWETH", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddressNotAllowed", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_memeToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_creator", + "type": "address" + } + ], + "name": "CreatorUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_curveType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "_curveCalculator", + "type": "address" + } + ], + "name": "CurveCalculatorSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_feePercent", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "_feeDestination", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "_isTradingFee", + "type": "bool" + } + ], + "name": "FeeInfoAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_index", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_feePercent", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "_feeDestination", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "_isTradingFee", + "type": "bool" + } + ], + "name": "FeePercentSet", + "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": "memeTokenAddress", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "memeTokenCreator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "curveType", + "type": "uint8" + }, + { + "indexed": true, + "internalType": "address", + "name": "depositTokenAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "depositTokenAmountTarget", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "initialMemeTokenPrice", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "launchTimestamp", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalTokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "creatorMemeTokenBuyAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "creatorMemeTokenBuyAmountNative", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "curveCalculator", + "type": "address" + }, + { + "indexed": false, + "internalType": "enum IMEMELaunchpad.Tags", + "name": "tags", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "string", + "name": "tokenURI", + "type": "string" + } + ], + "name": "LaunchCreated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "pair", + "type": "address" + } + ], + "name": "LaunchFinalized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_maxCreatorBuyAmountPercentage", + "type": "uint256" + } + ], + "name": "MaxCreatorBuyAmountPercentageSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "memeToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "depositTokenAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "memeTokenAmountRec", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "referral", + "type": "address" + } + ], + "name": "MemeTokenBuy", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "memeToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "memeTokenAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "depositTokenAmountRec", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "referral", + "type": "address" + } + ], + "name": "MemeTokenSell", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Paused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalRaised", + "type": "uint256" + } + ], + "name": "PreLaunchPhaseStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_feePercent", + "type": "uint256" + } + ], + "name": "TokenCreatorFeeSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Unpaused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_hyperpieConfig", + "type": "address" + } + ], + "name": "UpdatedHyperpieConfig", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_referral", + "type": "address" + } + ], + "name": "UserReferralSet", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "allLaunches", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_memeToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_depositTokenAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minReceivedMemeTokenAmount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_referral", + "type": "address" + } + ], + "name": "buyMemeTokenWithPoolCreationAndSwap", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_memeToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_minReceivedMemeTokenAmount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_referral", + "type": "address" + } + ], + "name": "buyMemeTokenWithPoolCreationAndSwapNative", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_memeToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_depositTokenAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minReceivedMemeTokenAmount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_referral", + "type": "address" + } + ], + "name": "buyMemeTokenWithoutPoolCreation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_memeToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_minReceivedMemeTokenAmount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_referral", + "type": "address" + } + ], + "name": "buyMemeTokenWithoutPoolCreationNative", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "string", + "name": "tokenName", + "type": "string" + }, + { + "internalType": "string", + "name": "tokenSymbol", + "type": "string" + }, + { + "internalType": "address", + "name": "depositToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "startTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "creatorBuyAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "creatorBuyAmountNative", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "curveType", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" + }, + { + "internalType": "enum IMEMELaunchpad.Tags", + "name": "tags", + "type": "uint8" + }, + { + "internalType": "string", + "name": "tokenURI", + "type": "string" + }, + { + "internalType": "address", + "name": "referral", + "type": "address" + } + ], + "internalType": "struct IMEMELaunchpad.LaunchCreationParams", + "name": "_params", + "type": "tuple" + } + ], + "name": "createLaunch", + "outputs": [ + { + "internalType": "address", + "name": "memeTokenAddress", + "type": "address" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_memeTokens", + "type": "address[]" + } + ], + "name": "finalizeLaunch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getLaunchCount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + } + ], + "name": "getLaunchInfo", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "memeToken", + "type": "address" + }, + { + "internalType": "address", + "name": "memeTokenCreator", + "type": "address" + }, + { + "internalType": "address", + "name": "depositTokenAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "launchTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "depositTokenAmountRaised", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "soldMemeTokenAmount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "pair", + "type": "address" + }, + { + "internalType": "uint8", + "name": "curveType", + "type": "uint8" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "depositTokenAmountTarget", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "initialMemeTokenPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "coefficient", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "bondingCurveMemeTokenSupply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "initialX", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "initialY", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isSupported", + "type": "bool" + } + ], + "internalType": "struct ILaunchpadStorage.MemeDepositTokenInfo", + "name": "depositTokenInfo", + "type": "tuple" + }, + { + "internalType": "address", + "name": "curveCalculator", + "type": "address" + }, + { + "internalType": "enum IMEMELaunchpad.Tags", + "name": "tags", + "type": "uint8" + }, + { + "internalType": "string", + "name": "tokenURI", + "type": "string" + } + ], + "internalType": "struct IMEMELaunchpad.LaunchInfo", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "hyperpieConfig", + "outputs": [ + { + "internalType": "contract IHyperpieConfig", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_hyperpieConfig", + "type": "address" + }, + { + "internalType": "address", + "name": "_launchpadStorage", + "type": "address" + }, + { + "internalType": "address", + "name": "_wNative", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "launches", + "outputs": [ + { + "internalType": "address", + "name": "memeToken", + "type": "address" + }, + { + "internalType": "address", + "name": "memeTokenCreator", + "type": "address" + }, + { + "internalType": "address", + "name": "depositTokenAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "launchTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "depositTokenAmountRaised", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "soldMemeTokenAmount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "pair", + "type": "address" + }, + { + "internalType": "uint8", + "name": "curveType", + "type": "uint8" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "depositTokenAmountTarget", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "initialMemeTokenPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "coefficient", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "bondingCurveMemeTokenSupply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "initialX", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "initialY", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isSupported", + "type": "bool" + } + ], + "internalType": "struct ILaunchpadStorage.MemeDepositTokenInfo", + "name": "depositTokenInfo", + "type": "tuple" + }, + { + "internalType": "address", + "name": "curveCalculator", + "type": "address" + }, + { + "internalType": "enum IMEMELaunchpad.Tags", + "name": "tags", + "type": "uint8" + }, + { + "internalType": "string", + "name": "tokenURI", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "launchpadStorage", + "outputs": [ + { + "internalType": "contract ILaunchpadStorage", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_memeToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_depositTokenAmount", + "type": "uint256" + } + ], + "name": "quoteBuyMemeTokenAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "memeTokenAmount", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_memeToken", + "type": "address" + } + ], + "name": "quoteMaxDepositTokenInputAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_memeToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_memeTokenAmount", + "type": "uint256" + } + ], + "name": "quoteSellMemeTokenAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "depositTokenAmountRecAfterFee", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_memeToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_memeTokenAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minDepositTokenAmount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_referral", + "type": "address" + } + ], + "name": "sellMemeToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_memeToken", + "type": "address" + }, + { + "internalType": "address", + "name": "_creator", + "type": "address" + } + ], + "name": "setCreator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "unpause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_hyperpieConfig", + "type": "address" + } + ], + "name": "updateConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "wNative", + "outputs": [ + { + "internalType": "contract IWHYPE", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } +] \ No newline at end of file diff --git a/src/memeDropsReferral.ts b/src/memeDropsReferral.ts new file mode 100644 index 0000000..743129a --- /dev/null +++ b/src/memeDropsReferral.ts @@ -0,0 +1,27 @@ +import { BigInt } from "@graphprotocol/graph-ts"; +import { UserReferralSet } from "../generated/LaunchPadStorage/LaunchPadStorage"; +import { ReferralData, StakingUserData } from "../generated/schema"; +import { loadOrCreateReferralData, loadOrCreateStakingUserData } from "./utils/entityUtils"; +import { ADDRESS_ZERO, BYTES_ZERO, HYPERPIE_DEVIL_ADDRESS } from "./constants"; +import { handleReferralTransfer } from "./referralPointsTransfer"; + +export function handleReferralSet(event: UserReferralSet): void { + let user: StakingUserData = loadOrCreateStakingUserData(event.params._user); + + if (user.referral.equals(HYPERPIE_DEVIL_ADDRESS) && event.params._referral.notEqual(HYPERPIE_DEVIL_ADDRESS) + && event.params._referral.notEqual(ADDRESS_ZERO) && event.params._referral.notEqual(user.id)) { + handleReferralTransfer(user.id, event.params._referral); + user.referral = event.params._referral; + user.save(); + } + + // First referral will be final. so no need to consider referral point transfer logic. just update the referral address. + if (user.referral.equals(BYTES_ZERO) && event.params._referral.notEqual(ADDRESS_ZERO) && event.params._referral.notEqual(user.id)) { + user.referral = event.params._referral; + user.save(); + + let referral: ReferralData = loadOrCreateReferralData(event.params._referral); + referral.referralCount = referral.referralCount.plus(BigInt.fromI32(1)); + referral.save(); + } +} \ No newline at end of file diff --git a/subgraph.yaml b/subgraph.yaml index fe6f663..b9b731c 100644 --- a/subgraph.yaml +++ b/subgraph.yaml @@ -194,4 +194,64 @@ dataSources: eventHandlers: - event: OwnershipTransferred(indexed address,indexed address) handler: handleKeikoVaultOperationOwnershipTransferred - file: ./src/keiko.ts \ No newline at end of file + file: ./src/keiko.ts + - kind: ethereum/contract + name: LaunchPadStorage + network: hyperevm + source: + address: "0x3f9FFF545C217c85aa024087CBa25854B2117DEE" + abi: LaunchPadStorage + startBlock: 7400000 + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + entities: + - StakingUserData + abis: + - name: LaunchPadStorage + file: ./abis/LaunchPadStorage.json + eventHandlers: + - event: UserReferralSet(indexed address,indexed address) + handler: handleReferralSet + file: ./src/memeDropsReferral.ts + - kind: ethereum/contract + name: MEMELaunchpad + network: hyperevm + source: + address: "0xE42d81b87bb0e9Afa2789282878f79aFbF5E925E" + abi: MEMELaunchpad + startBlock: 7400000 + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + entities: + - StakingUserData + abis: + - name: MEMELaunchpad + file: ./abis/MEMELaunchpad.json + eventHandlers: + - event: UserReferralSet(indexed address,indexed address) + handler: handleReferralSet + file: ./src/memeDropsReferral.ts + - kind: ethereum/contract + name: HyperpieRouter + network: hyperevm + source: + address: "0x29E56ab33a45d8089fC6d8cD42bD1e342FA8CD61" + abi: HyperpieRouter + startBlock: 7400000 + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + entities: + - StakingUserData + abis: + - name: HyperpieRouter + file: ./abis/HyperpieRouter.json + eventHandlers: + - event: UserReferralSet(indexed address,indexed address) + handler: handleReferralSet + file: ./src/memeDropsReferral.ts \ No newline at end of file