Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
451 changes: 1 addition & 450 deletions tests/contracts/out/LimitedContract.sol/LimitedContract.json

Large diffs are not rendered by default.

584 changes: 1 addition & 583 deletions tests/contracts/out/OverloadedContract.sol/OverloadedContract.json

Large diffs are not rendered by default.

451 changes: 1 addition & 450 deletions tests/contracts/out/RevertingContract.sol/RevertingContract.json

Large diffs are not rendered by default.

846 changes: 1 addition & 845 deletions tests/contracts/out/SimpleContract.sol/SimpleContract.json

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions tests/integration-tests/source-subgraph/abis/Contract.abi
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[
{
"inputs": [],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint16",
"name": "x",
"type": "uint16"
}
],
"name": "Trigger",
"type": "event"
},
{
"inputs": [
{
"internalType": "uint16",
"name": "x",
"type": "uint16"
}
],
"name": "emitTrigger",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]
25 changes: 25 additions & 0 deletions tests/integration-tests/source-subgraph/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "source-subgraph",
"version": "0.1.0",
"scripts": {
"build-contracts": "../../common/build-contracts.sh",
"codegen": "graph codegen --skip-migrations",
"test": "yarn build-contracts && truffle test --compile-none --network test",
"create:test": "graph create test/source-subgraph --node $GRAPH_NODE_ADMIN_URI",
"deploy:test": "graph deploy test/source-subgraph --version-label v0.0.1 --ipfs $IPFS_URI --node $GRAPH_NODE_ADMIN_URI"
},
"devDependencies": {
"@graphprotocol/graph-cli": "0.69.0",
"@graphprotocol/graph-ts": "0.34.0",
"solc": "^0.8.2"
},
"dependencies": {
"@truffle/contract": "^4.3",
"@truffle/hdwallet-provider": "^1.2",
"apollo-fetch": "^0.7.0",
"babel-polyfill": "^6.26.0",
"babel-register": "^6.26.0",
"gluegun": "^4.6.1",
"truffle": "^5.2"
}
}
7 changes: 7 additions & 0 deletions tests/integration-tests/source-subgraph/schema.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@


type Block @entity {
id: ID!
number: BigInt!
hash: Bytes!
}
10 changes: 10 additions & 0 deletions tests/integration-tests/source-subgraph/src/mapping.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { ethereum, log } from '@graphprotocol/graph-ts';
import { Block } from '../generated/schema';

export function handleBlock(block: ethereum.Block): void {
log.info('handleBlock {}', [block.number.toString()]);
let blockEntity = new Block(block.number.toString());
blockEntity.number = block.number;
blockEntity.hash = block.hash;
blockEntity.save();
}
23 changes: 23 additions & 0 deletions tests/integration-tests/source-subgraph/subgraph.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
specVersion: 0.0.8
schema:
file: ./schema.graphql
dataSources:
- kind: ethereum/contract
name: BlockHandlerTest
network: test
source:
address: "@SimpleContract@"
abi: Contract
startBlock: 1
mapping:
kind: ethereum/events
apiVersion: 0.0.7
language: wasm/assemblyscript
abis:
- name: Contract
file: ./abis/Contract.abi
entities:
- Call
blockHandlers:
- handler: handleBlock
file: ./src/mapping.ts
15 changes: 15 additions & 0 deletions tests/integration-tests/subgraph-data-sources/abis/Contract.abi
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "string",
"name": "testCommand",
"type": "string"
}
],
"name": "TestEvent",
"type": "event"
}
]
13 changes: 13 additions & 0 deletions tests/integration-tests/subgraph-data-sources/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "subgraph-data-sources",
"version": "0.1.0",
"scripts": {
"codegen": "graph codegen --skip-migrations",
"create:test": "graph create test/subgraph-data-sources --node $GRAPH_NODE_ADMIN_URI",
"deploy:test": "graph deploy test/subgraph-data-sources --version-label v0.0.1 --ipfs $IPFS_URI --node $GRAPH_NODE_ADMIN_URI"
},
"devDependencies": {
"@graphprotocol/graph-cli": "0.79.0-alpha-20240711124603-49edf22",
"@graphprotocol/graph-ts": "0.31.0"
}
}
5 changes: 5 additions & 0 deletions tests/integration-tests/subgraph-data-sources/schema.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type MirrorBlock @entity {
id: Bytes!
number: BigInt!
hash: Bytes!
}
14 changes: 14 additions & 0 deletions tests/integration-tests/subgraph-data-sources/src/mapping.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Entity, log } from '@graphprotocol/graph-ts';
import { MirrorBlock } from '../generated/schema';

export function handleEntity(blockEntity: Entity): void {
let blockNumber = blockEntity.getBigInt('number');
let blockHash = blockEntity.getBytes('hash');

log.info('Block number: {}', [blockNumber.toString()]);

let block = new MirrorBlock(blockHash);
block.number = blockNumber;
block.hash = blockHash;
block.save();
}
19 changes: 19 additions & 0 deletions tests/integration-tests/subgraph-data-sources/subgraph.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
specVersion: 1.3.0
schema:
file: ./schema.graphql
dataSources:
- kind: subgraph
name: Contract
network: test
source:
address: 'QmUVaWpdKgcxBov1jHEa8dr46d2rkVzfHuZFu4fXJ4sFse'
startBlock: 0
mapping:
apiVersion: 0.0.7
language: wasm/assemblyscript
entities:
- Gravatar
handlers:
- handler: handleEntity
entity: Block
file: ./src/mapping.ts
57 changes: 56 additions & 1 deletion tests/integration-tests/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,47 @@
which "2.0.2"
yaml "1.10.2"

"@graphprotocol/[email protected]":
version "0.79.0-alpha-20240711124603-49edf22"
resolved "https://registry.yarnpkg.com/@graphprotocol/graph-cli/-/graph-cli-0.79.0-alpha-20240711124603-49edf22.tgz#4e3f6201932a0b68ce64d6badd8432cf2bead3c2"
integrity sha512-fZrdPiFbbbBVMnvsjfKA+j48WzzquaHQIpozBqnUKRPCV1n1NenIaq2nH16mlMwovRIS7AAIVCpa0QYQuPzw7Q==
dependencies:
"@float-capital/float-subgraph-uncrashable" "^0.0.0-alpha.4"
"@oclif/core" "2.8.6"
"@oclif/plugin-autocomplete" "^2.3.6"
"@oclif/plugin-not-found" "^2.4.0"
"@whatwg-node/fetch" "^0.8.4"
assemblyscript "0.19.23"
binary-install-raw "0.0.13"
chalk "3.0.0"
chokidar "3.5.3"
debug "4.3.4"
docker-compose "0.23.19"
dockerode "2.5.8"
fs-extra "9.1.0"
glob "9.3.5"
gluegun "5.1.6"
graphql "15.5.0"
immutable "4.2.1"
ipfs-http-client "55.0.0"
jayson "4.0.0"
js-yaml "3.14.1"
open "8.4.2"
prettier "3.0.3"
semver "7.4.0"
sync-request "6.1.0"
tmp-promise "3.0.3"
web3-eth-abi "1.7.0"
which "2.0.2"
yaml "1.10.2"

"@graphprotocol/[email protected]":
version "0.31.0"
resolved "https://registry.yarnpkg.com/@graphprotocol/graph-ts/-/graph-ts-0.31.0.tgz#730668c0369828b31bef81e8d9bc66b9b48e3480"
integrity sha512-xreRVM6ho2BtolyOh2flDkNoGZximybnzUnF53zJVp0+Ed0KnAlO1/KOCUYw06euVI9tk0c9nA2Z/D5SIQV2Rg==
dependencies:
assemblyscript "0.19.10"

"@graphprotocol/[email protected]":
version "0.34.0"
resolved "https://registry.yarnpkg.com/@graphprotocol/graph-ts/-/graph-ts-0.34.0.tgz#ca47398295b114f25b412faa364b98af31fa2bb7"
Expand Down Expand Up @@ -3544,6 +3585,11 @@ define-data-property@^1.1.2:
es-errors "^1.3.0"
gopd "^1.0.1"

define-lazy-prop@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz#3f7ae421129bcaaac9bc74905c98a0009ec9ee7f"
integrity sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==

delay@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/delay/-/delay-5.0.0.tgz#137045ef1b96e5071060dd5be60bf9334436bd1d"
Expand Down Expand Up @@ -5429,7 +5475,7 @@ is-core-module@^2.13.0:
dependencies:
hasown "^2.0.0"

is-docker@^2.0.0:
is-docker@^2.0.0, is-docker@^2.1.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-2.2.1.tgz#33eeabe23cfe86f14bde4408a02c0cfb853acdaa"
integrity sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==
Expand Down Expand Up @@ -6883,6 +6929,15 @@ onetime@^5.1.0, onetime@^5.1.2:
dependencies:
mimic-fn "^2.1.0"

[email protected]:
version "8.4.2"
resolved "https://registry.yarnpkg.com/open/-/open-8.4.2.tgz#5b5ffe2a8f793dcd2aad73e550cb87b59cb084f9"
integrity sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ==
dependencies:
define-lazy-prop "^2.0.0"
is-docker "^2.1.1"
is-wsl "^2.2.0"

[email protected]:
version "4.0.2"
resolved "https://registry.yarnpkg.com/ora/-/ora-4.0.2.tgz#0e1e68fd45b135d28648b27cf08081fa6e8a297d"
Expand Down
Loading