From a4e69d799d5617041a1445421ee0dfb156a1a6ec Mon Sep 17 00:00:00 2001 From: zramsay Date: Tue, 19 Sep 2023 16:13:32 -0400 Subject: [PATCH] add examples --- packages/codegen/SimpleContract.sol | 15 +++++++++++++ packages/codegen/example.config.yaml | 32 ++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 packages/codegen/SimpleContract.sol create mode 100644 packages/codegen/example.config.yaml diff --git a/packages/codegen/SimpleContract.sol b/packages/codegen/SimpleContract.sol new file mode 100644 index 00000000..7b9f19a7 --- /dev/null +++ b/packages/codegen/SimpleContract.sol @@ -0,0 +1,15 @@ +// contracts/SimpleContract.sol +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +contract SimpleContract { + uint256 public data; + + function setData(uint256 _data) public { + data = _data; + } + + function getData() public view returns (uint256) { + return data; + } +} diff --git a/packages/codegen/example.config.yaml b/packages/codegen/example.config.yaml new file mode 100644 index 00000000..a4a565c9 --- /dev/null +++ b/packages/codegen/example.config.yaml @@ -0,0 +1,32 @@ +contracts: + # Contract name: + - name: SimpleContract + # Contract file path or an url: + path: ./SimpleContract.sol + # Contract kind (should match name of dataSource in {subgraphPath}/subgraph.yaml if subgraphPath provided) + #kind: Example1 + +# Output folder path (logs output using `stdout` if not provided). +outputFolder: ../simple-contract-watcher + +# Code generation mode [eth_call | storage | all | none] (default: none). +mode: none + +# Kind of watcher [lazy | active] (default: active). +kind: lazy + +# Watcher server port (default: 3008). +port: 3008 + +# Solc version to use (optional) +# If not defined, uses solc version listed in dependencies +solc: v0.8.0+commit.c7dfd78e + +# Flatten the input contract file(s) [true | false] (default: true). +flatten: true + +# Path to the subgraph build (optional). +# Can set empty contracts array when using subgraphPath. +# subgraphPath: ../graph-node/test/subgraph/example1/build + +# NOTE: When passed an *URL* as contract path, it is assumed that it points to an already flattened contract file.