Skip to content

Commit

Permalink
chore: add subgraph service contracts boilerplate
Browse files Browse the repository at this point in the history
Signed-off-by: Tomás Migone <[email protected]>
  • Loading branch information
tmigone committed Mar 26, 2024
1 parent 8a32061 commit ce0b766
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 53 deletions.
4 changes: 0 additions & 4 deletions packages/contracts/contracts/staking/IHorizonStaking.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
pragma solidity >=0.7.6 <0.9.0;
pragma abicoder v2;

interface Test {
function test() external returns (uint256);
}

interface IHorizonStaking {
struct Provision {
// Service provider that created the provision
Expand Down
16 changes: 16 additions & 0 deletions packages/subgraph-service/contracts/ISubgraphService.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.25;

interface ISubgraphService {
// register as a provider in the data service
function register(address provisionId, string calldata url, string calldata geohash, uint256 delegatorQueryFeeCut)
external;

// register as a provider in the data service, create the required provision first
// function provisionAndRegister(
// uint256 tokens,
// string calldata url,
// string calldata geohash,
// uint256 delegatorQueryFeeCut
// ) external;
}
22 changes: 16 additions & 6 deletions packages/subgraph-service/contracts/SubgraphService.sol
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.4.0 <0.9.0;
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.25;

import {Test} from "@graphprotocol/contracts/contracts/staking/IHorizonStaking.sol";
import {IHorizonStaking} from "@graphprotocol/contracts/contracts/staking/IHorizonStaking.sol";
import {ISubgraphService} from "./ISubgraphService.sol";
import {SubgraphServiceV1Storage} from "./SubgraphServiceStorage.sol";

contract SimpleTest is Test {
function test() external pure returns (uint256) {
return 42;
contract SubgraphService is SubgraphServiceV1Storage, ISubgraphService {
function register(address provisionId, string calldata url, string calldata geohash, uint256 delegatorQueryFeeCut)
external
override
{
// Get provision from Staking contract
// Validate provision parameters meet DS requirements
}

function _register(address provisionId, string calldata url, string calldata geohash, uint256 delegatorQueryFeeCut)
internal
{}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.25;

contract SubgraphServiceV1Storage {}
2 changes: 1 addition & 1 deletion packages/subgraph-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"lint": "yarn lint:ts && yarn lint:sol",
"clean": "rm -rf build cache typechain-types",
"build": "hardhat compile",
"test": "forge test"
"test": "forge test && hardhat test"
},
"devDependencies": {
"@graphprotocol/contracts": "workspace:^7.0.0",
Expand Down
18 changes: 0 additions & 18 deletions packages/subgraph-service/test/SimpleTest.t.sol

This file was deleted.

23 changes: 0 additions & 23 deletions packages/subgraph-service/test/SimpleTest.ts

This file was deleted.

0 comments on commit ce0b766

Please sign in to comment.