init
This commit is contained in:
commit
90b6e718e9
69
.gitignore
vendored
Normal file
69
.gitignore
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules
|
||||
jspm_packages/
|
||||
|
||||
# TypeScript v1 declaration files
|
||||
typings/
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# dotenv environment variables file
|
||||
.env
|
||||
|
||||
# next.js build output
|
||||
.next
|
||||
|
||||
build
|
||||
.vscode
|
||||
.idea
|
||||
.env
|
||||
|
||||
generated
|
||||
.DS_Store
|
428
abis/RelayerRegistry.json
Normal file
428
abis/RelayerRegistry.json
Normal file
@ -0,0 +1,428 @@
|
||||
[
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "_torn", "type": "address" },
|
||||
{ "internalType": "address", "name": "_governance", "type": "address" },
|
||||
{ "internalType": "address", "name": "_ens", "type": "address" },
|
||||
{ "internalType": "bytes32", "name": "_staking", "type": "bytes32" },
|
||||
{ "internalType": "bytes32", "name": "_feeManager", "type": "bytes32" }
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "constructor"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "minStakeAmount",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "MinimumStakeAmount",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "address",
|
||||
"name": "relayer",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "RelayerBalanceNullified",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "bytes32",
|
||||
"name": "relayer",
|
||||
"type": "bytes32"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "string",
|
||||
"name": "ensName",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "address",
|
||||
"name": "relayerAddress",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "stakedAmount",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "RelayerRegistered",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "address",
|
||||
"name": "tornadoRouter",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "RouterRegistered",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "address",
|
||||
"name": "relayer",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "amountStakeAdded",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "StakeAddedToRelayer",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "address",
|
||||
"name": "relayer",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "amountBurned",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "StakeBurned",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "address",
|
||||
"name": "relayer",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "address",
|
||||
"name": "worker",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "WorkerRegistered",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "address",
|
||||
"name": "relayer",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "address",
|
||||
"name": "worker",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "WorkerUnregistered",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "bytes32[]", "name": "domains", "type": "bytes32[]" }
|
||||
],
|
||||
"name": "bulkResolve",
|
||||
"outputs": [
|
||||
{ "internalType": "address[]", "name": "result", "type": "address[]" }
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "sender", "type": "address" },
|
||||
{ "internalType": "address", "name": "relayer", "type": "address" },
|
||||
{
|
||||
"internalType": "contract ITornadoInstance",
|
||||
"name": "pool",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "burn",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "ens",
|
||||
"outputs": [
|
||||
{ "internalType": "contract IENS", "name": "", "type": "address" }
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "feeManager",
|
||||
"outputs": [
|
||||
{ "internalType": "contract FeeManager", "name": "", "type": "address" }
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "relayer", "type": "address" }
|
||||
],
|
||||
"name": "getRelayerBalance",
|
||||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "relayer", "type": "address" }
|
||||
],
|
||||
"name": "getRelayerEnsHash",
|
||||
"outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "governance",
|
||||
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "bytes32", "name": "_tornadoRouter", "type": "bytes32" }
|
||||
],
|
||||
"name": "initialize",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "toResolve", "type": "address" }
|
||||
],
|
||||
"name": "isRelayer",
|
||||
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "relayer", "type": "address" },
|
||||
{ "internalType": "address", "name": "toResolve", "type": "address" }
|
||||
],
|
||||
"name": "isRelayerRegistered",
|
||||
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "minStakeAmount",
|
||||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "relayer", "type": "address" }
|
||||
],
|
||||
"name": "nullifyBalance",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "string", "name": "ensName", "type": "string" },
|
||||
{ "internalType": "uint256", "name": "stake", "type": "uint256" },
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "workersToRegister",
|
||||
"type": "address[]"
|
||||
}
|
||||
],
|
||||
"name": "register",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "string", "name": "ensName", "type": "string" },
|
||||
{ "internalType": "uint256", "name": "stake", "type": "uint256" },
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "workersToRegister",
|
||||
"type": "address[]"
|
||||
},
|
||||
{ "internalType": "address", "name": "relayer", "type": "address" },
|
||||
{ "internalType": "uint256", "name": "deadline", "type": "uint256" },
|
||||
{ "internalType": "uint8", "name": "v", "type": "uint8" },
|
||||
{ "internalType": "bytes32", "name": "r", "type": "bytes32" },
|
||||
{ "internalType": "bytes32", "name": "s", "type": "bytes32" }
|
||||
],
|
||||
"name": "registerPermit",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "relayer", "type": "address" },
|
||||
{ "internalType": "address", "name": "worker", "type": "address" }
|
||||
],
|
||||
"name": "registerWorker",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
||||
"name": "relayers",
|
||||
"outputs": [
|
||||
{ "internalType": "uint256", "name": "balance", "type": "uint256" },
|
||||
{ "internalType": "bytes32", "name": "ensHash", "type": "bytes32" }
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "bytes32", "name": "node", "type": "bytes32" }
|
||||
],
|
||||
"name": "resolve",
|
||||
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "uint256", "name": "minAmount", "type": "uint256" }
|
||||
],
|
||||
"name": "setMinStakeAmount",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "tornadoRouterAddress",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "setTornadoRouter",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "relayer", "type": "address" },
|
||||
{ "internalType": "uint256", "name": "stake", "type": "uint256" }
|
||||
],
|
||||
"name": "stakeToRelayer",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "relayer", "type": "address" },
|
||||
{ "internalType": "uint256", "name": "stake", "type": "uint256" },
|
||||
{ "internalType": "address", "name": "staker", "type": "address" },
|
||||
{ "internalType": "uint256", "name": "deadline", "type": "uint256" },
|
||||
{ "internalType": "uint8", "name": "v", "type": "uint8" },
|
||||
{ "internalType": "bytes32", "name": "r", "type": "bytes32" },
|
||||
{ "internalType": "bytes32", "name": "s", "type": "bytes32" }
|
||||
],
|
||||
"name": "stakeToRelayerPermit",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "staking",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "contract TornadoStakingRewards",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "torn",
|
||||
"outputs": [
|
||||
{ "internalType": "contract TORN", "name": "", "type": "address" }
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "tornadoRouter",
|
||||
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "worker", "type": "address" }
|
||||
],
|
||||
"name": "unregisterWorker",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
||||
"name": "workers",
|
||||
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}
|
||||
]
|
13
package.json
Normal file
13
package.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "tornado-relayer-registry-subgraph",
|
||||
"license": "UNLICENSED",
|
||||
"scripts": {
|
||||
"codegen": "graph codegen",
|
||||
"build": "graph build",
|
||||
"deploy": "graph deploy --node https://api.thegraph.com/deploy/ tornadocash/tornado-relayer-registry --access-token $TOKEN"
|
||||
},
|
||||
"dependencies": {
|
||||
"@graphprotocol/graph-cli": "0.27.0",
|
||||
"@graphprotocol/graph-ts": "0.24.1"
|
||||
}
|
||||
}
|
7
schema.graphql
Normal file
7
schema.graphql
Normal file
@ -0,0 +1,7 @@
|
||||
type Relayer @entity {
|
||||
id: ID!
|
||||
address: Bytes!
|
||||
ensName: String!
|
||||
ensHash: Bytes!
|
||||
blockRegistration: BigInt!
|
||||
}
|
14
src/mapping.ts
Normal file
14
src/mapping.ts
Normal file
@ -0,0 +1,14 @@
|
||||
// import { BigInt } from "@graphprotocol/graph-ts";
|
||||
import { RelayerRegistered } from "../generated/RelayerRegistry/RelayerRegistry";
|
||||
import { Relayer } from "../generated/schema";
|
||||
|
||||
export function handleRelayerRegistered(event: RelayerRegistered): void {
|
||||
let relayer = new Relayer(
|
||||
event.transaction.hash.toHex() + "-" + event.logIndex.toString()
|
||||
);
|
||||
relayer.ensHash = event.params.relayer;
|
||||
relayer.ensName = event.params.ensName;
|
||||
relayer.address = event.params.relayerAddress;
|
||||
relayer.blockRegistration = event.block.number;
|
||||
relayer.save();
|
||||
}
|
35
subgraph.yaml
Normal file
35
subgraph.yaml
Normal file
@ -0,0 +1,35 @@
|
||||
specVersion: 0.0.2
|
||||
schema:
|
||||
file: ./schema.graphql
|
||||
dataSources:
|
||||
- kind: ethereum
|
||||
name: RelayerRegistry
|
||||
network: mainnet
|
||||
source:
|
||||
address: "0x58E8dCC13BE9780fC42E8723D8EaD4CF46943dF2"
|
||||
abi: RelayerRegistry
|
||||
startBlock: 14173129
|
||||
mapping:
|
||||
kind: ethereum/events
|
||||
apiVersion: 0.0.5
|
||||
language: wasm/assemblyscript
|
||||
entities:
|
||||
- Relayer
|
||||
# - Worker
|
||||
abis:
|
||||
- name: RelayerRegistry
|
||||
file: ./abis/RelayerRegistry.json
|
||||
eventHandlers:
|
||||
# - event: RelayerBalanceNullified(address)
|
||||
# handler: handleRelayerBalanceNullified
|
||||
# - event: WorkerRegistered(address,address)
|
||||
# handler: handleWorkerRegistered
|
||||
# - event: WorkerUnregistered(address,address)
|
||||
# handler: handleWorkerUnregistered
|
||||
# - event: StakeAddedToRelayer(address,uint256)
|
||||
# handler: handleStakeAddedToRelayer
|
||||
# - event: StakeBurned(address,uint256)
|
||||
# handler: handleStakeBurned
|
||||
- event: RelayerRegistered(bytes32,string,address,uint256)
|
||||
handler: handleRelayerRegistered
|
||||
file: ./src/mapping.ts
|
4
tsconfig.json
Normal file
4
tsconfig.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"extends": "@graphprotocol/graph-ts/types/tsconfig.base.json",
|
||||
"include": ["src"]
|
||||
}
|
Loading…
Reference in New Issue
Block a user