├── .github └── workflows │ ├── child-subgraph-release.yml │ ├── ci.yml │ └── root-subgraph-release.yml ├── .gitignore ├── LICENSE ├── README.md ├── child ├── .eslintrc.js ├── .gitignore ├── LICENSE ├── abis │ └── ChildErc20.json ├── config │ ├── mainnet.json │ └── mumbai.json ├── package-lock.json ├── package.json ├── schema.graphql ├── src │ ├── helpers │ │ └── numbers.ts │ └── mappings │ │ ├── child-erc20.ts │ │ └── erc20.ts ├── subgraph.template.yaml ├── tsconfig.json └── yarn.lock └── root ├── .eslintrc.js ├── .gitignore ├── abis ├── Decoder.json ├── EventsHub.json ├── FxErc1155RootTunnel.json ├── FxErc20RootTunnel.json ├── FxErc721RootTunnel.json ├── Registry.json ├── RootChainManager.json ├── Rootchain.json ├── StakingInfo.json ├── StakingNft.json ├── StateSender.json ├── TestToken.json └── WithdrawManager.json ├── config ├── goerli.json └── mainnet.json ├── package-lock.json ├── package.json ├── schema.graphql ├── src ├── mappings │ ├── checkpoint.ts │ ├── fx-erc1155.ts │ ├── fx-erc20.ts │ ├── fx-erc721.ts │ ├── matic-transfer.ts │ ├── registry.ts │ ├── rootchain-manager.ts │ ├── staking-info.ts │ ├── staking-nft.ts │ ├── state-sync.ts │ └── withdraw-manager.ts └── network.template.ts ├── subgraph.template.yaml ├── tsconfig.json └── yarn.lock /.github/workflows/child-subgraph-release.yml: -------------------------------------------------------------------------------- 1 | name: Child subgraph release 2 | 3 | on: 4 | release: 5 | types: [created] 6 | # Allows you to run this workflow manually from the Actions tab 7 | workflow_dispatch: 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | strategy: 13 | matrix: 14 | include: 15 | - SUBGRAPH_NETWORK: mumbai 16 | SUBGRAPH_NAME: maticnetwork/mumbai-child-subgraphs 17 | - SUBGRAPH_NETWORK: matic 18 | SUBGRAPH_NAME: maticnetwork/mainnet-child-subgraphs 19 | 20 | defaults: 21 | run: 22 | working-directory: child 23 | 24 | steps: 25 | - uses: actions/checkout@v2 26 | - uses: actions/setup-node@v2 27 | with: 28 | node-version: "14" 29 | check-latest: true 30 | - run: npm install 31 | - name: Prepare subgraph for ${{ matrix.SUBGRAPH_NETWORK }} 32 | run: npm run prepare:${{ matrix.SUBGRAPH_NETWORK }} 33 | - name: Generate code for subgraph 34 | run: npm run codegen 35 | - name: Build subgraph 36 | run: npm run build 37 | - name: Deploy subgraph 38 | run: | 39 | npm run graph -- deploy --access-token ${{ secrets.THE_GRAPH_ACCESS_TOKEN }} --node ${{ secrets.THE_GRAPH_NODE_URL }} --ipfs ${{ secrets.THE_GRAPH_IPFS_URL }} ${{ matrix.SUBGRAPH_NAME }} 40 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | branches: [master] 6 | pull_request: 7 | branches: [master] 8 | # Allows you to run this workflow manually from the Actions tab 9 | workflow_dispatch: 10 | 11 | jobs: 12 | build: 13 | runs-on: ubuntu-latest 14 | strategy: 15 | matrix: 16 | include: 17 | - SUBGRAPH_DIRECTORY: root 18 | SUBGRAPH_NETWORK: goerli 19 | - SUBGRAPH_DIRECTORY: root 20 | SUBGRAPH_NETWORK: mainnet 21 | - SUBGRAPH_DIRECTORY: child 22 | SUBGRAPH_NETWORK: mumbai 23 | - SUBGRAPH_DIRECTORY: child 24 | SUBGRAPH_NETWORK: mainnet 25 | 26 | defaults: 27 | run: 28 | working-directory: ${{ matrix.SUBGRAPH_DIRECTORY }} 29 | 30 | steps: 31 | - uses: actions/checkout@v2 32 | - uses: actions/setup-node@v2 33 | with: 34 | node-version: "14" 35 | check-latest: true 36 | - name: Install npm package 37 | run: npm install 38 | - name: Check lint 39 | run: npm run lint 40 | - name: Prepare subgraph for ${{ matrix.SUBGRAPH_NETWORK }} 41 | run: npm run prepare:${{ matrix.SUBGRAPH_NETWORK }} 42 | - name: Generate code for subgraph 43 | run: npm run codegen 44 | - name: Build subgraph 45 | run: npm run build 46 | -------------------------------------------------------------------------------- /.github/workflows/root-subgraph-release.yml: -------------------------------------------------------------------------------- 1 | name: Root subgraph release 2 | 3 | on: 4 | release: 5 | types: [created] 6 | # Allows you to run this workflow manually from the Actions tab 7 | workflow_dispatch: 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | strategy: 13 | matrix: 14 | include: 15 | - SUBGRAPH_NETWORK: goerli 16 | SUBGRAPH_NAME: maticnetwork/mumbai-root-subgraphs 17 | - SUBGRAPH_NETWORK: mainnet 18 | SUBGRAPH_NAME: maticnetwork/mainnet-root-subgraphs 19 | 20 | defaults: 21 | run: 22 | working-directory: root 23 | 24 | steps: 25 | - uses: actions/checkout@v2 26 | - uses: actions/setup-node@v2 27 | with: 28 | node-version: "14" 29 | check-latest: true 30 | - run: npm install 31 | - name: Prepare subgraph for ${{ matrix.SUBGRAPH_NETWORK }} 32 | run: npm run prepare:${{ matrix.SUBGRAPH_NETWORK }} 33 | - name: Generate code for subgraph 34 | run: npm run codegen 35 | - name: Build subgraph 36 | run: npm run build 37 | - name: Deploy subgraph 38 | run: | 39 | npm run graph -- deploy --access-token ${{ secrets.THE_GRAPH_ACCESS_TOKEN }} --node ${{ secrets.THE_GRAPH_NODE_URL }} --ipfs ${{ secrets.THE_GRAPH_IPFS_URL }} ${{ matrix.SUBGRAPH_NAME }} 40 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (https://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | dist/ 39 | generated/ 40 | build/ 41 | 42 | # TypeScript v1 declaration files 43 | typings/ 44 | 45 | # Optional npm cache directory 46 | .npm 47 | 48 | # Optional eslint cache 49 | .eslintcache 50 | 51 | # Optional REPL history 52 | .node_repl_history 53 | 54 | # Output of 'npm pack' 55 | *.tgz 56 | 57 | # Yarn Integrity file 58 | .yarn-integrity 59 | 60 | # dotenv environment variables file 61 | .env 62 | 63 | # next.js build output 64 | .next 65 | 66 | # IPFS hash 67 | .ipfs.hash 68 | 69 | # DS Store 70 | .DS_Store 71 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Matic 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Subgraphs 2 | Subgraph for Matic contracts 3 | 4 | Please take a look at [Graph protocol](https://github.com/graphprotocol/graph-node) for more information. 5 | 6 | ## Polygon hosted node endpoints 7 | 8 | **Root** 9 | - Mainnet: `https://thegraph.com/hosted-service/subgraph/maticnetwork/mainnet-root-subgraphs` 10 | - Goerli: `https://thegraph.com/hosted-service/subgraph/maticnetwork/mumbai-root-subgraphs` 11 | 12 | ## For Mumbai hosted node endpoints 13 | - Graph node: `https://mumbai-graph.matic.today` 14 | - GraphQL endpoint: `https://api.mumbai-graph.matic.today/subgraphs/name///graphql` 15 | - HTTP endpoint: `https://api.mumbai-graph.matic.today/subgraphs/name//` 16 | - IPFS endpoint: `https://ipfs.infura.io:5001/` 17 | 18 | ## Subgraphs 19 | 20 | This repository contains subgraphs for two chains: `root` (Ethereum) and `child` (Matic) with respective testnets. 21 | 22 | **To prepare root (Ethereum) subgraphs** 23 | 24 | ```bash 25 | cd root 26 | 27 | # install dependencies 28 | npm install 29 | 30 | # For goerli 31 | npm run prepare:goerli 32 | 33 | # For mainnet 34 | # npm run prepare:mainnet 35 | ``` 36 | 37 | **To prepare child (Matic) subgraphs** 38 | 39 | ```bash 40 | cd child 41 | 42 | # install dependencies 43 | npm install 44 | 45 | # For mumbai 46 | npm run prepare:mumbai 47 | 48 | # For mainnet 49 | # npm run prepare:mainnet 50 | ``` 51 | 52 | ### Build 53 | 54 | ```bash 55 | # generate code 56 | npm run codegen 57 | 58 | # build 59 | npm run build 60 | ``` 61 | 62 | ### Deploy locally 63 | 64 | **For goerli** 65 | 66 | ```bash 67 | # create sub graph in local node 68 | npm run graph -- create --node http://localhost:8020/ maticnetwork/goerli-matic-subgraph 69 | 70 | # deploy sub graph locally 71 | npm run graph -- deploy --node http://localhost:8020/ --ipfs https://ipfs.infura.io:5001/ maticnetwork/goerli-matic-subgraph 72 | ``` 73 | 74 | ### Deploy on Graph's hosted node 75 | 76 | **For goerli** 77 | 78 | ```bash 79 | # create sub graph in local node 80 | npm run graph -- create --node https://api.thegraph.com/deploy/ maticnetwork/goerli-matic-subgraph 81 | 82 | # deploy sub graph locally 83 | npm run graph -- deploy --node https://api.thegraph.com/deploy/ --ipfs https://api.thegraph.com/ipfs/ maticnetwork/goerli-matic-subgraph 84 | ``` 85 | 86 | **For mumbai** 87 | 88 | ```bash 89 | # create sub graph in local node 90 | npm run graph -- create --node https://mumbai-graph.matic.today nglglhtr/mumbai-matic-subgraph 91 | 92 | # deploy sub graph locally 93 | npm run graph -- deploy --node https://mumbai-graph.matic.today --ipfs https://ipfs.infura.io:5001/ nglglhtr/mumbai-matic-subgraph 94 | ``` 95 | 96 | ## Run local graph node 97 | 98 | ```bash 99 | $ cargo run -p graph-node --release -- \ 100 | --postgres-url postgresql://localhost:5432/token-transfer \ 101 | --ethereum-rpc http://localhost:8545/ \ 102 | --ipfs 127.0.0.1:5001 \ 103 | --subgraph 104 | ``` 105 | 106 | You can open graphiQL UI at http://localhost:8000 107 | 108 | ## License 109 | 110 | MIT -------------------------------------------------------------------------------- /child/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | parser: '@typescript-eslint/parser', 3 | plugins: [ 4 | '@typescript-eslint', 5 | 'unicorn', 6 | 'json', 7 | ], 8 | extends: 'eslint:recommended', 9 | parserOptions: { 10 | 'sourceType': 'module', 11 | }, 12 | globals: { 13 | Promise: true, 14 | Buffer: true, 15 | fetch: true, 16 | require: true, 17 | process: true, 18 | module: true, 19 | setTimeout: true, 20 | __dirname: true, 21 | u32: true, 22 | u8: true, 23 | }, 24 | rules: { 25 | 'indent': ['error', 2], 26 | 'space-before-function-paren': ['error', 'never'], 27 | semi: ['error', 'never'], 28 | 'no-underscore-dangle': 0, 29 | // allow debugger during development 30 | 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0, 31 | // trailing comma 32 | 'comma-dangle': ['error', 'always-multiline'], 33 | quotes: ['error', 'single', { 'avoidEscape': true, 'allowTemplateLiterals': true }], 34 | camelcase: ['error', { 'properties': 'always' }], 35 | 'unicorn/filename-case': ['error', { 'case': 'kebabCase' }], 36 | }, 37 | overrides: [ 38 | { 39 | files: ['*.ts', '*.tsx'], 40 | rules: { 41 | '@typescript-eslint/no-unused-vars': ['error', { args: 'none' }], 42 | }, 43 | }, 44 | { 45 | files: ['*.json'], 46 | rules: { 47 | 'unicorn/filename-case': ['error', { 'case': 'pascalCase' }], 48 | }, 49 | }, 50 | ], 51 | } 52 | -------------------------------------------------------------------------------- /child/.gitignore: -------------------------------------------------------------------------------- 1 | subgraph.yaml 2 | -------------------------------------------------------------------------------- /child/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Matic Network 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /child/config/mainnet.json: -------------------------------------------------------------------------------- 1 | { 2 | "network": "matic", 3 | "contracts": { 4 | "maticToken": { 5 | "address": "0x0000000000000000000000000000000000001010", 6 | "startBlock": 23557300 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /child/config/mumbai.json: -------------------------------------------------------------------------------- 1 | { 2 | "network": "mumbai", 3 | "contracts": { 4 | "maticToken": { 5 | "address": "0x0000000000000000000000000000000000001010", 6 | "startBlock": 1 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /child/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "matic-child-subgraphs", 3 | "version": "1.0.0", 4 | "description": "Subgraphs mapping for Graph-node protocol - Matic Network", 5 | "scripts": { 6 | "lint": "eslint --ext .ts --ext .js --ext .json .eslintrc.js src abis", 7 | "lint:fix": "eslint --ext .ts --ext .js --ext .json .eslintrc.js src abis --fix", 8 | "graph": "graph", 9 | "codegen": "graph codegen", 10 | "build": "graph build", 11 | "create": "graph create --node https://mumbai-graph.matic.today/ maticnetwork/token-subgraph", 12 | "deploy": "graph deploy --node https://mumbai-graph.matic.today/ --ipfs https://ipfs.infura.io:5001/ maticnetwork/token-subgraph", 13 | "prepare:mainnet": "mustache config/mainnet.json subgraph.template.yaml > subgraph.yaml", 14 | "prepare:mumbai": "mustache config/mumbai.json subgraph.template.yaml > subgraph.yaml", 15 | "create-local": "graph create --node http://localhost:8020/ maticnetwork/mumbai-child-subgraphs", 16 | "remove-local": "graph remove --node http://localhost:8020/ maticnetwork/mumbai-child-subgraphs", 17 | "deploy-local": "graph deploy --node http://localhost:8020/ --ipfs https://ipfs.infura.io:5001 maticnetwork/mumbai-child-subgraphs" 18 | }, 19 | "repository": { 20 | "type": "git", 21 | "url": "git+https://github.com/maticnetwork/subgraphs.git" 22 | }, 23 | "keywords": [ 24 | "ethereum", 25 | "matic", 26 | "mumbai", 27 | "token", 28 | "graphql", 29 | "graph" 30 | ], 31 | "license": "MIT", 32 | "bugs": { 33 | "url": "https://github.com/maticnetwork/subgraphs/issues" 34 | }, 35 | "homepage": "https://github.com/maticnetwork/subgraph#readme", 36 | "devDependencies": { 37 | "@graphprotocol/graph-cli": "0.18.0", 38 | "@typescript-eslint/eslint-plugin": "^4.10.0", 39 | "@typescript-eslint/parser": "^4.10.0", 40 | "eslint": "^7.16.0", 41 | "eslint-plugin-json": "^2.1.2", 42 | "eslint-plugin-unicorn": "^24.0.0", 43 | "mustache": "4.0.1", 44 | "typescript": "^4.1.3" 45 | }, 46 | "dependencies": { 47 | "@graphprotocol/graph-ts": "0.18.0" 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /child/schema.graphql: -------------------------------------------------------------------------------- 1 | # Transaction entity includes deposits, transfers and withdrawals of an erc20 token 2 | type TransactionEntity @entity { 3 | id: ID! # unique identifier 4 | token: Bytes! 5 | from: Bytes! 6 | to: Bytes! 7 | value: BigDecimal! 8 | type: String! # deposit, transfer or withdrawal 9 | block: BigInt! 10 | timestamp: BigInt! 11 | transaction: Bytes! 12 | } 13 | 14 | type User @entity { 15 | id: ID! 16 | address: Bytes! 17 | amount: BigInt! 18 | } 19 | -------------------------------------------------------------------------------- /child/src/helpers/numbers.ts: -------------------------------------------------------------------------------- 1 | import { BigDecimal, BigInt } from '@graphprotocol/graph-ts' 2 | 3 | export let ZERO = BigInt.fromI32(0) 4 | export let ONE = BigInt.fromI32(1) 5 | 6 | export function toDecimal(value: BigInt, decimals: u32): BigDecimal { 7 | let precision = BigInt.fromI32(10) 8 | .pow(decimals) 9 | .toBigDecimal() 10 | 11 | return value.divDecimal(precision) 12 | } 13 | -------------------------------------------------------------------------------- /child/src/mappings/child-erc20.ts: -------------------------------------------------------------------------------- 1 | import { LogTransfer, Withdraw } from '../../generated/ChildERC20/ChildERC20' 2 | import { TransactionEntity } from '../../generated/schema' 3 | import { toDecimal } from '../helpers/numbers' 4 | 5 | const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000' 6 | 7 | // token, from, amount, to 8 | export function handleLogTransfer(event: LogTransfer): void { 9 | let transactionEntity = new TransactionEntity(event.transaction.hash.toHex() + '-' + event.logIndex.toString() + '-logTransfer') 10 | 11 | transactionEntity.from = event.params.from 12 | transactionEntity.to = event.params.to 13 | transactionEntity.value = toDecimal(event.params.amount, 18) 14 | transactionEntity.block = event.block.number 15 | transactionEntity.timestamp = event.block.timestamp 16 | transactionEntity.transaction = event.transaction.hash 17 | transactionEntity.token = event.address 18 | transactionEntity.type = 'transfer' 19 | 20 | if (transactionEntity.to.toHex() == ZERO_ADDRESS) { 21 | return 22 | } 23 | transactionEntity.save() 24 | } 25 | 26 | export function handleWithdraw(event: Withdraw): void { 27 | let transactionEntity = new TransactionEntity(event.transaction.hash.toHex() + '-' + event.logIndex.toString() + '-withdraw') 28 | 29 | transactionEntity.from = event.params.from 30 | transactionEntity.to = null 31 | transactionEntity.value = toDecimal(event.params.amount, 18) 32 | transactionEntity.block = event.block.number 33 | transactionEntity.timestamp = event.block.timestamp 34 | transactionEntity.transaction = event.transaction.hash 35 | transactionEntity.token = event.address 36 | transactionEntity.type = 'withdraw' 37 | 38 | transactionEntity.save() 39 | } 40 | -------------------------------------------------------------------------------- /child/src/mappings/erc20.ts: -------------------------------------------------------------------------------- 1 | import { Address, BigInt } from '@graphprotocol/graph-ts' 2 | import { Transfer } from '../../generated/ChildERC20/ChildERC20' 3 | import { User } from '../../generated/schema' 4 | 5 | let ZERO_ADDRESS = Address.fromString('0x0000000000000000000000000000000000000000') 6 | 7 | // handleTransfer handles the transfer for ERC20 8 | // Each transfer log will update the balance of `to` and `from` address 9 | export function handleTransfer(event: Transfer): void { 10 | if (event.params.to != ZERO_ADDRESS) { 11 | let userToID = event.params.to.toHex() 12 | let userTo = User.load(userToID) 13 | if (userTo == null) { 14 | userTo = new User(userToID) 15 | userTo.address = event.params.to 16 | userTo.amount = BigInt.fromI32(0) 17 | } 18 | userTo.amount = userTo.amount.plus(event.params.value) 19 | userTo.save() 20 | } 21 | 22 | if (event.params.from != ZERO_ADDRESS) { 23 | let userFromID = event.params.from.toHex() 24 | let userFrom = User.load(userFromID) 25 | if (userFrom == null) { 26 | userFrom = new User(userFromID) 27 | userFrom.address = event.params.from 28 | userFrom.amount = BigInt.fromI32(0) 29 | } 30 | userFrom.amount = userFrom.amount.minus(event.params.value) 31 | userFrom.save() 32 | } 33 | } -------------------------------------------------------------------------------- /child/subgraph.template.yaml: -------------------------------------------------------------------------------- 1 | specVersion: 0.0.2 2 | schema: 3 | file: ./schema.graphql 4 | dataSources: 5 | - kind: ethereum/contract 6 | name: ChildERC20 7 | network: {{network}} 8 | source: 9 | address: "{{contracts.maticToken.address}}" 10 | abi: ChildERC20 11 | startBlock: {{ contracts.maticToken.startBlock }} 12 | mapping: 13 | kind: ethereum/events 14 | apiVersion: 0.0.4 15 | language: wasm/assemblyscript 16 | file: ./src/mappings/child-erc20.ts 17 | entities: 18 | - TransactionEntity 19 | abis: 20 | - name: ChildERC20 21 | file: ./abis/ChildErc20.json 22 | eventHandlers: 23 | - event: LogTransfer(indexed address,indexed address,indexed address,uint256,uint256,uint256,uint256,uint256) 24 | handler: handleLogTransfer 25 | - event: Withdraw(indexed address,indexed address,uint256,uint256,uint256) 26 | handler: handleWithdraw 27 | -------------------------------------------------------------------------------- /child/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extend": "./node_modules/@graphprotocol/graph-ts/tsconfig.json", 3 | "compilerOptions": { 4 | "types": ["@graphprotocol/graph-ts"] 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /root/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | parser: '@typescript-eslint/parser', 3 | plugins: [ 4 | '@typescript-eslint', 5 | 'unicorn', 6 | 'json', 7 | ], 8 | extends: 'eslint:recommended', 9 | parserOptions: { 10 | 'sourceType': 'module', 11 | }, 12 | globals: { 13 | Promise: true, 14 | Buffer: true, 15 | fetch: true, 16 | require: true, 17 | process: true, 18 | module: true, 19 | setTimeout: true, 20 | __dirname: true, 21 | u32: true, 22 | u8: true, 23 | }, 24 | rules: { 25 | 'indent': ['error', 2], 26 | 'space-before-function-paren': ['error', 'never'], 27 | semi: ['error', 'never'], 28 | 'no-underscore-dangle': 0, 29 | // allow debugger during development 30 | 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0, 31 | // trailing comma 32 | 'comma-dangle': ['error', 'always-multiline'], 33 | quotes: ['error', 'single', { 'avoidEscape': true, 'allowTemplateLiterals': true }], 34 | camelcase: ['error', { 'properties': 'always' }], 35 | 'unicorn/filename-case': ['error', { 'case': 'kebabCase' }], 36 | }, 37 | overrides: [ 38 | { 39 | files: ['*.ts', '*.tsx'], 40 | rules: { 41 | '@typescript-eslint/no-unused-vars': ['error', { args: 'none' }], 42 | }, 43 | }, 44 | { 45 | files: ['*.json'], 46 | rules: { 47 | 'unicorn/filename-case': ['error', { 'case': 'pascalCase' }], 48 | }, 49 | }, 50 | ], 51 | } 52 | -------------------------------------------------------------------------------- /root/.gitignore: -------------------------------------------------------------------------------- 1 | subgraph.yaml 2 | src/network.ts 3 | -------------------------------------------------------------------------------- /root/abis/Decoder.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "bytes", 6 | "name": "depositData", 7 | "type": "bytes" 8 | } 9 | ], 10 | "name": "decodeERC1155BatchDeposit", 11 | "outputs": [ 12 | { 13 | "internalType": "uint256[]", 14 | "name": "", 15 | "type": "uint256[]" 16 | }, 17 | { 18 | "internalType": "uint256[]", 19 | "name": "", 20 | "type": "uint256[]" 21 | }, 22 | { 23 | "internalType": "bytes", 24 | "name": "", 25 | "type": "bytes" 26 | } 27 | ], 28 | "stateMutability": "pure", 29 | "type": "function" 30 | }, 31 | { 32 | "inputs": [ 33 | { 34 | "internalType": "bytes", 35 | "name": "depositData", 36 | "type": "bytes" 37 | } 38 | ], 39 | "name": "decodeERC20Deposit", 40 | "outputs": [ 41 | { 42 | "internalType": "uint256", 43 | "name": "", 44 | "type": "uint256" 45 | } 46 | ], 47 | "stateMutability": "pure", 48 | "type": "function" 49 | }, 50 | { 51 | "inputs": [ 52 | { 53 | "internalType": "bytes", 54 | "name": "depositData", 55 | "type": "bytes" 56 | } 57 | ], 58 | "name": "decodeERC721BatchDeposit", 59 | "outputs": [ 60 | { 61 | "internalType": "uint256[]", 62 | "name": "", 63 | "type": "uint256[]" 64 | } 65 | ], 66 | "stateMutability": "pure", 67 | "type": "function" 68 | }, 69 | { 70 | "inputs": [ 71 | { 72 | "internalType": "bytes", 73 | "name": "depositData", 74 | "type": "bytes" 75 | } 76 | ], 77 | "name": "decodeERC721SingleDeposit", 78 | "outputs": [ 79 | { 80 | "internalType": "uint256", 81 | "name": "", 82 | "type": "uint256" 83 | } 84 | ], 85 | "stateMutability": "pure", 86 | "type": "function" 87 | }, 88 | { 89 | "inputs": [ 90 | { 91 | "internalType": "bytes", 92 | "name": "data", 93 | "type": "bytes" 94 | } 95 | ], 96 | "name": "decodeStateSyncData", 97 | "outputs": [ 98 | { 99 | "internalType": "enum Decoder.SyncType", 100 | "name": "", 101 | "type": "uint8" 102 | }, 103 | { 104 | "internalType": "address", 105 | "name": "", 106 | "type": "address" 107 | }, 108 | { 109 | "internalType": "address", 110 | "name": "", 111 | "type": "address" 112 | }, 113 | { 114 | "internalType": "bytes", 115 | "name": "", 116 | "type": "bytes" 117 | } 118 | ], 119 | "stateMutability": "pure", 120 | "type": "function" 121 | }, 122 | { 123 | "inputs": [], 124 | "name": "DEPOSIT", 125 | "outputs": [ 126 | { 127 | "internalType": "bytes32", 128 | "name": "", 129 | "type": "bytes32" 130 | } 131 | ], 132 | "stateMutability": "view", 133 | "type": "function" 134 | }, 135 | { 136 | "inputs": [], 137 | "name": "MAP_TOKEN", 138 | "outputs": [ 139 | { 140 | "internalType": "bytes32", 141 | "name": "", 142 | "type": "bytes32" 143 | } 144 | ], 145 | "stateMutability": "view", 146 | "type": "function" 147 | } 148 | ] 149 | -------------------------------------------------------------------------------- /root/abis/EventsHub.json: -------------------------------------------------------------------------------- 1 | [{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"validatorId","type":"uint256"},{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"nonce","type":"uint256"}],"name":"DelegatorUnstakeWithId","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"rewardDecreasePerCheckpoint","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"maxRewardedCheckpoints","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"checkpointRewardDelta","type":"uint256"}],"name":"RewardParams","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"validatorId","type":"uint256"},{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokens","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"nonce","type":"uint256"}],"name":"ShareBurnedWithId","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"validatorId","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"SharesTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"validatorId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"newCommissionRate","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"oldCommissionRate","type":"uint256"}],"name":"UpdateCommissionRate","type":"event"},{"constant":false,"inputs":[{"internalType":"contractRegistry","name":"_registry","type":"address"}],"name":"initialize","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"validatorId","type":"uint256"},{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"}],"name":"logDelegatorUnstakedWithId","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"rewardDecreasePerCheckpoint","type":"uint256"},{"internalType":"uint256","name":"maxRewardedCheckpoints","type":"uint256"},{"internalType":"uint256","name":"checkpointRewardDelta","type":"uint256"}],"name":"logRewardParams","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"validatorId","type":"uint256"},{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"tokens","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"}],"name":"logShareBurnedWithId","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"validatorId","type":"uint256"},{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"logSharesTransfer","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"validatorId","type":"uint256"},{"internalType":"uint256","name":"newCommissionRate","type":"uint256"},{"internalType":"uint256","name":"oldCommissionRate","type":"uint256"}],"name":"logUpdateCommissionRate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"internalType":"contractRegistry","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"}] -------------------------------------------------------------------------------- /root/abis/FxErc1155RootTunnel.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs":[ 4 | { 5 | "internalType":"address", 6 | "name":"_checkpointManager", 7 | "type":"address" 8 | }, 9 | { 10 | "internalType":"address", 11 | "name":"_fxRoot", 12 | "type":"address" 13 | }, 14 | { 15 | "internalType":"address", 16 | "name":"_fxERC1155Token", 17 | "type":"address" 18 | } 19 | ], 20 | "stateMutability":"nonpayable", 21 | "type":"constructor" 22 | }, 23 | { 24 | "anonymous":false, 25 | "inputs":[ 26 | { 27 | "indexed":true, 28 | "internalType":"address", 29 | "name":"rootToken", 30 | "type":"address" 31 | }, 32 | { 33 | "indexed":true, 34 | "internalType":"address", 35 | "name":"userAddress", 36 | "type":"address" 37 | }, 38 | { 39 | "indexed":false, 40 | "internalType":"uint256[]", 41 | "name":"ids", 42 | "type":"uint256[]" 43 | }, 44 | { 45 | "indexed":false, 46 | "internalType":"uint256[]", 47 | "name":"amounts", 48 | "type":"uint256[]" 49 | } 50 | ], 51 | "name":"FxDepositBatchERC1155", 52 | "type":"event" 53 | }, 54 | { 55 | "anonymous":false, 56 | "inputs":[ 57 | { 58 | "indexed":true, 59 | "internalType":"address", 60 | "name":"rootToken", 61 | "type":"address" 62 | }, 63 | { 64 | "indexed":true, 65 | "internalType":"address", 66 | "name":"depositor", 67 | "type":"address" 68 | }, 69 | { 70 | "indexed":true, 71 | "internalType":"address", 72 | "name":"userAddress", 73 | "type":"address" 74 | }, 75 | { 76 | "indexed":false, 77 | "internalType":"uint256", 78 | "name":"id", 79 | "type":"uint256" 80 | }, 81 | { 82 | "indexed":false, 83 | "internalType":"uint256", 84 | "name":"amount", 85 | "type":"uint256" 86 | } 87 | ], 88 | "name":"FxDepositERC1155", 89 | "type":"event" 90 | }, 91 | { 92 | "anonymous":false, 93 | "inputs":[ 94 | { 95 | "indexed":true, 96 | "internalType":"address", 97 | "name":"rootToken", 98 | "type":"address" 99 | }, 100 | { 101 | "indexed":true, 102 | "internalType":"address", 103 | "name":"childToken", 104 | "type":"address" 105 | }, 106 | { 107 | "indexed":true, 108 | "internalType":"address", 109 | "name":"userAddress", 110 | "type":"address" 111 | }, 112 | { 113 | "indexed":false, 114 | "internalType":"uint256[]", 115 | "name":"ids", 116 | "type":"uint256[]" 117 | }, 118 | { 119 | "indexed":false, 120 | "internalType":"uint256[]", 121 | "name":"amounts", 122 | "type":"uint256[]" 123 | } 124 | ], 125 | "name":"FxWithdrawBatchERC1155", 126 | "type":"event" 127 | }, 128 | { 129 | "anonymous":false, 130 | "inputs":[ 131 | { 132 | "indexed":true, 133 | "internalType":"address", 134 | "name":"rootToken", 135 | "type":"address" 136 | }, 137 | { 138 | "indexed":true, 139 | "internalType":"address", 140 | "name":"childToken", 141 | "type":"address" 142 | }, 143 | { 144 | "indexed":true, 145 | "internalType":"address", 146 | "name":"userAddress", 147 | "type":"address" 148 | }, 149 | { 150 | "indexed":false, 151 | "internalType":"uint256", 152 | "name":"id", 153 | "type":"uint256" 154 | }, 155 | { 156 | "indexed":false, 157 | "internalType":"uint256", 158 | "name":"amount", 159 | "type":"uint256" 160 | } 161 | ], 162 | "name":"FxWithdrawERC1155", 163 | "type":"event" 164 | }, 165 | { 166 | "anonymous":false, 167 | "inputs":[ 168 | { 169 | "indexed":true, 170 | "internalType":"address", 171 | "name":"rootToken", 172 | "type":"address" 173 | }, 174 | { 175 | "indexed":true, 176 | "internalType":"address", 177 | "name":"childToken", 178 | "type":"address" 179 | } 180 | ], 181 | "name":"TokenMappedERC1155", 182 | "type":"event" 183 | }, 184 | { 185 | "inputs":[ 186 | 187 | ], 188 | "name":"DEPOSIT", 189 | "outputs":[ 190 | { 191 | "internalType":"bytes32", 192 | "name":"", 193 | "type":"bytes32" 194 | } 195 | ], 196 | "stateMutability":"view", 197 | "type":"function" 198 | }, 199 | { 200 | "inputs":[ 201 | 202 | ], 203 | "name":"DEPOSIT_BATCH", 204 | "outputs":[ 205 | { 206 | "internalType":"bytes32", 207 | "name":"", 208 | "type":"bytes32" 209 | } 210 | ], 211 | "stateMutability":"view", 212 | "type":"function" 213 | }, 214 | { 215 | "inputs":[ 216 | 217 | ], 218 | "name":"MAP_TOKEN", 219 | "outputs":[ 220 | { 221 | "internalType":"bytes32", 222 | "name":"", 223 | "type":"bytes32" 224 | } 225 | ], 226 | "stateMutability":"view", 227 | "type":"function" 228 | }, 229 | { 230 | "inputs":[ 231 | 232 | ], 233 | "name":"SEND_MESSAGE_EVENT_SIG", 234 | "outputs":[ 235 | { 236 | "internalType":"bytes32", 237 | "name":"", 238 | "type":"bytes32" 239 | } 240 | ], 241 | "stateMutability":"view", 242 | "type":"function" 243 | }, 244 | { 245 | "inputs":[ 246 | 247 | ], 248 | "name":"WITHDRAW", 249 | "outputs":[ 250 | { 251 | "internalType":"bytes32", 252 | "name":"", 253 | "type":"bytes32" 254 | } 255 | ], 256 | "stateMutability":"view", 257 | "type":"function" 258 | }, 259 | { 260 | "inputs":[ 261 | 262 | ], 263 | "name":"WITHDRAW_BATCH", 264 | "outputs":[ 265 | { 266 | "internalType":"bytes32", 267 | "name":"", 268 | "type":"bytes32" 269 | } 270 | ], 271 | "stateMutability":"view", 272 | "type":"function" 273 | }, 274 | { 275 | "inputs":[ 276 | 277 | ], 278 | "name":"checkpointManager", 279 | "outputs":[ 280 | { 281 | "internalType":"contract ICheckpointManager", 282 | "name":"", 283 | "type":"address" 284 | } 285 | ], 286 | "stateMutability":"view", 287 | "type":"function" 288 | }, 289 | { 290 | "inputs":[ 291 | 292 | ], 293 | "name":"childTokenTemplateCodeHash", 294 | "outputs":[ 295 | { 296 | "internalType":"bytes32", 297 | "name":"", 298 | "type":"bytes32" 299 | } 300 | ], 301 | "stateMutability":"view", 302 | "type":"function" 303 | }, 304 | { 305 | "inputs":[ 306 | { 307 | "internalType":"bytes32", 308 | "name":"salt", 309 | "type":"bytes32" 310 | }, 311 | { 312 | "internalType":"bytes32", 313 | "name":"bytecodeHash", 314 | "type":"bytes32" 315 | }, 316 | { 317 | "internalType":"address", 318 | "name":"deployer", 319 | "type":"address" 320 | } 321 | ], 322 | "name":"computedCreate2Address", 323 | "outputs":[ 324 | { 325 | "internalType":"address", 326 | "name":"", 327 | "type":"address" 328 | } 329 | ], 330 | "stateMutability":"pure", 331 | "type":"function" 332 | }, 333 | { 334 | "inputs":[ 335 | { 336 | "internalType":"address", 337 | "name":"rootToken", 338 | "type":"address" 339 | }, 340 | { 341 | "internalType":"address", 342 | "name":"user", 343 | "type":"address" 344 | }, 345 | { 346 | "internalType":"uint256", 347 | "name":"id", 348 | "type":"uint256" 349 | }, 350 | { 351 | "internalType":"uint256", 352 | "name":"amount", 353 | "type":"uint256" 354 | }, 355 | { 356 | "internalType":"bytes", 357 | "name":"data", 358 | "type":"bytes" 359 | } 360 | ], 361 | "name":"deposit", 362 | "outputs":[ 363 | 364 | ], 365 | "stateMutability":"nonpayable", 366 | "type":"function" 367 | }, 368 | { 369 | "inputs":[ 370 | { 371 | "internalType":"address", 372 | "name":"rootToken", 373 | "type":"address" 374 | }, 375 | { 376 | "internalType":"address", 377 | "name":"user", 378 | "type":"address" 379 | }, 380 | { 381 | "internalType":"uint256[]", 382 | "name":"ids", 383 | "type":"uint256[]" 384 | }, 385 | { 386 | "internalType":"uint256[]", 387 | "name":"amounts", 388 | "type":"uint256[]" 389 | }, 390 | { 391 | "internalType":"bytes", 392 | "name":"data", 393 | "type":"bytes" 394 | } 395 | ], 396 | "name":"depositBatch", 397 | "outputs":[ 398 | 399 | ], 400 | "stateMutability":"nonpayable", 401 | "type":"function" 402 | }, 403 | { 404 | "inputs":[ 405 | 406 | ], 407 | "name":"fxChildTunnel", 408 | "outputs":[ 409 | { 410 | "internalType":"address", 411 | "name":"", 412 | "type":"address" 413 | } 414 | ], 415 | "stateMutability":"view", 416 | "type":"function" 417 | }, 418 | { 419 | "inputs":[ 420 | 421 | ], 422 | "name":"fxRoot", 423 | "outputs":[ 424 | { 425 | "internalType":"contract IFxStateSender", 426 | "name":"", 427 | "type":"address" 428 | } 429 | ], 430 | "stateMutability":"view", 431 | "type":"function" 432 | }, 433 | { 434 | "inputs":[ 435 | { 436 | "internalType":"address", 437 | "name":"rootToken", 438 | "type":"address" 439 | } 440 | ], 441 | "name":"mapToken", 442 | "outputs":[ 443 | 444 | ], 445 | "stateMutability":"nonpayable", 446 | "type":"function" 447 | }, 448 | { 449 | "inputs":[ 450 | { 451 | "internalType":"address", 452 | "name":"", 453 | "type":"address" 454 | }, 455 | { 456 | "internalType":"address", 457 | "name":"", 458 | "type":"address" 459 | }, 460 | { 461 | "internalType":"uint256[]", 462 | "name":"", 463 | "type":"uint256[]" 464 | }, 465 | { 466 | "internalType":"uint256[]", 467 | "name":"", 468 | "type":"uint256[]" 469 | }, 470 | { 471 | "internalType":"bytes", 472 | "name":"", 473 | "type":"bytes" 474 | } 475 | ], 476 | "name":"onERC1155BatchReceived", 477 | "outputs":[ 478 | { 479 | "internalType":"bytes4", 480 | "name":"", 481 | "type":"bytes4" 482 | } 483 | ], 484 | "stateMutability":"nonpayable", 485 | "type":"function" 486 | }, 487 | { 488 | "inputs":[ 489 | { 490 | "internalType":"address", 491 | "name":"", 492 | "type":"address" 493 | }, 494 | { 495 | "internalType":"address", 496 | "name":"", 497 | "type":"address" 498 | }, 499 | { 500 | "internalType":"uint256", 501 | "name":"", 502 | "type":"uint256" 503 | }, 504 | { 505 | "internalType":"uint256", 506 | "name":"", 507 | "type":"uint256" 508 | }, 509 | { 510 | "internalType":"bytes", 511 | "name":"", 512 | "type":"bytes" 513 | } 514 | ], 515 | "name":"onERC1155Received", 516 | "outputs":[ 517 | { 518 | "internalType":"bytes4", 519 | "name":"", 520 | "type":"bytes4" 521 | } 522 | ], 523 | "stateMutability":"nonpayable", 524 | "type":"function" 525 | }, 526 | { 527 | "inputs":[ 528 | { 529 | "internalType":"bytes32", 530 | "name":"", 531 | "type":"bytes32" 532 | } 533 | ], 534 | "name":"processedExits", 535 | "outputs":[ 536 | { 537 | "internalType":"bool", 538 | "name":"", 539 | "type":"bool" 540 | } 541 | ], 542 | "stateMutability":"view", 543 | "type":"function" 544 | }, 545 | { 546 | "inputs":[ 547 | { 548 | "internalType":"bytes", 549 | "name":"inputData", 550 | "type":"bytes" 551 | } 552 | ], 553 | "name":"receiveMessage", 554 | "outputs":[ 555 | 556 | ], 557 | "stateMutability":"nonpayable", 558 | "type":"function" 559 | }, 560 | { 561 | "inputs":[ 562 | { 563 | "internalType":"address", 564 | "name":"", 565 | "type":"address" 566 | } 567 | ], 568 | "name":"rootToChildTokens", 569 | "outputs":[ 570 | { 571 | "internalType":"address", 572 | "name":"", 573 | "type":"address" 574 | } 575 | ], 576 | "stateMutability":"view", 577 | "type":"function" 578 | }, 579 | { 580 | "inputs":[ 581 | { 582 | "internalType":"address", 583 | "name":"_fxChildTunnel", 584 | "type":"address" 585 | } 586 | ], 587 | "name":"setFxChildTunnel", 588 | "outputs":[ 589 | 590 | ], 591 | "stateMutability":"nonpayable", 592 | "type":"function" 593 | }, 594 | { 595 | "inputs":[ 596 | { 597 | "internalType":"bytes4", 598 | "name":"interfaceId", 599 | "type":"bytes4" 600 | } 601 | ], 602 | "name":"supportsInterface", 603 | "outputs":[ 604 | { 605 | "internalType":"bool", 606 | "name":"", 607 | "type":"bool" 608 | } 609 | ], 610 | "stateMutability":"view", 611 | "type":"function" 612 | } 613 | ] 614 | -------------------------------------------------------------------------------- /root/abis/FxErc20RootTunnel.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs":[ 4 | { 5 | "internalType":"address", 6 | "name":"_checkpointManager", 7 | "type":"address" 8 | }, 9 | { 10 | "internalType":"address", 11 | "name":"_fxRoot", 12 | "type":"address" 13 | }, 14 | { 15 | "internalType":"address", 16 | "name":"_fxERC20Token", 17 | "type":"address" 18 | } 19 | ], 20 | "stateMutability":"nonpayable", 21 | "type":"constructor" 22 | }, 23 | { 24 | "anonymous":false, 25 | "inputs":[ 26 | { 27 | "indexed":true, 28 | "internalType":"address", 29 | "name":"rootToken", 30 | "type":"address" 31 | }, 32 | { 33 | "indexed":true, 34 | "internalType":"address", 35 | "name":"depositor", 36 | "type":"address" 37 | }, 38 | { 39 | "indexed":true, 40 | "internalType":"address", 41 | "name":"userAddress", 42 | "type":"address" 43 | }, 44 | { 45 | "indexed":false, 46 | "internalType":"uint256", 47 | "name":"amount", 48 | "type":"uint256" 49 | } 50 | ], 51 | "name":"FxDepositERC20", 52 | "type":"event" 53 | }, 54 | { 55 | "anonymous":false, 56 | "inputs":[ 57 | { 58 | "indexed":true, 59 | "internalType":"address", 60 | "name":"rootToken", 61 | "type":"address" 62 | }, 63 | { 64 | "indexed":true, 65 | "internalType":"address", 66 | "name":"childToken", 67 | "type":"address" 68 | }, 69 | { 70 | "indexed":true, 71 | "internalType":"address", 72 | "name":"userAddress", 73 | "type":"address" 74 | }, 75 | { 76 | "indexed":false, 77 | "internalType":"uint256", 78 | "name":"amount", 79 | "type":"uint256" 80 | } 81 | ], 82 | "name":"FxWithdrawERC20", 83 | "type":"event" 84 | }, 85 | { 86 | "anonymous":false, 87 | "inputs":[ 88 | { 89 | "indexed":true, 90 | "internalType":"address", 91 | "name":"rootToken", 92 | "type":"address" 93 | }, 94 | { 95 | "indexed":true, 96 | "internalType":"address", 97 | "name":"childToken", 98 | "type":"address" 99 | } 100 | ], 101 | "name":"TokenMappedERC20", 102 | "type":"event" 103 | }, 104 | { 105 | "inputs":[ 106 | 107 | ], 108 | "name":"DEPOSIT", 109 | "outputs":[ 110 | { 111 | "internalType":"bytes32", 112 | "name":"", 113 | "type":"bytes32" 114 | } 115 | ], 116 | "stateMutability":"view", 117 | "type":"function" 118 | }, 119 | { 120 | "inputs":[ 121 | 122 | ], 123 | "name":"MAP_TOKEN", 124 | "outputs":[ 125 | { 126 | "internalType":"bytes32", 127 | "name":"", 128 | "type":"bytes32" 129 | } 130 | ], 131 | "stateMutability":"view", 132 | "type":"function" 133 | }, 134 | { 135 | "inputs":[ 136 | 137 | ], 138 | "name":"SEND_MESSAGE_EVENT_SIG", 139 | "outputs":[ 140 | { 141 | "internalType":"bytes32", 142 | "name":"", 143 | "type":"bytes32" 144 | } 145 | ], 146 | "stateMutability":"view", 147 | "type":"function" 148 | }, 149 | { 150 | "inputs":[ 151 | 152 | ], 153 | "name":"checkpointManager", 154 | "outputs":[ 155 | { 156 | "internalType":"contract ICheckpointManager", 157 | "name":"", 158 | "type":"address" 159 | } 160 | ], 161 | "stateMutability":"view", 162 | "type":"function" 163 | }, 164 | { 165 | "inputs":[ 166 | 167 | ], 168 | "name":"childTokenTemplateCodeHash", 169 | "outputs":[ 170 | { 171 | "internalType":"bytes32", 172 | "name":"", 173 | "type":"bytes32" 174 | } 175 | ], 176 | "stateMutability":"view", 177 | "type":"function" 178 | }, 179 | { 180 | "inputs":[ 181 | { 182 | "internalType":"bytes32", 183 | "name":"salt", 184 | "type":"bytes32" 185 | }, 186 | { 187 | "internalType":"bytes32", 188 | "name":"bytecodeHash", 189 | "type":"bytes32" 190 | }, 191 | { 192 | "internalType":"address", 193 | "name":"deployer", 194 | "type":"address" 195 | } 196 | ], 197 | "name":"computedCreate2Address", 198 | "outputs":[ 199 | { 200 | "internalType":"address", 201 | "name":"", 202 | "type":"address" 203 | } 204 | ], 205 | "stateMutability":"pure", 206 | "type":"function" 207 | }, 208 | { 209 | "inputs":[ 210 | { 211 | "internalType":"address", 212 | "name":"rootToken", 213 | "type":"address" 214 | }, 215 | { 216 | "internalType":"address", 217 | "name":"user", 218 | "type":"address" 219 | }, 220 | { 221 | "internalType":"uint256", 222 | "name":"amount", 223 | "type":"uint256" 224 | }, 225 | { 226 | "internalType":"bytes", 227 | "name":"data", 228 | "type":"bytes" 229 | } 230 | ], 231 | "name":"deposit", 232 | "outputs":[ 233 | 234 | ], 235 | "stateMutability":"nonpayable", 236 | "type":"function" 237 | }, 238 | { 239 | "inputs":[ 240 | 241 | ], 242 | "name":"fxChildTunnel", 243 | "outputs":[ 244 | { 245 | "internalType":"address", 246 | "name":"", 247 | "type":"address" 248 | } 249 | ], 250 | "stateMutability":"view", 251 | "type":"function" 252 | }, 253 | { 254 | "inputs":[ 255 | 256 | ], 257 | "name":"fxRoot", 258 | "outputs":[ 259 | { 260 | "internalType":"contract IFxStateSender", 261 | "name":"", 262 | "type":"address" 263 | } 264 | ], 265 | "stateMutability":"view", 266 | "type":"function" 267 | }, 268 | { 269 | "inputs":[ 270 | { 271 | "internalType":"address", 272 | "name":"rootToken", 273 | "type":"address" 274 | } 275 | ], 276 | "name":"mapToken", 277 | "outputs":[ 278 | 279 | ], 280 | "stateMutability":"nonpayable", 281 | "type":"function" 282 | }, 283 | { 284 | "inputs":[ 285 | { 286 | "internalType":"bytes32", 287 | "name":"", 288 | "type":"bytes32" 289 | } 290 | ], 291 | "name":"processedExits", 292 | "outputs":[ 293 | { 294 | "internalType":"bool", 295 | "name":"", 296 | "type":"bool" 297 | } 298 | ], 299 | "stateMutability":"view", 300 | "type":"function" 301 | }, 302 | { 303 | "inputs":[ 304 | { 305 | "internalType":"bytes", 306 | "name":"inputData", 307 | "type":"bytes" 308 | } 309 | ], 310 | "name":"receiveMessage", 311 | "outputs":[ 312 | 313 | ], 314 | "stateMutability":"nonpayable", 315 | "type":"function" 316 | }, 317 | { 318 | "inputs":[ 319 | { 320 | "internalType":"address", 321 | "name":"", 322 | "type":"address" 323 | } 324 | ], 325 | "name":"rootToChildTokens", 326 | "outputs":[ 327 | { 328 | "internalType":"address", 329 | "name":"", 330 | "type":"address" 331 | } 332 | ], 333 | "stateMutability":"view", 334 | "type":"function" 335 | }, 336 | { 337 | "inputs":[ 338 | { 339 | "internalType":"address", 340 | "name":"_fxChildTunnel", 341 | "type":"address" 342 | } 343 | ], 344 | "name":"setFxChildTunnel", 345 | "outputs":[ 346 | 347 | ], 348 | "stateMutability":"nonpayable", 349 | "type":"function" 350 | } 351 | ] 352 | -------------------------------------------------------------------------------- /root/abis/FxErc721RootTunnel.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs":[ 4 | { 5 | "internalType":"address", 6 | "name":"_checkpointManager", 7 | "type":"address" 8 | }, 9 | { 10 | "internalType":"address", 11 | "name":"_fxRoot", 12 | "type":"address" 13 | }, 14 | { 15 | "internalType":"address", 16 | "name":"_fxERC721Token", 17 | "type":"address" 18 | } 19 | ], 20 | "stateMutability":"nonpayable", 21 | "type":"constructor" 22 | }, 23 | { 24 | "anonymous":false, 25 | "inputs":[ 26 | { 27 | "indexed":true, 28 | "internalType":"address", 29 | "name":"rootToken", 30 | "type":"address" 31 | }, 32 | { 33 | "indexed":true, 34 | "internalType":"address", 35 | "name":"depositor", 36 | "type":"address" 37 | }, 38 | { 39 | "indexed":true, 40 | "internalType":"address", 41 | "name":"userAddress", 42 | "type":"address" 43 | }, 44 | { 45 | "indexed":false, 46 | "internalType":"uint256", 47 | "name":"id", 48 | "type":"uint256" 49 | } 50 | ], 51 | "name":"FxDepositERC721", 52 | "type":"event" 53 | }, 54 | { 55 | "anonymous":false, 56 | "inputs":[ 57 | { 58 | "indexed":true, 59 | "internalType":"address", 60 | "name":"rootToken", 61 | "type":"address" 62 | }, 63 | { 64 | "indexed":true, 65 | "internalType":"address", 66 | "name":"childToken", 67 | "type":"address" 68 | }, 69 | { 70 | "indexed":true, 71 | "internalType":"address", 72 | "name":"userAddress", 73 | "type":"address" 74 | }, 75 | { 76 | "indexed":false, 77 | "internalType":"uint256", 78 | "name":"id", 79 | "type":"uint256" 80 | } 81 | ], 82 | "name":"FxWithdrawERC721", 83 | "type":"event" 84 | }, 85 | { 86 | "anonymous":false, 87 | "inputs":[ 88 | { 89 | "indexed":true, 90 | "internalType":"address", 91 | "name":"rootToken", 92 | "type":"address" 93 | }, 94 | { 95 | "indexed":true, 96 | "internalType":"address", 97 | "name":"childToken", 98 | "type":"address" 99 | } 100 | ], 101 | "name":"TokenMappedERC721", 102 | "type":"event" 103 | }, 104 | { 105 | "inputs":[ 106 | 107 | ], 108 | "name":"DEPOSIT", 109 | "outputs":[ 110 | { 111 | "internalType":"bytes32", 112 | "name":"", 113 | "type":"bytes32" 114 | } 115 | ], 116 | "stateMutability":"view", 117 | "type":"function" 118 | }, 119 | { 120 | "inputs":[ 121 | 122 | ], 123 | "name":"MAP_TOKEN", 124 | "outputs":[ 125 | { 126 | "internalType":"bytes32", 127 | "name":"", 128 | "type":"bytes32" 129 | } 130 | ], 131 | "stateMutability":"view", 132 | "type":"function" 133 | }, 134 | { 135 | "inputs":[ 136 | 137 | ], 138 | "name":"SEND_MESSAGE_EVENT_SIG", 139 | "outputs":[ 140 | { 141 | "internalType":"bytes32", 142 | "name":"", 143 | "type":"bytes32" 144 | } 145 | ], 146 | "stateMutability":"view", 147 | "type":"function" 148 | }, 149 | { 150 | "inputs":[ 151 | 152 | ], 153 | "name":"checkpointManager", 154 | "outputs":[ 155 | { 156 | "internalType":"contract ICheckpointManager", 157 | "name":"", 158 | "type":"address" 159 | } 160 | ], 161 | "stateMutability":"view", 162 | "type":"function" 163 | }, 164 | { 165 | "inputs":[ 166 | 167 | ], 168 | "name":"childTokenTemplateCodeHash", 169 | "outputs":[ 170 | { 171 | "internalType":"bytes32", 172 | "name":"", 173 | "type":"bytes32" 174 | } 175 | ], 176 | "stateMutability":"view", 177 | "type":"function" 178 | }, 179 | { 180 | "inputs":[ 181 | { 182 | "internalType":"bytes32", 183 | "name":"salt", 184 | "type":"bytes32" 185 | }, 186 | { 187 | "internalType":"bytes32", 188 | "name":"bytecodeHash", 189 | "type":"bytes32" 190 | }, 191 | { 192 | "internalType":"address", 193 | "name":"deployer", 194 | "type":"address" 195 | } 196 | ], 197 | "name":"computedCreate2Address", 198 | "outputs":[ 199 | { 200 | "internalType":"address", 201 | "name":"", 202 | "type":"address" 203 | } 204 | ], 205 | "stateMutability":"pure", 206 | "type":"function" 207 | }, 208 | { 209 | "inputs":[ 210 | { 211 | "internalType":"address", 212 | "name":"rootToken", 213 | "type":"address" 214 | }, 215 | { 216 | "internalType":"address", 217 | "name":"user", 218 | "type":"address" 219 | }, 220 | { 221 | "internalType":"uint256", 222 | "name":"tokenId", 223 | "type":"uint256" 224 | }, 225 | { 226 | "internalType":"bytes", 227 | "name":"data", 228 | "type":"bytes" 229 | } 230 | ], 231 | "name":"deposit", 232 | "outputs":[ 233 | 234 | ], 235 | "stateMutability":"nonpayable", 236 | "type":"function" 237 | }, 238 | { 239 | "inputs":[ 240 | 241 | ], 242 | "name":"fxChildTunnel", 243 | "outputs":[ 244 | { 245 | "internalType":"address", 246 | "name":"", 247 | "type":"address" 248 | } 249 | ], 250 | "stateMutability":"view", 251 | "type":"function" 252 | }, 253 | { 254 | "inputs":[ 255 | 256 | ], 257 | "name":"fxRoot", 258 | "outputs":[ 259 | { 260 | "internalType":"contract IFxStateSender", 261 | "name":"", 262 | "type":"address" 263 | } 264 | ], 265 | "stateMutability":"view", 266 | "type":"function" 267 | }, 268 | { 269 | "inputs":[ 270 | { 271 | "internalType":"address", 272 | "name":"rootToken", 273 | "type":"address" 274 | } 275 | ], 276 | "name":"mapToken", 277 | "outputs":[ 278 | 279 | ], 280 | "stateMutability":"nonpayable", 281 | "type":"function" 282 | }, 283 | { 284 | "inputs":[ 285 | { 286 | "internalType":"address", 287 | "name":"", 288 | "type":"address" 289 | }, 290 | { 291 | "internalType":"address", 292 | "name":"", 293 | "type":"address" 294 | }, 295 | { 296 | "internalType":"uint256", 297 | "name":"", 298 | "type":"uint256" 299 | }, 300 | { 301 | "internalType":"bytes", 302 | "name":"", 303 | "type":"bytes" 304 | } 305 | ], 306 | "name":"onERC721Received", 307 | "outputs":[ 308 | { 309 | "internalType":"bytes4", 310 | "name":"", 311 | "type":"bytes4" 312 | } 313 | ], 314 | "stateMutability":"pure", 315 | "type":"function" 316 | }, 317 | { 318 | "inputs":[ 319 | { 320 | "internalType":"bytes32", 321 | "name":"", 322 | "type":"bytes32" 323 | } 324 | ], 325 | "name":"processedExits", 326 | "outputs":[ 327 | { 328 | "internalType":"bool", 329 | "name":"", 330 | "type":"bool" 331 | } 332 | ], 333 | "stateMutability":"view", 334 | "type":"function" 335 | }, 336 | { 337 | "inputs":[ 338 | { 339 | "internalType":"bytes", 340 | "name":"inputData", 341 | "type":"bytes" 342 | } 343 | ], 344 | "name":"receiveMessage", 345 | "outputs":[ 346 | 347 | ], 348 | "stateMutability":"nonpayable", 349 | "type":"function" 350 | }, 351 | { 352 | "inputs":[ 353 | { 354 | "internalType":"address", 355 | "name":"", 356 | "type":"address" 357 | } 358 | ], 359 | "name":"rootToChildTokens", 360 | "outputs":[ 361 | { 362 | "internalType":"address", 363 | "name":"", 364 | "type":"address" 365 | } 366 | ], 367 | "stateMutability":"view", 368 | "type":"function" 369 | }, 370 | { 371 | "inputs":[ 372 | { 373 | "internalType":"address", 374 | "name":"_fxChildTunnel", 375 | "type":"address" 376 | } 377 | ], 378 | "name":"setFxChildTunnel", 379 | "outputs":[ 380 | 381 | ], 382 | "stateMutability":"nonpayable", 383 | "type":"function" 384 | } 385 | ] 386 | -------------------------------------------------------------------------------- /root/abis/Registry.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "address", 6 | "name": "_governance", 7 | "type": "address" 8 | } 9 | ], 10 | "payable": false, 11 | "stateMutability": "nonpayable", 12 | "type": "constructor" 13 | }, 14 | { 15 | "anonymous": false, 16 | "inputs": [ 17 | { 18 | "indexed": true, 19 | "internalType": "bytes32", 20 | "name": "key", 21 | "type": "bytes32" 22 | }, 23 | { 24 | "indexed": true, 25 | "internalType": "address", 26 | "name": "previousContract", 27 | "type": "address" 28 | }, 29 | { 30 | "indexed": true, 31 | "internalType": "address", 32 | "name": "newContract", 33 | "type": "address" 34 | } 35 | ], 36 | "name": "ContractMapUpdated", 37 | "type": "event" 38 | }, 39 | { 40 | "anonymous": false, 41 | "inputs": [ 42 | { 43 | "indexed": true, 44 | "internalType": "address", 45 | "name": "predicate", 46 | "type": "address" 47 | }, 48 | { 49 | "indexed": true, 50 | "internalType": "address", 51 | "name": "from", 52 | "type": "address" 53 | } 54 | ], 55 | "name": "PredicateAdded", 56 | "type": "event" 57 | }, 58 | { 59 | "anonymous": false, 60 | "inputs": [ 61 | { 62 | "indexed": true, 63 | "internalType": "address", 64 | "name": "predicate", 65 | "type": "address" 66 | }, 67 | { 68 | "indexed": true, 69 | "internalType": "address", 70 | "name": "from", 71 | "type": "address" 72 | } 73 | ], 74 | "name": "PredicateRemoved", 75 | "type": "event" 76 | }, 77 | { 78 | "anonymous": false, 79 | "inputs": [ 80 | { 81 | "indexed": true, 82 | "internalType": "address", 83 | "name": "validator", 84 | "type": "address" 85 | }, 86 | { 87 | "indexed": true, 88 | "internalType": "address", 89 | "name": "from", 90 | "type": "address" 91 | } 92 | ], 93 | "name": "ProofValidatorAdded", 94 | "type": "event" 95 | }, 96 | { 97 | "anonymous": false, 98 | "inputs": [ 99 | { 100 | "indexed": true, 101 | "internalType": "address", 102 | "name": "validator", 103 | "type": "address" 104 | }, 105 | { 106 | "indexed": true, 107 | "internalType": "address", 108 | "name": "from", 109 | "type": "address" 110 | } 111 | ], 112 | "name": "ProofValidatorRemoved", 113 | "type": "event" 114 | }, 115 | { 116 | "anonymous": false, 117 | "inputs": [ 118 | { 119 | "indexed": true, 120 | "internalType": "address", 121 | "name": "rootToken", 122 | "type": "address" 123 | }, 124 | { 125 | "indexed": true, 126 | "internalType": "address", 127 | "name": "childToken", 128 | "type": "address" 129 | } 130 | ], 131 | "name": "TokenMapped", 132 | "type": "event" 133 | }, 134 | { 135 | "constant": true, 136 | "inputs": [ 137 | { 138 | "internalType": "address", 139 | "name": "", 140 | "type": "address" 141 | } 142 | ], 143 | "name": "childToRootToken", 144 | "outputs": [ 145 | { 146 | "internalType": "address", 147 | "name": "", 148 | "type": "address" 149 | } 150 | ], 151 | "payable": false, 152 | "stateMutability": "view", 153 | "type": "function" 154 | }, 155 | { 156 | "constant": true, 157 | "inputs": [ 158 | { 159 | "internalType": "bytes32", 160 | "name": "", 161 | "type": "bytes32" 162 | } 163 | ], 164 | "name": "contractMap", 165 | "outputs": [ 166 | { 167 | "internalType": "address", 168 | "name": "", 169 | "type": "address" 170 | } 171 | ], 172 | "payable": false, 173 | "stateMutability": "view", 174 | "type": "function" 175 | }, 176 | { 177 | "constant": true, 178 | "inputs": [], 179 | "name": "erc20Predicate", 180 | "outputs": [ 181 | { 182 | "internalType": "address", 183 | "name": "", 184 | "type": "address" 185 | } 186 | ], 187 | "payable": false, 188 | "stateMutability": "view", 189 | "type": "function" 190 | }, 191 | { 192 | "constant": true, 193 | "inputs": [], 194 | "name": "erc721Predicate", 195 | "outputs": [ 196 | { 197 | "internalType": "address", 198 | "name": "", 199 | "type": "address" 200 | } 201 | ], 202 | "payable": false, 203 | "stateMutability": "view", 204 | "type": "function" 205 | }, 206 | { 207 | "constant": true, 208 | "inputs": [], 209 | "name": "governance", 210 | "outputs": [ 211 | { 212 | "internalType": "contract IGovernance", 213 | "name": "", 214 | "type": "address" 215 | } 216 | ], 217 | "payable": false, 218 | "stateMutability": "view", 219 | "type": "function" 220 | }, 221 | { 222 | "constant": true, 223 | "inputs": [ 224 | { 225 | "internalType": "address", 226 | "name": "", 227 | "type": "address" 228 | } 229 | ], 230 | "name": "isERC721", 231 | "outputs": [ 232 | { 233 | "internalType": "bool", 234 | "name": "", 235 | "type": "bool" 236 | } 237 | ], 238 | "payable": false, 239 | "stateMutability": "view", 240 | "type": "function" 241 | }, 242 | { 243 | "constant": true, 244 | "inputs": [ 245 | { 246 | "internalType": "address", 247 | "name": "", 248 | "type": "address" 249 | } 250 | ], 251 | "name": "predicates", 252 | "outputs": [ 253 | { 254 | "internalType": "enum Registry.Type", 255 | "name": "_type", 256 | "type": "uint8" 257 | } 258 | ], 259 | "payable": false, 260 | "stateMutability": "view", 261 | "type": "function" 262 | }, 263 | { 264 | "constant": true, 265 | "inputs": [ 266 | { 267 | "internalType": "address", 268 | "name": "", 269 | "type": "address" 270 | } 271 | ], 272 | "name": "proofValidatorContracts", 273 | "outputs": [ 274 | { 275 | "internalType": "bool", 276 | "name": "", 277 | "type": "bool" 278 | } 279 | ], 280 | "payable": false, 281 | "stateMutability": "view", 282 | "type": "function" 283 | }, 284 | { 285 | "constant": true, 286 | "inputs": [ 287 | { 288 | "internalType": "address", 289 | "name": "", 290 | "type": "address" 291 | } 292 | ], 293 | "name": "rootToChildToken", 294 | "outputs": [ 295 | { 296 | "internalType": "address", 297 | "name": "", 298 | "type": "address" 299 | } 300 | ], 301 | "payable": false, 302 | "stateMutability": "view", 303 | "type": "function" 304 | }, 305 | { 306 | "constant": false, 307 | "inputs": [ 308 | { 309 | "internalType": "bytes32", 310 | "name": "_key", 311 | "type": "bytes32" 312 | }, 313 | { 314 | "internalType": "address", 315 | "name": "_address", 316 | "type": "address" 317 | } 318 | ], 319 | "name": "updateContractMap", 320 | "outputs": [], 321 | "payable": false, 322 | "stateMutability": "nonpayable", 323 | "type": "function" 324 | }, 325 | { 326 | "constant": false, 327 | "inputs": [ 328 | { 329 | "internalType": "address", 330 | "name": "_rootToken", 331 | "type": "address" 332 | }, 333 | { 334 | "internalType": "address", 335 | "name": "_childToken", 336 | "type": "address" 337 | }, 338 | { 339 | "internalType": "bool", 340 | "name": "_isERC721", 341 | "type": "bool" 342 | } 343 | ], 344 | "name": "mapToken", 345 | "outputs": [], 346 | "payable": false, 347 | "stateMutability": "nonpayable", 348 | "type": "function" 349 | }, 350 | { 351 | "constant": false, 352 | "inputs": [ 353 | { 354 | "internalType": "address", 355 | "name": "predicate", 356 | "type": "address" 357 | } 358 | ], 359 | "name": "addErc20Predicate", 360 | "outputs": [], 361 | "payable": false, 362 | "stateMutability": "nonpayable", 363 | "type": "function" 364 | }, 365 | { 366 | "constant": false, 367 | "inputs": [ 368 | { 369 | "internalType": "address", 370 | "name": "predicate", 371 | "type": "address" 372 | } 373 | ], 374 | "name": "addErc721Predicate", 375 | "outputs": [], 376 | "payable": false, 377 | "stateMutability": "nonpayable", 378 | "type": "function" 379 | }, 380 | { 381 | "constant": false, 382 | "inputs": [ 383 | { 384 | "internalType": "address", 385 | "name": "predicate", 386 | "type": "address" 387 | }, 388 | { 389 | "internalType": "enum Registry.Type", 390 | "name": "_type", 391 | "type": "uint8" 392 | } 393 | ], 394 | "name": "addPredicate", 395 | "outputs": [], 396 | "payable": false, 397 | "stateMutability": "nonpayable", 398 | "type": "function" 399 | }, 400 | { 401 | "constant": false, 402 | "inputs": [ 403 | { 404 | "internalType": "address", 405 | "name": "predicate", 406 | "type": "address" 407 | } 408 | ], 409 | "name": "removePredicate", 410 | "outputs": [], 411 | "payable": false, 412 | "stateMutability": "nonpayable", 413 | "type": "function" 414 | }, 415 | { 416 | "constant": true, 417 | "inputs": [], 418 | "name": "getValidatorShareAddress", 419 | "outputs": [ 420 | { 421 | "internalType": "address", 422 | "name": "", 423 | "type": "address" 424 | } 425 | ], 426 | "payable": false, 427 | "stateMutability": "view", 428 | "type": "function" 429 | }, 430 | { 431 | "constant": true, 432 | "inputs": [], 433 | "name": "getWethTokenAddress", 434 | "outputs": [ 435 | { 436 | "internalType": "address", 437 | "name": "", 438 | "type": "address" 439 | } 440 | ], 441 | "payable": false, 442 | "stateMutability": "view", 443 | "type": "function" 444 | }, 445 | { 446 | "constant": true, 447 | "inputs": [], 448 | "name": "getDepositManagerAddress", 449 | "outputs": [ 450 | { 451 | "internalType": "address", 452 | "name": "", 453 | "type": "address" 454 | } 455 | ], 456 | "payable": false, 457 | "stateMutability": "view", 458 | "type": "function" 459 | }, 460 | { 461 | "constant": true, 462 | "inputs": [], 463 | "name": "getStakeManagerAddress", 464 | "outputs": [ 465 | { 466 | "internalType": "address", 467 | "name": "", 468 | "type": "address" 469 | } 470 | ], 471 | "payable": false, 472 | "stateMutability": "view", 473 | "type": "function" 474 | }, 475 | { 476 | "constant": true, 477 | "inputs": [], 478 | "name": "getSlashingManagerAddress", 479 | "outputs": [ 480 | { 481 | "internalType": "address", 482 | "name": "", 483 | "type": "address" 484 | } 485 | ], 486 | "payable": false, 487 | "stateMutability": "view", 488 | "type": "function" 489 | }, 490 | { 491 | "constant": true, 492 | "inputs": [], 493 | "name": "getWithdrawManagerAddress", 494 | "outputs": [ 495 | { 496 | "internalType": "address", 497 | "name": "", 498 | "type": "address" 499 | } 500 | ], 501 | "payable": false, 502 | "stateMutability": "view", 503 | "type": "function" 504 | }, 505 | { 506 | "constant": true, 507 | "inputs": [], 508 | "name": "getChildChainAndStateSender", 509 | "outputs": [ 510 | { 511 | "internalType": "address", 512 | "name": "", 513 | "type": "address" 514 | }, 515 | { 516 | "internalType": "address", 517 | "name": "", 518 | "type": "address" 519 | } 520 | ], 521 | "payable": false, 522 | "stateMutability": "view", 523 | "type": "function" 524 | }, 525 | { 526 | "constant": true, 527 | "inputs": [ 528 | { 529 | "internalType": "address", 530 | "name": "_token", 531 | "type": "address" 532 | } 533 | ], 534 | "name": "isTokenMapped", 535 | "outputs": [ 536 | { 537 | "internalType": "bool", 538 | "name": "", 539 | "type": "bool" 540 | } 541 | ], 542 | "payable": false, 543 | "stateMutability": "view", 544 | "type": "function" 545 | }, 546 | { 547 | "constant": true, 548 | "inputs": [ 549 | { 550 | "internalType": "address", 551 | "name": "_token", 552 | "type": "address" 553 | } 554 | ], 555 | "name": "isTokenMappedAndIsErc721", 556 | "outputs": [ 557 | { 558 | "internalType": "bool", 559 | "name": "", 560 | "type": "bool" 561 | } 562 | ], 563 | "payable": false, 564 | "stateMutability": "view", 565 | "type": "function" 566 | }, 567 | { 568 | "constant": true, 569 | "inputs": [ 570 | { 571 | "internalType": "address", 572 | "name": "_token", 573 | "type": "address" 574 | } 575 | ], 576 | "name": "isTokenMappedAndGetPredicate", 577 | "outputs": [ 578 | { 579 | "internalType": "address", 580 | "name": "", 581 | "type": "address" 582 | } 583 | ], 584 | "payable": false, 585 | "stateMutability": "view", 586 | "type": "function" 587 | }, 588 | { 589 | "constant": true, 590 | "inputs": [ 591 | { 592 | "internalType": "address", 593 | "name": "childToken", 594 | "type": "address" 595 | } 596 | ], 597 | "name": "isChildTokenErc721", 598 | "outputs": [ 599 | { 600 | "internalType": "bool", 601 | "name": "", 602 | "type": "bool" 603 | } 604 | ], 605 | "payable": false, 606 | "stateMutability": "view", 607 | "type": "function" 608 | } 609 | ] 610 | -------------------------------------------------------------------------------- /root/abis/RootChainManager.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "indexed": false, 7 | "internalType": "address", 8 | "name": "userAddress", 9 | "type": "address" 10 | }, 11 | { 12 | "indexed": false, 13 | "internalType": "address payable", 14 | "name": "relayerAddress", 15 | "type": "address" 16 | }, 17 | { 18 | "indexed": false, 19 | "internalType": "bytes", 20 | "name": "functionSignature", 21 | "type": "bytes" 22 | } 23 | ], 24 | "name": "MetaTransactionExecuted", 25 | "type": "event" 26 | }, 27 | { 28 | "anonymous": false, 29 | "inputs": [ 30 | { 31 | "indexed": true, 32 | "internalType": "bytes32", 33 | "name": "tokenType", 34 | "type": "bytes32" 35 | }, 36 | { 37 | "indexed": true, 38 | "internalType": "address", 39 | "name": "predicateAddress", 40 | "type": "address" 41 | } 42 | ], 43 | "name": "PredicateRegistered", 44 | "type": "event" 45 | }, 46 | { 47 | "anonymous": false, 48 | "inputs": [ 49 | { 50 | "indexed": true, 51 | "internalType": "bytes32", 52 | "name": "role", 53 | "type": "bytes32" 54 | }, 55 | { 56 | "indexed": true, 57 | "internalType": "bytes32", 58 | "name": "previousAdminRole", 59 | "type": "bytes32" 60 | }, 61 | { 62 | "indexed": true, 63 | "internalType": "bytes32", 64 | "name": "newAdminRole", 65 | "type": "bytes32" 66 | } 67 | ], 68 | "name": "RoleAdminChanged", 69 | "type": "event" 70 | }, 71 | { 72 | "anonymous": false, 73 | "inputs": [ 74 | { 75 | "indexed": true, 76 | "internalType": "bytes32", 77 | "name": "role", 78 | "type": "bytes32" 79 | }, 80 | { 81 | "indexed": true, 82 | "internalType": "address", 83 | "name": "account", 84 | "type": "address" 85 | }, 86 | { 87 | "indexed": true, 88 | "internalType": "address", 89 | "name": "sender", 90 | "type": "address" 91 | } 92 | ], 93 | "name": "RoleGranted", 94 | "type": "event" 95 | }, 96 | { 97 | "anonymous": false, 98 | "inputs": [ 99 | { 100 | "indexed": true, 101 | "internalType": "bytes32", 102 | "name": "role", 103 | "type": "bytes32" 104 | }, 105 | { 106 | "indexed": true, 107 | "internalType": "address", 108 | "name": "account", 109 | "type": "address" 110 | }, 111 | { 112 | "indexed": true, 113 | "internalType": "address", 114 | "name": "sender", 115 | "type": "address" 116 | } 117 | ], 118 | "name": "RoleRevoked", 119 | "type": "event" 120 | }, 121 | { 122 | "anonymous": false, 123 | "inputs": [ 124 | { 125 | "indexed": true, 126 | "internalType": "address", 127 | "name": "rootToken", 128 | "type": "address" 129 | }, 130 | { 131 | "indexed": true, 132 | "internalType": "address", 133 | "name": "childToken", 134 | "type": "address" 135 | }, 136 | { 137 | "indexed": true, 138 | "internalType": "bytes32", 139 | "name": "tokenType", 140 | "type": "bytes32" 141 | } 142 | ], 143 | "name": "TokenMapped", 144 | "type": "event" 145 | }, 146 | { 147 | "inputs": [], 148 | "name": "DEFAULT_ADMIN_ROLE", 149 | "outputs": [ 150 | { 151 | "internalType": "bytes32", 152 | "name": "", 153 | "type": "bytes32" 154 | } 155 | ], 156 | "stateMutability": "view", 157 | "type": "function" 158 | }, 159 | { 160 | "inputs": [], 161 | "name": "DEPOSIT", 162 | "outputs": [ 163 | { 164 | "internalType": "bytes32", 165 | "name": "", 166 | "type": "bytes32" 167 | } 168 | ], 169 | "stateMutability": "view", 170 | "type": "function" 171 | }, 172 | { 173 | "inputs": [], 174 | "name": "ERC712_VERSION", 175 | "outputs": [ 176 | { 177 | "internalType": "string", 178 | "name": "", 179 | "type": "string" 180 | } 181 | ], 182 | "stateMutability": "view", 183 | "type": "function" 184 | }, 185 | { 186 | "inputs": [], 187 | "name": "ETHER_ADDRESS", 188 | "outputs": [ 189 | { 190 | "internalType": "address", 191 | "name": "", 192 | "type": "address" 193 | } 194 | ], 195 | "stateMutability": "view", 196 | "type": "function" 197 | }, 198 | { 199 | "inputs": [], 200 | "name": "MAPPER_ROLE", 201 | "outputs": [ 202 | { 203 | "internalType": "bytes32", 204 | "name": "", 205 | "type": "bytes32" 206 | } 207 | ], 208 | "stateMutability": "view", 209 | "type": "function" 210 | }, 211 | { 212 | "inputs": [], 213 | "name": "MAP_TOKEN", 214 | "outputs": [ 215 | { 216 | "internalType": "bytes32", 217 | "name": "", 218 | "type": "bytes32" 219 | } 220 | ], 221 | "stateMutability": "view", 222 | "type": "function" 223 | }, 224 | { 225 | "inputs": [], 226 | "name": "childChainManagerAddress", 227 | "outputs": [ 228 | { 229 | "internalType": "address", 230 | "name": "", 231 | "type": "address" 232 | } 233 | ], 234 | "stateMutability": "view", 235 | "type": "function" 236 | }, 237 | { 238 | "inputs": [ 239 | { 240 | "internalType": "address", 241 | "name": "", 242 | "type": "address" 243 | } 244 | ], 245 | "name": "childToRootToken", 246 | "outputs": [ 247 | { 248 | "internalType": "address", 249 | "name": "", 250 | "type": "address" 251 | } 252 | ], 253 | "stateMutability": "view", 254 | "type": "function" 255 | }, 256 | { 257 | "inputs": [ 258 | { 259 | "internalType": "address", 260 | "name": "userAddress", 261 | "type": "address" 262 | }, 263 | { 264 | "internalType": "bytes", 265 | "name": "functionSignature", 266 | "type": "bytes" 267 | }, 268 | { 269 | "internalType": "bytes32", 270 | "name": "sigR", 271 | "type": "bytes32" 272 | }, 273 | { 274 | "internalType": "bytes32", 275 | "name": "sigS", 276 | "type": "bytes32" 277 | }, 278 | { 279 | "internalType": "uint8", 280 | "name": "sigV", 281 | "type": "uint8" 282 | } 283 | ], 284 | "name": "executeMetaTransaction", 285 | "outputs": [ 286 | { 287 | "internalType": "bytes", 288 | "name": "", 289 | "type": "bytes" 290 | } 291 | ], 292 | "stateMutability": "payable", 293 | "type": "function" 294 | }, 295 | { 296 | "inputs": [], 297 | "name": "getChainId", 298 | "outputs": [ 299 | { 300 | "internalType": "uint256", 301 | "name": "", 302 | "type": "uint256" 303 | } 304 | ], 305 | "stateMutability": "pure", 306 | "type": "function" 307 | }, 308 | { 309 | "inputs": [], 310 | "name": "getDomainSeperator", 311 | "outputs": [ 312 | { 313 | "internalType": "bytes32", 314 | "name": "", 315 | "type": "bytes32" 316 | } 317 | ], 318 | "stateMutability": "view", 319 | "type": "function" 320 | }, 321 | { 322 | "inputs": [ 323 | { 324 | "internalType": "address", 325 | "name": "user", 326 | "type": "address" 327 | } 328 | ], 329 | "name": "getNonce", 330 | "outputs": [ 331 | { 332 | "internalType": "uint256", 333 | "name": "nonce", 334 | "type": "uint256" 335 | } 336 | ], 337 | "stateMutability": "view", 338 | "type": "function" 339 | }, 340 | { 341 | "inputs": [ 342 | { 343 | "internalType": "bytes32", 344 | "name": "role", 345 | "type": "bytes32" 346 | } 347 | ], 348 | "name": "getRoleAdmin", 349 | "outputs": [ 350 | { 351 | "internalType": "bytes32", 352 | "name": "", 353 | "type": "bytes32" 354 | } 355 | ], 356 | "stateMutability": "view", 357 | "type": "function" 358 | }, 359 | { 360 | "inputs": [ 361 | { 362 | "internalType": "bytes32", 363 | "name": "role", 364 | "type": "bytes32" 365 | }, 366 | { 367 | "internalType": "uint256", 368 | "name": "index", 369 | "type": "uint256" 370 | } 371 | ], 372 | "name": "getRoleMember", 373 | "outputs": [ 374 | { 375 | "internalType": "address", 376 | "name": "", 377 | "type": "address" 378 | } 379 | ], 380 | "stateMutability": "view", 381 | "type": "function" 382 | }, 383 | { 384 | "inputs": [ 385 | { 386 | "internalType": "bytes32", 387 | "name": "role", 388 | "type": "bytes32" 389 | } 390 | ], 391 | "name": "getRoleMemberCount", 392 | "outputs": [ 393 | { 394 | "internalType": "uint256", 395 | "name": "", 396 | "type": "uint256" 397 | } 398 | ], 399 | "stateMutability": "view", 400 | "type": "function" 401 | }, 402 | { 403 | "inputs": [ 404 | { 405 | "internalType": "bytes32", 406 | "name": "role", 407 | "type": "bytes32" 408 | }, 409 | { 410 | "internalType": "address", 411 | "name": "account", 412 | "type": "address" 413 | } 414 | ], 415 | "name": "grantRole", 416 | "outputs": [], 417 | "stateMutability": "nonpayable", 418 | "type": "function" 419 | }, 420 | { 421 | "inputs": [ 422 | { 423 | "internalType": "bytes32", 424 | "name": "role", 425 | "type": "bytes32" 426 | }, 427 | { 428 | "internalType": "address", 429 | "name": "account", 430 | "type": "address" 431 | } 432 | ], 433 | "name": "hasRole", 434 | "outputs": [ 435 | { 436 | "internalType": "bool", 437 | "name": "", 438 | "type": "bool" 439 | } 440 | ], 441 | "stateMutability": "view", 442 | "type": "function" 443 | }, 444 | { 445 | "inputs": [ 446 | { 447 | "internalType": "bytes32", 448 | "name": "", 449 | "type": "bytes32" 450 | } 451 | ], 452 | "name": "processedExits", 453 | "outputs": [ 454 | { 455 | "internalType": "bool", 456 | "name": "", 457 | "type": "bool" 458 | } 459 | ], 460 | "stateMutability": "view", 461 | "type": "function" 462 | }, 463 | { 464 | "inputs": [ 465 | { 466 | "internalType": "bytes32", 467 | "name": "role", 468 | "type": "bytes32" 469 | }, 470 | { 471 | "internalType": "address", 472 | "name": "account", 473 | "type": "address" 474 | } 475 | ], 476 | "name": "renounceRole", 477 | "outputs": [], 478 | "stateMutability": "nonpayable", 479 | "type": "function" 480 | }, 481 | { 482 | "inputs": [ 483 | { 484 | "internalType": "bytes32", 485 | "name": "role", 486 | "type": "bytes32" 487 | }, 488 | { 489 | "internalType": "address", 490 | "name": "account", 491 | "type": "address" 492 | } 493 | ], 494 | "name": "revokeRole", 495 | "outputs": [], 496 | "stateMutability": "nonpayable", 497 | "type": "function" 498 | }, 499 | { 500 | "inputs": [ 501 | { 502 | "internalType": "address", 503 | "name": "", 504 | "type": "address" 505 | } 506 | ], 507 | "name": "rootToChildToken", 508 | "outputs": [ 509 | { 510 | "internalType": "address", 511 | "name": "", 512 | "type": "address" 513 | } 514 | ], 515 | "stateMutability": "view", 516 | "type": "function" 517 | }, 518 | { 519 | "inputs": [ 520 | { 521 | "internalType": "address", 522 | "name": "", 523 | "type": "address" 524 | } 525 | ], 526 | "name": "tokenToType", 527 | "outputs": [ 528 | { 529 | "internalType": "bytes32", 530 | "name": "", 531 | "type": "bytes32" 532 | } 533 | ], 534 | "stateMutability": "view", 535 | "type": "function" 536 | }, 537 | { 538 | "inputs": [ 539 | { 540 | "internalType": "bytes32", 541 | "name": "", 542 | "type": "bytes32" 543 | } 544 | ], 545 | "name": "typeToPredicate", 546 | "outputs": [ 547 | { 548 | "internalType": "address", 549 | "name": "", 550 | "type": "address" 551 | } 552 | ], 553 | "stateMutability": "view", 554 | "type": "function" 555 | }, 556 | { 557 | "stateMutability": "payable", 558 | "type": "receive" 559 | }, 560 | { 561 | "inputs": [ 562 | { 563 | "internalType": "address", 564 | "name": "_owner", 565 | "type": "address" 566 | } 567 | ], 568 | "name": "initialize", 569 | "outputs": [], 570 | "stateMutability": "nonpayable", 571 | "type": "function" 572 | }, 573 | { 574 | "inputs": [], 575 | "name": "setupContractId", 576 | "outputs": [], 577 | "stateMutability": "nonpayable", 578 | "type": "function" 579 | }, 580 | { 581 | "inputs": [], 582 | "name": "initializeEIP712", 583 | "outputs": [], 584 | "stateMutability": "nonpayable", 585 | "type": "function" 586 | }, 587 | { 588 | "inputs": [ 589 | { 590 | "internalType": "address", 591 | "name": "newStateSender", 592 | "type": "address" 593 | } 594 | ], 595 | "name": "setStateSender", 596 | "outputs": [], 597 | "stateMutability": "nonpayable", 598 | "type": "function" 599 | }, 600 | { 601 | "inputs": [], 602 | "name": "stateSenderAddress", 603 | "outputs": [ 604 | { 605 | "internalType": "address", 606 | "name": "", 607 | "type": "address" 608 | } 609 | ], 610 | "stateMutability": "view", 611 | "type": "function" 612 | }, 613 | { 614 | "inputs": [ 615 | { 616 | "internalType": "address", 617 | "name": "newCheckpointManager", 618 | "type": "address" 619 | } 620 | ], 621 | "name": "setCheckpointManager", 622 | "outputs": [], 623 | "stateMutability": "nonpayable", 624 | "type": "function" 625 | }, 626 | { 627 | "inputs": [], 628 | "name": "checkpointManagerAddress", 629 | "outputs": [ 630 | { 631 | "internalType": "address", 632 | "name": "", 633 | "type": "address" 634 | } 635 | ], 636 | "stateMutability": "view", 637 | "type": "function" 638 | }, 639 | { 640 | "inputs": [ 641 | { 642 | "internalType": "address", 643 | "name": "newChildChainManager", 644 | "type": "address" 645 | } 646 | ], 647 | "name": "setChildChainManagerAddress", 648 | "outputs": [], 649 | "stateMutability": "nonpayable", 650 | "type": "function" 651 | }, 652 | { 653 | "inputs": [ 654 | { 655 | "internalType": "bytes32", 656 | "name": "tokenType", 657 | "type": "bytes32" 658 | }, 659 | { 660 | "internalType": "address", 661 | "name": "predicateAddress", 662 | "type": "address" 663 | } 664 | ], 665 | "name": "registerPredicate", 666 | "outputs": [], 667 | "stateMutability": "nonpayable", 668 | "type": "function" 669 | }, 670 | { 671 | "inputs": [ 672 | { 673 | "internalType": "address", 674 | "name": "rootToken", 675 | "type": "address" 676 | }, 677 | { 678 | "internalType": "address", 679 | "name": "childToken", 680 | "type": "address" 681 | }, 682 | { 683 | "internalType": "bytes32", 684 | "name": "tokenType", 685 | "type": "bytes32" 686 | } 687 | ], 688 | "name": "mapToken", 689 | "outputs": [], 690 | "stateMutability": "nonpayable", 691 | "type": "function" 692 | }, 693 | { 694 | "inputs": [ 695 | { 696 | "internalType": "address", 697 | "name": "rootToken", 698 | "type": "address" 699 | }, 700 | { 701 | "internalType": "address", 702 | "name": "childToken", 703 | "type": "address" 704 | }, 705 | { 706 | "internalType": "bytes32", 707 | "name": "tokenType", 708 | "type": "bytes32" 709 | } 710 | ], 711 | "name": "remapToken", 712 | "outputs": [], 713 | "stateMutability": "nonpayable", 714 | "type": "function" 715 | }, 716 | { 717 | "inputs": [ 718 | { 719 | "internalType": "address", 720 | "name": "user", 721 | "type": "address" 722 | } 723 | ], 724 | "name": "depositEtherFor", 725 | "outputs": [], 726 | "stateMutability": "payable", 727 | "type": "function" 728 | }, 729 | { 730 | "inputs": [ 731 | { 732 | "internalType": "address", 733 | "name": "user", 734 | "type": "address" 735 | }, 736 | { 737 | "internalType": "address", 738 | "name": "rootToken", 739 | "type": "address" 740 | }, 741 | { 742 | "internalType": "bytes", 743 | "name": "depositData", 744 | "type": "bytes" 745 | } 746 | ], 747 | "name": "depositFor", 748 | "outputs": [], 749 | "stateMutability": "nonpayable", 750 | "type": "function" 751 | }, 752 | { 753 | "inputs": [ 754 | { 755 | "internalType": "bytes", 756 | "name": "inputData", 757 | "type": "bytes" 758 | } 759 | ], 760 | "name": "exit", 761 | "outputs": [], 762 | "stateMutability": "nonpayable", 763 | "type": "function" 764 | } 765 | ] 766 | -------------------------------------------------------------------------------- /root/abis/Rootchain.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "constant": false, 4 | "inputs": [], 5 | "name": "slash", 6 | "outputs": [], 7 | "payable": false, 8 | "stateMutability": "nonpayable", 9 | "type": "function" 10 | }, 11 | { 12 | "constant": true, 13 | "inputs": [ 14 | { 15 | "internalType": "uint256", 16 | "name": "", 17 | "type": "uint256" 18 | } 19 | ], 20 | "name": "headerBlocks", 21 | "outputs": [ 22 | { 23 | "internalType": "bytes32", 24 | "name": "root", 25 | "type": "bytes32" 26 | }, 27 | { 28 | "internalType": "uint256", 29 | "name": "start", 30 | "type": "uint256" 31 | }, 32 | { 33 | "internalType": "uint256", 34 | "name": "end", 35 | "type": "uint256" 36 | }, 37 | { 38 | "internalType": "uint256", 39 | "name": "createdAt", 40 | "type": "uint256" 41 | }, 42 | { 43 | "internalType": "address", 44 | "name": "proposer", 45 | "type": "address" 46 | } 47 | ], 48 | "payable": false, 49 | "stateMutability": "view", 50 | "type": "function" 51 | }, 52 | { 53 | "constant": false, 54 | "inputs": [ 55 | { 56 | "internalType": "uint256", 57 | "name": "numDeposits", 58 | "type": "uint256" 59 | } 60 | ], 61 | "name": "updateDepositId", 62 | "outputs": [ 63 | { 64 | "internalType": "uint256", 65 | "name": "depositId", 66 | "type": "uint256" 67 | } 68 | ], 69 | "payable": false, 70 | "stateMutability": "nonpayable", 71 | "type": "function" 72 | }, 73 | { 74 | "constant": false, 75 | "inputs": [ 76 | { 77 | "internalType": "bytes", 78 | "name": "data", 79 | "type": "bytes" 80 | }, 81 | { 82 | "internalType": "bytes", 83 | "name": "sigs", 84 | "type": "bytes" 85 | } 86 | ], 87 | "name": "submitHeaderBlock", 88 | "outputs": [], 89 | "payable": false, 90 | "stateMutability": "nonpayable", 91 | "type": "function" 92 | }, 93 | { 94 | "constant": false, 95 | "inputs": [], 96 | "name": "renounceOwnership", 97 | "outputs": [], 98 | "payable": false, 99 | "stateMutability": "nonpayable", 100 | "type": "function" 101 | }, 102 | { 103 | "constant": true, 104 | "inputs": [], 105 | "name": "_nextHeaderBlock", 106 | "outputs": [ 107 | { 108 | "internalType": "uint256", 109 | "name": "", 110 | "type": "uint256" 111 | } 112 | ], 113 | "payable": false, 114 | "stateMutability": "view", 115 | "type": "function" 116 | }, 117 | { 118 | "constant": true, 119 | "inputs": [], 120 | "name": "owner", 121 | "outputs": [ 122 | { 123 | "internalType": "address", 124 | "name": "", 125 | "type": "address" 126 | } 127 | ], 128 | "payable": false, 129 | "stateMutability": "view", 130 | "type": "function" 131 | }, 132 | { 133 | "constant": true, 134 | "inputs": [], 135 | "name": "isOwner", 136 | "outputs": [ 137 | { 138 | "internalType": "bool", 139 | "name": "", 140 | "type": "bool" 141 | } 142 | ], 143 | "payable": false, 144 | "stateMutability": "view", 145 | "type": "function" 146 | }, 147 | { 148 | "constant": true, 149 | "inputs": [], 150 | "name": "networkId", 151 | "outputs": [ 152 | { 153 | "internalType": "bytes", 154 | "name": "", 155 | "type": "bytes" 156 | } 157 | ], 158 | "payable": false, 159 | "stateMutability": "view", 160 | "type": "function" 161 | }, 162 | { 163 | "constant": true, 164 | "inputs": [], 165 | "name": "getLastChildBlock", 166 | "outputs": [ 167 | { 168 | "internalType": "uint256", 169 | "name": "", 170 | "type": "uint256" 171 | } 172 | ], 173 | "payable": false, 174 | "stateMutability": "view", 175 | "type": "function" 176 | }, 177 | { 178 | "constant": true, 179 | "inputs": [], 180 | "name": "CHAINID", 181 | "outputs": [ 182 | { 183 | "internalType": "uint256", 184 | "name": "", 185 | "type": "uint256" 186 | } 187 | ], 188 | "payable": false, 189 | "stateMutability": "view", 190 | "type": "function" 191 | }, 192 | { 193 | "constant": false, 194 | "inputs": [ 195 | { 196 | "internalType": "uint256", 197 | "name": "_value", 198 | "type": "uint256" 199 | } 200 | ], 201 | "name": "setNextHeaderBlock", 202 | "outputs": [], 203 | "payable": false, 204 | "stateMutability": "nonpayable", 205 | "type": "function" 206 | }, 207 | { 208 | "constant": true, 209 | "inputs": [], 210 | "name": "VOTE_TYPE", 211 | "outputs": [ 212 | { 213 | "internalType": "uint8", 214 | "name": "", 215 | "type": "uint8" 216 | } 217 | ], 218 | "payable": false, 219 | "stateMutability": "view", 220 | "type": "function" 221 | }, 222 | { 223 | "constant": false, 224 | "inputs": [ 225 | { 226 | "internalType": "string", 227 | "name": "_heimdallId", 228 | "type": "string" 229 | } 230 | ], 231 | "name": "setHeimdallId", 232 | "outputs": [], 233 | "payable": false, 234 | "stateMutability": "nonpayable", 235 | "type": "function" 236 | }, 237 | { 238 | "constant": true, 239 | "inputs": [], 240 | "name": "currentHeaderBlock", 241 | "outputs": [ 242 | { 243 | "internalType": "uint256", 244 | "name": "", 245 | "type": "uint256" 246 | } 247 | ], 248 | "payable": false, 249 | "stateMutability": "view", 250 | "type": "function" 251 | }, 252 | { 253 | "constant": false, 254 | "inputs": [ 255 | { 256 | "internalType": "address", 257 | "name": "newOwner", 258 | "type": "address" 259 | } 260 | ], 261 | "name": "transferOwnership", 262 | "outputs": [], 263 | "payable": false, 264 | "stateMutability": "nonpayable", 265 | "type": "function" 266 | }, 267 | { 268 | "constant": true, 269 | "inputs": [], 270 | "name": "heimdallId", 271 | "outputs": [ 272 | { 273 | "internalType": "bytes32", 274 | "name": "", 275 | "type": "bytes32" 276 | } 277 | ], 278 | "payable": false, 279 | "stateMutability": "view", 280 | "type": "function" 281 | }, 282 | { 283 | "anonymous": false, 284 | "inputs": [ 285 | { 286 | "indexed": true, 287 | "internalType": "address", 288 | "name": "proposer", 289 | "type": "address" 290 | }, 291 | { 292 | "indexed": true, 293 | "internalType": "uint256", 294 | "name": "headerBlockId", 295 | "type": "uint256" 296 | }, 297 | { 298 | "indexed": true, 299 | "internalType": "uint256", 300 | "name": "reward", 301 | "type": "uint256" 302 | }, 303 | { 304 | "indexed": false, 305 | "internalType": "uint256", 306 | "name": "start", 307 | "type": "uint256" 308 | }, 309 | { 310 | "indexed": false, 311 | "internalType": "uint256", 312 | "name": "end", 313 | "type": "uint256" 314 | }, 315 | { 316 | "indexed": false, 317 | "internalType": "bytes32", 318 | "name": "root", 319 | "type": "bytes32" 320 | } 321 | ], 322 | "name": "NewHeaderBlock", 323 | "type": "event" 324 | }, 325 | { 326 | "anonymous": false, 327 | "inputs": [ 328 | { 329 | "indexed": true, 330 | "internalType": "address", 331 | "name": "proposer", 332 | "type": "address" 333 | }, 334 | { 335 | "indexed": true, 336 | "internalType": "uint256", 337 | "name": "headerBlockId", 338 | "type": "uint256" 339 | } 340 | ], 341 | "name": "ResetHeaderBlock", 342 | "type": "event" 343 | }, 344 | { 345 | "anonymous": false, 346 | "inputs": [ 347 | { 348 | "indexed": true, 349 | "internalType": "address", 350 | "name": "previousOwner", 351 | "type": "address" 352 | }, 353 | { 354 | "indexed": true, 355 | "internalType": "address", 356 | "name": "newOwner", 357 | "type": "address" 358 | } 359 | ], 360 | "name": "OwnershipTransferred", 361 | "type": "event" 362 | } 363 | ] 364 | -------------------------------------------------------------------------------- /root/abis/StakingNft.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "string", 6 | "name": "name", 7 | "type": "string" 8 | }, 9 | { 10 | "internalType": "string", 11 | "name": "symbol", 12 | "type": "string" 13 | } 14 | ], 15 | "payable": false, 16 | "stateMutability": "nonpayable", 17 | "type": "constructor" 18 | }, 19 | { 20 | "anonymous": false, 21 | "inputs": [ 22 | { 23 | "indexed": true, 24 | "internalType": "address", 25 | "name": "owner", 26 | "type": "address" 27 | }, 28 | { 29 | "indexed": true, 30 | "internalType": "address", 31 | "name": "approved", 32 | "type": "address" 33 | }, 34 | { 35 | "indexed": true, 36 | "internalType": "uint256", 37 | "name": "tokenId", 38 | "type": "uint256" 39 | } 40 | ], 41 | "name": "Approval", 42 | "type": "event" 43 | }, 44 | { 45 | "anonymous": false, 46 | "inputs": [ 47 | { 48 | "indexed": true, 49 | "internalType": "address", 50 | "name": "owner", 51 | "type": "address" 52 | }, 53 | { 54 | "indexed": true, 55 | "internalType": "address", 56 | "name": "operator", 57 | "type": "address" 58 | }, 59 | { 60 | "indexed": false, 61 | "internalType": "bool", 62 | "name": "approved", 63 | "type": "bool" 64 | } 65 | ], 66 | "name": "ApprovalForAll", 67 | "type": "event" 68 | }, 69 | { 70 | "anonymous": false, 71 | "inputs": [ 72 | { 73 | "indexed": true, 74 | "internalType": "address", 75 | "name": "previousOwner", 76 | "type": "address" 77 | }, 78 | { 79 | "indexed": true, 80 | "internalType": "address", 81 | "name": "newOwner", 82 | "type": "address" 83 | } 84 | ], 85 | "name": "OwnershipTransferred", 86 | "type": "event" 87 | }, 88 | { 89 | "anonymous": false, 90 | "inputs": [ 91 | { 92 | "indexed": true, 93 | "internalType": "address", 94 | "name": "from", 95 | "type": "address" 96 | }, 97 | { 98 | "indexed": true, 99 | "internalType": "address", 100 | "name": "to", 101 | "type": "address" 102 | }, 103 | { 104 | "indexed": true, 105 | "internalType": "uint256", 106 | "name": "tokenId", 107 | "type": "uint256" 108 | } 109 | ], 110 | "name": "Transfer", 111 | "type": "event" 112 | }, 113 | { 114 | "constant": false, 115 | "inputs": [ 116 | { 117 | "internalType": "address", 118 | "name": "to", 119 | "type": "address" 120 | }, 121 | { 122 | "internalType": "uint256", 123 | "name": "tokenId", 124 | "type": "uint256" 125 | } 126 | ], 127 | "name": "approve", 128 | "outputs": [], 129 | "payable": false, 130 | "stateMutability": "nonpayable", 131 | "type": "function" 132 | }, 133 | { 134 | "constant": true, 135 | "inputs": [ 136 | { 137 | "internalType": "address", 138 | "name": "owner", 139 | "type": "address" 140 | } 141 | ], 142 | "name": "balanceOf", 143 | "outputs": [ 144 | { 145 | "internalType": "uint256", 146 | "name": "", 147 | "type": "uint256" 148 | } 149 | ], 150 | "payable": false, 151 | "stateMutability": "view", 152 | "type": "function" 153 | }, 154 | { 155 | "constant": true, 156 | "inputs": [ 157 | { 158 | "internalType": "uint256", 159 | "name": "tokenId", 160 | "type": "uint256" 161 | } 162 | ], 163 | "name": "getApproved", 164 | "outputs": [ 165 | { 166 | "internalType": "address", 167 | "name": "", 168 | "type": "address" 169 | } 170 | ], 171 | "payable": false, 172 | "stateMutability": "view", 173 | "type": "function" 174 | }, 175 | { 176 | "constant": true, 177 | "inputs": [ 178 | { 179 | "internalType": "address", 180 | "name": "owner", 181 | "type": "address" 182 | }, 183 | { 184 | "internalType": "address", 185 | "name": "operator", 186 | "type": "address" 187 | } 188 | ], 189 | "name": "isApprovedForAll", 190 | "outputs": [ 191 | { 192 | "internalType": "bool", 193 | "name": "", 194 | "type": "bool" 195 | } 196 | ], 197 | "payable": false, 198 | "stateMutability": "view", 199 | "type": "function" 200 | }, 201 | { 202 | "constant": true, 203 | "inputs": [], 204 | "name": "isOwner", 205 | "outputs": [ 206 | { 207 | "internalType": "bool", 208 | "name": "", 209 | "type": "bool" 210 | } 211 | ], 212 | "payable": false, 213 | "stateMutability": "view", 214 | "type": "function" 215 | }, 216 | { 217 | "constant": true, 218 | "inputs": [], 219 | "name": "name", 220 | "outputs": [ 221 | { 222 | "internalType": "string", 223 | "name": "", 224 | "type": "string" 225 | } 226 | ], 227 | "payable": false, 228 | "stateMutability": "view", 229 | "type": "function" 230 | }, 231 | { 232 | "constant": true, 233 | "inputs": [], 234 | "name": "owner", 235 | "outputs": [ 236 | { 237 | "internalType": "address", 238 | "name": "", 239 | "type": "address" 240 | } 241 | ], 242 | "payable": false, 243 | "stateMutability": "view", 244 | "type": "function" 245 | }, 246 | { 247 | "constant": true, 248 | "inputs": [ 249 | { 250 | "internalType": "uint256", 251 | "name": "tokenId", 252 | "type": "uint256" 253 | } 254 | ], 255 | "name": "ownerOf", 256 | "outputs": [ 257 | { 258 | "internalType": "address", 259 | "name": "", 260 | "type": "address" 261 | } 262 | ], 263 | "payable": false, 264 | "stateMutability": "view", 265 | "type": "function" 266 | }, 267 | { 268 | "constant": false, 269 | "inputs": [], 270 | "name": "renounceOwnership", 271 | "outputs": [], 272 | "payable": false, 273 | "stateMutability": "nonpayable", 274 | "type": "function" 275 | }, 276 | { 277 | "constant": false, 278 | "inputs": [ 279 | { 280 | "internalType": "address", 281 | "name": "from", 282 | "type": "address" 283 | }, 284 | { 285 | "internalType": "address", 286 | "name": "to", 287 | "type": "address" 288 | }, 289 | { 290 | "internalType": "uint256", 291 | "name": "tokenId", 292 | "type": "uint256" 293 | } 294 | ], 295 | "name": "safeTransferFrom", 296 | "outputs": [], 297 | "payable": false, 298 | "stateMutability": "nonpayable", 299 | "type": "function" 300 | }, 301 | { 302 | "constant": false, 303 | "inputs": [ 304 | { 305 | "internalType": "address", 306 | "name": "from", 307 | "type": "address" 308 | }, 309 | { 310 | "internalType": "address", 311 | "name": "to", 312 | "type": "address" 313 | }, 314 | { 315 | "internalType": "uint256", 316 | "name": "tokenId", 317 | "type": "uint256" 318 | }, 319 | { 320 | "internalType": "bytes", 321 | "name": "_data", 322 | "type": "bytes" 323 | } 324 | ], 325 | "name": "safeTransferFrom", 326 | "outputs": [], 327 | "payable": false, 328 | "stateMutability": "nonpayable", 329 | "type": "function" 330 | }, 331 | { 332 | "constant": false, 333 | "inputs": [ 334 | { 335 | "internalType": "address", 336 | "name": "to", 337 | "type": "address" 338 | }, 339 | { 340 | "internalType": "bool", 341 | "name": "approved", 342 | "type": "bool" 343 | } 344 | ], 345 | "name": "setApprovalForAll", 346 | "outputs": [], 347 | "payable": false, 348 | "stateMutability": "nonpayable", 349 | "type": "function" 350 | }, 351 | { 352 | "constant": true, 353 | "inputs": [ 354 | { 355 | "internalType": "bytes4", 356 | "name": "interfaceId", 357 | "type": "bytes4" 358 | } 359 | ], 360 | "name": "supportsInterface", 361 | "outputs": [ 362 | { 363 | "internalType": "bool", 364 | "name": "", 365 | "type": "bool" 366 | } 367 | ], 368 | "payable": false, 369 | "stateMutability": "view", 370 | "type": "function" 371 | }, 372 | { 373 | "constant": true, 374 | "inputs": [], 375 | "name": "symbol", 376 | "outputs": [ 377 | { 378 | "internalType": "string", 379 | "name": "", 380 | "type": "string" 381 | } 382 | ], 383 | "payable": false, 384 | "stateMutability": "view", 385 | "type": "function" 386 | }, 387 | { 388 | "constant": true, 389 | "inputs": [ 390 | { 391 | "internalType": "uint256", 392 | "name": "index", 393 | "type": "uint256" 394 | } 395 | ], 396 | "name": "tokenByIndex", 397 | "outputs": [ 398 | { 399 | "internalType": "uint256", 400 | "name": "", 401 | "type": "uint256" 402 | } 403 | ], 404 | "payable": false, 405 | "stateMutability": "view", 406 | "type": "function" 407 | }, 408 | { 409 | "constant": true, 410 | "inputs": [ 411 | { 412 | "internalType": "address", 413 | "name": "owner", 414 | "type": "address" 415 | }, 416 | { 417 | "internalType": "uint256", 418 | "name": "index", 419 | "type": "uint256" 420 | } 421 | ], 422 | "name": "tokenOfOwnerByIndex", 423 | "outputs": [ 424 | { 425 | "internalType": "uint256", 426 | "name": "", 427 | "type": "uint256" 428 | } 429 | ], 430 | "payable": false, 431 | "stateMutability": "view", 432 | "type": "function" 433 | }, 434 | { 435 | "constant": true, 436 | "inputs": [ 437 | { 438 | "internalType": "uint256", 439 | "name": "tokenId", 440 | "type": "uint256" 441 | } 442 | ], 443 | "name": "tokenURI", 444 | "outputs": [ 445 | { 446 | "internalType": "string", 447 | "name": "", 448 | "type": "string" 449 | } 450 | ], 451 | "payable": false, 452 | "stateMutability": "view", 453 | "type": "function" 454 | }, 455 | { 456 | "constant": true, 457 | "inputs": [], 458 | "name": "totalSupply", 459 | "outputs": [ 460 | { 461 | "internalType": "uint256", 462 | "name": "", 463 | "type": "uint256" 464 | } 465 | ], 466 | "payable": false, 467 | "stateMutability": "view", 468 | "type": "function" 469 | }, 470 | { 471 | "constant": false, 472 | "inputs": [ 473 | { 474 | "internalType": "address", 475 | "name": "from", 476 | "type": "address" 477 | }, 478 | { 479 | "internalType": "address", 480 | "name": "to", 481 | "type": "address" 482 | }, 483 | { 484 | "internalType": "uint256", 485 | "name": "tokenId", 486 | "type": "uint256" 487 | } 488 | ], 489 | "name": "transferFrom", 490 | "outputs": [], 491 | "payable": false, 492 | "stateMutability": "nonpayable", 493 | "type": "function" 494 | }, 495 | { 496 | "constant": false, 497 | "inputs": [ 498 | { 499 | "internalType": "address", 500 | "name": "newOwner", 501 | "type": "address" 502 | } 503 | ], 504 | "name": "transferOwnership", 505 | "outputs": [], 506 | "payable": false, 507 | "stateMutability": "nonpayable", 508 | "type": "function" 509 | }, 510 | { 511 | "constant": false, 512 | "inputs": [ 513 | { 514 | "internalType": "address", 515 | "name": "to", 516 | "type": "address" 517 | }, 518 | { 519 | "internalType": "uint256", 520 | "name": "tokenId", 521 | "type": "uint256" 522 | } 523 | ], 524 | "name": "mint", 525 | "outputs": [], 526 | "payable": false, 527 | "stateMutability": "nonpayable", 528 | "type": "function" 529 | }, 530 | { 531 | "constant": false, 532 | "inputs": [ 533 | { 534 | "internalType": "uint256", 535 | "name": "tokenId", 536 | "type": "uint256" 537 | } 538 | ], 539 | "name": "burn", 540 | "outputs": [], 541 | "payable": false, 542 | "stateMutability": "nonpayable", 543 | "type": "function" 544 | } 545 | ] 546 | -------------------------------------------------------------------------------- /root/abis/StateSender.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "constant": false, 4 | "inputs": [ 5 | { 6 | "internalType": "address", 7 | "name": "receiver", 8 | "type": "address" 9 | }, 10 | { 11 | "internalType": "bytes", 12 | "name": "data", 13 | "type": "bytes" 14 | } 15 | ], 16 | "name": "syncState", 17 | "outputs": [], 18 | "payable": false, 19 | "stateMutability": "nonpayable", 20 | "type": "function" 21 | }, 22 | { 23 | "constant": true, 24 | "inputs": [], 25 | "name": "counter", 26 | "outputs": [ 27 | { 28 | "internalType": "uint256", 29 | "name": "", 30 | "type": "uint256" 31 | } 32 | ], 33 | "payable": false, 34 | "stateMutability": "view", 35 | "type": "function" 36 | }, 37 | { 38 | "constant": false, 39 | "inputs": [], 40 | "name": "renounceOwnership", 41 | "outputs": [], 42 | "payable": false, 43 | "stateMutability": "nonpayable", 44 | "type": "function" 45 | }, 46 | { 47 | "constant": true, 48 | "inputs": [], 49 | "name": "owner", 50 | "outputs": [ 51 | { 52 | "internalType": "address", 53 | "name": "", 54 | "type": "address" 55 | } 56 | ], 57 | "payable": false, 58 | "stateMutability": "view", 59 | "type": "function" 60 | }, 61 | { 62 | "constant": true, 63 | "inputs": [], 64 | "name": "isOwner", 65 | "outputs": [ 66 | { 67 | "internalType": "bool", 68 | "name": "", 69 | "type": "bool" 70 | } 71 | ], 72 | "payable": false, 73 | "stateMutability": "view", 74 | "type": "function" 75 | }, 76 | { 77 | "constant": true, 78 | "inputs": [ 79 | { 80 | "internalType": "address", 81 | "name": "", 82 | "type": "address" 83 | } 84 | ], 85 | "name": "registrations", 86 | "outputs": [ 87 | { 88 | "internalType": "address", 89 | "name": "", 90 | "type": "address" 91 | } 92 | ], 93 | "payable": false, 94 | "stateMutability": "view", 95 | "type": "function" 96 | }, 97 | { 98 | "constant": false, 99 | "inputs": [ 100 | { 101 | "internalType": "address", 102 | "name": "sender", 103 | "type": "address" 104 | }, 105 | { 106 | "internalType": "address", 107 | "name": "receiver", 108 | "type": "address" 109 | } 110 | ], 111 | "name": "register", 112 | "outputs": [], 113 | "payable": false, 114 | "stateMutability": "nonpayable", 115 | "type": "function" 116 | }, 117 | { 118 | "constant": false, 119 | "inputs": [ 120 | { 121 | "internalType": "address", 122 | "name": "newOwner", 123 | "type": "address" 124 | } 125 | ], 126 | "name": "transferOwnership", 127 | "outputs": [], 128 | "payable": false, 129 | "stateMutability": "nonpayable", 130 | "type": "function" 131 | }, 132 | { 133 | "anonymous": false, 134 | "inputs": [ 135 | { 136 | "indexed": true, 137 | "internalType": "address", 138 | "name": "user", 139 | "type": "address" 140 | }, 141 | { 142 | "indexed": true, 143 | "internalType": "address", 144 | "name": "sender", 145 | "type": "address" 146 | }, 147 | { 148 | "indexed": true, 149 | "internalType": "address", 150 | "name": "receiver", 151 | "type": "address" 152 | } 153 | ], 154 | "name": "NewRegistration", 155 | "type": "event" 156 | }, 157 | { 158 | "anonymous": false, 159 | "inputs": [ 160 | { 161 | "indexed": true, 162 | "internalType": "address", 163 | "name": "user", 164 | "type": "address" 165 | }, 166 | { 167 | "indexed": true, 168 | "internalType": "address", 169 | "name": "sender", 170 | "type": "address" 171 | }, 172 | { 173 | "indexed": true, 174 | "internalType": "address", 175 | "name": "receiver", 176 | "type": "address" 177 | } 178 | ], 179 | "name": "RegistrationUpdated", 180 | "type": "event" 181 | }, 182 | { 183 | "anonymous": false, 184 | "inputs": [ 185 | { 186 | "indexed": true, 187 | "internalType": "uint256", 188 | "name": "id", 189 | "type": "uint256" 190 | }, 191 | { 192 | "indexed": true, 193 | "internalType": "address", 194 | "name": "contractAddress", 195 | "type": "address" 196 | }, 197 | { 198 | "indexed": false, 199 | "internalType": "bytes", 200 | "name": "data", 201 | "type": "bytes" 202 | } 203 | ], 204 | "name": "StateSynced", 205 | "type": "event" 206 | }, 207 | { 208 | "anonymous": false, 209 | "inputs": [ 210 | { 211 | "indexed": true, 212 | "internalType": "address", 213 | "name": "previousOwner", 214 | "type": "address" 215 | }, 216 | { 217 | "indexed": true, 218 | "internalType": "address", 219 | "name": "newOwner", 220 | "type": "address" 221 | } 222 | ], 223 | "name": "OwnershipTransferred", 224 | "type": "event" 225 | } 226 | ] 227 | -------------------------------------------------------------------------------- /root/abis/TestToken.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "string", 6 | "name": "_name", 7 | "type": "string" 8 | }, 9 | { 10 | "internalType": "string", 11 | "name": "_symbol", 12 | "type": "string" 13 | } 14 | ], 15 | "payable": false, 16 | "stateMutability": "nonpayable", 17 | "type": "constructor" 18 | }, 19 | { 20 | "anonymous": false, 21 | "inputs": [ 22 | { 23 | "indexed": true, 24 | "internalType": "address", 25 | "name": "owner", 26 | "type": "address" 27 | }, 28 | { 29 | "indexed": true, 30 | "internalType": "address", 31 | "name": "spender", 32 | "type": "address" 33 | }, 34 | { 35 | "indexed": false, 36 | "internalType": "uint256", 37 | "name": "value", 38 | "type": "uint256" 39 | } 40 | ], 41 | "name": "Approval", 42 | "type": "event" 43 | }, 44 | { 45 | "anonymous": false, 46 | "inputs": [ 47 | { 48 | "indexed": true, 49 | "internalType": "address", 50 | "name": "account", 51 | "type": "address" 52 | } 53 | ], 54 | "name": "MinterAdded", 55 | "type": "event" 56 | }, 57 | { 58 | "anonymous": false, 59 | "inputs": [ 60 | { 61 | "indexed": true, 62 | "internalType": "address", 63 | "name": "account", 64 | "type": "address" 65 | } 66 | ], 67 | "name": "MinterRemoved", 68 | "type": "event" 69 | }, 70 | { 71 | "anonymous": false, 72 | "inputs": [ 73 | { 74 | "indexed": true, 75 | "internalType": "address", 76 | "name": "from", 77 | "type": "address" 78 | }, 79 | { 80 | "indexed": true, 81 | "internalType": "address", 82 | "name": "to", 83 | "type": "address" 84 | }, 85 | { 86 | "indexed": false, 87 | "internalType": "uint256", 88 | "name": "value", 89 | "type": "uint256" 90 | } 91 | ], 92 | "name": "Transfer", 93 | "type": "event" 94 | }, 95 | { 96 | "constant": false, 97 | "inputs": [ 98 | { 99 | "internalType": "address", 100 | "name": "account", 101 | "type": "address" 102 | } 103 | ], 104 | "name": "addMinter", 105 | "outputs": [], 106 | "payable": false, 107 | "stateMutability": "nonpayable", 108 | "type": "function" 109 | }, 110 | { 111 | "constant": true, 112 | "inputs": [ 113 | { 114 | "internalType": "address", 115 | "name": "owner", 116 | "type": "address" 117 | }, 118 | { 119 | "internalType": "address", 120 | "name": "spender", 121 | "type": "address" 122 | } 123 | ], 124 | "name": "allowance", 125 | "outputs": [ 126 | { 127 | "internalType": "uint256", 128 | "name": "", 129 | "type": "uint256" 130 | } 131 | ], 132 | "payable": false, 133 | "stateMutability": "view", 134 | "type": "function" 135 | }, 136 | { 137 | "constant": false, 138 | "inputs": [ 139 | { 140 | "internalType": "address", 141 | "name": "spender", 142 | "type": "address" 143 | }, 144 | { 145 | "internalType": "uint256", 146 | "name": "value", 147 | "type": "uint256" 148 | } 149 | ], 150 | "name": "approve", 151 | "outputs": [ 152 | { 153 | "internalType": "bool", 154 | "name": "", 155 | "type": "bool" 156 | } 157 | ], 158 | "payable": false, 159 | "stateMutability": "nonpayable", 160 | "type": "function" 161 | }, 162 | { 163 | "constant": true, 164 | "inputs": [ 165 | { 166 | "internalType": "address", 167 | "name": "owner", 168 | "type": "address" 169 | } 170 | ], 171 | "name": "balanceOf", 172 | "outputs": [ 173 | { 174 | "internalType": "uint256", 175 | "name": "", 176 | "type": "uint256" 177 | } 178 | ], 179 | "payable": false, 180 | "stateMutability": "view", 181 | "type": "function" 182 | }, 183 | { 184 | "constant": true, 185 | "inputs": [], 186 | "name": "decimals", 187 | "outputs": [ 188 | { 189 | "internalType": "uint8", 190 | "name": "", 191 | "type": "uint8" 192 | } 193 | ], 194 | "payable": false, 195 | "stateMutability": "view", 196 | "type": "function" 197 | }, 198 | { 199 | "constant": false, 200 | "inputs": [ 201 | { 202 | "internalType": "address", 203 | "name": "spender", 204 | "type": "address" 205 | }, 206 | { 207 | "internalType": "uint256", 208 | "name": "subtractedValue", 209 | "type": "uint256" 210 | } 211 | ], 212 | "name": "decreaseAllowance", 213 | "outputs": [ 214 | { 215 | "internalType": "bool", 216 | "name": "", 217 | "type": "bool" 218 | } 219 | ], 220 | "payable": false, 221 | "stateMutability": "nonpayable", 222 | "type": "function" 223 | }, 224 | { 225 | "constant": false, 226 | "inputs": [ 227 | { 228 | "internalType": "address", 229 | "name": "spender", 230 | "type": "address" 231 | }, 232 | { 233 | "internalType": "uint256", 234 | "name": "addedValue", 235 | "type": "uint256" 236 | } 237 | ], 238 | "name": "increaseAllowance", 239 | "outputs": [ 240 | { 241 | "internalType": "bool", 242 | "name": "", 243 | "type": "bool" 244 | } 245 | ], 246 | "payable": false, 247 | "stateMutability": "nonpayable", 248 | "type": "function" 249 | }, 250 | { 251 | "constant": true, 252 | "inputs": [ 253 | { 254 | "internalType": "address", 255 | "name": "account", 256 | "type": "address" 257 | } 258 | ], 259 | "name": "isMinter", 260 | "outputs": [ 261 | { 262 | "internalType": "bool", 263 | "name": "", 264 | "type": "bool" 265 | } 266 | ], 267 | "payable": false, 268 | "stateMutability": "view", 269 | "type": "function" 270 | }, 271 | { 272 | "constant": false, 273 | "inputs": [ 274 | { 275 | "internalType": "address", 276 | "name": "to", 277 | "type": "address" 278 | }, 279 | { 280 | "internalType": "uint256", 281 | "name": "value", 282 | "type": "uint256" 283 | } 284 | ], 285 | "name": "mint", 286 | "outputs": [ 287 | { 288 | "internalType": "bool", 289 | "name": "", 290 | "type": "bool" 291 | } 292 | ], 293 | "payable": false, 294 | "stateMutability": "nonpayable", 295 | "type": "function" 296 | }, 297 | { 298 | "constant": true, 299 | "inputs": [], 300 | "name": "name", 301 | "outputs": [ 302 | { 303 | "internalType": "string", 304 | "name": "", 305 | "type": "string" 306 | } 307 | ], 308 | "payable": false, 309 | "stateMutability": "view", 310 | "type": "function" 311 | }, 312 | { 313 | "constant": false, 314 | "inputs": [], 315 | "name": "renounceMinter", 316 | "outputs": [], 317 | "payable": false, 318 | "stateMutability": "nonpayable", 319 | "type": "function" 320 | }, 321 | { 322 | "constant": true, 323 | "inputs": [], 324 | "name": "symbol", 325 | "outputs": [ 326 | { 327 | "internalType": "string", 328 | "name": "", 329 | "type": "string" 330 | } 331 | ], 332 | "payable": false, 333 | "stateMutability": "view", 334 | "type": "function" 335 | }, 336 | { 337 | "constant": true, 338 | "inputs": [], 339 | "name": "totalSupply", 340 | "outputs": [ 341 | { 342 | "internalType": "uint256", 343 | "name": "", 344 | "type": "uint256" 345 | } 346 | ], 347 | "payable": false, 348 | "stateMutability": "view", 349 | "type": "function" 350 | }, 351 | { 352 | "constant": false, 353 | "inputs": [ 354 | { 355 | "internalType": "address", 356 | "name": "to", 357 | "type": "address" 358 | }, 359 | { 360 | "internalType": "uint256", 361 | "name": "value", 362 | "type": "uint256" 363 | } 364 | ], 365 | "name": "transfer", 366 | "outputs": [ 367 | { 368 | "internalType": "bool", 369 | "name": "", 370 | "type": "bool" 371 | } 372 | ], 373 | "payable": false, 374 | "stateMutability": "nonpayable", 375 | "type": "function" 376 | }, 377 | { 378 | "constant": false, 379 | "inputs": [ 380 | { 381 | "internalType": "address", 382 | "name": "from", 383 | "type": "address" 384 | }, 385 | { 386 | "internalType": "address", 387 | "name": "to", 388 | "type": "address" 389 | }, 390 | { 391 | "internalType": "uint256", 392 | "name": "value", 393 | "type": "uint256" 394 | } 395 | ], 396 | "name": "transferFrom", 397 | "outputs": [ 398 | { 399 | "internalType": "bool", 400 | "name": "", 401 | "type": "bool" 402 | } 403 | ], 404 | "payable": false, 405 | "stateMutability": "nonpayable", 406 | "type": "function" 407 | } 408 | ] -------------------------------------------------------------------------------- /root/abis/WithdrawManager.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "indexed": true, 7 | "internalType": "uint256", 8 | "name": "exitId", 9 | "type": "uint256" 10 | } 11 | ], 12 | "name": "ExitCancelled", 13 | "type": "event" 14 | }, 15 | { 16 | "anonymous": false, 17 | "inputs": [ 18 | { 19 | "indexed": true, 20 | "internalType": "uint256", 21 | "name": "oldExitPeriod", 22 | "type": "uint256" 23 | }, 24 | { 25 | "indexed": true, 26 | "internalType": "uint256", 27 | "name": "newExitPeriod", 28 | "type": "uint256" 29 | } 30 | ], 31 | "name": "ExitPeriodUpdate", 32 | "type": "event" 33 | }, 34 | { 35 | "anonymous": false, 36 | "inputs": [ 37 | { 38 | "indexed": true, 39 | "internalType": "address", 40 | "name": "exitor", 41 | "type": "address" 42 | }, 43 | { 44 | "indexed": true, 45 | "internalType": "uint256", 46 | "name": "exitId", 47 | "type": "uint256" 48 | }, 49 | { 50 | "indexed": true, 51 | "internalType": "address", 52 | "name": "token", 53 | "type": "address" 54 | }, 55 | { 56 | "indexed": false, 57 | "internalType": "uint256", 58 | "name": "amount", 59 | "type": "uint256" 60 | }, 61 | { 62 | "indexed": false, 63 | "internalType": "bool", 64 | "name": "isRegularExit", 65 | "type": "bool" 66 | } 67 | ], 68 | "name": "ExitStarted", 69 | "type": "event" 70 | }, 71 | { 72 | "anonymous": false, 73 | "inputs": [ 74 | { 75 | "indexed": true, 76 | "internalType": "uint256", 77 | "name": "exitId", 78 | "type": "uint256" 79 | }, 80 | { 81 | "indexed": true, 82 | "internalType": "uint256", 83 | "name": "age", 84 | "type": "uint256" 85 | }, 86 | { 87 | "indexed": false, 88 | "internalType": "address", 89 | "name": "signer", 90 | "type": "address" 91 | } 92 | ], 93 | "name": "ExitUpdated", 94 | "type": "event" 95 | }, 96 | { 97 | "anonymous": false, 98 | "inputs": [ 99 | { 100 | "indexed": true, 101 | "internalType": "address", 102 | "name": "previousOwner", 103 | "type": "address" 104 | }, 105 | { 106 | "indexed": true, 107 | "internalType": "address", 108 | "name": "newOwner", 109 | "type": "address" 110 | } 111 | ], 112 | "name": "OwnershipTransferred", 113 | "type": "event" 114 | }, 115 | { 116 | "anonymous": false, 117 | "inputs": [ 118 | { 119 | "indexed": true, 120 | "internalType": "uint256", 121 | "name": "exitId", 122 | "type": "uint256" 123 | }, 124 | { 125 | "indexed": true, 126 | "internalType": "address", 127 | "name": "user", 128 | "type": "address" 129 | }, 130 | { 131 | "indexed": true, 132 | "internalType": "address", 133 | "name": "token", 134 | "type": "address" 135 | }, 136 | { 137 | "indexed": false, 138 | "internalType": "uint256", 139 | "name": "amount", 140 | "type": "uint256" 141 | } 142 | ], 143 | "name": "Withdraw", 144 | "type": "event" 145 | }, 146 | { 147 | "payable": true, 148 | "stateMutability": "payable", 149 | "type": "fallback" 150 | }, 151 | { 152 | "constant": true, 153 | "inputs": [], 154 | "name": "HALF_EXIT_PERIOD", 155 | "outputs": [ 156 | { 157 | "internalType": "uint256", 158 | "name": "", 159 | "type": "uint256" 160 | } 161 | ], 162 | "payable": false, 163 | "stateMutability": "view", 164 | "type": "function" 165 | }, 166 | { 167 | "constant": true, 168 | "inputs": [], 169 | "name": "ON_FINALIZE_GAS_LIMIT", 170 | "outputs": [ 171 | { 172 | "internalType": "uint32", 173 | "name": "", 174 | "type": "uint32" 175 | } 176 | ], 177 | "payable": false, 178 | "stateMutability": "view", 179 | "type": "function" 180 | }, 181 | { 182 | "constant": true, 183 | "inputs": [], 184 | "name": "exitNft", 185 | "outputs": [ 186 | { 187 | "internalType": "contract ExitNFT", 188 | "name": "", 189 | "type": "address" 190 | } 191 | ], 192 | "payable": false, 193 | "stateMutability": "view", 194 | "type": "function" 195 | }, 196 | { 197 | "constant": true, 198 | "inputs": [], 199 | "name": "exitWindow", 200 | "outputs": [ 201 | { 202 | "internalType": "uint256", 203 | "name": "", 204 | "type": "uint256" 205 | } 206 | ], 207 | "payable": false, 208 | "stateMutability": "view", 209 | "type": "function" 210 | }, 211 | { 212 | "constant": true, 213 | "inputs": [ 214 | { 215 | "internalType": "uint256", 216 | "name": "", 217 | "type": "uint256" 218 | } 219 | ], 220 | "name": "exits", 221 | "outputs": [ 222 | { 223 | "internalType": "uint256", 224 | "name": "receiptAmountOrNFTId", 225 | "type": "uint256" 226 | }, 227 | { 228 | "internalType": "bytes32", 229 | "name": "txHash", 230 | "type": "bytes32" 231 | }, 232 | { 233 | "internalType": "address", 234 | "name": "owner", 235 | "type": "address" 236 | }, 237 | { 238 | "internalType": "address", 239 | "name": "token", 240 | "type": "address" 241 | }, 242 | { 243 | "internalType": "bool", 244 | "name": "isRegularExit", 245 | "type": "bool" 246 | }, 247 | { 248 | "internalType": "address", 249 | "name": "predicate", 250 | "type": "address" 251 | } 252 | ], 253 | "payable": false, 254 | "stateMutability": "view", 255 | "type": "function" 256 | }, 257 | { 258 | "constant": true, 259 | "inputs": [ 260 | { 261 | "internalType": "address", 262 | "name": "", 263 | "type": "address" 264 | } 265 | ], 266 | "name": "exitsQueues", 267 | "outputs": [ 268 | { 269 | "internalType": "address", 270 | "name": "", 271 | "type": "address" 272 | } 273 | ], 274 | "payable": false, 275 | "stateMutability": "view", 276 | "type": "function" 277 | }, 278 | { 279 | "constant": true, 280 | "inputs": [], 281 | "name": "isOwner", 282 | "outputs": [ 283 | { 284 | "internalType": "bool", 285 | "name": "", 286 | "type": "bool" 287 | } 288 | ], 289 | "payable": false, 290 | "stateMutability": "view", 291 | "type": "function" 292 | }, 293 | { 294 | "constant": true, 295 | "inputs": [], 296 | "name": "owner", 297 | "outputs": [ 298 | { 299 | "internalType": "address", 300 | "name": "", 301 | "type": "address" 302 | } 303 | ], 304 | "payable": false, 305 | "stateMutability": "view", 306 | "type": "function" 307 | }, 308 | { 309 | "constant": true, 310 | "inputs": [ 311 | { 312 | "internalType": "bytes32", 313 | "name": "", 314 | "type": "bytes32" 315 | } 316 | ], 317 | "name": "ownerExits", 318 | "outputs": [ 319 | { 320 | "internalType": "uint256", 321 | "name": "", 322 | "type": "uint256" 323 | } 324 | ], 325 | "payable": false, 326 | "stateMutability": "view", 327 | "type": "function" 328 | }, 329 | { 330 | "constant": false, 331 | "inputs": [], 332 | "name": "renounceOwnership", 333 | "outputs": [], 334 | "payable": false, 335 | "stateMutability": "nonpayable", 336 | "type": "function" 337 | }, 338 | { 339 | "constant": false, 340 | "inputs": [ 341 | { 342 | "internalType": "address", 343 | "name": "newOwner", 344 | "type": "address" 345 | } 346 | ], 347 | "name": "transferOwnership", 348 | "outputs": [], 349 | "payable": false, 350 | "stateMutability": "nonpayable", 351 | "type": "function" 352 | }, 353 | { 354 | "constant": false, 355 | "inputs": [ 356 | { 357 | "internalType": "address", 358 | "name": "token", 359 | "type": "address" 360 | } 361 | ], 362 | "name": "createExitQueue", 363 | "outputs": [], 364 | "payable": false, 365 | "stateMutability": "nonpayable", 366 | "type": "function" 367 | }, 368 | { 369 | "constant": true, 370 | "inputs": [ 371 | { 372 | "internalType": "bytes", 373 | "name": "data", 374 | "type": "bytes" 375 | }, 376 | { 377 | "internalType": "uint8", 378 | "name": "offset", 379 | "type": "uint8" 380 | }, 381 | { 382 | "internalType": "bool", 383 | "name": "verifyTxInclusion", 384 | "type": "bool" 385 | } 386 | ], 387 | "name": "verifyInclusion", 388 | "outputs": [ 389 | { 390 | "internalType": "uint256", 391 | "name": "", 392 | "type": "uint256" 393 | } 394 | ], 395 | "payable": false, 396 | "stateMutability": "view", 397 | "type": "function" 398 | }, 399 | { 400 | "constant": false, 401 | "inputs": [ 402 | { 403 | "internalType": "uint256", 404 | "name": "depositId", 405 | "type": "uint256" 406 | }, 407 | { 408 | "internalType": "address", 409 | "name": "token", 410 | "type": "address" 411 | }, 412 | { 413 | "internalType": "uint256", 414 | "name": "amountOrToken", 415 | "type": "uint256" 416 | } 417 | ], 418 | "name": "startExitWithDepositedTokens", 419 | "outputs": [], 420 | "payable": true, 421 | "stateMutability": "payable", 422 | "type": "function" 423 | }, 424 | { 425 | "constant": false, 426 | "inputs": [ 427 | { 428 | "internalType": "address", 429 | "name": "exitor", 430 | "type": "address" 431 | }, 432 | { 433 | "internalType": "address", 434 | "name": "childToken", 435 | "type": "address" 436 | }, 437 | { 438 | "internalType": "address", 439 | "name": "rootToken", 440 | "type": "address" 441 | }, 442 | { 443 | "internalType": "uint256", 444 | "name": "exitAmountOrTokenId", 445 | "type": "uint256" 446 | }, 447 | { 448 | "internalType": "bytes32", 449 | "name": "txHash", 450 | "type": "bytes32" 451 | }, 452 | { 453 | "internalType": "bool", 454 | "name": "isRegularExit", 455 | "type": "bool" 456 | }, 457 | { 458 | "internalType": "uint256", 459 | "name": "priority", 460 | "type": "uint256" 461 | } 462 | ], 463 | "name": "addExitToQueue", 464 | "outputs": [], 465 | "payable": false, 466 | "stateMutability": "nonpayable", 467 | "type": "function" 468 | }, 469 | { 470 | "constant": false, 471 | "inputs": [ 472 | { 473 | "internalType": "uint256", 474 | "name": "exitId", 475 | "type": "uint256" 476 | }, 477 | { 478 | "internalType": "uint256", 479 | "name": "inputId", 480 | "type": "uint256" 481 | }, 482 | { 483 | "internalType": "bytes", 484 | "name": "challengeData", 485 | "type": "bytes" 486 | }, 487 | { 488 | "internalType": "address", 489 | "name": "adjudicatorPredicate", 490 | "type": "address" 491 | } 492 | ], 493 | "name": "challengeExit", 494 | "outputs": [], 495 | "payable": false, 496 | "stateMutability": "nonpayable", 497 | "type": "function" 498 | }, 499 | { 500 | "constant": false, 501 | "inputs": [ 502 | { 503 | "internalType": "address", 504 | "name": "_token", 505 | "type": "address" 506 | } 507 | ], 508 | "name": "processExits", 509 | "outputs": [], 510 | "payable": false, 511 | "stateMutability": "nonpayable", 512 | "type": "function" 513 | }, 514 | { 515 | "constant": false, 516 | "inputs": [ 517 | { 518 | "internalType": "address[]", 519 | "name": "_tokens", 520 | "type": "address[]" 521 | } 522 | ], 523 | "name": "processExitsBatch", 524 | "outputs": [], 525 | "payable": false, 526 | "stateMutability": "nonpayable", 527 | "type": "function" 528 | }, 529 | { 530 | "constant": false, 531 | "inputs": [ 532 | { 533 | "internalType": "uint256", 534 | "name": "exitId", 535 | "type": "uint256" 536 | }, 537 | { 538 | "internalType": "uint256", 539 | "name": "age", 540 | "type": "uint256" 541 | }, 542 | { 543 | "internalType": "address", 544 | "name": "utxoOwner", 545 | "type": "address" 546 | }, 547 | { 548 | "internalType": "address", 549 | "name": "token", 550 | "type": "address" 551 | } 552 | ], 553 | "name": "addInput", 554 | "outputs": [], 555 | "payable": false, 556 | "stateMutability": "nonpayable", 557 | "type": "function" 558 | }, 559 | { 560 | "constant": false, 561 | "inputs": [ 562 | { 563 | "internalType": "uint256", 564 | "name": "halfExitPeriod", 565 | "type": "uint256" 566 | } 567 | ], 568 | "name": "updateExitPeriod", 569 | "outputs": [], 570 | "payable": false, 571 | "stateMutability": "nonpayable", 572 | "type": "function" 573 | } 574 | ] 575 | -------------------------------------------------------------------------------- /root/config/goerli.json: -------------------------------------------------------------------------------- 1 | { 2 | "network": "goerli", 3 | "subgraphId": "QmNcSW8KahtQmFYCKCw58oYNGT7J7V7Q4eZAMgsDYNitYc", 4 | "graftingStartBlock": 2815580, 5 | "contracts": { 6 | "rootChain": { 7 | "address": "0x2890bA17EfE978480615e330ecB65333b880928e", 8 | "startBlock": 2815568 9 | }, 10 | "stateSender": { 11 | "address": "0xEAa852323826C71cd7920C3b4c007184234c3945", 12 | "startBlock": 2815588 13 | }, 14 | "withdrawManager": { 15 | "address": "0x2923C8dD6Cdf6b2507ef91de74F1d5E0F11Eac53", 16 | "startBlock": 3779631 17 | }, 18 | "rootChainManager": { 19 | "address": "0xBbD7cBFA79faee899Eaf900F13C9065bF03B1A74", 20 | "startBlock": 3000761 21 | }, 22 | "stakingInfo": { 23 | "address": "0x29C40836C17f22d16a7fE953Fb25DA670C96d69E", 24 | "startBlock": 2917902 25 | }, 26 | "stakingNft": { 27 | "address": "0x532c7020E0F3666f9440B8B9d899A9763BCc5dB7", 28 | "startBlock": 2917904 29 | }, 30 | "maticTokenContract": { 31 | "address": "0x499d11E0b6eAC7c0593d8Fb292DCBbF815Fb29Ae", 32 | "startBlock": 5996697 33 | }, 34 | "eventsHub": { 35 | "address": "0x158d5fa3Ef8e4dDA8a5367deCF76b94E7efFCe95", 36 | "startBlock": 4269970 37 | }, 38 | "registry": { 39 | "address": "0xeE11713Fe713b2BfF2942452517483654078154D", 40 | "startBlock": 2815566 41 | }, 42 | "decoderForPoSPortalData": { 43 | "address": "0x8fcFA769D420AdA837206294eb054Ad514a7a8a0" 44 | }, 45 | "fxERC20RootTunnel": { 46 | "startBlock": 5433435 47 | }, 48 | "fxERC721RootTunnel": { 49 | "startBlock": 5433438 50 | }, 51 | "fxERC1155RootTunnel": { 52 | "startBlock": 5433438 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /root/config/mainnet.json: -------------------------------------------------------------------------------- 1 | { 2 | "network": "mainnet", 3 | "subgraphId": "QmXhZa2bzqhXCU4bMQunbY1rPeT5aVSVppciojDRikuwo1", 4 | "graftingStartBlock": 10167760, 5 | "contracts": { 6 | "rootChain": { 7 | "address": "0x86E4Dc95c7FBdBf52e33D563BbDB00823894C287", 8 | "startBlock": 10167725 9 | }, 10 | "stateSender": { 11 | "address": "0x28e4F3a7f651294B9564800b2D01f35189A5bFbE", 12 | "startBlock": 10167763 13 | }, 14 | "withdrawManager": { 15 | "address": "0x2A88696e0fFA76bAA1338F2C74497cC013495922", 16 | "startBlock": 11286726 17 | }, 18 | "eventsHub": { 19 | "address": "0x6dF5CB08d3f0193C768C8A01f42ac4424DC5086b", 20 | "startBlock": 12115587 21 | }, 22 | "rootChainManager": { 23 | "address": "0xA0c68C638235ee32657e8f720a23ceC1bFc77C77", 24 | "startBlock": 10735437 25 | }, 26 | "stakingInfo": { 27 | "address": "0xa59C847Bd5aC0172Ff4FE912C5d29E5A71A7512B", 28 | "startBlock": 10342572 29 | }, 30 | "stakingNft": { 31 | "address": "0x47Cbe25BbDB40a774cC37E1dA92d10C2C7Ec897F", 32 | "startBlock": 10342574 33 | }, 34 | "maticTokenContract": { 35 | "address": "0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0", 36 | "startBlock": 13977920 37 | }, 38 | "registry": { 39 | "address": "0x33a02E6cC863D393d6Bf231B697b82F6e499cA71", 40 | "startBlock": 10167715 41 | }, 42 | "decoderForPoSPortalData": { 43 | "address": "0x13E301F8d9563e3D8d48F1d21aE8110B22558cd5" 44 | }, 45 | "fxERC20RootTunnel": { 46 | "startBlock": 13241945 47 | }, 48 | "fxERC721RootTunnel": { 49 | "startBlock": 13242431 50 | }, 51 | "fxERC1155RootTunnel": { 52 | "startBlock": 13242936 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /root/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "matic-root-subgraphs", 3 | "license": "MIT", 4 | "scripts": { 5 | "lint": "eslint --ext .ts --ext .js --ext .json .eslintrc.js src abis", 6 | "lint:fix": "eslint --ext .ts --ext .js --ext .json .eslintrc.js src abis --fix", 7 | "graph": "graph", 8 | "codegen": "graph codegen", 9 | "build": "graph build", 10 | "prepare:mainnet": "mustache config/mainnet.json subgraph.template.yaml > subgraph.yaml && mustache config/mainnet.json src/network.template.ts > src/network.ts", 11 | "prepare:goerli": "mustache config/goerli.json subgraph.template.yaml > subgraph.yaml && mustache config/goerli.json src/network.template.ts > src/network.ts", 12 | "deploy": "graph deploy --node https://api.thegraph.com/deploy/ --ipfs https://api.thegraph.com/ipfs/ maticnetwork/mumbai-root-subgraphs", 13 | "create-local": "graph create --node http://localhost:8020/ maticnetwork/mumbai-root-subgraphs", 14 | "remove-local": "graph remove --node http://localhost:8020/ maticnetwork/mumbai-root-subgraphs", 15 | "deploy-local": "graph deploy --node http://localhost:8020/ --ipfs https://ipfs.infura.io:5001 maticnetwork/mumbai-root-subgraphs" 16 | }, 17 | "dependencies": { 18 | "@graphprotocol/graph-ts": "^0.24.1" 19 | }, 20 | "devDependencies": { 21 | "@graphprotocol/graph-cli": "^0.25.3", 22 | "@typescript-eslint/eslint-plugin": "^4.10.0", 23 | "@typescript-eslint/parser": "^4.10.0", 24 | "eslint": "^7.16.0", 25 | "eslint-plugin-json": "^2.1.2", 26 | "eslint-plugin-unicorn": "^24.0.0", 27 | "mustache": "4.0.1", 28 | "typescript": "^4.1.3" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /root/schema.graphql: -------------------------------------------------------------------------------- 1 | type Checkpoint @entity { 2 | id: ID! 3 | proposer: Bytes! 4 | headerBlockId: BigInt! 5 | checkpointNumber: BigInt! 6 | reward: BigInt! 7 | start: BigInt! 8 | end: BigInt! 9 | root: Bytes! 10 | logIndex: String! 11 | transactionHash: Bytes! 12 | timestamp: BigInt! 13 | } 14 | 15 | type StateSync @entity { 16 | id: ID! 17 | stateId: BigInt! 18 | contract: Bytes! 19 | syncType: Int! 20 | depositorOrRootToken: String! 21 | depositedTokenOrChildToken: String! 22 | data: String! 23 | rawData: String! 24 | logIndex: String! 25 | transactionHash: Bytes! 26 | timestamp: BigInt! 27 | blockNumber: BigInt! 28 | } 29 | 30 | type StateRegistration @entity { 31 | id: ID! 32 | user: Bytes! 33 | receiver: Bytes! 34 | sender: Bytes! 35 | } 36 | 37 | # This entity will hold everything regarding 38 | # plasma exit 39 | # 40 | # Not all fields are made compulsory due to the fact, 41 | # all steps don't happen at a time, rather they will be async ops 42 | type PlasmaExit @entity { 43 | # id always created using `plasma-exit-${exitId}` 44 | id: ID! 45 | counter: BigInt! # this field can be used to know where the exitStarted transaction happened. 46 | exitId: BigInt! 47 | exitInitiator: Bytes 48 | exitCompleter: Bytes 49 | token: Bytes 50 | amount: BigInt 51 | isRegularExit: Boolean! 52 | exited: Int! 53 | # exited can take 3 possible values 54 | # 0 -> exit started 55 | # 1 -> exit cancelled 56 | # 2 -> exit completed 57 | exitStartedTxHash: Bytes 58 | exitStartedTimeStamp: BigInt 59 | exitCancelledTxHash: Bytes 60 | exitCancelledTimeStamp: BigInt 61 | exitCompletedTxHash: Bytes 62 | exitCompletedTimeStamp: BigInt 63 | } 64 | 65 | type PredicateRegistration @entity { 66 | id: ID! 67 | tokenType: Bytes! 68 | predicateAddress: Bytes! 69 | timestamp: BigInt! 70 | transactionHash: Bytes! 71 | } 72 | 73 | type TokenMapping @entity { 74 | id: ID! 75 | rootToken: Bytes! 76 | childToken: Bytes! 77 | tokenType: String! 78 | isPOS: Boolean! 79 | timestamp: BigInt! 80 | transactionHash: Bytes! 81 | } 82 | 83 | type FxTokenMapping @entity { 84 | id: ID! 85 | counter: BigInt! 86 | contractAddress: Bytes! 87 | rootToken: Bytes! 88 | childToken: Bytes! 89 | tokenType: String! 90 | timestamp: BigInt! 91 | transactionHash: Bytes! 92 | } 93 | 94 | type FxTokenMappingCounter @entity { 95 | id: ID! 96 | current: BigInt! 97 | } 98 | 99 | type FxDeposit @entity { 100 | id: ID! 101 | counter: BigInt! 102 | contractAddress: Bytes! 103 | rootToken: Bytes! 104 | tokenType: String! 105 | depositor: Bytes! 106 | userAddress: Bytes! 107 | amount: BigInt 108 | tokenId: BigInt 109 | timestamp: BigInt! 110 | transactionHash: Bytes! 111 | } 112 | 113 | type FxDepositCounter @entity { 114 | id: ID! 115 | current: BigInt! 116 | } 117 | 118 | type FxWithdraw @entity { 119 | id: ID! 120 | counter: BigInt! 121 | contractAddress: Bytes! 122 | rootToken: Bytes! 123 | childToken: Bytes! 124 | tokenType: String! 125 | userAddress: Bytes! 126 | amount: BigInt 127 | tokenId: BigInt 128 | timestamp: BigInt! 129 | transactionHash: Bytes! 130 | } 131 | 132 | type FxWithdrawCounter @entity { 133 | id: ID! 134 | current: BigInt! 135 | } 136 | 137 | type Validator @entity { 138 | id: ID! 139 | validatorId: BigInt! 140 | owner: Bytes! 141 | signer: Bytes! 142 | signerPubKey: Bytes! 143 | liquidatedRewards: BigInt! 144 | activationEpoch: BigInt! 145 | deactivationEpoch: BigInt! 146 | totalStaked: BigInt! 147 | selfStake: BigInt! 148 | delegatedStake: BigInt! 149 | commissionRate: BigInt! 150 | nonce: BigInt! 151 | # Meaning of status codes 152 | # 153 | # 0 : Staked 154 | # 1 : Unstaked 155 | # 2 : Jailed 156 | # 3 : Unjailed 157 | status: Int! 158 | jailEndEpoch: BigInt! 159 | auctionAmount: BigInt! 160 | isInAuction: Boolean! 161 | } 162 | 163 | type StakeUpdate @entity { 164 | id: ID! 165 | validatorId: BigInt! 166 | totalStaked: BigInt! 167 | block: BigInt! 168 | nonce: BigInt! 169 | transactionHash: Bytes! 170 | logIndex: BigInt! 171 | } 172 | 173 | # Keeps track of current delegator counter i.e. how many 174 | # delegators are present as of now 175 | type GlobalDelegatorCounter @entity { 176 | id: ID! 177 | current: BigInt! 178 | } 179 | 180 | # This can be used to get the count of the plasma exits and till where have the process exits been processed. 181 | type GlobalPlasmaExitCounter @entity { 182 | id: ID! 183 | current: BigInt! 184 | } 185 | 186 | type Delegator @entity { 187 | id: ID! 188 | counter: BigInt! # this field can be used for traversing through large number of delegator list 189 | validatorId: BigInt! 190 | address: Bytes! 191 | # total delegated amount 192 | delegatedAmount: BigInt! 193 | # total unclaimed amount (after sellVoucher and before claiming it) 194 | unclaimedAmount: BigInt! 195 | # total claimed amount (after withdraw delay, while claiming unstaked amount) 196 | claimedAmount: BigInt! 197 | # total current shares (works until tokens are non-transferable) 198 | tokens: BigInt! 199 | claimedRewards: BigInt! 200 | } 201 | 202 | # Heimdall topups 203 | type Topup @entity { 204 | id: ID! 205 | address: Bytes! 206 | topupAmount: BigInt! 207 | withdrawAmount: BigInt! 208 | } 209 | 210 | # Staking Params across all validators 211 | type StakingParams 212 | @queryFields(singular: "stakingParams", plural: "allStakingParams") 213 | @entity { 214 | id: ID! 215 | owner: Bytes 216 | validatorThreshold: BigInt! 217 | proposerBonus: BigInt! 218 | dynasty: BigInt! 219 | liquidatedRewards: BigInt! 220 | } 221 | 222 | # Staking NFT's historical ownership 223 | # can be checked using this entity 224 | type StakingNFTTransfer @entity { 225 | id: ID! 226 | tokenId: BigInt! 227 | currentOwner: Bytes! 228 | previousOwners: [Bytes!]! 229 | transactionHashes: [Bytes!]! 230 | } 231 | 232 | type DelegatorUnbond @entity { 233 | id: ID! 234 | nonce: BigInt! 235 | validatorId: BigInt! 236 | user: Bytes! 237 | amount: BigInt! 238 | tokens: BigInt! 239 | completed: Boolean! 240 | unbondStartedTxHash: Bytes 241 | unbondStartedTimeStamp: BigInt 242 | unbondClaimedTxHash: Bytes 243 | unbondClaimedTimeStamp: BigInt 244 | activeStake: BigInt! 245 | } 246 | 247 | type MaticTransfer @entity { 248 | id: ID! 249 | token: Bytes! 250 | from: Bytes! 251 | to: Bytes! 252 | value: BigInt! 253 | block: BigInt! 254 | timestamp: BigInt! 255 | transactionHash: Bytes! 256 | } 257 | 258 | type GlobalDelegationCounter @entity { 259 | id: ID! 260 | current: BigInt! 261 | } 262 | 263 | type Delegation @entity { 264 | id: ID! 265 | counter: BigInt! # this field can be used for traversing through large number of delegations list 266 | validatorId: BigInt! 267 | address: Bytes! 268 | timestamp: BigInt! 269 | transactionHash: Bytes! 270 | # delegated amount in that transaction 271 | amount: BigInt! 272 | block: BigInt! 273 | activeStake: BigInt! 274 | } 275 | -------------------------------------------------------------------------------- /root/src/mappings/checkpoint.ts: -------------------------------------------------------------------------------- 1 | import { BigInt } from '@graphprotocol/graph-ts' 2 | import { NewHeaderBlock } from '../../generated/Rootchain/Rootchain' 3 | import { Checkpoint } from '../../generated/schema' 4 | 5 | let MAX_DEPOSITS = BigInt.fromI32(10000) 6 | 7 | export function handleNewHeaderBlock(event: NewHeaderBlock): void { 8 | // checkpoint number is `header block / max_deposits` 9 | let checkpointNumber = event.params.headerBlockId.div(MAX_DEPOSITS) 10 | 11 | // use checkpoint number as id 12 | let entity = new Checkpoint('checkpoint:' + checkpointNumber.toString()) 13 | 14 | entity.proposer = event.params.proposer 15 | entity.headerBlockId = event.params.headerBlockId 16 | entity.checkpointNumber = checkpointNumber 17 | entity.reward = event.params.reward 18 | entity.start = event.params.start 19 | entity.end = event.params.end 20 | entity.root = event.params.root 21 | entity.logIndex = event.logIndex.toString() 22 | 23 | entity.transactionHash = event.transaction.hash 24 | entity.timestamp = event.block.timestamp 25 | 26 | entity.save() 27 | 28 | } 29 | -------------------------------------------------------------------------------- /root/src/mappings/fx-erc1155.ts: -------------------------------------------------------------------------------- 1 | import { BigInt } from '@graphprotocol/graph-ts' 2 | 3 | import { TokenMappedERC1155, FxDepositERC1155, FxWithdrawERC1155 } from '../../generated/FxERC1155Events/FxERC1155RootTunnel' 4 | import { FxTokenMapping, FxDeposit, FxWithdraw, 5 | FxTokenMappingCounter, FxDepositCounter, FxWithdrawCounter } from '../../generated/schema' 6 | 7 | function getFxTokenMappingCounter(): FxTokenMappingCounter { 8 | // Only one entry will be kept in this entity 9 | let id = 'fx-token-mapping-counter' 10 | let entity = FxTokenMappingCounter.load(id) 11 | if (entity == null) { 12 | 13 | entity = new FxTokenMappingCounter(id) 14 | entity.current = BigInt.fromI32(0) 15 | 16 | } 17 | return entity as FxTokenMappingCounter 18 | } 19 | 20 | function getFxDepositCounter(): FxDepositCounter { 21 | // Only one entry will be kept in this entity 22 | let id = 'fx-deposit-counter' 23 | let entity = FxDepositCounter.load(id) 24 | if (entity == null) { 25 | 26 | entity = new FxDepositCounter(id) 27 | entity.current = BigInt.fromI32(0) 28 | 29 | } 30 | return entity as FxDepositCounter 31 | } 32 | 33 | function getFxWithdrawCounter(): FxWithdrawCounter { 34 | // Only one entry will be kept in this entity 35 | let id = 'fx-withdraw-counter' 36 | let entity = FxWithdrawCounter.load(id) 37 | if (entity == null) { 38 | 39 | entity = new FxWithdrawCounter(id) 40 | entity.current = BigInt.fromI32(0) 41 | 42 | } 43 | return entity as FxWithdrawCounter 44 | } 45 | 46 | export function handleTokenMappedERC1155(event: TokenMappedERC1155): void { 47 | let counter = getFxTokenMappingCounter() 48 | let updated = counter.current.plus(BigInt.fromI32(1)) 49 | 50 | let id = 'fx-token-mapping:' + counter.current.toString() 51 | 52 | // Updating global counter's state 53 | counter.current = updated 54 | counter.save() 55 | 56 | let entity = FxTokenMapping.load(id) 57 | if (entity == null) { 58 | entity = new FxTokenMapping(id) 59 | } 60 | 61 | entity.transactionHash = event.transaction.hash 62 | entity.timestamp = event.block.timestamp 63 | entity.counter = counter.current 64 | entity.contractAddress = event.address 65 | entity.rootToken = event.params.rootToken 66 | entity.childToken = event.params.childToken 67 | entity.tokenType = 'ERC1155' 68 | 69 | // save entity 70 | entity.save() 71 | } 72 | 73 | export function handleFxDepositERC1155(event: FxDepositERC1155): void { 74 | let counter = getFxDepositCounter() 75 | let updated = counter.current.plus(BigInt.fromI32(1)) 76 | 77 | let id = 'fx-deposit:' + counter.current.toString() 78 | 79 | // Updating global counter's state 80 | counter.current = updated 81 | counter.save() 82 | 83 | let entity = FxDeposit.load(id) 84 | if (entity == null) { 85 | entity = new FxDeposit(id) 86 | } 87 | 88 | entity.transactionHash = event.transaction.hash 89 | entity.timestamp = event.block.timestamp 90 | entity.counter = counter.current 91 | entity.contractAddress = event.address 92 | entity.rootToken = event.params.rootToken 93 | entity.tokenType = 'ERC1155' 94 | entity.userAddress = event.params.userAddress 95 | entity.depositor = event.params.depositor 96 | entity.tokenId = event.params.id 97 | entity.amount = event.params.amount 98 | 99 | // save entity 100 | entity.save() 101 | } 102 | 103 | export function handleFxWithdrawERC1155(event: FxWithdrawERC1155): void { 104 | let counter = getFxWithdrawCounter() 105 | let updated = counter.current.plus(BigInt.fromI32(1)) 106 | 107 | let id = 'fx-withdraw:' + counter.current.toString() 108 | 109 | // Updating global counter's state 110 | counter.current = updated 111 | counter.save() 112 | 113 | let entity = FxWithdraw.load(id) 114 | if (entity == null) { 115 | entity = new FxWithdraw(id) 116 | } 117 | 118 | entity.transactionHash = event.transaction.hash 119 | entity.timestamp = event.block.timestamp 120 | entity.counter = counter.current 121 | entity.contractAddress = event.address 122 | entity.rootToken = event.params.rootToken 123 | entity.childToken = event.params.childToken 124 | entity.tokenType = 'ERC1155' 125 | entity.userAddress = event.params.userAddress 126 | entity.tokenId = event.params.id 127 | entity.amount = event.params.amount 128 | 129 | // save entity 130 | entity.save() 131 | } 132 | -------------------------------------------------------------------------------- /root/src/mappings/fx-erc20.ts: -------------------------------------------------------------------------------- 1 | import { BigInt } from '@graphprotocol/graph-ts' 2 | 3 | import { TokenMappedERC20, FxDepositERC20, FxWithdrawERC20 } from '../../generated/FxERC20Events/FxERC20RootTunnel' 4 | import { FxTokenMapping, FxDeposit, FxWithdraw, 5 | FxTokenMappingCounter, FxDepositCounter, FxWithdrawCounter } from '../../generated/schema' 6 | 7 | function getFxTokenMappingCounter(): FxTokenMappingCounter { 8 | // Only one entry will be kept in this entity 9 | let id = 'fx-token-mapping-counter' 10 | let entity = FxTokenMappingCounter.load(id) 11 | if (entity == null) { 12 | 13 | entity = new FxTokenMappingCounter(id) 14 | entity.current = BigInt.fromI32(0) 15 | 16 | } 17 | return entity as FxTokenMappingCounter 18 | } 19 | 20 | function getFxDepositCounter(): FxDepositCounter { 21 | // Only one entry will be kept in this entity 22 | let id = 'fx-deposit-counter' 23 | let entity = FxDepositCounter.load(id) 24 | if (entity == null) { 25 | 26 | entity = new FxDepositCounter(id) 27 | entity.current = BigInt.fromI32(0) 28 | 29 | } 30 | return entity as FxDepositCounter 31 | } 32 | 33 | function getFxWithdrawCounter(): FxWithdrawCounter { 34 | // Only one entry will be kept in this entity 35 | let id = 'fx-withdraw-counter' 36 | let entity = FxWithdrawCounter.load(id) 37 | if (entity == null) { 38 | 39 | entity = new FxWithdrawCounter(id) 40 | entity.current = BigInt.fromI32(0) 41 | 42 | } 43 | return entity as FxWithdrawCounter 44 | } 45 | 46 | export function handleTokenMappedERC20(event: TokenMappedERC20): void { 47 | let counter = getFxTokenMappingCounter() 48 | let updated = counter.current.plus(BigInt.fromI32(1)) 49 | 50 | let id = 'fx-token-mapping:' + counter.current.toString() 51 | 52 | // Updating global counter's state 53 | counter.current = updated 54 | counter.save() 55 | 56 | let entity = FxTokenMapping.load(id) 57 | if (entity == null) { 58 | entity = new FxTokenMapping(id) 59 | } 60 | 61 | entity.transactionHash = event.transaction.hash 62 | entity.timestamp = event.block.timestamp 63 | entity.counter = counter.current 64 | entity.contractAddress = event.address 65 | entity.rootToken = event.params.rootToken 66 | entity.childToken = event.params.childToken 67 | entity.tokenType = 'ERC20' 68 | 69 | // save entity 70 | entity.save() 71 | } 72 | 73 | export function handleFxDepositERC20(event: FxDepositERC20): void { 74 | let counter = getFxDepositCounter() 75 | let updated = counter.current.plus(BigInt.fromI32(1)) 76 | 77 | let id = 'fx-deposit:' + counter.current.toString() 78 | 79 | // Updating global counter's state 80 | counter.current = updated 81 | counter.save() 82 | 83 | let entity = FxDeposit.load(id) 84 | if (entity == null) { 85 | entity = new FxDeposit(id) 86 | } 87 | 88 | entity.transactionHash = event.transaction.hash 89 | entity.timestamp = event.block.timestamp 90 | entity.counter = counter.current 91 | entity.contractAddress = event.address 92 | entity.rootToken = event.params.rootToken 93 | entity.tokenType = 'ERC20' 94 | entity.userAddress = event.params.userAddress 95 | entity.depositor = event.params.depositor 96 | entity.amount = event.params.amount 97 | 98 | // save entity 99 | entity.save() 100 | } 101 | 102 | export function handleFxWithdrawERC20(event: FxWithdrawERC20): void { 103 | let counter = getFxWithdrawCounter() 104 | let updated = counter.current.plus(BigInt.fromI32(1)) 105 | 106 | let id = 'fx-withdraw:' + counter.current.toString() 107 | 108 | // Updating global counter's state 109 | counter.current = updated 110 | counter.save() 111 | 112 | let entity = FxWithdraw.load(id) 113 | if (entity == null) { 114 | entity = new FxWithdraw(id) 115 | } 116 | 117 | entity.transactionHash = event.transaction.hash 118 | entity.timestamp = event.block.timestamp 119 | entity.counter = counter.current 120 | entity.contractAddress = event.address 121 | entity.rootToken = event.params.rootToken 122 | entity.childToken = event.params.childToken 123 | entity.tokenType = 'ERC20' 124 | entity.userAddress = event.params.userAddress 125 | entity.amount = event.params.amount 126 | 127 | // save entity 128 | entity.save() 129 | } 130 | -------------------------------------------------------------------------------- /root/src/mappings/fx-erc721.ts: -------------------------------------------------------------------------------- 1 | import { BigInt } from '@graphprotocol/graph-ts' 2 | 3 | import { TokenMappedERC721, FxDepositERC721, FxWithdrawERC721 } from '../../generated/FxERC721Events/FxERC721RootTunnel' 4 | import { FxTokenMapping, FxDeposit, FxWithdraw, 5 | FxTokenMappingCounter, FxDepositCounter, FxWithdrawCounter } from '../../generated/schema' 6 | 7 | function getFxTokenMappingCounter(): FxTokenMappingCounter { 8 | // Only one entry will be kept in this entity 9 | let id = 'fx-token-mapping-counter' 10 | let entity = FxTokenMappingCounter.load(id) 11 | if (entity == null) { 12 | 13 | entity = new FxTokenMappingCounter(id) 14 | entity.current = BigInt.fromI32(0) 15 | 16 | } 17 | return entity as FxTokenMappingCounter 18 | } 19 | 20 | function getFxDepositCounter(): FxDepositCounter { 21 | // Only one entry will be kept in this entity 22 | let id = 'fx-deposit-counter' 23 | let entity = FxDepositCounter.load(id) 24 | if (entity == null) { 25 | 26 | entity = new FxDepositCounter(id) 27 | entity.current = BigInt.fromI32(0) 28 | 29 | } 30 | return entity as FxDepositCounter 31 | } 32 | 33 | function getFxWithdrawCounter(): FxWithdrawCounter { 34 | // Only one entry will be kept in this entity 35 | let id = 'fx-withdraw-counter' 36 | let entity = FxWithdrawCounter.load(id) 37 | if (entity == null) { 38 | 39 | entity = new FxWithdrawCounter(id) 40 | entity.current = BigInt.fromI32(0) 41 | 42 | } 43 | return entity as FxWithdrawCounter 44 | } 45 | 46 | export function handleTokenMappedERC721(event: TokenMappedERC721): void { 47 | let counter = getFxTokenMappingCounter() 48 | let updated = counter.current.plus(BigInt.fromI32(1)) 49 | 50 | let id = 'fx-token-mapping:' + counter.current.toString() 51 | 52 | // Updating global counter's state 53 | counter.current = updated 54 | counter.save() 55 | 56 | let entity = FxTokenMapping.load(id) 57 | if (entity == null) { 58 | entity = new FxTokenMapping(id) 59 | } 60 | 61 | entity.transactionHash = event.transaction.hash 62 | entity.timestamp = event.block.timestamp 63 | entity.counter = counter.current 64 | entity.contractAddress = event.address 65 | entity.rootToken = event.params.rootToken 66 | entity.childToken = event.params.childToken 67 | entity.tokenType = 'ERC721' 68 | 69 | // save entity 70 | entity.save() 71 | } 72 | 73 | export function handleFxDepositERC721(event: FxDepositERC721): void { 74 | let counter = getFxDepositCounter() 75 | let updated = counter.current.plus(BigInt.fromI32(1)) 76 | 77 | let id = 'fx-deposit:' + counter.current.toString() 78 | 79 | // Updating global counter's state 80 | counter.current = updated 81 | counter.save() 82 | 83 | let entity = FxDeposit.load(id) 84 | if (entity == null) { 85 | entity = new FxDeposit(id) 86 | } 87 | 88 | entity.transactionHash = event.transaction.hash 89 | entity.timestamp = event.block.timestamp 90 | entity.counter = counter.current 91 | entity.contractAddress = event.address 92 | entity.rootToken = event.params.rootToken 93 | entity.tokenType = 'ERC721' 94 | entity.userAddress = event.params.userAddress 95 | entity.depositor = event.params.depositor 96 | entity.tokenId = event.params.id 97 | 98 | // save entity 99 | entity.save() 100 | } 101 | 102 | export function handleFxWithdrawERC721(event: FxWithdrawERC721): void { 103 | let counter = getFxWithdrawCounter() 104 | let updated = counter.current.plus(BigInt.fromI32(1)) 105 | 106 | let id = 'fx-withdraw:' + counter.current.toString() 107 | 108 | // Updating global counter's state 109 | counter.current = updated 110 | counter.save() 111 | 112 | let entity = FxWithdraw.load(id) 113 | if (entity == null) { 114 | entity = new FxWithdraw(id) 115 | } 116 | 117 | entity.transactionHash = event.transaction.hash 118 | entity.timestamp = event.block.timestamp 119 | entity.counter = counter.current 120 | entity.contractAddress = event.address 121 | entity.rootToken = event.params.rootToken 122 | entity.childToken = event.params.childToken 123 | entity.tokenType = 'ERC721' 124 | entity.userAddress = event.params.userAddress 125 | entity.tokenId = event.params.id 126 | 127 | // save entity 128 | entity.save() 129 | } 130 | -------------------------------------------------------------------------------- /root/src/mappings/matic-transfer.ts: -------------------------------------------------------------------------------- 1 | import { Transfer } from '../../generated/TestToken/TestToken' 2 | import { MaticTransfer } from '../../generated/schema' 3 | 4 | export function handleTransfer(event: Transfer): void { 5 | let entity = new MaticTransfer(event.transaction.hash.toHex() + '-' + event.logIndex.toString()) 6 | 7 | entity.from = event.params.from 8 | entity.to = event.params.to 9 | entity.value = event.params.value 10 | entity.block = event.block.number 11 | entity.timestamp = event.block.timestamp 12 | entity.transactionHash = event.transaction.hash 13 | entity.token = event.address 14 | 15 | entity.save() 16 | } 17 | -------------------------------------------------------------------------------- /root/src/mappings/registry.ts: -------------------------------------------------------------------------------- 1 | import { Address } from '@graphprotocol/graph-ts' 2 | 3 | import { Registry, TokenMapped } from '../../generated/Registry/Registry' 4 | import { TokenMapping } from '../../generated/schema' 5 | 6 | // Using contract address for creating instance of `Registry` 7 | // contract, to be used for checking whether token is ERC20/ ERC721 8 | import { registryAddress } from '../network' 9 | 10 | export function handlePlasmaTokenMapped(event: TokenMapped): void { 11 | let id = 'plasma-token-mapping-' + event.params.rootToken.toHexString() 12 | 13 | let entity = TokenMapping.load(id) 14 | if (entity == null) { 15 | entity = new TokenMapping(id) 16 | } 17 | 18 | entity.rootToken = event.params.rootToken 19 | entity.childToken = event.params.childToken 20 | 21 | // Attempting to check from `Registry` contract what kind of 22 | // token it is. 23 | // 24 | // `tokenType` will be any of two possible values for Plasma Tokens 25 | // 26 | // 1. keccak256('ERC721') = 0x73ad2146b3d3a286642c794379d750360a2d53a3459a11b3e5d6cc900f55f44a 27 | // 2. keccak256('ERC20') = 0x8ae85d849167ff996c04040c44924fd364217285e4cad818292c7ac37c0a345b 28 | let registry = Registry.bind(Address.fromString(registryAddress)) 29 | entity.tokenType = (registry.isERC721(event.params.rootToken) ? '0x73ad2146b3d3a286642c794379d750360a2d53a3459a11b3e5d6cc900f55f44a' : '0x8ae85d849167ff996c04040c44924fd364217285e4cad818292c7ac37c0a345b') as String 30 | 31 | // Yes, this is plasma mapping handler, so it's a plasma bridge token 32 | entity.isPOS = false 33 | 34 | entity.timestamp = event.block.timestamp 35 | entity.transactionHash = event.transaction.hash 36 | 37 | // save entity 38 | entity.save() 39 | } 40 | -------------------------------------------------------------------------------- /root/src/mappings/rootchain-manager.ts: -------------------------------------------------------------------------------- 1 | import { PredicateRegistered, TokenMapped } from '../../generated/RootChainManager/RootChainManager' 2 | import { PredicateRegistration, TokenMapping } from '../../generated/schema' 3 | 4 | 5 | export function handlePredicateRegistered(event: PredicateRegistered): void { 6 | let id = 'predicate-registered-' + event.params.tokenType.toHexString() 7 | 8 | let entity = PredicateRegistration.load(id) 9 | if (entity == null) { 10 | entity = new PredicateRegistration(id) 11 | } 12 | 13 | entity.tokenType = event.params.tokenType 14 | entity.predicateAddress = event.params.predicateAddress 15 | entity.timestamp = event.block.timestamp 16 | entity.transactionHash = event.transaction.hash 17 | 18 | // save entity 19 | entity.save() 20 | } 21 | 22 | export function handlePOSTokenMapped(event: TokenMapped): void { 23 | let id = 'pos-token-mapping-' + event.params.rootToken.toHexString() 24 | 25 | let entity = TokenMapping.load(id) 26 | if (entity == null) { 27 | entity = new TokenMapping(id) 28 | } 29 | 30 | entity.rootToken = event.params.rootToken 31 | entity.childToken = event.params.childToken 32 | entity.tokenType = event.params.tokenType.toHex() 33 | entity.isPOS = true 34 | 35 | entity.timestamp = event.block.timestamp 36 | entity.transactionHash = event.transaction.hash 37 | 38 | // save entity 39 | entity.save() 40 | } 41 | -------------------------------------------------------------------------------- /root/src/mappings/staking-nft.ts: -------------------------------------------------------------------------------- 1 | import { Transfer } from '../../generated/StakingNft/StakingNft' 2 | import { StakingNFTTransfer, Validator } from '../../generated/schema' 3 | 4 | // To be invoked when staking NFT contracts Transfer event to be emitted 5 | // 6 | // Keeps unique entries by using `tokenId` i.e. NFT ID as GraphQL entity ID 7 | export function handleTransfer(event: Transfer): void { 8 | let id = 'staking-nft-transfer:' + event.params.tokenId.toString() 9 | 10 | // trying to load entity from store 11 | let entity = StakingNFTTransfer.load(id) 12 | if (entity == null) { 13 | // if not found in store, creating new instance for this NFT 14 | entity = new StakingNFTTransfer(id) 15 | entity.previousOwners = [] 16 | entity.transactionHashes = [] 17 | } 18 | 19 | entity.tokenId = event.params.tokenId 20 | entity.currentOwner = event.params.to 21 | 22 | let previousOwners = entity.previousOwners 23 | previousOwners.push(event.params.from) 24 | entity.previousOwners = previousOwners 25 | 26 | let transactionHashes = entity.transactionHashes 27 | transactionHashes.push(event.transaction.hash) 28 | entity.transactionHashes = transactionHashes 29 | // save entity 30 | entity.save() 31 | 32 | // Save new owner address to validator DB. 33 | let validatorId = 'validator:' + event.params.tokenId.toString() 34 | let validator = Validator.load(validatorId) 35 | if (validator) { 36 | validator.owner = event.params.to 37 | validator.save() 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /root/src/mappings/state-sync.ts: -------------------------------------------------------------------------------- 1 | import { Address } from '@graphprotocol/graph-ts' 2 | 3 | import { StateSynced, NewRegistration, RegistrationUpdated } from '../../generated/StateSender/StateSender' 4 | import { StateRegistration, StateSync } from '../../generated/schema' 5 | 6 | import { decoderForPoSPortalData } from '../network' 7 | import { Decoder } from '../../generated/StateSender/Decoder' 8 | 9 | export function handleStateSynced(event: StateSynced): void { 10 | let entity = new StateSync('statesync:' + event.params.id.toString()) 11 | entity.stateId = event.params.id 12 | entity.contract = event.params.contractAddress 13 | 14 | entity.transactionHash = event.transaction.hash 15 | entity.timestamp = event.block.timestamp 16 | entity.blockNumber = event.block.number 17 | entity.logIndex = event.logIndex.toString() 18 | entity.rawData = event.params.data.toHexString() 19 | 20 | // Attempting to create an instance of `Decoder` smart contract 21 | // to be used for decoding valid state sync data 22 | let decoder = Decoder.bind(Address.fromString(decoderForPoSPortalData)) 23 | // 👇 is being done because there's a possibly decoding might fail 24 | // if bad input is provided with 25 | let callResult = decoder.try_decodeStateSyncData(event.params.data) 26 | 27 | // this condition will be true if during decoding 28 | // decoder contract faces some issue 29 | // 30 | // consumer can safely ignore this state sync 31 | // if they see, `syncType` = -1, because it has 32 | // undecodable data 33 | // 34 | // but it interested client can always find out what data 35 | // is by reading `data` field, where it is encoded form 36 | if (callResult.reverted) { 37 | 38 | entity.syncType = -1 39 | entity.depositorOrRootToken = '0x' 40 | entity.depositedTokenOrChildToken = '0x' 41 | entity.data = event.params.data.toHexString() 42 | 43 | // save entity 44 | entity.save() 45 | 46 | return 47 | 48 | } 49 | 50 | // Attempting to read decoded data, so that 51 | // it can be stored in this entity 52 | let decoded = callResult.value 53 | 54 | entity.syncType = decoded.value0 55 | entity.depositorOrRootToken = decoded.value1.toHex() 56 | entity.depositedTokenOrChildToken = decoded.value2.toHex() 57 | entity.data = decoded.value3.toHexString() 58 | 59 | // save entity 60 | entity.save() 61 | } 62 | 63 | export function handleNewRegistration(event: NewRegistration): void { 64 | let id = 'registration:' + event.params.receiver.toHexString() 65 | 66 | let entity = StateRegistration.load(id) 67 | if (entity == null) { 68 | entity = new StateRegistration(id) 69 | } 70 | entity.receiver = event.params.receiver 71 | entity.sender = event.params.sender 72 | entity.user = event.params.user 73 | 74 | // save entity 75 | entity.save() 76 | } 77 | 78 | export function handleRegistrationUpdated(event: RegistrationUpdated): void { 79 | let id = 'registration:' + event.params.receiver.toHexString() 80 | 81 | let entity = StateRegistration.load(id) 82 | if (entity == null) { 83 | entity = new StateRegistration(id) 84 | } 85 | entity.receiver = event.params.receiver 86 | entity.sender = event.params.sender 87 | entity.user = event.params.user 88 | 89 | // save entity 90 | entity.save() 91 | } 92 | -------------------------------------------------------------------------------- /root/src/mappings/withdraw-manager.ts: -------------------------------------------------------------------------------- 1 | import { BigInt } from '@graphprotocol/graph-ts' 2 | import { ExitStarted, ExitCancelled, Withdraw } from '../../generated/WithdrawManager/WithdrawManager' 3 | import { PlasmaExit, GlobalPlasmaExitCounter } from '../../generated/schema' 4 | 5 | function getGlobalPlasmaExitCounter(): GlobalPlasmaExitCounter { 6 | // Only one entry will be kept in this entity 7 | let id = 'global-plasma-exit-counter' 8 | let entity = GlobalPlasmaExitCounter.load(id) 9 | if (entity == null) { 10 | 11 | entity = new GlobalPlasmaExitCounter(id) 12 | entity.current = BigInt.fromI32(0) 13 | 14 | } 15 | return entity as GlobalPlasmaExitCounter 16 | } 17 | 18 | export function handleExitStarted(event: ExitStarted): void { 19 | let id = 'plasma-exit-' + event.params.exitId.toHexString() 20 | 21 | // Try to get what's current global plasma counter's state 22 | // when called for very first time, it'll be `0` 23 | let counter = getGlobalPlasmaExitCounter() 24 | let updated = counter.current.plus(BigInt.fromI32(1)) 25 | 26 | // Updating global counter's state 27 | counter.current = updated 28 | counter.save() 29 | 30 | // this is first time this entity being created i.e. during plasma 31 | // exit start step 32 | let entity = new PlasmaExit(id) 33 | entity.counter = updated 34 | entity.exitId = event.params.exitId 35 | entity.exitInitiator = event.params.exitor 36 | entity.token = event.params.token 37 | entity.amount = event.params.amount 38 | entity.isRegularExit = event.params.isRegularExit 39 | // exit started state => 0 40 | entity.exited = 0 41 | entity.exitStartedTxHash = event.transaction.hash 42 | entity.exitStartedTimeStamp = event.block.timestamp 43 | 44 | // save entity 45 | entity.save() 46 | } 47 | 48 | export function handleExitCancelled(event: ExitCancelled): void { 49 | let id = 'plasma-exit-' + event.params.exitId.toHexString() 50 | 51 | let entity = PlasmaExit.load(id) 52 | if (entity == null) { 53 | entity = new PlasmaExit(id) 54 | 55 | entity.counter = BigInt.fromI32(0) 56 | entity.isRegularExit = true 57 | entity.exited = 1 58 | } 59 | 60 | entity.exitId = event.params.exitId 61 | 62 | // exit cancelled state => 1 63 | if (entity.exited < 1) { 64 | entity.exited = 1 65 | } 66 | 67 | entity.exitCancelledTxHash = event.transaction.hash 68 | entity.exitCancelledTimeStamp = event.block.timestamp 69 | 70 | entity.save() 71 | } 72 | 73 | 74 | export function handleWithdraw(event: Withdraw): void { 75 | let id = 'plasma-exit-' + event.params.exitId.toHexString() 76 | 77 | let entity = PlasmaExit.load(id) 78 | if (entity == null) { 79 | entity = new PlasmaExit(id) 80 | 81 | entity.counter = BigInt.fromI32(0) 82 | entity.isRegularExit = true 83 | entity.exited = 2 84 | } 85 | 86 | entity.token = event.params.token 87 | entity.amount = event.params.amount 88 | entity.exitId = event.params.exitId 89 | 90 | entity.exitCompleter = event.params.user 91 | // exit completed state => 2 92 | if(entity.exited < 2) { 93 | entity.exited = 2 94 | } 95 | 96 | entity.exitCompletedTxHash = event.transaction.hash 97 | entity.exitCompletedTimeStamp = event.block.timestamp 98 | 99 | entity.save() 100 | } 101 | -------------------------------------------------------------------------------- /root/src/network.template.ts: -------------------------------------------------------------------------------- 1 | export const network: string = '{{ network }}' 2 | export const stakingNftAddress: string = '{{ contracts.stakingNft.address }}' 3 | export const registryAddress: string = '{{ contracts.registry.address }}' 4 | export const decoderForPoSPortalData: string = '{{ contracts.decoderForPoSPortalData.address }}' 5 | -------------------------------------------------------------------------------- /root/subgraph.template.yaml: -------------------------------------------------------------------------------- 1 | specVersion: 0.0.4 2 | description: Indexes checkpoints and new deposits on root chain 3 | # features: 4 | # - grafting 5 | # graft: 6 | # base: {{ subgraphId }} 7 | # block: {{ graftingStartBlock }} 8 | repository: https://github.com/maticnetwork/subgraphs 9 | schema: 10 | file: ./schema.graphql 11 | dataSources: 12 | - kind: ethereum/contract 13 | name: Rootchain 14 | network: {{ network }} 15 | source: 16 | address: "{{contracts.rootChain.address}}" 17 | abi: Rootchain 18 | startBlock: {{ contracts.rootChain.startBlock }} 19 | mapping: 20 | kind: ethereum/events 21 | apiVersion: 0.0.5 22 | language: wasm/assemblyscript 23 | entities: 24 | - NewHeaderBlock 25 | abis: 26 | - name: Rootchain 27 | file: ./abis/Rootchain.json 28 | eventHandlers: 29 | - event: NewHeaderBlock(indexed address,indexed uint256,indexed uint256,uint256,uint256,bytes32) 30 | handler: handleNewHeaderBlock 31 | file: ./src/mappings/checkpoint.ts 32 | 33 | - kind: ethereum/contract 34 | name: TestToken 35 | network: {{ network }} 36 | source: 37 | address: "{{contracts.maticTokenContract.address}}" 38 | abi: TestToken 39 | startBlock: {{ contracts.maticTokenContract.startBlock }} 40 | mapping: 41 | kind: ethereum/events 42 | apiVersion: 0.0.5 43 | language: wasm/assemblyscript 44 | entities: 45 | - MaticTransfer 46 | abis: 47 | - name: TestToken 48 | file: ./abis/TestToken.json 49 | eventHandlers: 50 | - event: Transfer(indexed address,indexed address,uint256) 51 | handler: handleTransfer 52 | file: ./src/mappings/matic-transfer.ts 53 | 54 | - kind: ethereum/contract 55 | name: WithdrawManager 56 | network: {{ network }} 57 | source: 58 | address: "{{contracts.withdrawManager.address}}" 59 | abi: WithdrawManager 60 | startBlock: {{ contracts.withdrawManager.startBlock }} 61 | mapping: 62 | kind: ethereum/events 63 | apiVersion: 0.0.5 64 | language: wasm/assemblyscript 65 | entities: 66 | - ExitStarted 67 | - ExitCancelled 68 | - Withdraw 69 | abis: 70 | - name: WithdrawManager 71 | file: ./abis/WithdrawManager.json 72 | eventHandlers: 73 | - event: ExitStarted(indexed address,indexed uint256,indexed address,uint256,bool) 74 | handler: handleExitStarted 75 | - event: ExitCancelled(indexed uint256) 76 | handler: handleExitCancelled 77 | - event: Withdraw(indexed uint256,indexed address,indexed address,uint256) 78 | handler: handleWithdraw 79 | file: ./src/mappings/withdraw-manager.ts 80 | 81 | - kind: ethereum/contract 82 | name: RootChainManager 83 | network: {{ network }} 84 | source: 85 | address: "{{contracts.rootChainManager.address}}" 86 | abi: RootChainManager 87 | startBlock: {{ contracts.rootChainManager.startBlock }} 88 | mapping: 89 | kind: ethereum/events 90 | apiVersion: 0.0.5 91 | language: wasm/assemblyscript 92 | entities: 93 | - PredicateRegistered 94 | - TokenMapping 95 | abis: 96 | - name: RootChainManager 97 | file: ./abis/RootChainManager.json 98 | eventHandlers: 99 | - event: PredicateRegistered(indexed bytes32,indexed address) 100 | handler: handlePredicateRegistered 101 | - event: TokenMapped(indexed address,indexed address,indexed bytes32) 102 | handler: handlePOSTokenMapped 103 | file: ./src/mappings/rootchain-manager.ts 104 | 105 | - kind: ethereum/contract 106 | name: Registry 107 | network: {{ network }} 108 | source: 109 | address: "{{contracts.registry.address}}" 110 | abi: Registry 111 | startBlock: {{ contracts.registry.startBlock }} 112 | mapping: 113 | kind: ethereum/events 114 | apiVersion: 0.0.5 115 | language: wasm/assemblyscript 116 | entities: 117 | - TokenMapping 118 | abis: 119 | - name: Registry 120 | file: ./abis/Registry.json 121 | eventHandlers: 122 | - event: TokenMapped(indexed address,indexed address) 123 | handler: handlePlasmaTokenMapped 124 | file: ./src/mappings/registry.ts 125 | 126 | - kind: ethereum/contract 127 | name: StateSender 128 | network: {{ network }} 129 | source: 130 | address: "{{contracts.stateSender.address}}" 131 | abi: StateSender 132 | startBlock: {{ contracts.stateSender.startBlock }} 133 | mapping: 134 | kind: ethereum/events 135 | apiVersion: 0.0.5 136 | language: wasm/assemblyscript 137 | entities: 138 | - StateSync 139 | - StateRegistration 140 | abis: 141 | - name: StateSender 142 | file: ./abis/StateSender.json 143 | - name: Decoder 144 | file: ./abis/Decoder.json 145 | eventHandlers: 146 | - event: StateSynced(indexed uint256,indexed address,bytes) 147 | handler: handleStateSynced 148 | - event: NewRegistration(indexed address,indexed address,indexed address) 149 | handler: handleNewRegistration 150 | - event: RegistrationUpdated(indexed address,indexed address,indexed address) 151 | handler: handleRegistrationUpdated 152 | file: ./src/mappings/state-sync.ts 153 | 154 | - kind: ethereum/contract 155 | name: StakingInfo 156 | network: {{ network }} 157 | source: 158 | address: "{{contracts.stakingInfo.address}}" 159 | abi: StakingInfo 160 | startBlock: {{ contracts.stakingInfo.startBlock }} 161 | mapping: 162 | kind: ethereum/events 163 | apiVersion: 0.0.5 164 | language: wasm/assemblyscript 165 | entities: 166 | - Validator 167 | - Delegator 168 | - StakingParams 169 | - Topup 170 | abis: 171 | - name: StakingInfo 172 | file: ./abis/StakingInfo.json 173 | - name: StakingNft 174 | file: ./abis/StakingNft.json 175 | eventHandlers: 176 | - event: ClaimFee(indexed address,indexed uint256) 177 | handler: handleClaimFee 178 | - event: ClaimRewards(indexed uint256,indexed uint256,indexed uint256) 179 | handler: handleClaimRewards 180 | - event: DelegatorClaimedRewards(indexed uint256,indexed address,indexed uint256) 181 | handler: handleDelegatorClaimedRewards 182 | # - event: DelegatorRestaked(indexed uint256,indexed address,indexed uint256) 183 | # handler: handleDelegatorRestaked 184 | - event: DelegatorUnstaked(indexed uint256,indexed address,uint256) 185 | handler: handleDelegatorUnstaked 186 | - event: DynastyValueChange(uint256,uint256) 187 | handler: handleDynastyValueChange 188 | - event: Jailed(indexed uint256,indexed uint256,indexed address) 189 | handler: handleJailed 190 | - event: OwnershipTransferred(indexed address,indexed address) 191 | handler: handleOwnershipTransferred 192 | - event: ProposerBonusChange(uint256,uint256) 193 | handler: handleProposerBonusChange 194 | - event: Restaked(indexed uint256,uint256,uint256) 195 | handler: handleRestaked 196 | # - event: RewardUpdate(uint256,uint256) 197 | - event: ShareBurned(indexed uint256,indexed address,indexed uint256,uint256) 198 | handler: handleShareBurned 199 | - event: ShareMinted(indexed uint256,indexed address,indexed uint256,uint256) 200 | handler: handleShareMinted 201 | - event: SignerChange(indexed uint256,uint256,indexed address,indexed address,bytes) 202 | handler: handleSignerChange 203 | # - event: Slashed(indexed uint256,indexed uint256) 204 | - event: StakeUpdate(indexed uint256,indexed uint256,indexed uint256) 205 | handler: handleStakeUpdate 206 | - event: Staked(indexed address,indexed uint256,uint256,indexed uint256,uint256,uint256,bytes) 207 | handler: handleStaked 208 | - event: ThresholdChange(uint256,uint256) 209 | handler: handleThresholdChange 210 | - event: TopUpFee(indexed address,indexed uint256) 211 | handler: handleTopUpFee 212 | - event: UnJailed(indexed uint256,indexed address) 213 | handler: handleUnJailed 214 | - event: UnstakeInit(indexed address,indexed uint256,uint256,uint256,indexed uint256) 215 | handler: handleUnstakeInit 216 | - event: Unstaked(indexed address,indexed uint256,uint256,uint256) 217 | handler: handleUnstaked 218 | - event: UpdateCommissionRate(indexed uint256,indexed uint256,indexed uint256) 219 | handler: handleUpdateCommissionRate 220 | - event: StartAuction(indexed uint256,indexed uint256,indexed uint256) 221 | handler: handleStartAuction 222 | - event: ConfirmAuction(indexed uint256,indexed uint256,indexed uint256) 223 | handler: handleConfirmAuction 224 | file: ./src/mappings/staking-info.ts 225 | 226 | - kind: ethereum/contract 227 | name: StakingNft 228 | network: {{ network }} 229 | source: 230 | address: "{{contracts.stakingNft.address}}" 231 | abi: StakingNft 232 | startBlock: {{ contracts.stakingNft.startBlock }} 233 | mapping: 234 | kind: ethereum/events 235 | apiVersion: 0.0.5 236 | language: wasm/assemblyscript 237 | entities: 238 | - StakingNFTTransfer 239 | - Validator 240 | abis: 241 | - name: StakingNft 242 | file: ./abis/StakingNft.json 243 | eventHandlers: 244 | - event: Transfer(indexed address,indexed address,indexed uint256) 245 | handler: handleTransfer 246 | file: ./src/mappings/staking-nft.ts 247 | 248 | - kind: ethereum/contract 249 | name: EventsHub 250 | network: {{ network }} 251 | source: 252 | address: "{{contracts.eventsHub.address}}" 253 | abi: EventsHub 254 | startBlock: {{ contracts.eventsHub.startBlock }} 255 | mapping: 256 | kind: ethereum/events 257 | apiVersion: 0.0.5 258 | language: wasm/assemblyscript 259 | entities: 260 | - Validator 261 | - Delegator 262 | abis: 263 | - name: EventsHub 264 | file: ./abis/EventsHub.json 265 | eventHandlers: 266 | - event: DelegatorUnstakeWithId(indexed uint256,indexed address,uint256,uint256) 267 | handler: handleDelegatorUnstakeWithId 268 | - event: ShareBurnedWithId(indexed uint256,indexed address,indexed uint256,uint256,uint256) 269 | handler: handleShareBurnedWithId 270 | - event: UpdateCommissionRate(indexed uint256,indexed uint256,indexed uint256) 271 | handler: handleUpdateCommissionRate 272 | - event: SharesTransfer(indexed uint256,indexed address,indexed address,uint256) 273 | handler: handleSharesTransfer 274 | file: ./src/mappings/staking-info.ts 275 | 276 | - kind: ethereum/contract 277 | name: FxERC20Events 278 | network: {{ network }} 279 | source: 280 | abi: FxERC20RootTunnel 281 | startBlock: {{ contracts.fxERC20RootTunnel.startBlock }} 282 | mapping: 283 | kind: ethereum/events 284 | apiVersion: 0.0.5 285 | language: wasm/assemblyscript 286 | entities: 287 | - FxTokenMapping 288 | - FxDeposit 289 | - FxWithdraw 290 | abis: 291 | - name: FxERC20RootTunnel 292 | file: ./abis/FxErc20RootTunnel.json 293 | eventHandlers: 294 | - event: TokenMappedERC20(indexed address,indexed address) 295 | handler: handleTokenMappedERC20 296 | - event: FxDepositERC20(indexed address,indexed address,indexed address,uint256) 297 | handler: handleFxDepositERC20 298 | - event: FxWithdrawERC20(indexed address,indexed address,indexed address,uint256) 299 | handler: handleFxWithdrawERC20 300 | file: ./src/mappings/fx-erc20.ts 301 | 302 | - kind: ethereum/contract 303 | name: FxERC721Events 304 | network: {{ network }} 305 | source: 306 | abi: FxERC721RootTunnel 307 | startBlock: {{ contracts.fxERC721RootTunnel.startBlock }} 308 | mapping: 309 | kind: ethereum/events 310 | apiVersion: 0.0.5 311 | language: wasm/assemblyscript 312 | entities: 313 | - FxTokenMapping 314 | - FxDeposit 315 | - FxWithdraw 316 | abis: 317 | - name: FxERC721RootTunnel 318 | file: ./abis/FxErc721RootTunnel.json 319 | eventHandlers: 320 | - event: TokenMappedERC721(indexed address,indexed address) 321 | handler: handleTokenMappedERC721 322 | - event: FxDepositERC721(indexed address,indexed address,indexed address,uint256) 323 | handler: handleFxDepositERC721 324 | - event: FxWithdrawERC721(indexed address,indexed address,indexed address,uint256) 325 | handler: handleFxWithdrawERC721 326 | file: ./src/mappings/fx-erc721.ts 327 | 328 | - kind: ethereum/contract 329 | name: FxERC1155Events 330 | network: {{ network }} 331 | source: 332 | abi: FxERC1155RootTunnel 333 | startBlock: {{ contracts.fxERC1155RootTunnel.startBlock }} 334 | mapping: 335 | kind: ethereum/events 336 | apiVersion: 0.0.5 337 | language: wasm/assemblyscript 338 | entities: 339 | - FxTokenMapping 340 | - FxDeposit 341 | - FxWithdraw 342 | abis: 343 | - name: FxERC1155RootTunnel 344 | file: ./abis/FxErc1155RootTunnel.json 345 | eventHandlers: 346 | - event: TokenMappedERC1155(indexed address,indexed address) 347 | handler: handleTokenMappedERC1155 348 | - event: FxDepositERC1155(indexed address,indexed address,indexed address,uint256,uint256) 349 | handler: handleFxDepositERC1155 350 | - event: FxWithdrawERC1155(indexed address,indexed address,indexed address,uint256,uint256) 351 | handler: handleFxWithdrawERC1155 352 | file: ./src/mappings/fx-erc1155.ts 353 | -------------------------------------------------------------------------------- /root/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extend": "./node_modules/@graphprotocol/graph-ts/tsconfig.json", 3 | "compilerOptions": { 4 | "types": ["@graphprotocol/graph-ts"] 5 | } 6 | } 7 | --------------------------------------------------------------------------------