diff --git a/packages/config/src/arbitrum-sepolia.json b/packages/config/src/arbitrum-sepolia.json index ebca3d6..4d3c455 100644 --- a/packages/config/src/arbitrum-sepolia.json +++ b/packages/config/src/arbitrum-sepolia.json @@ -67,8 +67,8 @@ "transmolgrifier_address": "0x4489eee4b7218a74d516396c2f3ee6eba54f0773", "transmolgrifier_start_block": 6249003, "smol_renderer_address": "0x79973af48c424de5f199a7c0369c5e9cdeb493fc", - "meme_presale_address": "0x324d1670765cb8799ecd5271a8d595a64ed92fbf", - "meme_presale_start_block": 86641150, + "meme_presale_address": "0xC5589d3978225235e46a79Fc51E1563FBFa84062", + "meme_presale_start_block": 86999225, "magicswapv1_start_block": 654981, "magicswapv1_uniswapv2_factory_address": "0x9b58fc8c7B224Ae8479DA7E6eD37CA4Ac58099a9", diff --git a/subgraphs/memecoins/abis/MemePresale.json b/subgraphs/memecoins/abis/MemePresale.json index 7912625..0d4afeb 100644 --- a/subgraphs/memecoins/abis/MemePresale.json +++ b/subgraphs/memecoins/abis/MemePresale.json @@ -3,7 +3,7 @@ "inputs": [ { "internalType": "contract IERC20", - "name": "_fakemagic", + "name": "_magic", "type": "address" }, { @@ -255,6 +255,47 @@ "name": "MemeMade", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_collectionAddress", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "lpaddress", + "type": "address" + }, + { + "internalType": "address", + "name": "vaultaddress", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + } + ], + "indexed": false, + "internalType": "struct PRESALE.AltPairInfo", + "name": "alt", + "type": "tuple" + } + ], + "name": "PairCoinApproved", + "type": "event" + }, { "inputs": [], "name": "TARGETMCAP", @@ -291,6 +332,11 @@ "internalType": "bool", "name": "approved", "type": "bool" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" } ], "internalType": "struct PRESALE.AltPairInfo", @@ -327,6 +373,11 @@ "internalType": "bool", "name": "approved", "type": "bool" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" } ], "stateMutability": "view", @@ -684,4 +735,4 @@ "stateMutability": "view", "type": "function" } -] +] \ No newline at end of file diff --git a/subgraphs/memecoins/schema.graphql b/subgraphs/memecoins/schema.graphql index d06f883..acd88d2 100644 --- a/subgraphs/memecoins/schema.graphql +++ b/subgraphs/memecoins/schema.graphql @@ -22,3 +22,12 @@ type MemePresale @entity { pairCoin: Bytes lpAddress: Bytes } + +type PairCoin @entity { + id: Bytes! + + lpAddress: Bytes + symbol: String + vaultAddress: Bytes + approved: Boolean +} diff --git a/subgraphs/memecoins/src/mapping.ts b/subgraphs/memecoins/src/mapping.ts index d66cad9..313d3af 100644 --- a/subgraphs/memecoins/src/mapping.ts +++ b/subgraphs/memecoins/src/mapping.ts @@ -4,8 +4,9 @@ import { BuySell, Graduation, MemeMade, + PairCoinApproved, } from "../generated/Meme Presale/MemePresale"; -import { MemePresale } from "../generated/schema"; +import { MemePresale, PairCoin } from "../generated/schema"; const getOrCreateMemePresale = (memecoin: Address): MemePresale => { let memePresale = MemePresale.load(memecoin); @@ -16,6 +17,15 @@ const getOrCreateMemePresale = (memecoin: Address): MemePresale => { return memePresale; }; +const getOrCreatePairCoin = (pairCoinAddress: Address): PairCoin => { + let pairCoin = PairCoin.load(pairCoinAddress); + if (!pairCoin) { + pairCoin = new PairCoin(pairCoinAddress); + } + + return pairCoin; +}; + export function handleMemeMade(event: MemeMade): void { const params = event.params; const memePresale = getOrCreateMemePresale(params.presaleinfo.memecoin); @@ -69,3 +79,14 @@ export function handleGraduation(event: Graduation): void { memePresale.save(); } + +export function handlePairCoinApproved(event: PairCoinApproved): void { + const params = event.params; + const pairCoin = getOrCreatePairCoin(params._collectionAddress); + pairCoin.lpAddress = params.alt.lpaddress; + pairCoin.vaultAddress = params.alt.vaultaddress; + pairCoin.approved = params.alt.approved; + pairCoin.symbol = params.alt.symbol; + + pairCoin.save(); +} diff --git a/subgraphs/memecoins/template.yaml b/subgraphs/memecoins/template.yaml index 87feef2..cfb279e 100644 --- a/subgraphs/memecoins/template.yaml +++ b/subgraphs/memecoins/template.yaml @@ -25,4 +25,6 @@ dataSources: handler: handleBuySell - event: Graduation(indexed address,(uint256,uint256,uint256,uint256,uint256,bool,address,address,address,bool)) handler: handleGraduation + - event: PairCoinApproved(indexed address,(address,address,bool,string)) + handler: handlePairCoinApproved file: ./src/mapping.ts