This is another component
3 | 4 | -------------------------------------------------------------------------------- /echidna.config.ci.yml: -------------------------------------------------------------------------------- 1 | #maximum time between generated txs; default is one week 2 | maxTimeDelay: 31556952 # approximately 1 year 3 | -------------------------------------------------------------------------------- /.env_template: -------------------------------------------------------------------------------- 1 | CHILD_ENDPOINT=http://127.0.0.1:8545 2 | ROOT_ENDPOINT 3 | PK= 4 | ETHERSCAN_API_KEY=sjdkkdndnkdssnj 5 | POLYGONSCAN_API_KEY= -------------------------------------------------------------------------------- /docs/themes/markdown/contract.hbs: -------------------------------------------------------------------------------- 1 | {{>common}} 2 | 3 | {{#each items}} 4 | {{#hsection}} 5 | {{>item}} 6 | {{/hsection}} 7 | 8 | {{/each}} 9 | -------------------------------------------------------------------------------- /scripts/pack.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | if [[ ! -d "build/build" ]]; then 3 | echo "build folder not found" 4 | fi 5 | cd build/build 6 | npm pack 7 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | [*] 2 | indent_size = 4 3 | indent_style = space 4 | 5 | [tsconfig*.json] 6 | indent_size = 2 7 | 8 | [*.yaml] 9 | indent_size = 2 10 | -------------------------------------------------------------------------------- /audits/SubQuery_Pte_Ltd_16022022SCAudit_Report.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/subquery/network-contracts/HEAD/audits/SubQuery_Pte_Ltd_16022022SCAudit_Report.pdf -------------------------------------------------------------------------------- /audits/[SubQuery PTE. LTD. 14.06.2022] SC_Audit_Report.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/subquery/network-contracts/HEAD/audits/[SubQuery PTE. LTD. 14.06.2022] SC_Audit_Report.pdf -------------------------------------------------------------------------------- /audits/SlowMist Audit Report - subquery-network-contracts.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/subquery/network-contracts/HEAD/audits/SlowMist Audit Report - subquery-network-contracts.pdf -------------------------------------------------------------------------------- /docs/themes/markdown/enum.hbs: -------------------------------------------------------------------------------- 1 | {{>common}} 2 | 3 | ```solidity 4 | enum {{name}} { 5 | {{#each members}} 6 | {{name}}{{#unless @last}},{{/unless}} 7 | {{/each}} 8 | } 9 | ``` 10 | -------------------------------------------------------------------------------- /docs/.vuepress/styles/index.styl: -------------------------------------------------------------------------------- 1 | /** 2 | * Custom Styles here. 3 | * 4 | * ref:https://v1.vuepress.vuejs.org/config/#index-styl 5 | */ 6 | 7 | .home .hero img 8 | max-width 450px!important 9 | -------------------------------------------------------------------------------- /docs/config/README.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar: auto 3 | --- 4 | 5 | # Config 6 | 7 | ## foo 8 | 9 | - Type: `string` 10 | - Default: `/` 11 | 12 | ## bar 13 | 14 | - Type: `string` 15 | - Default: `/` 16 | -------------------------------------------------------------------------------- /docs/themes/markdown/struct.hbs: -------------------------------------------------------------------------------- 1 | {{>common}} 2 | 3 | ```solidity 4 | struct {{name}} { 5 | {{#each members}} 6 | {{{typeName.typeDescriptions.typeString}}} {{name}}; 7 | {{/each}} 8 | } 9 | ``` 10 | -------------------------------------------------------------------------------- /contracts/external/ProxyAdmin.sol: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2020-2024 SubQuery Pte Ltd authors & contributors 2 | // SPDX-License-Identifier: GPL-3.0-or-later 3 | 4 | pragma solidity 0.8.15; 5 | 6 | import '@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol'; 7 | -------------------------------------------------------------------------------- /docs/.vuepress/styles/palette.styl: -------------------------------------------------------------------------------- 1 | /** 2 | * Custom palette here. 3 | * 4 | * ref:https://v1.vuepress.vuejs.org/zh/config/#palette-styl 5 | */ 6 | 7 | $accentColor = #3eaf7c 8 | $textColor = #2c3e50 9 | $borderColor = #eaecef 10 | $codeBgColor = #282c34 11 | -------------------------------------------------------------------------------- /publish/vesting.json: -------------------------------------------------------------------------------- 1 | { 2 | "testnet": [ 3 | "0x4D1d1d932388E5d3015BEf071FC994A370892DEb", 4 | "0xA7b88D860cE66D2849782F0fD1413E0b1D6089f0", 5 | "0x901694bF30c351E233dE64661c52812C3913F028" 6 | ], 7 | "kepler": [], 8 | "mainnet": [] 9 | } 10 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2020-2024 SubQuery Pte Ltd authors & contributors 2 | // SPDX-License-Identifier: GPL-3.0-or-later 3 | 4 | export * from './sdk'; 5 | export * from './rootSdk'; 6 | export * from './typechain'; 7 | export * from './types'; 8 | export * from './networks'; 9 | -------------------------------------------------------------------------------- /docs/.vuepress/components/Foo/Bar.vue: -------------------------------------------------------------------------------- 1 | 2 |3 | {{ msg }} 4 |
5 | 6 | 7 | 16 | -------------------------------------------------------------------------------- /contracts/interfaces/IDisputeManager.sol: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2020-2024 SubQuery Pte Ltd authors & contributors 2 | // SPDX-License-Identifier: GPL-3.0-or-later 3 | 4 | pragma solidity 0.8.15; 5 | 6 | interface IDisputeManager { 7 | function isOnDispute(address indexer) external returns (bool); 8 | } 9 | -------------------------------------------------------------------------------- /contracts/root/IInflationDestination.sol: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2020-2024 SubQuery Pte Ltd authors & contributors 2 | // SPDX-License-Identifier: GPL-3.0-or-later 3 | 4 | pragma solidity 0.8.15; 5 | 6 | interface IInflationDestination { 7 | function afterReceiveInflatedTokens(uint256 tokenAmount) external; 8 | } 9 | -------------------------------------------------------------------------------- /docs/.vuepress/components/demo-component.vue: -------------------------------------------------------------------------------- 1 | 2 |3 | {{ msg }} 4 |
5 | 6 | 7 | 16 | -------------------------------------------------------------------------------- /test/fixtures/plan.yaml: -------------------------------------------------------------------------------- 1 | - kind: PlanTemplate 2 | period: 1209600 3 | dailyReqCap: 2000000 4 | rateLimit: 250 5 | metadata: 6 | planName: Startup RPC Plan 7 | period: 14 days 8 | description: Ideal for small or growing teams looking to explore and build without significant upfront costs. 9 | -------------------------------------------------------------------------------- /.solhint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "solhint:recommended", 3 | "rules": { 4 | "compiler-version": ["error", "^0.8.0"], 5 | "func-visibility": ["warn", { "ignoreConstructors": true }], 6 | "reason-string": ["warn", { "maxLength": 80 }], 7 | "quotes": false 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /contracts/interfaces/IPermissionedExchange.sol: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2020-2024 SubQuery Pte Ltd authors & contributors 2 | // SPDX-License-Identifier: GPL-3.0-or-later 3 | 4 | pragma solidity 0.8.15; 5 | 6 | interface IPermissionedExchange { 7 | function addQuota(address _token, address _account, uint256 _amount) external; 8 | } 9 | -------------------------------------------------------------------------------- /.yarnrc.yml: -------------------------------------------------------------------------------- 1 | changesetBaseRefs: 2 | - main 3 | - origin/main 4 | 5 | enableImmutableInstalls: false 6 | 7 | enableProgressBars: false 8 | 9 | nodeLinker: node-modules 10 | 11 | npmAuthToken: "${NPM_TOKEN:-}" 12 | 13 | npmPublishRegistry: "https://registry.npmjs.org" 14 | 15 | yarnPath: .yarn/releases/yarn-4.10.3.cjs 16 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "subql-contracts" 3 | version = "0.100.0" 4 | edition = "2021" 5 | include = ["/rust", "/publish"] 6 | 7 | [lib] 8 | path = "rust/lib.rs" 9 | 10 | [dependencies] 11 | ethers = { git = "https://github.com/gakonst/ethers-rs.git", tag = "ethers-v2.0.7" } 12 | paste = "1.0" 13 | serde_json = "1.0" 14 | -------------------------------------------------------------------------------- /contracts/utils/SQParameter.sol: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2020-2024 SubQuery Pte Ltd authors & contributors 2 | // SPDX-License-Identifier: GPL-3.0-or-later 3 | 4 | pragma solidity ^0.8.15; 5 | 6 | abstract contract SQParameter { 7 | /// @notice Emitted when parameter change. 8 | event Parameter(string name, bytes value); 9 | } 10 | -------------------------------------------------------------------------------- /contracts/mocks/MockInflationDestination2.sol: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2020-2024 SubQuery Pte Ltd authors & contributors 2 | // SPDX-License-Identifier: GPL-3.0-or-later 3 | pragma solidity 0.8.15; 4 | 5 | import { IInflationDestination } from '../root/IInflationDestination.sol'; 6 | 7 | contract MockInflationDestination2 { 8 | constructor() {} 9 | } 10 | -------------------------------------------------------------------------------- /contracts/interfaces/IVesting.sol: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2020-2024 SubQuery Pte Ltd authors & contributors 2 | // SPDX-License-Identifier: GPL-3.0-or-later 3 | 4 | pragma solidity ^0.8.15; 5 | 6 | interface IVesting { 7 | function allocations(address _account) external view returns (uint256); 8 | 9 | function claimed(address _account) external view returns (uint256); 10 | } 11 | -------------------------------------------------------------------------------- /contracts/interfaces/IConsumerRegistry.sol: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2020-2024 SubQuery Pte Ltd authors & contributors 2 | // SPDX-License-Identifier: GPL-3.0-or-later 3 | 4 | pragma solidity ^0.8.15; 5 | 6 | interface IConsumerRegistry { 7 | // check the consumer's controller account 8 | function isController(address consumer, address controller) external view returns (bool); 9 | } 10 | -------------------------------------------------------------------------------- /scripts/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | mkdir -p build/build/publish 6 | cp -r src/* build/ 7 | cp -r publish build/ 8 | 9 | cp -r artifacts build/ 10 | cp package.json build/build/ 11 | cp tsconfig-build.json build/tsconfig.json 12 | 13 | cd build || exit 14 | 15 | tsc -b 16 | 17 | sed -i -e '/"prepare"/d' build/package.json 18 | 19 | cp publish/*.json build/publish/ -------------------------------------------------------------------------------- /contracts/l2/L2SQToken.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.15; 3 | 4 | import { L2StandardERC20 } from '@eth-optimism/contracts/standards/L2StandardERC20.sol'; 5 | 6 | contract L2SQToken is L2StandardERC20 { 7 | constructor( 8 | address _l2Bridge, 9 | address _l1Token 10 | ) L2StandardERC20(_l2Bridge, _l1Token, 'SubQueryToken', 'SQT') {} 11 | } 12 | -------------------------------------------------------------------------------- /tsconfig-build.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "declaration": true, 4 | "esModuleInterop": true, 5 | "lib": ["ES2018"], 6 | "module": "CommonJS", 7 | "moduleResolution": "node", 8 | "outDir": "build", 9 | "resolveJsonModule": true, 10 | "skipLibCheck": true, 11 | "strict": true, 12 | "target": "ES2018" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /contracts/interfaces/ISQToken.sol: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2020-2024 SubQuery Pte Ltd authors & contributors 2 | // SPDX-License-Identifier: GPL-3.0-or-later 3 | 4 | pragma solidity 0.8.15; 5 | 6 | interface ISQToken { 7 | function mint(address destination, uint256 amount) external; 8 | 9 | function burn(uint256 amount) external; 10 | 11 | function burnFrom(address account, uint256 amount) external; 12 | } 13 | -------------------------------------------------------------------------------- /contracts/Constants.sol: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2020-2024 SubQuery Pte Ltd authors & contributors 2 | // SPDX-License-Identifier: GPL-3.0-or-later 3 | 4 | pragma solidity 0.8.15; 5 | 6 | uint256 constant PER_MILL = 1e6; 7 | uint256 constant PER_BILL = 1e9; 8 | uint256 constant PER_TRILL = 1e12; 9 | address constant ZERO_ADDRESS = address(0); 10 | uint256 constant MAX_UINT256 = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff; 11 | -------------------------------------------------------------------------------- /docs/.vuepress/enhanceApp.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Client app enhancement file. 3 | * 4 | * https://v1.vuepress.vuejs.org/guide/basic-config.html#app-level-enhancements 5 | */ 6 | 7 | export default ({ 8 | Vue, // the version of Vue being used in the VuePress app 9 | options, // the options for the root Vue instance 10 | router, // the router instance for the app 11 | siteData // site metadata 12 | }) => { 13 | // ...apply enhancements for the site. 14 | } 15 | -------------------------------------------------------------------------------- /scripts/dataEncoder.ts: -------------------------------------------------------------------------------- 1 | import { ContractSDK } from '../src'; 2 | import setup from './setup'; 3 | 4 | const main = async () => { 5 | const proxy = process.argv[2]; 6 | const newLogic = process.argv[3]; 7 | const { wallet } = await setup(['', '', '--testnet']); 8 | const sdk = await ContractSDK.create(wallet); 9 | const data = sdk.proxyAdmin.interface.encodeFunctionData('upgrade', [proxy, newLogic]); 10 | console.log(data); 11 | }; 12 | 13 | main(); 14 | -------------------------------------------------------------------------------- /contracts/interfaces/IPriceOracle.sol: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2020-2024 SubQuery Pte Ltd authors & contributors 2 | // SPDX-License-Identifier: GPL-3.0-or-later 3 | 4 | pragma solidity 0.8.15; 5 | 6 | interface IPriceOracle { 7 | function getAssetPrice(address fromToken, address toToken) external view returns (uint256); 8 | function convertPrice( 9 | address fromToken, 10 | address toToken, 11 | uint256 amount 12 | ) external view returns (uint256); 13 | } 14 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 120, 3 | "trailingComma": "es5", 4 | "tabWidth": 4, 5 | "singleQuote": true, 6 | "bracketSpacing": true, 7 | "overrides": [ 8 | { 9 | "files": "*.sol", 10 | "options": { 11 | "printWidth": 100, 12 | "tabWidth": 4, 13 | "useTabs": false, 14 | "singleQuote": true, 15 | "bracketSpacing": true 16 | } 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /src/deployments.ts: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2020-2024 SubQuery Pte Ltd authors & contributors 2 | // SPDX-License-Identifier: GPL-3.0-or-later 3 | 4 | import { ContractDeployment, SubqueryNetwork } from './types'; 5 | 6 | import mainnetDeployment from './publish/mainnet.json'; 7 | import testnetDeployment from './publish/testnet.json'; 8 | 9 | export const DEPLOYMENT_DETAILS: Partial