Skip to content

Commit ff8f0ed

Browse files
authored
Merge pull request #963 from graphprotocol/mde/add-data-edge-contracts
chore: add DataEdge contracts
2 parents 59154f7 + c8331d5 commit ff8f0ed

30 files changed

+2844
-56
lines changed

.github/workflows/ci-data-edge.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: CI - packages/data-edge
2+
3+
env:
4+
CI: true
5+
6+
on:
7+
push:
8+
branches: "*"
9+
paths:
10+
- packages/data-edge/**
11+
pull_request:
12+
branches: "*"
13+
paths:
14+
- packages/data-edge/**
15+
workflow_dispatch:
16+
17+
jobs:
18+
test-ci:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
- name: Set up environment
24+
uses: ./.github/actions/setup
25+
- name: Run tests
26+
run: yarn test

.husky/pre-commit

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,11 @@
22
. "$(dirname -- "$0")/_/husky.sh"
33

44
# contracts
5-
cd packages/contracts
5+
pushd packages/contracts
66
npx --no-install lint-staged
7+
popd
8+
9+
# data-edge
10+
pushd packages/data-edge
11+
npx --no-install lint-staged
12+
popd

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"packageManager": "[email protected]",
99
"workspaces": [
1010
"packages/contracts",
11+
"packages/data-edge",
1112
"packages/eslint-graph-config",
1213
"packages/sdk",
1314
"packages/solhint-graph-config",

packages/data-edge/.env.sample

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
MNEMONIC=
2+
INFURA_KEY=
3+
ETHERSCAN_API_KEY=
4+
ARBISCAN_API_KEY=

packages/data-edge/.prettierignore

Whitespace-only changes.

packages/data-edge/.solcover.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const skipFiles = ['']
2+
3+
module.exports = {
4+
providerOptions: {
5+
mnemonic: 'myth like bonus scare over problem client lizard pioneer submit female collect',
6+
network_id: 1337,
7+
},
8+
skipFiles,
9+
istanbulFolder: './reports/coverage',
10+
}

packages/data-edge/LICENSE

Lines changed: 342 additions & 0 deletions
Large diffs are not rendered by default.

packages/data-edge/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Data Edge
2+
3+
A DataEdge contract is used to store arbitrary data on-chain on any EVM compatible blockchain. A subgraph can then read all the calldata sent to a particular contract, decode it and update the subgraph state accordingly.
4+
5+
The DataEdge accepts any function call by using a fallback function that will not revert. It is up to the implementor to define the calldata format as well as how to decode it.
6+
7+
### Additional Considerations
8+
9+
- Fallback is not payable to avoid anyone sending ETH by mistake as the main purpose is to store calldata.
10+
11+
# Deploying
12+
13+
Setup a `.env` file with the keys you want to use for deployments. You can use `.env.sample` as a guide.
14+
Deploy a `DataEdge` contract by running `yarn deploy -- --network <network-name>`
15+
16+
# Copyright
17+
18+
Copyright &copy; 2022 The Graph Foundation
19+
20+
Licensed under [GPL license](LICENSE).

packages/data-edge/addresses.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"421614": {
3+
"DataEdge": "0x17f1fcD16E2A9fF2a55c63C97a778D96Fa473548",
4+
"EventfulDataEdge": "0x9b9402939133F27c6eba81a321dfBFa1feE6714E"
5+
},
6+
"11155111": {
7+
"DataEdge": "0x00C602A72363917Bc30a793593731F93352eB85d",
8+
"EventfulDataEdge": "0xEFC8D47673777b899f2FB597C6FC0E87ecce98Cb"
9+
}
10+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// SPDX-License-Identifier: GPL-2.0-or-later
2+
3+
pragma solidity ^0.8.12;
4+
5+
/// @title Data Edge contract is only used to store on-chain data, it does not
6+
/// perform execution. On-chain client services can read the data
7+
/// and decode the payload for different purposes.
8+
contract DataEdge {
9+
/// @dev Fallback function, accepts any payload
10+
fallback() external payable {
11+
// no-op
12+
}
13+
}

0 commit comments

Comments
 (0)