diff --git a/.gitignore b/.gitignore index a6cd455..06fd867 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /generated /node_modules /build +/subgraph.yaml diff --git a/config/mainnet.json b/config/mainnet.json new file mode 100644 index 0000000..d2596a2 --- /dev/null +++ b/config/mainnet.json @@ -0,0 +1,9 @@ +{ + "network": "mainnet", + "startBlock": 12809555, + "dydxTokenAddress": "0x92D6C1e31e14520e676a687F0a93788B716BEff5", + "dydxGovernorAddress": "0x7E9B1672616FF6D6629Ef2879419aaE79A9018D2", + "safetyModuleAddress": "0x65f7BA4Ec257AF7c55fd5854E5f6356bBd0fb8EC", + "merkleDistributorAddress": "0x01d3348601968aB85b4bb028979006eac235a588", + "liquidityStakingAddress": "0x5Aa653A076c1dbB47cec8C1B4d152444CAD91941" +} diff --git a/config/ropsten.json b/config/ropsten.json new file mode 100644 index 0000000..c5282c0 --- /dev/null +++ b/config/ropsten.json @@ -0,0 +1,9 @@ +{ + "network": "ropsten", + "startBlock": 10950559, + "dydxTokenAddress": "0x78b8ED55608F3db3f4e5A0A6f495f75cB8e0172F", + "dydxGovernorAddress": "0x5Fd2BfBba46f1EA4b5f7D468ddcd3Fa9Aca7Ce7F", + "safetyModuleAddress": "0xb9B802E34e646D383b85D9B9ad1B2baDf807603E", + "merkleDistributorAddress": "0x0968e47cBa485006d9CDC6a8eAa94eba779Ca309", + "liquidityStakingAddress": "0xf6c7cbb3381c819dD403a1b4B7669fE468cf738f" +} diff --git a/package.json b/package.json index e9e6d7b..752f0fa 100644 --- a/package.json +++ b/package.json @@ -1,16 +1,20 @@ { - "name": "dydx-ropsten", + "name": "dydx-subgraph", "license": "Apache 2.0", "scripts": { "codegen": "graph codegen", "build": "graph build", - "deploy": "graph deploy --node https://api.thegraph.com/deploy/ --ipfs https://api.thegraph.com/ipfs/ dydxfoundation/dydx-ropsten", + "prepare:ropsten": "mustache config/ropsten.json subgraph.template.yaml > subgraph.yaml", + "prepare:mainnet": "mustache config/mainnet.json subgraph.template.yaml > subgraph.yaml", + "deploy:ropsten": "yarn prepare:ropsten && graph deploy --node https://api.thegraph.com/deploy/ --ipfs https://api.thegraph.com/ipfs/ dydxfoundation/dydx-ropsten", + "deploy:mainnet": "yarn prepare:mainnet && graph deploy --node https://api.thegraph.com/deploy/ --ipfs https://api.thegraph.com/ipfs/ dydxfoundation/dydx", "create-local": "graph create --node http://localhost:8020/ fraypoint/merkle", "remove-local": "graph remove --node http://localhost:8020/ fraypoint/merkle", "deploy-local": "graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001 fraypoint/merkle" }, "dependencies": { "@graphprotocol/graph-cli": "0.22.1", - "@graphprotocol/graph-ts": "0.22.0" + "@graphprotocol/graph-ts": "0.22.0", + "mustache": "^4.2.0" } } diff --git a/subgraph.yaml b/subgraph.template.yaml similarity index 85% rename from subgraph.yaml rename to subgraph.template.yaml index 7f17c5b..29cc528 100644 --- a/subgraph.yaml +++ b/subgraph.template.yaml @@ -4,11 +4,11 @@ schema: dataSources: - kind: ethereum/contract name: DydxToken - network: ropsten + network: {{network}} source: - address: "0x78b8ED55608F3db3f4e5A0A6f495f75cB8e0172F" + address: "{{dydxTokenAddress}}" abi: DydxToken - startBlock: 10950559 + startBlock: {{startBlock}} mapping: kind: ethereum/events apiVersion: 0.0.5 @@ -26,11 +26,11 @@ dataSources: file: ./src/token.ts - kind: ethereum/contract name: DydxGovernor - network: ropsten + network: {{network}} source: - address: "0x5Fd2BfBba46f1EA4b5f7D468ddcd3Fa9Aca7Ce7F" + address: "{{dydxGovernorAddress}}" abi: DydxGovernor - startBlock: 10950559 + startBlock: {{startBlock}} mapping: kind: ethereum/events apiVersion: 0.0.5 @@ -49,11 +49,11 @@ dataSources: file: ./src/proposal.ts - kind: ethereum/contract name: SafetyModule - network: ropsten + network: {{network}} source: - address: "0xb9B802E34e646D383b85D9B9ad1B2baDf807603E" + address: "{{safetyModuleAddress}}" abi: SafetyModule - startBlock: 10950559 + startBlock: {{startBlock}} mapping: kind: ethereum/events apiVersion: 0.0.5 @@ -73,11 +73,11 @@ dataSources: file: ./src/safety-module.ts - kind: ethereum/contract name: MerkleDistributor - network: ropsten + network: {{network}} source: - address: "0x0968e47cBa485006d9CDC6a8eAa94eba779Ca309" + address: "{{merkleDistributorAddress}}" abi: MerkleDistributor - startBlock: 10950559 + startBlock: {{startBlock}} mapping: kind: ethereum/events apiVersion: 0.0.5 @@ -93,11 +93,11 @@ dataSources: file: ./src/merkle-distributor.ts - kind: ethereum/contract name: LiquidityStaking - network: ropsten + network: {{network}} source: - address: "0xf6c7cbb3381c819dD403a1b4B7669fE468cf738f" + address: "{{liquidityStakingAddress}}" abi: LiquidityStaking - startBlock: 10950559 + startBlock: {{startBlock}} mapping: kind: ethereum/events apiVersion: 0.0.5 diff --git a/yarn.lock b/yarn.lock index 1e01724..478d58c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1996,6 +1996,11 @@ murmurhash3js@^3.0.1: resolved "https://registry.yarnpkg.com/murmurhash3js/-/murmurhash3js-3.0.1.tgz#3e983e5b47c2a06f43a713174e7e435ca044b998" integrity sha1-Ppg+W0fCoG9DpxMXTn5DXKBEuZg= +mustache@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/mustache/-/mustache-4.2.0.tgz#e5892324d60a12ec9c2a73359edca52972bf6f64" + integrity sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ== + mute-stream@0.0.8: version "0.0.8" resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d"