-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move the subgraph out of the monorepo so it works with graph test
- Loading branch information
1 parent
0fdd6a1
commit 3bd5735
Showing
18 changed files
with
140 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,3 +47,6 @@ logs | |
# Misc | ||
.DS_Store | ||
*.pem | ||
.bin | ||
.latest.json | ||
.docker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
FROM --platform=linux/x86_64 ubuntu:22.04 | ||
|
||
ARG DEBIAN_FRONTEND=noninteractive | ||
|
||
ENV ARGS="" | ||
|
||
RUN apt update \ | ||
&& apt install -y sudo curl postgresql postgresql-contrib | ||
|
||
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - \ | ||
&& sudo apt-get install -y nodejs | ||
|
||
RUN curl -OL https://github.com/LimeChain/matchstick/releases/download/0.6.0/binary-linux-22 \ | ||
&& chmod a+x binary-linux-22 | ||
|
||
RUN mkdir matchstick | ||
WORKDIR /matchstick | ||
|
||
# Commenting out for now as it seems there's no need to copy when using bind mount | ||
# COPY ./ . | ||
|
||
CMD ../binary-linux-22 ${ARGS} |
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...racts/councilhaus-subgraph/src/council.ts → ...racts/councilhaus/subgraph/src/council.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
21 changes: 21 additions & 0 deletions
21
contracts/councilhaus/subgraph/tests/council-factory-utils.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Address, ethereum } from "@graphprotocol/graph-ts"; | ||
import { newMockEvent } from "matchstick-as"; | ||
import { CouncilCreated } from "../generated/CouncilFactory/CouncilFactory"; | ||
|
||
export function createCouncilCreatedEvent( | ||
council: Address, | ||
pool: Address, | ||
): CouncilCreated { | ||
const councilCreatedEvent = changetype<CouncilCreated>(newMockEvent()); | ||
|
||
councilCreatedEvent.parameters = new Array(); | ||
|
||
councilCreatedEvent.parameters.push( | ||
new ethereum.EventParam("council", ethereum.Value.fromAddress(council)), | ||
); | ||
councilCreatedEvent.parameters.push( | ||
new ethereum.EventParam("pool", ethereum.Value.fromAddress(pool)), | ||
); | ||
|
||
return councilCreatedEvent; | ||
} |
83 changes: 83 additions & 0 deletions
83
contracts/councilhaus/subgraph/tests/council-factory.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import { Address, ethereum } from "@graphprotocol/graph-ts"; | ||
import { | ||
assert, | ||
afterAll, | ||
beforeAll, | ||
clearStore, | ||
describe, | ||
mockFunction, | ||
test, | ||
} from "matchstick-as/assembly/index"; | ||
import { handleCouncilCreated } from "../src/council-factory"; | ||
import { createCouncilCreatedEvent } from "./council-factory-utils"; | ||
|
||
describe("Describe entity assertions", () => { | ||
beforeAll(() => { | ||
const councilAddress = Address.fromString( | ||
"0x0000000000000000000000000000000000000001", | ||
); | ||
const pool = Address.fromString( | ||
"0x0000000000000000000000000000000000000002", | ||
); | ||
const newCouncilCreatedEvent = createCouncilCreatedEvent( | ||
councilAddress, | ||
pool, | ||
); | ||
|
||
mockFunction( | ||
councilAddress, | ||
"name", | ||
"name():(string)", | ||
[], | ||
[ethereum.Value.fromString("Test Council")], | ||
false, | ||
); | ||
mockFunction( | ||
councilAddress, | ||
"symbol", | ||
"symbol():(string)", | ||
[], | ||
[ethereum.Value.fromString("TST")], | ||
false, | ||
); | ||
mockFunction( | ||
councilAddress, | ||
"distributionToken", | ||
"distributionToken():(address)", | ||
[], | ||
[ | ||
ethereum.Value.fromAddress( | ||
Address.fromString("0x0000000000000000000000000000000000000003"), | ||
), | ||
], | ||
false, | ||
); | ||
|
||
handleCouncilCreated(newCouncilCreatedEvent); | ||
}); | ||
|
||
afterAll(() => { | ||
clearStore(); | ||
}); | ||
|
||
test("Council created and stored", () => { | ||
assert.entityCount("Council", 1); | ||
|
||
const councilId = "0x0000000000000000000000000000000000000001"; | ||
|
||
assert.fieldEquals("Council", councilId, "councilName", "Test Council"); | ||
assert.fieldEquals("Council", councilId, "councilSymbol", "TST"); | ||
assert.fieldEquals( | ||
"Council", | ||
councilId, | ||
"pool", | ||
"0x0000000000000000000000000000000000000002", | ||
); | ||
assert.fieldEquals( | ||
"Council", | ||
councilId, | ||
"distributionToken", | ||
"0x0000000000000000000000000000000000000003", | ||
); | ||
}); | ||
}); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters