Skip to content

Commit 48afc39

Browse files
committed
contract address on crowdsale entity
Signed-off-by: Stefan Adolf <[email protected]>
1 parent c816611 commit 48afc39

File tree

7 files changed

+39
-54
lines changed

7 files changed

+39
-54
lines changed

subgraph/abis/LockingCrowdSale.json

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -196,19 +196,6 @@
196196
],
197197
"stateMutability": "view"
198198
},
199-
{
200-
"type": "function",
201-
"name": "lockingContractTrustee",
202-
"inputs": [],
203-
"outputs": [
204-
{
205-
"name": "",
206-
"type": "address",
207-
"internalType": "contract ITrustedLockingContracts"
208-
}
209-
],
210-
"stateMutability": "view"
211-
},
212199
{
213200
"type": "function",
214201
"name": "lockingContracts",
@@ -448,12 +435,17 @@
448435
},
449436
{
450437
"type": "function",
451-
"name": "trustLockingContractSource",
438+
"name": "trustLockingContract",
452439
"inputs": [
453440
{
454-
"name": "_lockingContractTrustee",
441+
"name": "token",
455442
"type": "address",
456-
"internalType": "contract ITrustedLockingContracts"
443+
"internalType": "contract IERC20"
444+
},
445+
{
446+
"name": "_timelockedToken",
447+
"type": "address",
448+
"internalType": "contract TimelockedToken"
457449
}
458450
],
459451
"outputs": [],

subgraph/abis/StakedLockingCrowdSale.json

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -225,19 +225,6 @@
225225
],
226226
"stateMutability": "view"
227227
},
228-
{
229-
"type": "function",
230-
"name": "lockingContractTrustee",
231-
"inputs": [],
232-
"outputs": [
233-
{
234-
"name": "",
235-
"type": "address",
236-
"internalType": "contract ITrustedLockingContracts"
237-
}
238-
],
239-
"stateMutability": "view"
240-
},
241228
{
242229
"type": "function",
243230
"name": "lockingContracts",
@@ -630,12 +617,17 @@
630617
},
631618
{
632619
"type": "function",
633-
"name": "trustLockingContractSource",
620+
"name": "trustLockingContract",
634621
"inputs": [
635622
{
636-
"name": "_lockingContractTrustee",
623+
"name": "token",
637624
"type": "address",
638-
"internalType": "contract ITrustedLockingContracts"
625+
"internalType": "contract IERC20"
626+
},
627+
{
628+
"name": "_timelockedToken",
629+
"type": "address",
630+
"internalType": "contract TimelockedToken"
639631
}
640632
],
641633
"outputs": [],

subgraph/networks.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@
1616
"address": "0x8cA737E2cdaE1Ceb332bEf7ba9eA711a3a2f8037",
1717
"startBlock": 5300777
1818
},
19-
"LockingCrowdSale": {
20-
"address": "0xaf7358576C9F7cD84696D28702fC5ADe33cce0e9",
21-
"startBlock": 7306191
22-
},
2319
"StakedLockingCrowdSale": {
2420
"address": "0xd1cE2EA7d3b0C9cAB025A4aD762FC00315141ad7",
2521
"startBlock": 5300777
2622
},
23+
"LockingCrowdSale": {
24+
"address": "0x0Da77f361bB56f065Aa21647d885685eb7cAE10F",
25+
"startBlock": 7339034
26+
},
2727
"StakedLockingCrowdSale2": {
28-
"address": "0xbaadf00dbaadf00dbaadf00dbaadf00dbaadf00d",
29-
"startBlock": 7306191
28+
"address": "0x2d309CF13dC3872f9c9B1B06Ebf6F60caDe08d55",
29+
"startBlock": 7339082
3030
},
3131
"TermsAcceptedPermissioner": {
3232
"address": "0xC05D649368d8A5e2E98CAa205d47795de5fCB599",
@@ -50,14 +50,14 @@
5050
"address": "0xf0a8d23f38e9cbbe01c4ed37f23bd519b65bc6c2",
5151
"startBlock": 18490640
5252
},
53-
"LockingCrowdSale": {
54-
"address": "0xbaadf00dbaadf00dbaadf00dbaadf00dbaadf00d",
55-
"startBlock": 21431344
56-
},
5753
"StakedLockingCrowdSale": {
5854
"address": "0x35Bce29F52f51f547998717CD598068Afa2B29B7",
5955
"startBlock": 17481804
6056
},
57+
"LockingCrowdSale": {
58+
"address": "0xbaadf00dbaadf00dbaadf00dbaadf00dbaadf00d",
59+
"startBlock": 21431344
60+
},
6161
"StakedLockingCrowdSale2": {
6262
"address": "0xbaadf00dbaadf00dbaadf00dbaadf00dbaadf00d",
6363
"startBlock": 21431344

subgraph/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"build:sepolia": "graph codegen && graph build --network sepolia",
99
"build:mainnet": "graph codegen && graph build --network mainnet",
1010
"deploy:local": "graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001 moleculeprotocol/ipnft-subgraph",
11-
"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",
11+
"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",
1212
"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",
1313
"create:local": "graph create --node http://localhost:8020/ moleculeprotocol/ipnft-subgraph",
1414
"remove:local": "graph remove --node http://localhost:8020/ moleculeprotocol/ipnft-subgraph",

subgraph/schema.graphql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ type CrowdSale @entity {
147147
contributions: [Contribution!] @derivedFrom(field: "crowdSale")
148148
feeBp: Int # the percentage fee that will be cut from the crowdsale upon its success
149149
type: SaleType!
150+
contract: Bytes! # the address of the crowdsale contract
150151
}
151152

152153
type Contribution @entity {

subgraph/src/crowdSaleMapping.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ export function handleStarted(event: StartedEvent): void {
2424
])
2525
return
2626
}
27-
27+
28+
crowdSale.contract = event.address
2829
crowdSale.ipt = ipt.id
2930
crowdSale.issuer = event.params.issuer
3031
crowdSale.feeBp = event.params.feeBp

subgraph/src/stakedLockingCrowdSaleMapping.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import {
22
BigInt,
3-
Bytes,
4-
DataSourceContext,
5-
log,
6-
ethereum
3+
ethereum,
4+
log
75
} from '@graphprotocol/graph-ts'
86
import { IERC20Metadata } from '../generated/CrowdSale/IERC20Metadata'
97
import {
@@ -13,25 +11,25 @@ import {
1311
ClaimedFundingGoal as ClaimedFundingGoalEvent,
1412
ClaimedStakes as ClaimedStakesEvent,
1513
Failed as FailedEvent,
14+
Started3 as LegacyStartedEvent,
1615
LockingContractCreated as LockingContractCreatedEvent,
1716
Settled as SettledEvent,
1817
Staked as StakedEvent,
19-
Started3 as LegacyStartedEvent,
2018
Started as StartedEvent
2119
} from '../generated/StakedLockingCrowdSale/StakedLockingCrowdSale'
20+
import { LockingContractCreated as LockedLockingContractCreatedEvent } from '../generated/LockingCrowdSale/LockingCrowdSale'
2221

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

2625
import { handleStarted as plainHandleStarted } from './crowdSaleMapping'
27-
import { lockingHandleStarted, handleLockingContractCreated as lockedHandleLockingContractCreated } from './lockingCrowdSaleMapping'
26+
import { handleLockingContractCreated as lockedHandleLockingContractCreated, lockingHandleStarted } from './lockingCrowdSaleMapping'
2827

2928
import * as GenericCrowdSale from './genericCrowdSale'
3029

31-
import { Contribution, CrowdSale, ERC20Token, IPT } from '../generated/schema'
30+
import { Contribution, CrowdSale } from '../generated/schema'
3231

33-
import { TimelockedToken as TimelockedTokenTemplate } from '../generated/templates'
34-
import { makeERC20Token, makeTimelockedToken } from './common'
32+
import { makeERC20Token } from './common'
3533

3634
/**
3735
* there are contracts that emit the started event without fees
@@ -153,7 +151,8 @@ export function handleClaimed(event: ClaimedEvent): void {
153151
export function handleLockingContractCreated(
154152
event: LockingContractCreatedEvent
155153
): void {
156-
lockedHandleLockingContractCreated(event)
154+
//xing fingers that this works!
155+
lockedHandleLockingContractCreated(changetype<LockedLockingContractCreatedEvent>(event))
157156
}
158157

159158
export function handleStaked(event: StakedEvent): void {

0 commit comments

Comments
 (0)