Skip to content

Commit

Permalink
contract address on crowdsale entity
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Adolf <[email protected]>
  • Loading branch information
elmariachi111 committed Dec 23, 2024
1 parent c816611 commit 48afc39
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 54 deletions.
24 changes: 8 additions & 16 deletions subgraph/abis/LockingCrowdSale.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,19 +196,6 @@
],
"stateMutability": "view"
},
{
"type": "function",
"name": "lockingContractTrustee",
"inputs": [],
"outputs": [
{
"name": "",
"type": "address",
"internalType": "contract ITrustedLockingContracts"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "lockingContracts",
Expand Down Expand Up @@ -448,12 +435,17 @@
},
{
"type": "function",
"name": "trustLockingContractSource",
"name": "trustLockingContract",
"inputs": [
{
"name": "_lockingContractTrustee",
"name": "token",
"type": "address",
"internalType": "contract ITrustedLockingContracts"
"internalType": "contract IERC20"
},
{
"name": "_timelockedToken",
"type": "address",
"internalType": "contract TimelockedToken"
}
],
"outputs": [],
Expand Down
24 changes: 8 additions & 16 deletions subgraph/abis/StakedLockingCrowdSale.json
Original file line number Diff line number Diff line change
Expand Up @@ -225,19 +225,6 @@
],
"stateMutability": "view"
},
{
"type": "function",
"name": "lockingContractTrustee",
"inputs": [],
"outputs": [
{
"name": "",
"type": "address",
"internalType": "contract ITrustedLockingContracts"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "lockingContracts",
Expand Down Expand Up @@ -630,12 +617,17 @@
},
{
"type": "function",
"name": "trustLockingContractSource",
"name": "trustLockingContract",
"inputs": [
{
"name": "_lockingContractTrustee",
"name": "token",
"type": "address",
"internalType": "contract ITrustedLockingContracts"
"internalType": "contract IERC20"
},
{
"name": "_timelockedToken",
"type": "address",
"internalType": "contract TimelockedToken"
}
],
"outputs": [],
Expand Down
20 changes: 10 additions & 10 deletions subgraph/networks.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@
"address": "0x8cA737E2cdaE1Ceb332bEf7ba9eA711a3a2f8037",
"startBlock": 5300777
},
"LockingCrowdSale": {
"address": "0xaf7358576C9F7cD84696D28702fC5ADe33cce0e9",
"startBlock": 7306191
},
"StakedLockingCrowdSale": {
"address": "0xd1cE2EA7d3b0C9cAB025A4aD762FC00315141ad7",
"startBlock": 5300777
},
"LockingCrowdSale": {
"address": "0x0Da77f361bB56f065Aa21647d885685eb7cAE10F",
"startBlock": 7339034
},
"StakedLockingCrowdSale2": {
"address": "0xbaadf00dbaadf00dbaadf00dbaadf00dbaadf00d",
"startBlock": 7306191
"address": "0x2d309CF13dC3872f9c9B1B06Ebf6F60caDe08d55",
"startBlock": 7339082
},
"TermsAcceptedPermissioner": {
"address": "0xC05D649368d8A5e2E98CAa205d47795de5fCB599",
Expand All @@ -50,14 +50,14 @@
"address": "0xf0a8d23f38e9cbbe01c4ed37f23bd519b65bc6c2",
"startBlock": 18490640
},
"LockingCrowdSale": {
"address": "0xbaadf00dbaadf00dbaadf00dbaadf00dbaadf00d",
"startBlock": 21431344
},
"StakedLockingCrowdSale": {
"address": "0x35Bce29F52f51f547998717CD598068Afa2B29B7",
"startBlock": 17481804
},
"LockingCrowdSale": {
"address": "0xbaadf00dbaadf00dbaadf00dbaadf00dbaadf00d",
"startBlock": 21431344
},
"StakedLockingCrowdSale2": {
"address": "0xbaadf00dbaadf00dbaadf00dbaadf00dbaadf00d",
"startBlock": 21431344
Expand Down
2 changes: 1 addition & 1 deletion subgraph/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"build:sepolia": "graph codegen && graph build --network sepolia",
"build:mainnet": "graph codegen && graph build --network mainnet",
"deploy:local": "graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001 moleculeprotocol/ipnft-subgraph",
"deploy:sepolia": "env-cmd -x -f ../.env graph deploy ip-nft-sepolia --version-label 1.2.1 --node https://subgraphs.alchemy.com/api/subgraphs/deploy --ipfs https://ipfs.satsuma.xyz --deploy-key \\$SATSUMA_DEPLOY_KEY",
"deploy:sepolia": "env-cmd -x -f ../.env graph deploy ip-nft-sepolia --version-label 1.3.0-dev.1 --node https://subgraphs.alchemy.com/api/subgraphs/deploy --ipfs https://ipfs.satsuma.xyz --deploy-key \\$SATSUMA_DEPLOY_KEY",
"deploy:mainnet": "env-cmd -x -f ../.env graph deploy ip-nft-mainnet --version-label 1.2.1 --node https://subgraphs.alchemy.com/api/subgraphs/deploy --ipfs https://ipfs.satsuma.xyz --deploy-key \\$SATSUMA_DEPLOY_KEY",
"create:local": "graph create --node http://localhost:8020/ moleculeprotocol/ipnft-subgraph",
"remove:local": "graph remove --node http://localhost:8020/ moleculeprotocol/ipnft-subgraph",
Expand Down
1 change: 1 addition & 0 deletions subgraph/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ type CrowdSale @entity {
contributions: [Contribution!] @derivedFrom(field: "crowdSale")
feeBp: Int # the percentage fee that will be cut from the crowdsale upon its success
type: SaleType!
contract: Bytes! # the address of the crowdsale contract
}

type Contribution @entity {
Expand Down
3 changes: 2 additions & 1 deletion subgraph/src/crowdSaleMapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ export function handleStarted(event: StartedEvent): void {
])
return
}


crowdSale.contract = event.address
crowdSale.ipt = ipt.id
crowdSale.issuer = event.params.issuer
crowdSale.feeBp = event.params.feeBp
Expand Down
19 changes: 9 additions & 10 deletions subgraph/src/stakedLockingCrowdSaleMapping.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import {
BigInt,
Bytes,
DataSourceContext,
log,
ethereum
ethereum,
log
} from '@graphprotocol/graph-ts'
import { IERC20Metadata } from '../generated/CrowdSale/IERC20Metadata'
import {
Expand All @@ -13,25 +11,25 @@ import {
ClaimedFundingGoal as ClaimedFundingGoalEvent,
ClaimedStakes as ClaimedStakesEvent,
Failed as FailedEvent,
Started3 as LegacyStartedEvent,
LockingContractCreated as LockingContractCreatedEvent,
Settled as SettledEvent,
Staked as StakedEvent,
Started3 as LegacyStartedEvent,
Started as StartedEvent
} from '../generated/StakedLockingCrowdSale/StakedLockingCrowdSale'
import { LockingContractCreated as LockedLockingContractCreatedEvent } from '../generated/LockingCrowdSale/LockingCrowdSale'

import { Started as PlainStartedEvent } from '../generated/CrowdSale/CrowdSale'
import { Started as LockingStartedEvent } from '../generated/LockingCrowdSale/LockingCrowdSale'

import { handleStarted as plainHandleStarted } from './crowdSaleMapping'
import { lockingHandleStarted, handleLockingContractCreated as lockedHandleLockingContractCreated } from './lockingCrowdSaleMapping'
import { handleLockingContractCreated as lockedHandleLockingContractCreated, lockingHandleStarted } from './lockingCrowdSaleMapping'

import * as GenericCrowdSale from './genericCrowdSale'

import { Contribution, CrowdSale, ERC20Token, IPT } from '../generated/schema'
import { Contribution, CrowdSale } from '../generated/schema'

import { TimelockedToken as TimelockedTokenTemplate } from '../generated/templates'
import { makeERC20Token, makeTimelockedToken } from './common'
import { makeERC20Token } from './common'

/**
* there are contracts that emit the started event without fees
Expand Down Expand Up @@ -153,7 +151,8 @@ export function handleClaimed(event: ClaimedEvent): void {
export function handleLockingContractCreated(
event: LockingContractCreatedEvent
): void {
lockedHandleLockingContractCreated(event)
//xing fingers that this works!
lockedHandleLockingContractCreated(changetype<LockedLockingContractCreatedEvent>(event))
}

export function handleStaked(event: StakedEvent): void {
Expand Down

0 comments on commit 48afc39

Please sign in to comment.