├── .github └── workflows │ └── build.yml ├── .gitignore ├── .gitmodules ├── .prettierrc.json ├── AUTHORS ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── package.json ├── packages ├── contracts │ ├── .gitignore │ ├── .prettierignore │ ├── .prettierrc.json │ ├── .solhint.json │ ├── cannonfile.toml │ ├── contracts │ │ ├── Bitmask.sol │ │ ├── CartesiMathV2.sol │ │ ├── MerkleV2.sol │ │ ├── UnrolledCordic.sol │ │ └── test │ │ │ ├── TestBitmask.sol │ │ │ ├── TestCartesiMath.sol │ │ │ └── TestMerkle.sol │ ├── deploy │ │ ├── 01_libs.ts │ │ └── 02_logarithms.ts │ ├── deployments │ │ ├── arbitrum │ │ │ ├── .chainId │ │ │ ├── Bitmask.json │ │ │ ├── CartesiMathV2.json │ │ │ ├── MerkleV2.json │ │ │ └── UnrolledCordic.json │ │ ├── arbitrum_goerli │ │ │ ├── .chainId │ │ │ ├── Bitmask.json │ │ │ ├── CartesiMathV2.json │ │ │ ├── MerkleV2.json │ │ │ └── UnrolledCordic.json │ │ ├── arbitrum_sepolia │ │ │ ├── .chainId │ │ │ ├── Bitmask.json │ │ │ ├── CartesiMathV2.json │ │ │ ├── MerkleV2.json │ │ │ └── UnrolledCordic.json │ │ ├── avalanche │ │ │ ├── .chainId │ │ │ ├── Bitmask.json │ │ │ ├── CartesiMathV2.json │ │ │ ├── MerkleV2.json │ │ │ └── UnrolledCordic.json │ │ ├── avalanche_fuji │ │ │ ├── .chainId │ │ │ ├── Bitmask.json │ │ │ ├── CartesiMathV2.json │ │ │ ├── MerkleV2.json │ │ │ └── UnrolledCordic.json │ │ ├── base │ │ │ ├── .chainId │ │ │ ├── Bitmask.json │ │ │ ├── CartesiMathV2.json │ │ │ ├── MerkleV2.json │ │ │ └── UnrolledCordic.json │ │ ├── base_sepolia │ │ │ ├── .chainId │ │ │ ├── Bitmask.json │ │ │ ├── CartesiMathV2.json │ │ │ ├── MerkleV2.json │ │ │ └── UnrolledCordic.json │ │ ├── bsc │ │ │ ├── .chainId │ │ │ ├── Bitmask.json │ │ │ ├── CartesiMathV2.json │ │ │ ├── MerkleV2.json │ │ │ └── UnrolledCordic.json │ │ ├── bsc_testnet │ │ │ ├── .chainId │ │ │ ├── Bitmask.json │ │ │ ├── CartesiMathV2.json │ │ │ ├── MerkleV2.json │ │ │ └── UnrolledCordic.json │ │ ├── celo │ │ │ ├── .chainId │ │ │ ├── Bitmask.json │ │ │ ├── CartesiMathV2.json │ │ │ ├── MerkleV2.json │ │ │ └── UnrolledCordic.json │ │ ├── celo_testnet │ │ │ ├── .chainId │ │ │ ├── Bitmask.json │ │ │ ├── CartesiMathV2.json │ │ │ ├── MerkleV2.json │ │ │ └── UnrolledCordic.json │ │ ├── chiado │ │ │ ├── .chainId │ │ │ ├── Bitmask.json │ │ │ ├── CartesiMathV2.json │ │ │ ├── MerkleV2.json │ │ │ └── UnrolledCordic.json │ │ ├── fantom │ │ │ ├── .chainId │ │ │ ├── Bitmask.json │ │ │ ├── CartesiMathV2.json │ │ │ ├── MerkleV2.json │ │ │ └── UnrolledCordic.json │ │ ├── fantom_testnet │ │ │ ├── .chainId │ │ │ ├── Bitmask.json │ │ │ ├── CartesiMathV2.json │ │ │ ├── MerkleV2.json │ │ │ └── UnrolledCordic.json │ │ ├── gnosis │ │ │ ├── .chainId │ │ │ ├── Bitmask.json │ │ │ ├── CartesiMathV2.json │ │ │ ├── MerkleV2.json │ │ │ └── UnrolledCordic.json │ │ ├── goerli │ │ │ ├── .chainId │ │ │ ├── Bitmask.json │ │ │ ├── CartesiMathV2.json │ │ │ ├── MerkleV2.json │ │ │ └── UnrolledCordic.json │ │ ├── iotex │ │ │ ├── .chainId │ │ │ ├── Bitmask.json │ │ │ ├── CartesiMathV2.json │ │ │ ├── MerkleV2.json │ │ │ └── UnrolledCordic.json │ │ ├── iotex_testnet │ │ │ ├── .chainId │ │ │ ├── Bitmask.json │ │ │ ├── CartesiMathV2.json │ │ │ ├── MerkleV2.json │ │ │ └── UnrolledCordic.json │ │ ├── mainnet │ │ │ ├── .chainId │ │ │ ├── Bitmask.json │ │ │ ├── CartesiMathV2.json │ │ │ ├── MerkleV2.json │ │ │ └── UnrolledCordic.json │ │ ├── metis │ │ │ ├── .chainId │ │ │ ├── Bitmask.json │ │ │ ├── CartesiMathV2.json │ │ │ ├── MerkleV2.json │ │ │ └── UnrolledCordic.json │ │ ├── metis_goerli │ │ │ ├── .chainId │ │ │ ├── Bitmask.json │ │ │ ├── CartesiMathV2.json │ │ │ ├── MerkleV2.json │ │ │ └── UnrolledCordic.json │ │ ├── optimism │ │ │ ├── .chainId │ │ │ ├── Bitmask.json │ │ │ ├── CartesiMathV2.json │ │ │ ├── MerkleV2.json │ │ │ └── UnrolledCordic.json │ │ ├── optimism_goerli │ │ │ ├── .chainId │ │ │ ├── Bitmask.json │ │ │ ├── CartesiMathV2.json │ │ │ ├── MerkleV2.json │ │ │ └── UnrolledCordic.json │ │ ├── optimism_sepolia │ │ │ ├── .chainId │ │ │ ├── Bitmask.json │ │ │ ├── CartesiMathV2.json │ │ │ ├── MerkleV2.json │ │ │ └── UnrolledCordic.json │ │ ├── polygon │ │ │ ├── .chainId │ │ │ ├── Bitmask.json │ │ │ ├── CartesiMathV2.json │ │ │ ├── MerkleV2.json │ │ │ └── UnrolledCordic.json │ │ ├── polygon_mumbai │ │ │ ├── .chainId │ │ │ ├── Bitmask.json │ │ │ ├── CartesiMathV2.json │ │ │ ├── MerkleV2.json │ │ │ └── UnrolledCordic.json │ │ └── sepolia │ │ │ ├── .chainId │ │ │ ├── Bitmask.json │ │ │ ├── CartesiMathV2.json │ │ │ ├── MerkleV2.json │ │ │ └── UnrolledCordic.json │ ├── export │ │ ├── abi │ │ │ ├── arbitrum.json │ │ │ ├── arbitrum_goerli.json │ │ │ ├── arbitrum_sepolia.json │ │ │ ├── avalanche.json │ │ │ ├── avalanche_fuji.json │ │ │ ├── base.json │ │ │ ├── base_sepolia.json │ │ │ ├── bsc.json │ │ │ ├── bsc_testnet.json │ │ │ ├── celo.json │ │ │ ├── celo_testnet.json │ │ │ ├── chiado.json │ │ │ ├── fantom.json │ │ │ ├── fantom_testnet.json │ │ │ ├── gnosis.json │ │ │ ├── goerli.json │ │ │ ├── iotex.json │ │ │ ├── iotex_testnet.json │ │ │ ├── mainnet.json │ │ │ ├── metis.json │ │ │ ├── metis_goerli.json │ │ │ ├── optimism.json │ │ │ ├── optimism_goerli.json │ │ │ ├── optimism_sepolia.json │ │ │ ├── polygon.json │ │ │ ├── polygon_mumbai.json │ │ │ └── sepolia.json │ │ └── artifacts │ │ │ └── contracts │ │ │ ├── Bitmask.sol │ │ │ └── Bitmask.json │ │ │ ├── CartesiMathV2.sol │ │ │ └── CartesiMathV2.json │ │ │ ├── MerkleV2.sol │ │ │ └── MerkleV2.json │ │ │ ├── UnrolledCordic.sol │ │ │ └── UnrolledCordic.json │ │ │ └── test │ │ │ ├── TestBitmask.sol │ │ │ └── TestBitmask.json │ │ │ ├── TestCartesiMath.sol │ │ │ └── TestCartesiMath.json │ │ │ └── TestMerkle.sol │ │ │ └── TestMerkle.json │ ├── foundry.toml │ ├── hardhat.config.ts │ ├── package.json │ ├── src │ │ └── util │ │ │ └── merkle.ts │ ├── test │ │ ├── TestBitmask.ts │ │ ├── TestCartesiMath.ts │ │ ├── TestLogarithm.ts │ │ ├── TestMerkle.ts │ │ └── ground-truth.json │ └── tsconfig.json ├── ethers-v5 │ ├── .gitignore │ ├── .prettierignore │ ├── package.json │ └── tsconfig.json ├── ethers-v6 │ ├── .gitignore │ ├── .prettierignore │ ├── package.json │ └── tsconfig.json ├── tsconfig │ ├── README.md │ ├── base.json │ └── package.json └── wagmi │ ├── .gitignore │ ├── .prettierignore │ ├── package.json │ ├── tsconfig.json │ └── wagmi.config.ts ├── pnpm-lock.yaml ├── pnpm-workspace.yaml └── turbo.json /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | on: [push, pull_request] 3 | jobs: 4 | build: 5 | runs-on: ubuntu-22.04 6 | steps: 7 | - uses: actions/checkout@v4 8 | with: 9 | submodules: recursive 10 | token: ${{ secrets.CI_TOKEN }} 11 | - uses: actions/setup-node@v4 12 | with: 13 | node-version: "20" 14 | - uses: pnpm/action-setup@v3 15 | with: 16 | version: 8 17 | - run: pnpm install 18 | - run: pnpm run prettier 19 | working-directory: packages/contracts 20 | - run: pnpm run prepack 21 | working-directory: packages/contracts 22 | - run: pnpm run test:coverage 23 | working-directory: packages/contracts 24 | - name: Coveralls 25 | uses: coverallsapp/github-action@master 26 | with: 27 | github-token: ${{ secrets.GITHUB_TOKEN }} 28 | path-to-lcov: ./packages/contracts/coverage/lcov.info 29 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .turbo 3 | .vscode 4 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cartesi/solidity-util/6c6c60c8cbcaaa5430cb751ac9cfd4cde2395dab/.gitmodules -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "tabWidth": 4, 3 | "overrides": [ 4 | { 5 | "files": "*.sol", 6 | "options": { 7 | "printWidth": 120 8 | } 9 | } 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cartesi/solidity-util/6c6c60c8cbcaaa5430cb751ac9cfd4cde2395dab/AUTHORS -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | - Using welcoming and inclusive language 18 | - Being respectful of differing viewpoints and experiences 19 | - Gracefully accepting constructive criticism 20 | - Focusing on what is best for the community 21 | - Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | - The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | - Trolling, insulting/derogatory comments, and personal or political attacks 28 | - Public or private harassment 29 | - Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | - Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at info@cartesi.io. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to Cartesi 2 | 3 | Thank you for your interest in Cartesi! We highly appreciate even the smallest of fixes or additions to our project. 4 | 5 | Make sure to review our [Contributing License Agreement](https://forms.gle/k3E9ZNkZY6Vy3mkK9), 6 | sign and send it to info@cartesi.io with the title of "CLA Signed" before taking part in the project. We are happy to automate 7 | this for you via DocuSign upon request in the Google Form as well. 8 | 9 | ## Basic Contributing Guidelines 10 | 11 | We use the same guidelines for contributing code to any of our repositories, any developers wanting to contribute to Cartesi must create pull requests. This process is described in the [GitHub documentation](https://help.github.com/en/articles/creating-a-pull-request). Each pull request should be started against the master branch in the respective Cartesi repository. After a pull request is submitted the Cartesi team will review the submission and give feedback via the comments section of the pull request. After the submission is reviewed and approved, it will be merged into the master branch of the source. 12 | 13 | Please note the below! We appreciate everyone following the guidelines. 14 | 15 | - No --force pushes or modifying the Git history in any way; 16 | - Use non-master branches, using a short meaningful description, with words separated by dash (e.g. 'fix-this-bug'); 17 | - All modifications must be made in a pull-request to solicit feedback from other contributors. 18 | 19 | ## Authors 20 | 21 | Any contributor who has in the past had at least one pull request for a code change accepted in that repo may submit a pull request to have their name added to the AUTHORS file. 22 | Submissions to the AUTHORS file should be in the format below: 23 | 24 | ``` 25 | Name 26 | ``` 27 | 28 | Inclusion in the AUTHORS file for each repo is entirely voluntary. 29 | It is up to each individual author to decide whether they would like attribution in a given AUTHORS file and to submit a pull request accordingly. 30 | Please note that a contributor's decision on whether to seek attribution in an AUTHORS file will have no impact on copyright ownership. 31 | 32 | ## Get in Touch 33 | 34 | When contributing in a deeper manner to this repository, please first discuss the change you wish to make via our 35 | [Discord channel here](https://discord.gg/cartesi), or contact us at info@cartesi.io email before working on the change. 36 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # solidity-util 2 | 3 | Basic solidity contracts and solidity libraries used the Cartesi on-chain code. 4 | 5 | Packaged as npm and published at https://www.npmjs.com/package/@cartesi/util 6 | 7 | The npm package contains `hardhat` deployment artifacts with information of deployed contracts on the following networks: 8 | 9 | - Arbitrum 10 | - Arbitrum Goerli 11 | - Arbitrum Sepolia 12 | - Avalanche 13 | - Avalanche Fuji 14 | - BNB Smart Chain 15 | - BNB Smart Chain Testnet 16 | - Celo 17 | - Celo Alfajores 18 | - Gnosis Chiado 19 | - Fantom 20 | - Fantom Testnet 21 | - Gnosis 22 | - Goerli 23 | - IoTex 24 | - IoTex Testnet 25 | - Mainnet 26 | - Metis 27 | - Metis Goerli 28 | - Optimism 29 | - Optimism Goerli 30 | - Optimism Sepolia 31 | - Polygon 32 | - Polygon Mumbai 33 | - Sepolia 34 | 35 | Deployment was done using deterministic deployment with the [Safe Singleton Factory](https://github.com/safe-global/safe-singleton-factory) (with the exceptions of IoTex Testnet and Gnosis Chiado). 36 | 37 | ## Getting Started 38 | 39 | To use this package in another project you must include as a dependency in `package.json`. 40 | 41 | "dependencies": { 42 | "@cartesi/util": "" 43 | }, 44 | 45 | And in your solidity contract import it as: 46 | 47 | import "@cartesi/util/contracts/MerkleV2.sol"; 48 | 49 | ## Build 50 | 51 | To get a list of all available `pnpm` targets run the following inside `packages/contracts`: 52 | 53 | % pnpm run info 54 | 55 | ## Contributing 56 | 57 | Thank you for your interest in Cartesi! Head over to our [Contributing Guidelines](CONTRIBUTING.md) for instructions on how to sign our Contributors Agreement and get started with Cartesi! 58 | 59 | Please note we have a [Code of Conduct](CODE_OF_CONDUCT.md), please follow it in all your interactions with the project. 60 | 61 | ## License 62 | 63 | The solidity-util repository and all contributions are licensed under 64 | [APACHE 2.0](https://www.apache.org/licenses/LICENSE-2.0). Please review our [LICENSE](LICENSE) file. 65 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@cartesi/solidity-util-monorepo", 3 | "version": "0.0.0", 4 | "private": true, 5 | "workspaces": [ 6 | "packages/*" 7 | ], 8 | "scripts": { 9 | "build": "turbo run build", 10 | "dev": "turbo run dev --parallel", 11 | "lint": "turbo run lint", 12 | "format": "prettier --write \"**/*.{ts,tsx,md}\"" 13 | }, 14 | "devDependencies": { 15 | "prettier": "^3", 16 | "turbo": "^1" 17 | }, 18 | "engines": { 19 | "node": ">=14.0.0" 20 | }, 21 | "dependencies": {}, 22 | "packageManager": "pnpm@8.15.6" 23 | } 24 | -------------------------------------------------------------------------------- /packages/contracts/.gitignore: -------------------------------------------------------------------------------- 1 | /artifacts 2 | bin 3 | cache 4 | coverage* 5 | **/solcInputs 6 | deployments/localhost 7 | dist 8 | node_modules 9 | src/proto/stateserver* 10 | src/types 11 | test/*/ 12 | .mnemonic 13 | .vscode 14 | .node* 15 | *.bin 16 | *.abi 17 | /out 18 | /forge-cache 19 | -------------------------------------------------------------------------------- /packages/contracts/.prettierignore: -------------------------------------------------------------------------------- 1 | src/types 2 | -------------------------------------------------------------------------------- /packages/contracts/.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "tabWidth": 4, 3 | "plugins": ["prettier-plugin-solidity"], 4 | "overrides": [ 5 | { 6 | "files": "*.sol", 7 | "options": { 8 | "printWidth": 120 9 | } 10 | } 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /packages/contracts/.solhint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "solhint:default", 3 | "plugins": ["prettier"], 4 | "rules": { 5 | "max-line-length": ["warn", 120] 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/contracts/cannonfile.toml: -------------------------------------------------------------------------------- 1 | name = "cartesi-util" 2 | version = "6.4.0" 3 | description = "Cartesi Smart Contract Utilities" 4 | 5 | [deploy.Bitmask] 6 | artifact = "Bitmask" 7 | create2 = "0xE1CB04A0fA36DdD16a06ea828007E35e1a3cBC37" 8 | salt = "0x0000000000000000000000000000000000000000000000000000000000000000" 9 | ifExists = "continue" 10 | 11 | [deploy.CartesiMathV2] 12 | artifact = "CartesiMathV2" 13 | create2 = "0xE1CB04A0fA36DdD16a06ea828007E35e1a3cBC37" 14 | salt = "0x0000000000000000000000000000000000000000000000000000000000000000" 15 | ifExists = "continue" 16 | 17 | [deploy.MerkleV2] 18 | artifact = "MerkleV2" 19 | create2 = "0xE1CB04A0fA36DdD16a06ea828007E35e1a3cBC37" 20 | salt = "0x0000000000000000000000000000000000000000000000000000000000000000" 21 | libraries = { CartesiMathV2 = "<%= contracts.CartesiMathV2.address %>" } 22 | ifExists = "continue" 23 | 24 | [deploy.UnrolledCordic] 25 | artifact = "UnrolledCordic" 26 | create2 = "0xE1CB04A0fA36DdD16a06ea828007E35e1a3cBC37" 27 | salt = "0x0000000000000000000000000000000000000000000000000000000000000000" 28 | ifExists = "continue" 29 | -------------------------------------------------------------------------------- /packages/contracts/contracts/Bitmask.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use 3 | // this file except in compliance with the License. You may obtain a copy of the 4 | // License at http://www.apache.org/licenses/LICENSE-2.0 5 | 6 | // Unless required by applicable law or agreed to in writing, software distributed 7 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 8 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | // specific language governing permissions and limitations under the License. 10 | 11 | pragma solidity ^0.8.0; 12 | 13 | /// @title Bit Mask Library 14 | /// @author Stephen Chen 15 | /// @notice Implements bit mask with dynamic array 16 | library Bitmask { 17 | /// @notice Set a bit in the bit mask 18 | function setBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit, bool _value) public { 19 | // calculate the number of bits has been store in bitmask now 20 | uint256 positionOfMask = uint256(_bit / 256); 21 | uint256 positionOfBit = _bit % 256; 22 | 23 | if (_value) { 24 | bitmask[positionOfMask] = bitmask[positionOfMask] | (1 << positionOfBit); 25 | } else { 26 | bitmask[positionOfMask] = bitmask[positionOfMask] & ~(1 << positionOfBit); 27 | } 28 | } 29 | 30 | /// @notice Get a bit in the bit mask 31 | function getBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit) public view returns (bool) { 32 | // calculate the number of bits has been store in bitmask now 33 | uint256 positionOfMask = uint256(_bit / 256); 34 | uint256 positionOfBit = _bit % 256; 35 | 36 | return ((bitmask[positionOfMask] & (1 << positionOfBit)) != 0); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /packages/contracts/contracts/CartesiMathV2.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use 3 | // this file except in compliance with the License. You may obtain a copy of the 4 | // License at http://www.apache.org/licenses/LICENSE-2.0 5 | 6 | // Unless required by applicable law or agreed to in writing, software distributed 7 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 8 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | // specific language governing permissions and limitations under the License. 10 | 11 | /// @title CartesiMath 12 | /// @author Felipe Argento 13 | pragma solidity ^0.8.0; 14 | 15 | library CartesiMathV2 { 16 | // mapping values are packed as bytes3 each 17 | // see test/TestCartesiMath.ts for decimal values 18 | bytes constant log2tableTimes1M = 19 | hex"0000000F4240182F421E8480236E082771822AD63A2DC6C0305E8532B04834C96736B3C23876D73A187A3B9D4A3D09003E5EA63FA0C540D17741F28843057D440BA745062945F60246DC1047B917488DC7495ABA4A207C4ADF8A4B98544C4B404CF8AA4DA0E64E44434EE3054F7D6D5013B750A61A5134C851BFF05247BD52CC58534DE753CC8D54486954C19C55384255AC75561E50568DE956FB575766B057D00758376F589CFA5900BA5962BC59C3135A21CA5A7EF15ADA945B34BF5B8D805BE4DF5C3AEA5C8FA95CE3265D356C5D86835DD6735E25455E73005EBFAD5F0B525F55F75F9FA25FE85A60302460770860BD0A61023061467F6189FD61CCAE620E98624FBF62902762CFD5630ECD634D12638AA963C7966403DC643F7F647A8264B4E864EEB56527EC6560906598A365D029660724663D9766738566A8F066DDDA6712476746386779AF67ACAF67DF3A6811526842FA68743268A4FC68D55C6905536934E169640A6992CF69C13169EF326A1CD46A4A186A76FF6AA38C6ACFC0"; 20 | 21 | /// @notice Approximates log2 * 1M 22 | /// @param _num number to take log2 * 1M of 23 | /// @return approximate log2 times 1M 24 | function log2ApproxTimes1M(uint256 _num) public pure returns (uint256) { 25 | require(_num > 0, "Number cannot be zero"); 26 | uint256 leading = 0; 27 | 28 | if (_num == 1) return 0; 29 | 30 | while (_num > 128) { 31 | _num = _num >> 1; 32 | leading += 1; 33 | } 34 | return (leading * uint256(1000000)) + (getLog2TableTimes1M(_num)); 35 | } 36 | 37 | /// @notice navigates log2tableTimes1M 38 | /// @param _num number to take log2 of 39 | /// @return result after table look-up 40 | function getLog2TableTimes1M(uint256 _num) public pure returns (uint256) { 41 | bytes3 result = 0; 42 | for (uint8 i = 0; i < 3; i++) { 43 | bytes3 tempResult = log2tableTimes1M[(_num - 1) * 3 + i]; 44 | result = result | (tempResult >> (i * 8)); 45 | } 46 | 47 | return uint256(uint24(result)); 48 | } 49 | 50 | /// @notice get floor of log2 of number 51 | /// @param _num number to take floor(log2) of 52 | /// @return floor(log2) of _num 53 | function getLog2Floor(uint256 _num) public pure returns (uint8) { 54 | require(_num != 0, "log of zero is undefined"); 55 | 56 | return uint8(255 - clz(_num)); 57 | } 58 | 59 | /// @notice checks if a number is Power of 2 60 | /// @param _num number to check 61 | /// @return true if number is power of 2, false if not 62 | function isPowerOf2(uint256 _num) public pure returns (bool) { 63 | if (_num == 0) return false; 64 | 65 | return _num & (_num - 1) == 0; 66 | } 67 | 68 | /// @notice count trailing zeros 69 | /// @param _num number you want the ctz of 70 | /// @dev this a binary search implementation 71 | function ctz(uint256 _num) public pure returns (uint256) { 72 | if (_num == 0) return 256; 73 | 74 | uint256 n = 0; 75 | if (_num & 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF == 0) { 76 | n = n + 128; 77 | _num = _num >> 128; 78 | } 79 | if (_num & 0x000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFF == 0) { 80 | n = n + 64; 81 | _num = _num >> 64; 82 | } 83 | if (_num & 0x00000000000000000000000000000000000000000000000000000000FFFFFFFF == 0) { 84 | n = n + 32; 85 | _num = _num >> 32; 86 | } 87 | if (_num & 0x000000000000000000000000000000000000000000000000000000000000FFFF == 0) { 88 | n = n + 16; 89 | _num = _num >> 16; 90 | } 91 | if (_num & 0x00000000000000000000000000000000000000000000000000000000000000FF == 0) { 92 | n = n + 8; 93 | _num = _num >> 8; 94 | } 95 | if (_num & 0x000000000000000000000000000000000000000000000000000000000000000F == 0) { 96 | n = n + 4; 97 | _num = _num >> 4; 98 | } 99 | if (_num & 0x0000000000000000000000000000000000000000000000000000000000000003 == 0) { 100 | n = n + 2; 101 | _num = _num >> 2; 102 | } 103 | if (_num & 0x0000000000000000000000000000000000000000000000000000000000000001 == 0) { 104 | n = n + 1; 105 | } 106 | 107 | return n; 108 | } 109 | 110 | /// @notice count leading zeros 111 | /// @param _num number you want the clz of 112 | /// @dev this a binary search implementation 113 | function clz(uint256 _num) public pure returns (uint256) { 114 | if (_num == 0) return 256; 115 | 116 | uint256 n = 0; 117 | if (_num & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000 == 0) { 118 | n = n + 128; 119 | _num = _num << 128; 120 | } 121 | if (_num & 0xFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000000 == 0) { 122 | n = n + 64; 123 | _num = _num << 64; 124 | } 125 | if (_num & 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 == 0) { 126 | n = n + 32; 127 | _num = _num << 32; 128 | } 129 | if (_num & 0xFFFF000000000000000000000000000000000000000000000000000000000000 == 0) { 130 | n = n + 16; 131 | _num = _num << 16; 132 | } 133 | if (_num & 0xFF00000000000000000000000000000000000000000000000000000000000000 == 0) { 134 | n = n + 8; 135 | _num = _num << 8; 136 | } 137 | if (_num & 0xF000000000000000000000000000000000000000000000000000000000000000 == 0) { 138 | n = n + 4; 139 | _num = _num << 4; 140 | } 141 | if (_num & 0xC000000000000000000000000000000000000000000000000000000000000000 == 0) { 142 | n = n + 2; 143 | _num = _num << 2; 144 | } 145 | if (_num & 0x8000000000000000000000000000000000000000000000000000000000000000 == 0) { 146 | n = n + 1; 147 | } 148 | 149 | return n; 150 | } 151 | } 152 | -------------------------------------------------------------------------------- /packages/contracts/contracts/test/TestBitmask.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use 3 | // this file except in compliance with the License. You may obtain a copy of the 4 | // License at http://www.apache.org/licenses/LICENSE-2.0 5 | 6 | // Unless required by applicable law or agreed to in writing, software distributed 7 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 8 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | // specific language governing permissions and limitations under the License. 10 | 11 | /// @title Test Bitmask 12 | pragma solidity ^0.8.0; 13 | 14 | import "../Bitmask.sol"; 15 | 16 | contract TestBitmask { 17 | using Bitmask for mapping(uint256 => uint256); 18 | 19 | mapping(uint256 => uint256) internal bitmask; 20 | 21 | function setBit(uint256 _bit) public { 22 | bitmask.setBit(_bit, true); 23 | } 24 | 25 | function unsetBit(uint256 _bit) public { 26 | bitmask.setBit(_bit, false); 27 | } 28 | 29 | function getBit(uint256 _bit) public view returns (bool) { 30 | return bitmask.getBit(_bit); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /packages/contracts/contracts/test/TestCartesiMath.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use 3 | // this file except in compliance with the License. You may obtain a copy of the 4 | // License at http://www.apache.org/licenses/LICENSE-2.0 5 | 6 | // Unless required by applicable law or agreed to in writing, software distributed 7 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 8 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | // specific language governing permissions and limitations under the License. 10 | 11 | /// @title Test CartesiMath 12 | pragma solidity ^0.8.0; 13 | 14 | import "../CartesiMathV2.sol"; 15 | 16 | contract TestCartesiMath { 17 | function getLog2TableTimes1M(uint256 _num) public pure returns (uint256) { 18 | return CartesiMathV2.getLog2TableTimes1M(_num); 19 | } 20 | 21 | function ctz(uint256 _num) public pure returns (uint256) { 22 | return CartesiMathV2.ctz(_num); 23 | } 24 | 25 | function clz(uint256 _num) public pure returns (uint256) { 26 | return CartesiMathV2.clz(_num); 27 | } 28 | 29 | function getLog2Floor(uint256 _num) public pure returns (uint256) { 30 | return CartesiMathV2.getLog2Floor(_num); 31 | } 32 | 33 | function isPowerOf2(uint256 _num) public pure returns (bool) { 34 | return CartesiMathV2.isPowerOf2(_num); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /packages/contracts/contracts/test/TestMerkle.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use 3 | // this file except in compliance with the License. You may obtain a copy of the 4 | // License at http://www.apache.org/licenses/LICENSE-2.0 5 | 6 | // Unless required by applicable law or agreed to in writing, software distributed 7 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 8 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | // specific language governing permissions and limitations under the License. 10 | 11 | /// @title Test Merkle 12 | pragma solidity ^0.8.0; 13 | 14 | import "../MerkleV2.sol"; 15 | 16 | contract TestMerkle { 17 | function getRootAfterReplacementInDrive( 18 | uint256 _position, 19 | uint256 _logSizeOfReplacement, 20 | uint256 _logSizeOfFullDrive, 21 | bytes32 _replacement, 22 | bytes32[] memory siblings 23 | ) public pure returns (bytes32) { 24 | return 25 | MerkleV2.getRootAfterReplacementInDrive( 26 | _position, 27 | _logSizeOfReplacement, 28 | _logSizeOfFullDrive, 29 | _replacement, 30 | siblings 31 | ); 32 | } 33 | 34 | function getEmptyTreeHashAtIndex(uint256 _index) public pure returns (bytes32) { 35 | return MerkleV2.getEmptyTreeHashAtIndex(_index); 36 | } 37 | 38 | function getMerkleRootFromBytes(bytes calldata _data, uint256 _log2Size) public pure returns (bytes32) { 39 | return MerkleV2.getMerkleRootFromBytes(_data, _log2Size); 40 | } 41 | 42 | function getHashOfWordAtIndex(bytes calldata _data, uint256 _wordIndex) public pure returns (bytes32) { 43 | return MerkleV2.getHashOfWordAtIndex(_data, _wordIndex); 44 | } 45 | 46 | function calculateRootFromPowerOfTwo(bytes32[] memory hashes) public pure returns (bytes32) { 47 | return MerkleV2.calculateRootFromPowerOfTwo(hashes); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /packages/contracts/deploy/01_libs.ts: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy 3 | // of the license at http://www.apache.org/licenses/LICENSE-2.0 4 | 5 | // Unless required by applicable law or agreed to in writing, software 6 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 7 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 8 | // License for the specific language governing permissions and limitations 9 | // under the License. 10 | 11 | import { HardhatRuntimeEnvironment } from "hardhat/types"; 12 | import { DeployFunction, DeployOptions } from "hardhat-deploy/types"; 13 | 14 | const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => { 15 | const { deployments, getNamedAccounts, network } = hre; 16 | const { deploy } = deployments; 17 | const { deployer } = await getNamedAccounts(); 18 | 19 | // IoTeX doesn't have support yet, see https://github.com/safe-global/safe-singleton-factory/issues/199 20 | // Chiado is not working, see https://github.com/safe-global/safe-singleton-factory/issues/201 21 | const nonDeterministicNetworks = ["iotex_testnet", "chiado"]; 22 | const deterministicDeployment = !nonDeterministicNetworks.includes( 23 | network.name, 24 | ); 25 | 26 | const opts: DeployOptions = { 27 | deterministicDeployment, 28 | from: deployer, 29 | log: true, 30 | }; 31 | 32 | await deploy("Bitmask", opts); 33 | 34 | const CartesiMathV2 = await deploy("CartesiMathV2", opts); 35 | await deploy("MerkleV2", { 36 | ...opts, 37 | libraries: { CartesiMathV2: CartesiMathV2.address }, 38 | }); 39 | }; 40 | 41 | func.tags = ["Libs"]; 42 | export default func; 43 | -------------------------------------------------------------------------------- /packages/contracts/deploy/02_logarithms.ts: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy 3 | // of the license at http://www.apache.org/licenses/LICENSE-2.0 4 | 5 | // Unless required by applicable law or agreed to in writing, software 6 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 7 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 8 | // License for the specific language governing permissions and limitations 9 | // under the License. 10 | 11 | import { HardhatRuntimeEnvironment } from "hardhat/types"; 12 | import { DeployFunction, DeployOptions } from "hardhat-deploy/types"; 13 | 14 | const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => { 15 | const { deployments, getNamedAccounts, network } = hre; 16 | const { deploy } = deployments; 17 | const { deployer } = await getNamedAccounts(); 18 | 19 | // IoTeX doesn't have support yet, see https://github.com/safe-global/safe-singleton-factory/issues/199 20 | // Chiado is not working, see https://github.com/safe-global/safe-singleton-factory/issues/201 21 | const nonDeterministicNetworks = ["iotex_testnet", "chiado"]; 22 | const deterministicDeployment = !nonDeterministicNetworks.includes( 23 | network.name, 24 | ); 25 | 26 | const opts: DeployOptions = { 27 | deterministicDeployment, 28 | from: deployer, 29 | log: true, 30 | }; 31 | 32 | await deploy("UnrolledCordic", opts); 33 | }; 34 | 35 | func.tags = ["Logarithms"]; 36 | export default func; 37 | -------------------------------------------------------------------------------- /packages/contracts/deployments/arbitrum/.chainId: -------------------------------------------------------------------------------- 1 | 42161 -------------------------------------------------------------------------------- /packages/contracts/deployments/arbitrum/Bitmask.json: -------------------------------------------------------------------------------- 1 | { 2 | "address": "0xF5B2d8c81cDE4D6238bBf20D3D77DB37df13f735", 3 | "abi": [], 4 | "transactionHash": "0x4674deafb3df58a6fed6936bd5930c8b843ca9140d5fb591e2580b69f0e89f1d", 5 | "receipt": { 6 | "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", 7 | "from": "0x0e28A8f88C6266dF0FE274c15c1d4b27f8B373C0", 8 | "contractAddress": null, 9 | "transactionIndex": 1, 10 | "gasUsed": "3702526", 11 | "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 12 | "blockHash": "0x69b869ce302300042d86a15bd10ba838b07fe99ed185ccbc4771dbc472327786", 13 | "transactionHash": "0x4674deafb3df58a6fed6936bd5930c8b843ca9140d5fb591e2580b69f0e89f1d", 14 | "logs": [], 15 | "blockNumber": 114520435, 16 | "cumulativeGasUsed": "3702526", 17 | "status": 1, 18 | "byzantium": true 19 | }, 20 | "args": [], 21 | "numDeployments": 2, 22 | "solcInputHash": "18c7b3fb984a9ee861b83d1058d152f0", 23 | "metadata": "{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"author\":\"Stephen Chen\",\"kind\":\"dev\",\"methods\":{},\"title\":\"Bit Mask Library\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"getBit(mapping(uint256 => uint256) storage,uint256)\":{\"notice\":\"Get a bit in the bit mask\"},\"setBit(mapping(uint256 => uint256) storage,uint256,bool)\":{\"notice\":\"Set a bit in the bit mask\"}},\"notice\":\"Implements bit mask with dynamic array\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/Bitmask.sol\":\"Bitmask\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/Bitmask.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\"); you may not use\\n// this file except in compliance with the License. You may obtain a copy of the\\n// License at http://www.apache.org/licenses/LICENSE-2.0\\n\\n// Unless required by applicable law or agreed to in writing, software distributed\\n// under the License is distributed on an \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR\\n// CONDITIONS OF ANY KIND, either express or implied. See the License for the\\n// specific language governing permissions and limitations under the License.\\n\\npragma solidity ^0.8.0;\\n\\n/// @title Bit Mask Library\\n/// @author Stephen Chen\\n/// @notice Implements bit mask with dynamic array\\nlibrary Bitmask {\\n /// @notice Set a bit in the bit mask\\n function setBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit, bool _value) public {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n if (_value) {\\n bitmask[positionOfMask] = bitmask[positionOfMask] | (1 << positionOfBit);\\n } else {\\n bitmask[positionOfMask] = bitmask[positionOfMask] & ~(1 << positionOfBit);\\n }\\n }\\n\\n /// @notice Get a bit in the bit mask\\n function getBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit) public view returns (bool) {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n return ((bitmask[positionOfMask] & (1 << positionOfBit)) != 0);\\n }\\n}\\n\",\"keccak256\":\"0x606a3967f7444ce1dc07726e6c5cdcf48360000817c65b631e6ebd8fb96f6e1d\",\"license\":\"Apache-2.0\"}},\"version\":1}", 24 | "bytecode": "0x61020461003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 25 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 26 | "devdoc": { 27 | "author": "Stephen Chen", 28 | "kind": "dev", 29 | "methods": {}, 30 | "title": "Bit Mask Library", 31 | "version": 1 32 | }, 33 | "userdoc": { 34 | "kind": "user", 35 | "methods": { 36 | "getBit(mapping(uint256 => uint256) storage,uint256)": { 37 | "notice": "Get a bit in the bit mask" 38 | }, 39 | "setBit(mapping(uint256 => uint256) storage,uint256,bool)": { 40 | "notice": "Set a bit in the bit mask" 41 | } 42 | }, 43 | "notice": "Implements bit mask with dynamic array", 44 | "version": 1 45 | }, 46 | "storageLayout": { 47 | "storage": [], 48 | "types": null 49 | } 50 | } -------------------------------------------------------------------------------- /packages/contracts/deployments/arbitrum_goerli/.chainId: -------------------------------------------------------------------------------- 1 | 421613 -------------------------------------------------------------------------------- /packages/contracts/deployments/arbitrum_goerli/Bitmask.json: -------------------------------------------------------------------------------- 1 | { 2 | "address": "0xF5B2d8c81cDE4D6238bBf20D3D77DB37df13f735", 3 | "abi": [], 4 | "transactionHash": "0x40f2095d32e7f3430a1b61a921ce2c2678679660e212218d26b97c97a976a818", 5 | "receipt": { 6 | "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", 7 | "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", 8 | "contractAddress": null, 9 | "transactionIndex": 1, 10 | "gasUsed": "203927", 11 | "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 12 | "blockHash": "0x8dc38dd22024d161b89f9c9dc178cc50aa7e2f7ac2ec8d0721f735d2b6a1bce0", 13 | "transactionHash": "0x40f2095d32e7f3430a1b61a921ce2c2678679660e212218d26b97c97a976a818", 14 | "logs": [], 15 | "blockNumber": 31614952, 16 | "cumulativeGasUsed": "203927", 17 | "status": 1, 18 | "byzantium": true 19 | }, 20 | "args": [], 21 | "numDeployments": 3, 22 | "solcInputHash": "18c7b3fb984a9ee861b83d1058d152f0", 23 | "metadata": "{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"author\":\"Stephen Chen\",\"kind\":\"dev\",\"methods\":{},\"title\":\"Bit Mask Library\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"getBit(mapping(uint256 => uint256) storage,uint256)\":{\"notice\":\"Get a bit in the bit mask\"},\"setBit(mapping(uint256 => uint256) storage,uint256,bool)\":{\"notice\":\"Set a bit in the bit mask\"}},\"notice\":\"Implements bit mask with dynamic array\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/Bitmask.sol\":\"Bitmask\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/Bitmask.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\"); you may not use\\n// this file except in compliance with the License. You may obtain a copy of the\\n// License at http://www.apache.org/licenses/LICENSE-2.0\\n\\n// Unless required by applicable law or agreed to in writing, software distributed\\n// under the License is distributed on an \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR\\n// CONDITIONS OF ANY KIND, either express or implied. See the License for the\\n// specific language governing permissions and limitations under the License.\\n\\npragma solidity ^0.8.0;\\n\\n/// @title Bit Mask Library\\n/// @author Stephen Chen\\n/// @notice Implements bit mask with dynamic array\\nlibrary Bitmask {\\n /// @notice Set a bit in the bit mask\\n function setBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit, bool _value) public {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n if (_value) {\\n bitmask[positionOfMask] = bitmask[positionOfMask] | (1 << positionOfBit);\\n } else {\\n bitmask[positionOfMask] = bitmask[positionOfMask] & ~(1 << positionOfBit);\\n }\\n }\\n\\n /// @notice Get a bit in the bit mask\\n function getBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit) public view returns (bool) {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n return ((bitmask[positionOfMask] & (1 << positionOfBit)) != 0);\\n }\\n}\\n\",\"keccak256\":\"0x606a3967f7444ce1dc07726e6c5cdcf48360000817c65b631e6ebd8fb96f6e1d\",\"license\":\"Apache-2.0\"}},\"version\":1}", 24 | "bytecode": "0x61020461003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 25 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 26 | "devdoc": { 27 | "author": "Stephen Chen", 28 | "kind": "dev", 29 | "methods": {}, 30 | "title": "Bit Mask Library", 31 | "version": 1 32 | }, 33 | "userdoc": { 34 | "kind": "user", 35 | "methods": { 36 | "getBit(mapping(uint256 => uint256) storage,uint256)": { 37 | "notice": "Get a bit in the bit mask" 38 | }, 39 | "setBit(mapping(uint256 => uint256) storage,uint256,bool)": { 40 | "notice": "Set a bit in the bit mask" 41 | } 42 | }, 43 | "notice": "Implements bit mask with dynamic array", 44 | "version": 1 45 | }, 46 | "storageLayout": { 47 | "storage": [], 48 | "types": null 49 | } 50 | } -------------------------------------------------------------------------------- /packages/contracts/deployments/arbitrum_sepolia/.chainId: -------------------------------------------------------------------------------- 1 | 421614 -------------------------------------------------------------------------------- /packages/contracts/deployments/arbitrum_sepolia/Bitmask.json: -------------------------------------------------------------------------------- 1 | { 2 | "address": "0xF5B2d8c81cDE4D6238bBf20D3D77DB37df13f735", 3 | "abi": [], 4 | "transactionHash": "0x612c8fb2ec12ee3e8e37d44a0fa997d0a7d5ed9fce56b9405cc5bf36a437eb46", 5 | "receipt": { 6 | "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", 7 | "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", 8 | "contractAddress": null, 9 | "transactionIndex": 1, 10 | "gasUsed": "165171", 11 | "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 12 | "blockHash": "0xce7bab95c82fd3f2cdd53a4379f2c3c20ec4ca81471c18c1b6ae98c4e4d1e9a1", 13 | "transactionHash": "0x612c8fb2ec12ee3e8e37d44a0fa997d0a7d5ed9fce56b9405cc5bf36a437eb46", 14 | "logs": [], 15 | "blockNumber": 2833688, 16 | "cumulativeGasUsed": "165171", 17 | "status": 1, 18 | "byzantium": true 19 | }, 20 | "args": [], 21 | "numDeployments": 1, 22 | "solcInputHash": "18c7b3fb984a9ee861b83d1058d152f0", 23 | "metadata": "{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"author\":\"Stephen Chen\",\"kind\":\"dev\",\"methods\":{},\"title\":\"Bit Mask Library\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"getBit(mapping(uint256 => uint256) storage,uint256)\":{\"notice\":\"Get a bit in the bit mask\"},\"setBit(mapping(uint256 => uint256) storage,uint256,bool)\":{\"notice\":\"Set a bit in the bit mask\"}},\"notice\":\"Implements bit mask with dynamic array\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/Bitmask.sol\":\"Bitmask\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/Bitmask.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\"); you may not use\\n// this file except in compliance with the License. You may obtain a copy of the\\n// License at http://www.apache.org/licenses/LICENSE-2.0\\n\\n// Unless required by applicable law or agreed to in writing, software distributed\\n// under the License is distributed on an \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR\\n// CONDITIONS OF ANY KIND, either express or implied. See the License for the\\n// specific language governing permissions and limitations under the License.\\n\\npragma solidity ^0.8.0;\\n\\n/// @title Bit Mask Library\\n/// @author Stephen Chen\\n/// @notice Implements bit mask with dynamic array\\nlibrary Bitmask {\\n /// @notice Set a bit in the bit mask\\n function setBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit, bool _value) public {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n if (_value) {\\n bitmask[positionOfMask] = bitmask[positionOfMask] | (1 << positionOfBit);\\n } else {\\n bitmask[positionOfMask] = bitmask[positionOfMask] & ~(1 << positionOfBit);\\n }\\n }\\n\\n /// @notice Get a bit in the bit mask\\n function getBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit) public view returns (bool) {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n return ((bitmask[positionOfMask] & (1 << positionOfBit)) != 0);\\n }\\n}\\n\",\"keccak256\":\"0x606a3967f7444ce1dc07726e6c5cdcf48360000817c65b631e6ebd8fb96f6e1d\",\"license\":\"Apache-2.0\"}},\"version\":1}", 24 | "bytecode": "0x61020461003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 25 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 26 | "devdoc": { 27 | "author": "Stephen Chen", 28 | "kind": "dev", 29 | "methods": {}, 30 | "title": "Bit Mask Library", 31 | "version": 1 32 | }, 33 | "userdoc": { 34 | "kind": "user", 35 | "methods": { 36 | "getBit(mapping(uint256 => uint256) storage,uint256)": { 37 | "notice": "Get a bit in the bit mask" 38 | }, 39 | "setBit(mapping(uint256 => uint256) storage,uint256,bool)": { 40 | "notice": "Set a bit in the bit mask" 41 | } 42 | }, 43 | "notice": "Implements bit mask with dynamic array", 44 | "version": 1 45 | }, 46 | "storageLayout": { 47 | "storage": [], 48 | "types": null 49 | } 50 | } -------------------------------------------------------------------------------- /packages/contracts/deployments/avalanche/.chainId: -------------------------------------------------------------------------------- 1 | 43114 -------------------------------------------------------------------------------- /packages/contracts/deployments/avalanche/Bitmask.json: -------------------------------------------------------------------------------- 1 | { 2 | "address": "0xF5B2d8c81cDE4D6238bBf20D3D77DB37df13f735", 3 | "abi": [], 4 | "transactionHash": "0x00497a6f7983beef310a048adf7077a9b2fbdb5103e6762146956088a09be963", 5 | "receipt": { 6 | "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", 7 | "from": "0x0e28A8f88C6266dF0FE274c15c1d4b27f8B373C0", 8 | "contractAddress": null, 9 | "transactionIndex": 12, 10 | "gasUsed": "165171", 11 | "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 12 | "blockHash": "0x65f567210dfd69c8a22f9b5c4c4628ac272955911c4867efc8f5f856cdb21ac0", 13 | "transactionHash": "0x00497a6f7983beef310a048adf7077a9b2fbdb5103e6762146956088a09be963", 14 | "logs": [], 15 | "blockNumber": 33024319, 16 | "cumulativeGasUsed": "4572258", 17 | "status": 1, 18 | "byzantium": true 19 | }, 20 | "args": [], 21 | "numDeployments": 2, 22 | "solcInputHash": "18c7b3fb984a9ee861b83d1058d152f0", 23 | "metadata": "{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"author\":\"Stephen Chen\",\"kind\":\"dev\",\"methods\":{},\"title\":\"Bit Mask Library\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"getBit(mapping(uint256 => uint256) storage,uint256)\":{\"notice\":\"Get a bit in the bit mask\"},\"setBit(mapping(uint256 => uint256) storage,uint256,bool)\":{\"notice\":\"Set a bit in the bit mask\"}},\"notice\":\"Implements bit mask with dynamic array\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/Bitmask.sol\":\"Bitmask\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/Bitmask.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\"); you may not use\\n// this file except in compliance with the License. You may obtain a copy of the\\n// License at http://www.apache.org/licenses/LICENSE-2.0\\n\\n// Unless required by applicable law or agreed to in writing, software distributed\\n// under the License is distributed on an \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR\\n// CONDITIONS OF ANY KIND, either express or implied. See the License for the\\n// specific language governing permissions and limitations under the License.\\n\\npragma solidity ^0.8.0;\\n\\n/// @title Bit Mask Library\\n/// @author Stephen Chen\\n/// @notice Implements bit mask with dynamic array\\nlibrary Bitmask {\\n /// @notice Set a bit in the bit mask\\n function setBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit, bool _value) public {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n if (_value) {\\n bitmask[positionOfMask] = bitmask[positionOfMask] | (1 << positionOfBit);\\n } else {\\n bitmask[positionOfMask] = bitmask[positionOfMask] & ~(1 << positionOfBit);\\n }\\n }\\n\\n /// @notice Get a bit in the bit mask\\n function getBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit) public view returns (bool) {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n return ((bitmask[positionOfMask] & (1 << positionOfBit)) != 0);\\n }\\n}\\n\",\"keccak256\":\"0x606a3967f7444ce1dc07726e6c5cdcf48360000817c65b631e6ebd8fb96f6e1d\",\"license\":\"Apache-2.0\"}},\"version\":1}", 24 | "bytecode": "0x61020461003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 25 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 26 | "devdoc": { 27 | "author": "Stephen Chen", 28 | "kind": "dev", 29 | "methods": {}, 30 | "title": "Bit Mask Library", 31 | "version": 1 32 | }, 33 | "userdoc": { 34 | "kind": "user", 35 | "methods": { 36 | "getBit(mapping(uint256 => uint256) storage,uint256)": { 37 | "notice": "Get a bit in the bit mask" 38 | }, 39 | "setBit(mapping(uint256 => uint256) storage,uint256,bool)": { 40 | "notice": "Set a bit in the bit mask" 41 | } 42 | }, 43 | "notice": "Implements bit mask with dynamic array", 44 | "version": 1 45 | }, 46 | "storageLayout": { 47 | "storage": [], 48 | "types": null 49 | } 50 | } -------------------------------------------------------------------------------- /packages/contracts/deployments/avalanche_fuji/.chainId: -------------------------------------------------------------------------------- 1 | 43113 -------------------------------------------------------------------------------- /packages/contracts/deployments/avalanche_fuji/Bitmask.json: -------------------------------------------------------------------------------- 1 | { 2 | "address": "0xF5B2d8c81cDE4D6238bBf20D3D77DB37df13f735", 3 | "abi": [], 4 | "transactionHash": "0x318a22afee7b68bc81a261a2896921c7f426ba9f15e221bbb66bcf6fbb10fbe1", 5 | "receipt": { 6 | "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", 7 | "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", 8 | "contractAddress": null, 9 | "transactionIndex": 1, 10 | "gasUsed": "165171", 11 | "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 12 | "blockHash": "0x3b8731670cf5990bbeb9ddcb88c42f9298fc3a4707c90135ebcd41d7030862fe", 13 | "transactionHash": "0x318a22afee7b68bc81a261a2896921c7f426ba9f15e221bbb66bcf6fbb10fbe1", 14 | "logs": [], 15 | "blockNumber": 24471179, 16 | "cumulativeGasUsed": "1121629", 17 | "status": 1, 18 | "byzantium": true 19 | }, 20 | "args": [], 21 | "numDeployments": 4, 22 | "solcInputHash": "18c7b3fb984a9ee861b83d1058d152f0", 23 | "metadata": "{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"author\":\"Stephen Chen\",\"kind\":\"dev\",\"methods\":{},\"title\":\"Bit Mask Library\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"getBit(mapping(uint256 => uint256) storage,uint256)\":{\"notice\":\"Get a bit in the bit mask\"},\"setBit(mapping(uint256 => uint256) storage,uint256,bool)\":{\"notice\":\"Set a bit in the bit mask\"}},\"notice\":\"Implements bit mask with dynamic array\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/Bitmask.sol\":\"Bitmask\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/Bitmask.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\"); you may not use\\n// this file except in compliance with the License. You may obtain a copy of the\\n// License at http://www.apache.org/licenses/LICENSE-2.0\\n\\n// Unless required by applicable law or agreed to in writing, software distributed\\n// under the License is distributed on an \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR\\n// CONDITIONS OF ANY KIND, either express or implied. See the License for the\\n// specific language governing permissions and limitations under the License.\\n\\npragma solidity ^0.8.0;\\n\\n/// @title Bit Mask Library\\n/// @author Stephen Chen\\n/// @notice Implements bit mask with dynamic array\\nlibrary Bitmask {\\n /// @notice Set a bit in the bit mask\\n function setBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit, bool _value) public {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n if (_value) {\\n bitmask[positionOfMask] = bitmask[positionOfMask] | (1 << positionOfBit);\\n } else {\\n bitmask[positionOfMask] = bitmask[positionOfMask] & ~(1 << positionOfBit);\\n }\\n }\\n\\n /// @notice Get a bit in the bit mask\\n function getBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit) public view returns (bool) {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n return ((bitmask[positionOfMask] & (1 << positionOfBit)) != 0);\\n }\\n}\\n\",\"keccak256\":\"0x606a3967f7444ce1dc07726e6c5cdcf48360000817c65b631e6ebd8fb96f6e1d\",\"license\":\"Apache-2.0\"}},\"version\":1}", 24 | "bytecode": "0x61020461003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 25 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 26 | "devdoc": { 27 | "author": "Stephen Chen", 28 | "kind": "dev", 29 | "methods": {}, 30 | "title": "Bit Mask Library", 31 | "version": 1 32 | }, 33 | "userdoc": { 34 | "kind": "user", 35 | "methods": { 36 | "getBit(mapping(uint256 => uint256) storage,uint256)": { 37 | "notice": "Get a bit in the bit mask" 38 | }, 39 | "setBit(mapping(uint256 => uint256) storage,uint256,bool)": { 40 | "notice": "Set a bit in the bit mask" 41 | } 42 | }, 43 | "notice": "Implements bit mask with dynamic array", 44 | "version": 1 45 | }, 46 | "storageLayout": { 47 | "storage": [], 48 | "types": null 49 | } 50 | } -------------------------------------------------------------------------------- /packages/contracts/deployments/base/.chainId: -------------------------------------------------------------------------------- 1 | 8453 -------------------------------------------------------------------------------- /packages/contracts/deployments/base/Bitmask.json: -------------------------------------------------------------------------------- 1 | { 2 | "address": "0xF5B2d8c81cDE4D6238bBf20D3D77DB37df13f735", 3 | "abi": [], 4 | "transactionHash": "0x694f442ffc47a51f7cb0e4597911bac3068bffbc98b0ef3d25782f19b2639aee", 5 | "receipt": { 6 | "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", 7 | "from": "0x0e28A8f88C6266dF0FE274c15c1d4b27f8B373C0", 8 | "contractAddress": null, 9 | "transactionIndex": 18, 10 | "gasUsed": "165207", 11 | "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 12 | "blockHash": "0x8740fc22560e611131e84e7e78ad23466da59bce05fff8b8a617c8e3503a140f", 13 | "transactionHash": "0x694f442ffc47a51f7cb0e4597911bac3068bffbc98b0ef3d25782f19b2639aee", 14 | "logs": [], 15 | "blockNumber": 12949275, 16 | "cumulativeGasUsed": "2310608", 17 | "status": 1, 18 | "byzantium": true 19 | }, 20 | "args": [], 21 | "numDeployments": 1, 22 | "solcInputHash": "18c7b3fb984a9ee861b83d1058d152f0", 23 | "metadata": "{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"author\":\"Stephen Chen\",\"kind\":\"dev\",\"methods\":{},\"title\":\"Bit Mask Library\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"getBit(mapping(uint256 => uint256) storage,uint256)\":{\"notice\":\"Get a bit in the bit mask\"},\"setBit(mapping(uint256 => uint256) storage,uint256,bool)\":{\"notice\":\"Set a bit in the bit mask\"}},\"notice\":\"Implements bit mask with dynamic array\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/Bitmask.sol\":\"Bitmask\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/Bitmask.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\"); you may not use\\n// this file except in compliance with the License. You may obtain a copy of the\\n// License at http://www.apache.org/licenses/LICENSE-2.0\\n\\n// Unless required by applicable law or agreed to in writing, software distributed\\n// under the License is distributed on an \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR\\n// CONDITIONS OF ANY KIND, either express or implied. See the License for the\\n// specific language governing permissions and limitations under the License.\\n\\npragma solidity ^0.8.0;\\n\\n/// @title Bit Mask Library\\n/// @author Stephen Chen\\n/// @notice Implements bit mask with dynamic array\\nlibrary Bitmask {\\n /// @notice Set a bit in the bit mask\\n function setBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit, bool _value) public {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n if (_value) {\\n bitmask[positionOfMask] = bitmask[positionOfMask] | (1 << positionOfBit);\\n } else {\\n bitmask[positionOfMask] = bitmask[positionOfMask] & ~(1 << positionOfBit);\\n }\\n }\\n\\n /// @notice Get a bit in the bit mask\\n function getBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit) public view returns (bool) {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n return ((bitmask[positionOfMask] & (1 << positionOfBit)) != 0);\\n }\\n}\\n\",\"keccak256\":\"0x606a3967f7444ce1dc07726e6c5cdcf48360000817c65b631e6ebd8fb96f6e1d\",\"license\":\"Apache-2.0\"}},\"version\":1}", 24 | "bytecode": "0x61020461003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 25 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 26 | "devdoc": { 27 | "author": "Stephen Chen", 28 | "kind": "dev", 29 | "methods": {}, 30 | "title": "Bit Mask Library", 31 | "version": 1 32 | }, 33 | "userdoc": { 34 | "kind": "user", 35 | "methods": { 36 | "getBit(mapping(uint256 => uint256) storage,uint256)": { 37 | "notice": "Get a bit in the bit mask" 38 | }, 39 | "setBit(mapping(uint256 => uint256) storage,uint256,bool)": { 40 | "notice": "Set a bit in the bit mask" 41 | } 42 | }, 43 | "notice": "Implements bit mask with dynamic array", 44 | "version": 1 45 | }, 46 | "storageLayout": { 47 | "storage": [], 48 | "types": null 49 | } 50 | } -------------------------------------------------------------------------------- /packages/contracts/deployments/base_sepolia/.chainId: -------------------------------------------------------------------------------- 1 | 84532 -------------------------------------------------------------------------------- /packages/contracts/deployments/base_sepolia/Bitmask.json: -------------------------------------------------------------------------------- 1 | { 2 | "address": "0xF5B2d8c81cDE4D6238bBf20D3D77DB37df13f735", 3 | "abi": [], 4 | "transactionHash": "0x8802387267e0bb54450fc709ed1644706f0bd61d9062b7db809e795e91234e94", 5 | "receipt": { 6 | "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", 7 | "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", 8 | "contractAddress": null, 9 | "transactionIndex": 1, 10 | "gasUsed": "165207", 11 | "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 12 | "blockHash": "0x1594836d39f2454475eb0c095b908a96db1076e22424394d80e6bb5c9e73c89d", 13 | "transactionHash": "0x8802387267e0bb54450fc709ed1644706f0bd61d9062b7db809e795e91234e94", 14 | "logs": [], 15 | "blockNumber": 8580250, 16 | "cumulativeGasUsed": "209070", 17 | "status": 1, 18 | "byzantium": true 19 | }, 20 | "args": [], 21 | "numDeployments": 1, 22 | "solcInputHash": "18c7b3fb984a9ee861b83d1058d152f0", 23 | "metadata": "{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"author\":\"Stephen Chen\",\"kind\":\"dev\",\"methods\":{},\"title\":\"Bit Mask Library\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"getBit(mapping(uint256 => uint256) storage,uint256)\":{\"notice\":\"Get a bit in the bit mask\"},\"setBit(mapping(uint256 => uint256) storage,uint256,bool)\":{\"notice\":\"Set a bit in the bit mask\"}},\"notice\":\"Implements bit mask with dynamic array\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/Bitmask.sol\":\"Bitmask\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/Bitmask.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\"); you may not use\\n// this file except in compliance with the License. You may obtain a copy of the\\n// License at http://www.apache.org/licenses/LICENSE-2.0\\n\\n// Unless required by applicable law or agreed to in writing, software distributed\\n// under the License is distributed on an \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR\\n// CONDITIONS OF ANY KIND, either express or implied. See the License for the\\n// specific language governing permissions and limitations under the License.\\n\\npragma solidity ^0.8.0;\\n\\n/// @title Bit Mask Library\\n/// @author Stephen Chen\\n/// @notice Implements bit mask with dynamic array\\nlibrary Bitmask {\\n /// @notice Set a bit in the bit mask\\n function setBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit, bool _value) public {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n if (_value) {\\n bitmask[positionOfMask] = bitmask[positionOfMask] | (1 << positionOfBit);\\n } else {\\n bitmask[positionOfMask] = bitmask[positionOfMask] & ~(1 << positionOfBit);\\n }\\n }\\n\\n /// @notice Get a bit in the bit mask\\n function getBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit) public view returns (bool) {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n return ((bitmask[positionOfMask] & (1 << positionOfBit)) != 0);\\n }\\n}\\n\",\"keccak256\":\"0x606a3967f7444ce1dc07726e6c5cdcf48360000817c65b631e6ebd8fb96f6e1d\",\"license\":\"Apache-2.0\"}},\"version\":1}", 24 | "bytecode": "0x61020461003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 25 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 26 | "devdoc": { 27 | "author": "Stephen Chen", 28 | "kind": "dev", 29 | "methods": {}, 30 | "title": "Bit Mask Library", 31 | "version": 1 32 | }, 33 | "userdoc": { 34 | "kind": "user", 35 | "methods": { 36 | "getBit(mapping(uint256 => uint256) storage,uint256)": { 37 | "notice": "Get a bit in the bit mask" 38 | }, 39 | "setBit(mapping(uint256 => uint256) storage,uint256,bool)": { 40 | "notice": "Set a bit in the bit mask" 41 | } 42 | }, 43 | "notice": "Implements bit mask with dynamic array", 44 | "version": 1 45 | }, 46 | "storageLayout": { 47 | "storage": [], 48 | "types": null 49 | } 50 | } -------------------------------------------------------------------------------- /packages/contracts/deployments/bsc/.chainId: -------------------------------------------------------------------------------- 1 | 56 -------------------------------------------------------------------------------- /packages/contracts/deployments/bsc/Bitmask.json: -------------------------------------------------------------------------------- 1 | { 2 | "address": "0xF5B2d8c81cDE4D6238bBf20D3D77DB37df13f735", 3 | "abi": [], 4 | "transactionHash": "0x484d263e019e16c02cf45493bcfb8275cad30432b71e70aa2cf0e2dd1353e330", 5 | "receipt": { 6 | "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", 7 | "from": "0x0e28A8f88C6266dF0FE274c15c1d4b27f8B373C0", 8 | "contractAddress": null, 9 | "transactionIndex": 16, 10 | "gasUsed": "165171", 11 | "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 12 | "blockHash": "0x8a4c8b659b4ded2386d3e37f02ac4ef4b16d2e0c0a314691d36f7df2f81838e4", 13 | "transactionHash": "0x484d263e019e16c02cf45493bcfb8275cad30432b71e70aa2cf0e2dd1353e330", 14 | "logs": [], 15 | "blockNumber": 30272064, 16 | "cumulativeGasUsed": "820927", 17 | "status": 1, 18 | "byzantium": true 19 | }, 20 | "args": [], 21 | "numDeployments": 1, 22 | "solcInputHash": "18c7b3fb984a9ee861b83d1058d152f0", 23 | "metadata": "{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"author\":\"Stephen Chen\",\"kind\":\"dev\",\"methods\":{},\"title\":\"Bit Mask Library\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"getBit(mapping(uint256 => uint256) storage,uint256)\":{\"notice\":\"Get a bit in the bit mask\"},\"setBit(mapping(uint256 => uint256) storage,uint256,bool)\":{\"notice\":\"Set a bit in the bit mask\"}},\"notice\":\"Implements bit mask with dynamic array\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/Bitmask.sol\":\"Bitmask\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/Bitmask.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\"); you may not use\\n// this file except in compliance with the License. You may obtain a copy of the\\n// License at http://www.apache.org/licenses/LICENSE-2.0\\n\\n// Unless required by applicable law or agreed to in writing, software distributed\\n// under the License is distributed on an \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR\\n// CONDITIONS OF ANY KIND, either express or implied. See the License for the\\n// specific language governing permissions and limitations under the License.\\n\\npragma solidity ^0.8.0;\\n\\n/// @title Bit Mask Library\\n/// @author Stephen Chen\\n/// @notice Implements bit mask with dynamic array\\nlibrary Bitmask {\\n /// @notice Set a bit in the bit mask\\n function setBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit, bool _value) public {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n if (_value) {\\n bitmask[positionOfMask] = bitmask[positionOfMask] | (1 << positionOfBit);\\n } else {\\n bitmask[positionOfMask] = bitmask[positionOfMask] & ~(1 << positionOfBit);\\n }\\n }\\n\\n /// @notice Get a bit in the bit mask\\n function getBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit) public view returns (bool) {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n return ((bitmask[positionOfMask] & (1 << positionOfBit)) != 0);\\n }\\n}\\n\",\"keccak256\":\"0x606a3967f7444ce1dc07726e6c5cdcf48360000817c65b631e6ebd8fb96f6e1d\",\"license\":\"Apache-2.0\"}},\"version\":1}", 24 | "bytecode": "0x61020461003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 25 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 26 | "devdoc": { 27 | "author": "Stephen Chen", 28 | "kind": "dev", 29 | "methods": {}, 30 | "title": "Bit Mask Library", 31 | "version": 1 32 | }, 33 | "userdoc": { 34 | "kind": "user", 35 | "methods": { 36 | "getBit(mapping(uint256 => uint256) storage,uint256)": { 37 | "notice": "Get a bit in the bit mask" 38 | }, 39 | "setBit(mapping(uint256 => uint256) storage,uint256,bool)": { 40 | "notice": "Set a bit in the bit mask" 41 | } 42 | }, 43 | "notice": "Implements bit mask with dynamic array", 44 | "version": 1 45 | }, 46 | "storageLayout": { 47 | "storage": [], 48 | "types": null 49 | } 50 | } -------------------------------------------------------------------------------- /packages/contracts/deployments/bsc_testnet/.chainId: -------------------------------------------------------------------------------- 1 | 97 -------------------------------------------------------------------------------- /packages/contracts/deployments/bsc_testnet/Bitmask.json: -------------------------------------------------------------------------------- 1 | { 2 | "address": "0xF5B2d8c81cDE4D6238bBf20D3D77DB37df13f735", 3 | "abi": [], 4 | "transactionHash": "0x7bf640f919669af69e98dc5212072965e9e267909ae3a6de175bf6c98eafdd5b", 5 | "receipt": { 6 | "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", 7 | "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", 8 | "contractAddress": null, 9 | "transactionIndex": 4, 10 | "gasUsed": "165171", 11 | "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 12 | "blockHash": "0x199eca849ede0c51e18323a5d4fa7159de9086ddcb049deda1ae6ed015882d6b", 13 | "transactionHash": "0x7bf640f919669af69e98dc5212072965e9e267909ae3a6de175bf6c98eafdd5b", 14 | "logs": [], 15 | "blockNumber": 31843280, 16 | "cumulativeGasUsed": "555654", 17 | "status": 1, 18 | "byzantium": true 19 | }, 20 | "args": [], 21 | "numDeployments": 4, 22 | "solcInputHash": "18c7b3fb984a9ee861b83d1058d152f0", 23 | "metadata": "{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"author\":\"Stephen Chen\",\"kind\":\"dev\",\"methods\":{},\"title\":\"Bit Mask Library\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"getBit(mapping(uint256 => uint256) storage,uint256)\":{\"notice\":\"Get a bit in the bit mask\"},\"setBit(mapping(uint256 => uint256) storage,uint256,bool)\":{\"notice\":\"Set a bit in the bit mask\"}},\"notice\":\"Implements bit mask with dynamic array\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/Bitmask.sol\":\"Bitmask\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/Bitmask.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\"); you may not use\\n// this file except in compliance with the License. You may obtain a copy of the\\n// License at http://www.apache.org/licenses/LICENSE-2.0\\n\\n// Unless required by applicable law or agreed to in writing, software distributed\\n// under the License is distributed on an \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR\\n// CONDITIONS OF ANY KIND, either express or implied. See the License for the\\n// specific language governing permissions and limitations under the License.\\n\\npragma solidity ^0.8.0;\\n\\n/// @title Bit Mask Library\\n/// @author Stephen Chen\\n/// @notice Implements bit mask with dynamic array\\nlibrary Bitmask {\\n /// @notice Set a bit in the bit mask\\n function setBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit, bool _value) public {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n if (_value) {\\n bitmask[positionOfMask] = bitmask[positionOfMask] | (1 << positionOfBit);\\n } else {\\n bitmask[positionOfMask] = bitmask[positionOfMask] & ~(1 << positionOfBit);\\n }\\n }\\n\\n /// @notice Get a bit in the bit mask\\n function getBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit) public view returns (bool) {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n return ((bitmask[positionOfMask] & (1 << positionOfBit)) != 0);\\n }\\n}\\n\",\"keccak256\":\"0x606a3967f7444ce1dc07726e6c5cdcf48360000817c65b631e6ebd8fb96f6e1d\",\"license\":\"Apache-2.0\"}},\"version\":1}", 24 | "bytecode": "0x61020461003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 25 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 26 | "devdoc": { 27 | "author": "Stephen Chen", 28 | "kind": "dev", 29 | "methods": {}, 30 | "title": "Bit Mask Library", 31 | "version": 1 32 | }, 33 | "userdoc": { 34 | "kind": "user", 35 | "methods": { 36 | "getBit(mapping(uint256 => uint256) storage,uint256)": { 37 | "notice": "Get a bit in the bit mask" 38 | }, 39 | "setBit(mapping(uint256 => uint256) storage,uint256,bool)": { 40 | "notice": "Set a bit in the bit mask" 41 | } 42 | }, 43 | "notice": "Implements bit mask with dynamic array", 44 | "version": 1 45 | }, 46 | "storageLayout": { 47 | "storage": [], 48 | "types": null 49 | } 50 | } -------------------------------------------------------------------------------- /packages/contracts/deployments/celo/.chainId: -------------------------------------------------------------------------------- 1 | 42220 -------------------------------------------------------------------------------- /packages/contracts/deployments/celo/Bitmask.json: -------------------------------------------------------------------------------- 1 | { 2 | "address": "0xF5B2d8c81cDE4D6238bBf20D3D77DB37df13f735", 3 | "abi": [], 4 | "transactionHash": "0xedcd062199f382219b8db027a3e38c5fe582ea3ef883d9baa6476fe4d80844af", 5 | "receipt": { 6 | "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", 7 | "from": "0x0e28A8f88C6266dF0FE274c15c1d4b27f8B373C0", 8 | "contractAddress": null, 9 | "transactionIndex": 8, 10 | "gasUsed": "165171", 11 | "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 12 | "blockHash": "0x1873fd362c6f60080785905c7a392769632e6f48ce3816de6b82ab07a4dadf32", 13 | "transactionHash": "0xedcd062199f382219b8db027a3e38c5fe582ea3ef883d9baa6476fe4d80844af", 14 | "logs": [], 15 | "blockNumber": 20511095, 16 | "cumulativeGasUsed": "1305595", 17 | "status": 1, 18 | "byzantium": true 19 | }, 20 | "args": [], 21 | "numDeployments": 1, 22 | "solcInputHash": "18c7b3fb984a9ee861b83d1058d152f0", 23 | "metadata": "{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"author\":\"Stephen Chen\",\"kind\":\"dev\",\"methods\":{},\"title\":\"Bit Mask Library\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"getBit(mapping(uint256 => uint256) storage,uint256)\":{\"notice\":\"Get a bit in the bit mask\"},\"setBit(mapping(uint256 => uint256) storage,uint256,bool)\":{\"notice\":\"Set a bit in the bit mask\"}},\"notice\":\"Implements bit mask with dynamic array\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/Bitmask.sol\":\"Bitmask\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/Bitmask.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\"); you may not use\\n// this file except in compliance with the License. You may obtain a copy of the\\n// License at http://www.apache.org/licenses/LICENSE-2.0\\n\\n// Unless required by applicable law or agreed to in writing, software distributed\\n// under the License is distributed on an \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR\\n// CONDITIONS OF ANY KIND, either express or implied. See the License for the\\n// specific language governing permissions and limitations under the License.\\n\\npragma solidity ^0.8.0;\\n\\n/// @title Bit Mask Library\\n/// @author Stephen Chen\\n/// @notice Implements bit mask with dynamic array\\nlibrary Bitmask {\\n /// @notice Set a bit in the bit mask\\n function setBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit, bool _value) public {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n if (_value) {\\n bitmask[positionOfMask] = bitmask[positionOfMask] | (1 << positionOfBit);\\n } else {\\n bitmask[positionOfMask] = bitmask[positionOfMask] & ~(1 << positionOfBit);\\n }\\n }\\n\\n /// @notice Get a bit in the bit mask\\n function getBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit) public view returns (bool) {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n return ((bitmask[positionOfMask] & (1 << positionOfBit)) != 0);\\n }\\n}\\n\",\"keccak256\":\"0x606a3967f7444ce1dc07726e6c5cdcf48360000817c65b631e6ebd8fb96f6e1d\",\"license\":\"Apache-2.0\"}},\"version\":1}", 24 | "bytecode": "0x61020461003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 25 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 26 | "devdoc": { 27 | "author": "Stephen Chen", 28 | "kind": "dev", 29 | "methods": {}, 30 | "title": "Bit Mask Library", 31 | "version": 1 32 | }, 33 | "userdoc": { 34 | "kind": "user", 35 | "methods": { 36 | "getBit(mapping(uint256 => uint256) storage,uint256)": { 37 | "notice": "Get a bit in the bit mask" 38 | }, 39 | "setBit(mapping(uint256 => uint256) storage,uint256,bool)": { 40 | "notice": "Set a bit in the bit mask" 41 | } 42 | }, 43 | "notice": "Implements bit mask with dynamic array", 44 | "version": 1 45 | }, 46 | "storageLayout": { 47 | "storage": [], 48 | "types": null 49 | } 50 | } -------------------------------------------------------------------------------- /packages/contracts/deployments/celo_testnet/.chainId: -------------------------------------------------------------------------------- 1 | 44787 -------------------------------------------------------------------------------- /packages/contracts/deployments/celo_testnet/Bitmask.json: -------------------------------------------------------------------------------- 1 | { 2 | "address": "0xF5B2d8c81cDE4D6238bBf20D3D77DB37df13f735", 3 | "abi": [], 4 | "transactionHash": "0x6b4d2908db3a368a1536aa6af5851a3bd2ada8e0e71aaf1651f460a44c68ae36", 5 | "receipt": { 6 | "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", 7 | "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", 8 | "contractAddress": null, 9 | "transactionIndex": 1, 10 | "gasUsed": "165171", 11 | "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 12 | "blockHash": "0x16ca108b47cf9aed1e9fe719157c25e86fb76369a204c1cb6289b76ca1880a51", 13 | "transactionHash": "0x6b4d2908db3a368a1536aa6af5851a3bd2ada8e0e71aaf1651f460a44c68ae36", 14 | "logs": [], 15 | "blockNumber": 18969315, 16 | "cumulativeGasUsed": "197709", 17 | "status": 1, 18 | "byzantium": true 19 | }, 20 | "args": [], 21 | "numDeployments": 2, 22 | "solcInputHash": "18c7b3fb984a9ee861b83d1058d152f0", 23 | "metadata": "{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"author\":\"Stephen Chen\",\"kind\":\"dev\",\"methods\":{},\"title\":\"Bit Mask Library\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"getBit(mapping(uint256 => uint256) storage,uint256)\":{\"notice\":\"Get a bit in the bit mask\"},\"setBit(mapping(uint256 => uint256) storage,uint256,bool)\":{\"notice\":\"Set a bit in the bit mask\"}},\"notice\":\"Implements bit mask with dynamic array\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/Bitmask.sol\":\"Bitmask\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/Bitmask.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\"); you may not use\\n// this file except in compliance with the License. You may obtain a copy of the\\n// License at http://www.apache.org/licenses/LICENSE-2.0\\n\\n// Unless required by applicable law or agreed to in writing, software distributed\\n// under the License is distributed on an \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR\\n// CONDITIONS OF ANY KIND, either express or implied. See the License for the\\n// specific language governing permissions and limitations under the License.\\n\\npragma solidity ^0.8.0;\\n\\n/// @title Bit Mask Library\\n/// @author Stephen Chen\\n/// @notice Implements bit mask with dynamic array\\nlibrary Bitmask {\\n /// @notice Set a bit in the bit mask\\n function setBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit, bool _value) public {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n if (_value) {\\n bitmask[positionOfMask] = bitmask[positionOfMask] | (1 << positionOfBit);\\n } else {\\n bitmask[positionOfMask] = bitmask[positionOfMask] & ~(1 << positionOfBit);\\n }\\n }\\n\\n /// @notice Get a bit in the bit mask\\n function getBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit) public view returns (bool) {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n return ((bitmask[positionOfMask] & (1 << positionOfBit)) != 0);\\n }\\n}\\n\",\"keccak256\":\"0x606a3967f7444ce1dc07726e6c5cdcf48360000817c65b631e6ebd8fb96f6e1d\",\"license\":\"Apache-2.0\"}},\"version\":1}", 24 | "bytecode": "0x61020461003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 25 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 26 | "devdoc": { 27 | "author": "Stephen Chen", 28 | "kind": "dev", 29 | "methods": {}, 30 | "title": "Bit Mask Library", 31 | "version": 1 32 | }, 33 | "userdoc": { 34 | "kind": "user", 35 | "methods": { 36 | "getBit(mapping(uint256 => uint256) storage,uint256)": { 37 | "notice": "Get a bit in the bit mask" 38 | }, 39 | "setBit(mapping(uint256 => uint256) storage,uint256,bool)": { 40 | "notice": "Set a bit in the bit mask" 41 | } 42 | }, 43 | "notice": "Implements bit mask with dynamic array", 44 | "version": 1 45 | }, 46 | "storageLayout": { 47 | "storage": [], 48 | "types": null 49 | } 50 | } -------------------------------------------------------------------------------- /packages/contracts/deployments/chiado/.chainId: -------------------------------------------------------------------------------- 1 | 10200 -------------------------------------------------------------------------------- /packages/contracts/deployments/chiado/Bitmask.json: -------------------------------------------------------------------------------- 1 | { 2 | "address": "0x25273575e86D9DC56F813f5F21D4C5b9d3982283", 3 | "abi": [], 4 | "transactionHash": "0xf718f564d81375b53d0a25c6f3465bfb59c1eac3ca46bd41db38d87ba99cc339", 5 | "receipt": { 6 | "to": null, 7 | "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", 8 | "contractAddress": "0x25273575e86D9DC56F813f5F21D4C5b9d3982283", 9 | "transactionIndex": 1, 10 | "gasUsed": "164782", 11 | "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 12 | "blockHash": "0x9f20a15daefb2c8da28bda4d462b87f7ed9fea13ded4eb7f10f6a8675eb66b63", 13 | "transactionHash": "0xf718f564d81375b53d0a25c6f3465bfb59c1eac3ca46bd41db38d87ba99cc339", 14 | "logs": [], 15 | "blockNumber": 5164768, 16 | "cumulativeGasUsed": "193302", 17 | "status": 1, 18 | "byzantium": true 19 | }, 20 | "args": [], 21 | "numDeployments": 3, 22 | "solcInputHash": "18c7b3fb984a9ee861b83d1058d152f0", 23 | "metadata": "{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"author\":\"Stephen Chen\",\"kind\":\"dev\",\"methods\":{},\"title\":\"Bit Mask Library\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"getBit(mapping(uint256 => uint256) storage,uint256)\":{\"notice\":\"Get a bit in the bit mask\"},\"setBit(mapping(uint256 => uint256) storage,uint256,bool)\":{\"notice\":\"Set a bit in the bit mask\"}},\"notice\":\"Implements bit mask with dynamic array\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/Bitmask.sol\":\"Bitmask\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/Bitmask.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\"); you may not use\\n// this file except in compliance with the License. You may obtain a copy of the\\n// License at http://www.apache.org/licenses/LICENSE-2.0\\n\\n// Unless required by applicable law or agreed to in writing, software distributed\\n// under the License is distributed on an \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR\\n// CONDITIONS OF ANY KIND, either express or implied. See the License for the\\n// specific language governing permissions and limitations under the License.\\n\\npragma solidity ^0.8.0;\\n\\n/// @title Bit Mask Library\\n/// @author Stephen Chen\\n/// @notice Implements bit mask with dynamic array\\nlibrary Bitmask {\\n /// @notice Set a bit in the bit mask\\n function setBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit, bool _value) public {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n if (_value) {\\n bitmask[positionOfMask] = bitmask[positionOfMask] | (1 << positionOfBit);\\n } else {\\n bitmask[positionOfMask] = bitmask[positionOfMask] & ~(1 << positionOfBit);\\n }\\n }\\n\\n /// @notice Get a bit in the bit mask\\n function getBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit) public view returns (bool) {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n return ((bitmask[positionOfMask] & (1 << positionOfBit)) != 0);\\n }\\n}\\n\",\"keccak256\":\"0x606a3967f7444ce1dc07726e6c5cdcf48360000817c65b631e6ebd8fb96f6e1d\",\"license\":\"Apache-2.0\"}},\"version\":1}", 24 | "bytecode": "0x61020461003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 25 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 26 | "devdoc": { 27 | "author": "Stephen Chen", 28 | "kind": "dev", 29 | "methods": {}, 30 | "title": "Bit Mask Library", 31 | "version": 1 32 | }, 33 | "userdoc": { 34 | "kind": "user", 35 | "methods": { 36 | "getBit(mapping(uint256 => uint256) storage,uint256)": { 37 | "notice": "Get a bit in the bit mask" 38 | }, 39 | "setBit(mapping(uint256 => uint256) storage,uint256,bool)": { 40 | "notice": "Set a bit in the bit mask" 41 | } 42 | }, 43 | "notice": "Implements bit mask with dynamic array", 44 | "version": 1 45 | }, 46 | "storageLayout": { 47 | "storage": [], 48 | "types": null 49 | } 50 | } -------------------------------------------------------------------------------- /packages/contracts/deployments/fantom/.chainId: -------------------------------------------------------------------------------- 1 | 250 -------------------------------------------------------------------------------- /packages/contracts/deployments/fantom/Bitmask.json: -------------------------------------------------------------------------------- 1 | { 2 | "address": "0xF5B2d8c81cDE4D6238bBf20D3D77DB37df13f735", 3 | "abi": [], 4 | "transactionHash": "0xb28516e3dff9a0ea48c14cdf3449f98cb9d788e698bc3bcb80dc3ddbd9e471c7", 5 | "receipt": { 6 | "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", 7 | "from": "0x0e28A8f88C6266dF0FE274c15c1d4b27f8B373C0", 8 | "contractAddress": null, 9 | "transactionIndex": 2, 10 | "gasUsed": "165330", 11 | "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 12 | "blockHash": "0x0003720400000832c7ddc4cb13ed4e723c5faf6b7c3c0fe53a214b930b676c71", 13 | "transactionHash": "0xb28516e3dff9a0ea48c14cdf3449f98cb9d788e698bc3bcb80dc3ddbd9e471c7", 14 | "logs": [], 15 | "blockNumber": 66258876, 16 | "cumulativeGasUsed": "210633", 17 | "status": 1, 18 | "byzantium": true 19 | }, 20 | "args": [], 21 | "numDeployments": 1, 22 | "solcInputHash": "18c7b3fb984a9ee861b83d1058d152f0", 23 | "metadata": "{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"author\":\"Stephen Chen\",\"kind\":\"dev\",\"methods\":{},\"title\":\"Bit Mask Library\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"getBit(mapping(uint256 => uint256) storage,uint256)\":{\"notice\":\"Get a bit in the bit mask\"},\"setBit(mapping(uint256 => uint256) storage,uint256,bool)\":{\"notice\":\"Set a bit in the bit mask\"}},\"notice\":\"Implements bit mask with dynamic array\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/Bitmask.sol\":\"Bitmask\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/Bitmask.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\"); you may not use\\n// this file except in compliance with the License. You may obtain a copy of the\\n// License at http://www.apache.org/licenses/LICENSE-2.0\\n\\n// Unless required by applicable law or agreed to in writing, software distributed\\n// under the License is distributed on an \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR\\n// CONDITIONS OF ANY KIND, either express or implied. See the License for the\\n// specific language governing permissions and limitations under the License.\\n\\npragma solidity ^0.8.0;\\n\\n/// @title Bit Mask Library\\n/// @author Stephen Chen\\n/// @notice Implements bit mask with dynamic array\\nlibrary Bitmask {\\n /// @notice Set a bit in the bit mask\\n function setBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit, bool _value) public {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n if (_value) {\\n bitmask[positionOfMask] = bitmask[positionOfMask] | (1 << positionOfBit);\\n } else {\\n bitmask[positionOfMask] = bitmask[positionOfMask] & ~(1 << positionOfBit);\\n }\\n }\\n\\n /// @notice Get a bit in the bit mask\\n function getBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit) public view returns (bool) {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n return ((bitmask[positionOfMask] & (1 << positionOfBit)) != 0);\\n }\\n}\\n\",\"keccak256\":\"0x606a3967f7444ce1dc07726e6c5cdcf48360000817c65b631e6ebd8fb96f6e1d\",\"license\":\"Apache-2.0\"}},\"version\":1}", 24 | "bytecode": "0x61020461003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 25 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 26 | "devdoc": { 27 | "author": "Stephen Chen", 28 | "kind": "dev", 29 | "methods": {}, 30 | "title": "Bit Mask Library", 31 | "version": 1 32 | }, 33 | "userdoc": { 34 | "kind": "user", 35 | "methods": { 36 | "getBit(mapping(uint256 => uint256) storage,uint256)": { 37 | "notice": "Get a bit in the bit mask" 38 | }, 39 | "setBit(mapping(uint256 => uint256) storage,uint256,bool)": { 40 | "notice": "Set a bit in the bit mask" 41 | } 42 | }, 43 | "notice": "Implements bit mask with dynamic array", 44 | "version": 1 45 | }, 46 | "storageLayout": { 47 | "storage": [], 48 | "types": null 49 | } 50 | } -------------------------------------------------------------------------------- /packages/contracts/deployments/fantom_testnet/.chainId: -------------------------------------------------------------------------------- 1 | 4002 -------------------------------------------------------------------------------- /packages/contracts/deployments/fantom_testnet/Bitmask.json: -------------------------------------------------------------------------------- 1 | { 2 | "address": "0xF5B2d8c81cDE4D6238bBf20D3D77DB37df13f735", 3 | "abi": [], 4 | "transactionHash": "0x18929fe202a131c4bf75502eb37f601a3c0e5efe7c849bc330e9c80e0ae969e2", 5 | "receipt": { 6 | "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", 7 | "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", 8 | "contractAddress": null, 9 | "transactionIndex": 0, 10 | "gasUsed": "165330", 11 | "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 12 | "blockHash": "0x00005043000020f394a6d9eedc5664352be7907a4d1078cb5b9db26626de7088", 13 | "transactionHash": "0x18929fe202a131c4bf75502eb37f601a3c0e5efe7c849bc330e9c80e0ae969e2", 14 | "logs": [], 15 | "blockNumber": 18732261, 16 | "cumulativeGasUsed": "165330", 17 | "status": 1, 18 | "byzantium": true 19 | }, 20 | "args": [], 21 | "numDeployments": 2, 22 | "solcInputHash": "18c7b3fb984a9ee861b83d1058d152f0", 23 | "metadata": "{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"author\":\"Stephen Chen\",\"kind\":\"dev\",\"methods\":{},\"title\":\"Bit Mask Library\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"getBit(mapping(uint256 => uint256) storage,uint256)\":{\"notice\":\"Get a bit in the bit mask\"},\"setBit(mapping(uint256 => uint256) storage,uint256,bool)\":{\"notice\":\"Set a bit in the bit mask\"}},\"notice\":\"Implements bit mask with dynamic array\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/Bitmask.sol\":\"Bitmask\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/Bitmask.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\"); you may not use\\n// this file except in compliance with the License. You may obtain a copy of the\\n// License at http://www.apache.org/licenses/LICENSE-2.0\\n\\n// Unless required by applicable law or agreed to in writing, software distributed\\n// under the License is distributed on an \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR\\n// CONDITIONS OF ANY KIND, either express or implied. See the License for the\\n// specific language governing permissions and limitations under the License.\\n\\npragma solidity ^0.8.0;\\n\\n/// @title Bit Mask Library\\n/// @author Stephen Chen\\n/// @notice Implements bit mask with dynamic array\\nlibrary Bitmask {\\n /// @notice Set a bit in the bit mask\\n function setBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit, bool _value) public {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n if (_value) {\\n bitmask[positionOfMask] = bitmask[positionOfMask] | (1 << positionOfBit);\\n } else {\\n bitmask[positionOfMask] = bitmask[positionOfMask] & ~(1 << positionOfBit);\\n }\\n }\\n\\n /// @notice Get a bit in the bit mask\\n function getBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit) public view returns (bool) {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n return ((bitmask[positionOfMask] & (1 << positionOfBit)) != 0);\\n }\\n}\\n\",\"keccak256\":\"0x606a3967f7444ce1dc07726e6c5cdcf48360000817c65b631e6ebd8fb96f6e1d\",\"license\":\"Apache-2.0\"}},\"version\":1}", 24 | "bytecode": "0x61020461003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 25 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 26 | "devdoc": { 27 | "author": "Stephen Chen", 28 | "kind": "dev", 29 | "methods": {}, 30 | "title": "Bit Mask Library", 31 | "version": 1 32 | }, 33 | "userdoc": { 34 | "kind": "user", 35 | "methods": { 36 | "getBit(mapping(uint256 => uint256) storage,uint256)": { 37 | "notice": "Get a bit in the bit mask" 38 | }, 39 | "setBit(mapping(uint256 => uint256) storage,uint256,bool)": { 40 | "notice": "Set a bit in the bit mask" 41 | } 42 | }, 43 | "notice": "Implements bit mask with dynamic array", 44 | "version": 1 45 | }, 46 | "storageLayout": { 47 | "storage": [], 48 | "types": null 49 | } 50 | } -------------------------------------------------------------------------------- /packages/contracts/deployments/gnosis/.chainId: -------------------------------------------------------------------------------- 1 | 100 -------------------------------------------------------------------------------- /packages/contracts/deployments/gnosis/Bitmask.json: -------------------------------------------------------------------------------- 1 | { 2 | "address": "0xF5B2d8c81cDE4D6238bBf20D3D77DB37df13f735", 3 | "abi": [], 4 | "transactionHash": "0xe946daa2bdb1a93dc7d58ac458e09d2d4482efcfa7f30273f73c31562654f3f4", 5 | "receipt": { 6 | "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", 7 | "from": "0x0e28A8f88C6266dF0FE274c15c1d4b27f8B373C0", 8 | "contractAddress": null, 9 | "transactionIndex": 3, 10 | "gasUsed": "165171", 11 | "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 12 | "blockHash": "0xd90ca2e2ffc1363afc7c1451b63f63ed6576ee5e85763b0aa8e86afa8b758847", 13 | "transactionHash": "0xe946daa2bdb1a93dc7d58ac458e09d2d4482efcfa7f30273f73c31562654f3f4", 14 | "logs": [], 15 | "blockNumber": 29114579, 16 | "cumulativeGasUsed": "564357", 17 | "status": 1, 18 | "byzantium": true 19 | }, 20 | "args": [], 21 | "numDeployments": 2, 22 | "solcInputHash": "18c7b3fb984a9ee861b83d1058d152f0", 23 | "metadata": "{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"author\":\"Stephen Chen\",\"kind\":\"dev\",\"methods\":{},\"title\":\"Bit Mask Library\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"getBit(mapping(uint256 => uint256) storage,uint256)\":{\"notice\":\"Get a bit in the bit mask\"},\"setBit(mapping(uint256 => uint256) storage,uint256,bool)\":{\"notice\":\"Set a bit in the bit mask\"}},\"notice\":\"Implements bit mask with dynamic array\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/Bitmask.sol\":\"Bitmask\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/Bitmask.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\"); you may not use\\n// this file except in compliance with the License. You may obtain a copy of the\\n// License at http://www.apache.org/licenses/LICENSE-2.0\\n\\n// Unless required by applicable law or agreed to in writing, software distributed\\n// under the License is distributed on an \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR\\n// CONDITIONS OF ANY KIND, either express or implied. See the License for the\\n// specific language governing permissions and limitations under the License.\\n\\npragma solidity ^0.8.0;\\n\\n/// @title Bit Mask Library\\n/// @author Stephen Chen\\n/// @notice Implements bit mask with dynamic array\\nlibrary Bitmask {\\n /// @notice Set a bit in the bit mask\\n function setBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit, bool _value) public {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n if (_value) {\\n bitmask[positionOfMask] = bitmask[positionOfMask] | (1 << positionOfBit);\\n } else {\\n bitmask[positionOfMask] = bitmask[positionOfMask] & ~(1 << positionOfBit);\\n }\\n }\\n\\n /// @notice Get a bit in the bit mask\\n function getBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit) public view returns (bool) {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n return ((bitmask[positionOfMask] & (1 << positionOfBit)) != 0);\\n }\\n}\\n\",\"keccak256\":\"0x606a3967f7444ce1dc07726e6c5cdcf48360000817c65b631e6ebd8fb96f6e1d\",\"license\":\"Apache-2.0\"}},\"version\":1}", 24 | "bytecode": "0x61020461003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 25 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 26 | "devdoc": { 27 | "author": "Stephen Chen", 28 | "kind": "dev", 29 | "methods": {}, 30 | "title": "Bit Mask Library", 31 | "version": 1 32 | }, 33 | "userdoc": { 34 | "kind": "user", 35 | "methods": { 36 | "getBit(mapping(uint256 => uint256) storage,uint256)": { 37 | "notice": "Get a bit in the bit mask" 38 | }, 39 | "setBit(mapping(uint256 => uint256) storage,uint256,bool)": { 40 | "notice": "Set a bit in the bit mask" 41 | } 42 | }, 43 | "notice": "Implements bit mask with dynamic array", 44 | "version": 1 45 | }, 46 | "storageLayout": { 47 | "storage": [], 48 | "types": null 49 | } 50 | } -------------------------------------------------------------------------------- /packages/contracts/deployments/goerli/.chainId: -------------------------------------------------------------------------------- 1 | 5 -------------------------------------------------------------------------------- /packages/contracts/deployments/goerli/Bitmask.json: -------------------------------------------------------------------------------- 1 | { 2 | "address": "0xF5B2d8c81cDE4D6238bBf20D3D77DB37df13f735", 3 | "abi": [], 4 | "transactionHash": "0x6b25ba865618d9ad462983aa63f52b800ec8db398e004a58831a1a760f34afa9", 5 | "receipt": { 6 | "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", 7 | "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", 8 | "contractAddress": null, 9 | "transactionIndex": 26, 10 | "gasUsed": "165207", 11 | "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 12 | "blockHash": "0x9aa4ecaab18c635909041e26ee7354c79533e0d3a517246e36acc4b2c01b6721", 13 | "transactionHash": "0x6b25ba865618d9ad462983aa63f52b800ec8db398e004a58831a1a760f34afa9", 14 | "logs": [], 15 | "blockNumber": 9401458, 16 | "cumulativeGasUsed": "4093630", 17 | "status": 1, 18 | "byzantium": true 19 | }, 20 | "args": [], 21 | "numDeployments": 5, 22 | "solcInputHash": "18c7b3fb984a9ee861b83d1058d152f0", 23 | "metadata": "{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"author\":\"Stephen Chen\",\"kind\":\"dev\",\"methods\":{},\"title\":\"Bit Mask Library\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"getBit(mapping(uint256 => uint256) storage,uint256)\":{\"notice\":\"Get a bit in the bit mask\"},\"setBit(mapping(uint256 => uint256) storage,uint256,bool)\":{\"notice\":\"Set a bit in the bit mask\"}},\"notice\":\"Implements bit mask with dynamic array\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/Bitmask.sol\":\"Bitmask\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/Bitmask.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\"); you may not use\\n// this file except in compliance with the License. You may obtain a copy of the\\n// License at http://www.apache.org/licenses/LICENSE-2.0\\n\\n// Unless required by applicable law or agreed to in writing, software distributed\\n// under the License is distributed on an \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR\\n// CONDITIONS OF ANY KIND, either express or implied. See the License for the\\n// specific language governing permissions and limitations under the License.\\n\\npragma solidity ^0.8.0;\\n\\n/// @title Bit Mask Library\\n/// @author Stephen Chen\\n/// @notice Implements bit mask with dynamic array\\nlibrary Bitmask {\\n /// @notice Set a bit in the bit mask\\n function setBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit, bool _value) public {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n if (_value) {\\n bitmask[positionOfMask] = bitmask[positionOfMask] | (1 << positionOfBit);\\n } else {\\n bitmask[positionOfMask] = bitmask[positionOfMask] & ~(1 << positionOfBit);\\n }\\n }\\n\\n /// @notice Get a bit in the bit mask\\n function getBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit) public view returns (bool) {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n return ((bitmask[positionOfMask] & (1 << positionOfBit)) != 0);\\n }\\n}\\n\",\"keccak256\":\"0x606a3967f7444ce1dc07726e6c5cdcf48360000817c65b631e6ebd8fb96f6e1d\",\"license\":\"Apache-2.0\"}},\"version\":1}", 24 | "bytecode": "0x61020461003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 25 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 26 | "devdoc": { 27 | "author": "Stephen Chen", 28 | "kind": "dev", 29 | "methods": {}, 30 | "title": "Bit Mask Library", 31 | "version": 1 32 | }, 33 | "userdoc": { 34 | "kind": "user", 35 | "methods": { 36 | "getBit(mapping(uint256 => uint256) storage,uint256)": { 37 | "notice": "Get a bit in the bit mask" 38 | }, 39 | "setBit(mapping(uint256 => uint256) storage,uint256,bool)": { 40 | "notice": "Set a bit in the bit mask" 41 | } 42 | }, 43 | "notice": "Implements bit mask with dynamic array", 44 | "version": 1 45 | }, 46 | "storageLayout": { 47 | "storage": [], 48 | "types": null 49 | } 50 | } -------------------------------------------------------------------------------- /packages/contracts/deployments/iotex/.chainId: -------------------------------------------------------------------------------- 1 | 4689 -------------------------------------------------------------------------------- /packages/contracts/deployments/iotex/Bitmask.json: -------------------------------------------------------------------------------- 1 | { 2 | "address": "0xF5B2d8c81cDE4D6238bBf20D3D77DB37df13f735", 3 | "abi": [], 4 | "transactionHash": "0x5368d84210c60a92ada2e0ff0e6630dc2b3388e5d9e69c7b04973f77fb6fb27f", 5 | "receipt": { 6 | "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", 7 | "from": "0x0e28A8f88C6266dF0FE274c15c1d4b27f8B373C0", 8 | "contractAddress": null, 9 | "transactionIndex": 0, 10 | "gasUsed": "206275", 11 | "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 12 | "blockHash": "0xb1983c9f28460f2129f7e1d9fa3f9d64fd453920fa3245c690eaccd08bd491ef", 13 | "transactionHash": "0x5368d84210c60a92ada2e0ff0e6630dc2b3388e5d9e69c7b04973f77fb6fb27f", 14 | "logs": [], 15 | "blockNumber": 24819586, 16 | "cumulativeGasUsed": "206275", 17 | "status": 1, 18 | "byzantium": true 19 | }, 20 | "args": [], 21 | "numDeployments": 1, 22 | "solcInputHash": "18c7b3fb984a9ee861b83d1058d152f0", 23 | "metadata": "{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"author\":\"Stephen Chen\",\"kind\":\"dev\",\"methods\":{},\"title\":\"Bit Mask Library\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"getBit(mapping(uint256 => uint256) storage,uint256)\":{\"notice\":\"Get a bit in the bit mask\"},\"setBit(mapping(uint256 => uint256) storage,uint256,bool)\":{\"notice\":\"Set a bit in the bit mask\"}},\"notice\":\"Implements bit mask with dynamic array\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/Bitmask.sol\":\"Bitmask\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/Bitmask.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\"); you may not use\\n// this file except in compliance with the License. You may obtain a copy of the\\n// License at http://www.apache.org/licenses/LICENSE-2.0\\n\\n// Unless required by applicable law or agreed to in writing, software distributed\\n// under the License is distributed on an \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR\\n// CONDITIONS OF ANY KIND, either express or implied. See the License for the\\n// specific language governing permissions and limitations under the License.\\n\\npragma solidity ^0.8.0;\\n\\n/// @title Bit Mask Library\\n/// @author Stephen Chen\\n/// @notice Implements bit mask with dynamic array\\nlibrary Bitmask {\\n /// @notice Set a bit in the bit mask\\n function setBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit, bool _value) public {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n if (_value) {\\n bitmask[positionOfMask] = bitmask[positionOfMask] | (1 << positionOfBit);\\n } else {\\n bitmask[positionOfMask] = bitmask[positionOfMask] & ~(1 << positionOfBit);\\n }\\n }\\n\\n /// @notice Get a bit in the bit mask\\n function getBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit) public view returns (bool) {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n return ((bitmask[positionOfMask] & (1 << positionOfBit)) != 0);\\n }\\n}\\n\",\"keccak256\":\"0x606a3967f7444ce1dc07726e6c5cdcf48360000817c65b631e6ebd8fb96f6e1d\",\"license\":\"Apache-2.0\"}},\"version\":1}", 24 | "bytecode": "0x61020461003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 25 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 26 | "devdoc": { 27 | "author": "Stephen Chen", 28 | "kind": "dev", 29 | "methods": {}, 30 | "title": "Bit Mask Library", 31 | "version": 1 32 | }, 33 | "userdoc": { 34 | "kind": "user", 35 | "methods": { 36 | "getBit(mapping(uint256 => uint256) storage,uint256)": { 37 | "notice": "Get a bit in the bit mask" 38 | }, 39 | "setBit(mapping(uint256 => uint256) storage,uint256,bool)": { 40 | "notice": "Set a bit in the bit mask" 41 | } 42 | }, 43 | "notice": "Implements bit mask with dynamic array", 44 | "version": 1 45 | }, 46 | "storageLayout": { 47 | "storage": [], 48 | "types": null 49 | } 50 | } -------------------------------------------------------------------------------- /packages/contracts/deployments/iotex_testnet/.chainId: -------------------------------------------------------------------------------- 1 | 4690 -------------------------------------------------------------------------------- /packages/contracts/deployments/iotex_testnet/Bitmask.json: -------------------------------------------------------------------------------- 1 | { 2 | "address": "0xf43C2FDc144a35bf1432d316D71FAC8A7353E5B5", 3 | "abi": [], 4 | "transactionHash": "0x311b3a20801385bb555351baac2151bcd625e0629c09e7ac28fa307a8504a06f", 5 | "receipt": { 6 | "to": null, 7 | "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", 8 | "contractAddress": "0xf43C2FDc144a35bf1432d316D71FAC8A7353E5B5", 9 | "transactionIndex": 0, 10 | "gasUsed": "170778", 11 | "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 12 | "blockHash": "0xdcc9f9dfe50f0a87efece61f469d8d3f6ecc09d46441a8809178f87152c6d679", 13 | "transactionHash": "0x311b3a20801385bb555351baac2151bcd625e0629c09e7ac28fa307a8504a06f", 14 | "logs": [], 15 | "blockNumber": 21337347, 16 | "cumulativeGasUsed": "170778", 17 | "status": 1, 18 | "byzantium": true 19 | }, 20 | "args": [], 21 | "numDeployments": 2, 22 | "solcInputHash": "18c7b3fb984a9ee861b83d1058d152f0", 23 | "metadata": "{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"author\":\"Stephen Chen\",\"kind\":\"dev\",\"methods\":{},\"title\":\"Bit Mask Library\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"getBit(mapping(uint256 => uint256) storage,uint256)\":{\"notice\":\"Get a bit in the bit mask\"},\"setBit(mapping(uint256 => uint256) storage,uint256,bool)\":{\"notice\":\"Set a bit in the bit mask\"}},\"notice\":\"Implements bit mask with dynamic array\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/Bitmask.sol\":\"Bitmask\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/Bitmask.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\"); you may not use\\n// this file except in compliance with the License. You may obtain a copy of the\\n// License at http://www.apache.org/licenses/LICENSE-2.0\\n\\n// Unless required by applicable law or agreed to in writing, software distributed\\n// under the License is distributed on an \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR\\n// CONDITIONS OF ANY KIND, either express or implied. See the License for the\\n// specific language governing permissions and limitations under the License.\\n\\npragma solidity ^0.8.0;\\n\\n/// @title Bit Mask Library\\n/// @author Stephen Chen\\n/// @notice Implements bit mask with dynamic array\\nlibrary Bitmask {\\n /// @notice Set a bit in the bit mask\\n function setBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit, bool _value) public {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n if (_value) {\\n bitmask[positionOfMask] = bitmask[positionOfMask] | (1 << positionOfBit);\\n } else {\\n bitmask[positionOfMask] = bitmask[positionOfMask] & ~(1 << positionOfBit);\\n }\\n }\\n\\n /// @notice Get a bit in the bit mask\\n function getBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit) public view returns (bool) {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n return ((bitmask[positionOfMask] & (1 << positionOfBit)) != 0);\\n }\\n}\\n\",\"keccak256\":\"0x606a3967f7444ce1dc07726e6c5cdcf48360000817c65b631e6ebd8fb96f6e1d\",\"license\":\"Apache-2.0\"}},\"version\":1}", 24 | "bytecode": "0x61020461003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 25 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 26 | "devdoc": { 27 | "author": "Stephen Chen", 28 | "kind": "dev", 29 | "methods": {}, 30 | "title": "Bit Mask Library", 31 | "version": 1 32 | }, 33 | "userdoc": { 34 | "kind": "user", 35 | "methods": { 36 | "getBit(mapping(uint256 => uint256) storage,uint256)": { 37 | "notice": "Get a bit in the bit mask" 38 | }, 39 | "setBit(mapping(uint256 => uint256) storage,uint256,bool)": { 40 | "notice": "Set a bit in the bit mask" 41 | } 42 | }, 43 | "notice": "Implements bit mask with dynamic array", 44 | "version": 1 45 | }, 46 | "storageLayout": { 47 | "storage": [], 48 | "types": null 49 | } 50 | } -------------------------------------------------------------------------------- /packages/contracts/deployments/mainnet/.chainId: -------------------------------------------------------------------------------- 1 | 1 -------------------------------------------------------------------------------- /packages/contracts/deployments/mainnet/Bitmask.json: -------------------------------------------------------------------------------- 1 | { 2 | "address": "0xF5B2d8c81cDE4D6238bBf20D3D77DB37df13f735", 3 | "abi": [], 4 | "transactionHash": "0xe2eb0d20d664f00df6105b6452c58f09fea14f8cfbb31af80390eacb3bda6e87", 5 | "receipt": { 6 | "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", 7 | "from": "0x0e28A8f88C6266dF0FE274c15c1d4b27f8B373C0", 8 | "contractAddress": null, 9 | "transactionIndex": 144, 10 | "gasUsed": "165207", 11 | "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 12 | "blockHash": "0x26ebcb3c9ae9f7970ef38c68ab3686b17f853551a04cc8b2d3da61039462407c", 13 | "transactionHash": "0xe2eb0d20d664f00df6105b6452c58f09fea14f8cfbb31af80390eacb3bda6e87", 14 | "logs": [], 15 | "blockNumber": 17763536, 16 | "cumulativeGasUsed": "12415891", 17 | "status": 1, 18 | "byzantium": true 19 | }, 20 | "args": [], 21 | "numDeployments": 3, 22 | "solcInputHash": "18c7b3fb984a9ee861b83d1058d152f0", 23 | "metadata": "{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"author\":\"Stephen Chen\",\"kind\":\"dev\",\"methods\":{},\"title\":\"Bit Mask Library\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"getBit(mapping(uint256 => uint256) storage,uint256)\":{\"notice\":\"Get a bit in the bit mask\"},\"setBit(mapping(uint256 => uint256) storage,uint256,bool)\":{\"notice\":\"Set a bit in the bit mask\"}},\"notice\":\"Implements bit mask with dynamic array\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/Bitmask.sol\":\"Bitmask\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/Bitmask.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\"); you may not use\\n// this file except in compliance with the License. You may obtain a copy of the\\n// License at http://www.apache.org/licenses/LICENSE-2.0\\n\\n// Unless required by applicable law or agreed to in writing, software distributed\\n// under the License is distributed on an \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR\\n// CONDITIONS OF ANY KIND, either express or implied. See the License for the\\n// specific language governing permissions and limitations under the License.\\n\\npragma solidity ^0.8.0;\\n\\n/// @title Bit Mask Library\\n/// @author Stephen Chen\\n/// @notice Implements bit mask with dynamic array\\nlibrary Bitmask {\\n /// @notice Set a bit in the bit mask\\n function setBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit, bool _value) public {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n if (_value) {\\n bitmask[positionOfMask] = bitmask[positionOfMask] | (1 << positionOfBit);\\n } else {\\n bitmask[positionOfMask] = bitmask[positionOfMask] & ~(1 << positionOfBit);\\n }\\n }\\n\\n /// @notice Get a bit in the bit mask\\n function getBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit) public view returns (bool) {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n return ((bitmask[positionOfMask] & (1 << positionOfBit)) != 0);\\n }\\n}\\n\",\"keccak256\":\"0x606a3967f7444ce1dc07726e6c5cdcf48360000817c65b631e6ebd8fb96f6e1d\",\"license\":\"Apache-2.0\"}},\"version\":1}", 24 | "bytecode": "0x61020461003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 25 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 26 | "devdoc": { 27 | "author": "Stephen Chen", 28 | "kind": "dev", 29 | "methods": {}, 30 | "title": "Bit Mask Library", 31 | "version": 1 32 | }, 33 | "userdoc": { 34 | "kind": "user", 35 | "methods": { 36 | "getBit(mapping(uint256 => uint256) storage,uint256)": { 37 | "notice": "Get a bit in the bit mask" 38 | }, 39 | "setBit(mapping(uint256 => uint256) storage,uint256,bool)": { 40 | "notice": "Set a bit in the bit mask" 41 | } 42 | }, 43 | "notice": "Implements bit mask with dynamic array", 44 | "version": 1 45 | }, 46 | "storageLayout": { 47 | "storage": [], 48 | "types": null 49 | } 50 | } -------------------------------------------------------------------------------- /packages/contracts/deployments/metis/.chainId: -------------------------------------------------------------------------------- 1 | 1088 -------------------------------------------------------------------------------- /packages/contracts/deployments/metis/Bitmask.json: -------------------------------------------------------------------------------- 1 | { 2 | "address": "0xF5B2d8c81cDE4D6238bBf20D3D77DB37df13f735", 3 | "abi": [], 4 | "transactionHash": "0x908769099f4728c42eb1869b95201615bf5d85e53ce2b5dc2db8e5f85e9c7d58", 5 | "receipt": { 6 | "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", 7 | "from": "0x0e28A8f88C6266dF0FE274c15c1d4b27f8B373C0", 8 | "contractAddress": null, 9 | "transactionIndex": 0, 10 | "gasUsed": "165171", 11 | "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 12 | "blockHash": "0xee7a8f9d36da73ccdb249e0622f6324b8479485feb11aa2bdd7dc358a905d824", 13 | "transactionHash": "0x908769099f4728c42eb1869b95201615bf5d85e53ce2b5dc2db8e5f85e9c7d58", 14 | "logs": [], 15 | "blockNumber": 7277031, 16 | "cumulativeGasUsed": "165171", 17 | "status": 1, 18 | "byzantium": true 19 | }, 20 | "args": [], 21 | "numDeployments": 1, 22 | "solcInputHash": "18c7b3fb984a9ee861b83d1058d152f0", 23 | "metadata": "{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"author\":\"Stephen Chen\",\"kind\":\"dev\",\"methods\":{},\"title\":\"Bit Mask Library\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"getBit(mapping(uint256 => uint256) storage,uint256)\":{\"notice\":\"Get a bit in the bit mask\"},\"setBit(mapping(uint256 => uint256) storage,uint256,bool)\":{\"notice\":\"Set a bit in the bit mask\"}},\"notice\":\"Implements bit mask with dynamic array\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/Bitmask.sol\":\"Bitmask\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/Bitmask.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\"); you may not use\\n// this file except in compliance with the License. You may obtain a copy of the\\n// License at http://www.apache.org/licenses/LICENSE-2.0\\n\\n// Unless required by applicable law or agreed to in writing, software distributed\\n// under the License is distributed on an \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR\\n// CONDITIONS OF ANY KIND, either express or implied. See the License for the\\n// specific language governing permissions and limitations under the License.\\n\\npragma solidity ^0.8.0;\\n\\n/// @title Bit Mask Library\\n/// @author Stephen Chen\\n/// @notice Implements bit mask with dynamic array\\nlibrary Bitmask {\\n /// @notice Set a bit in the bit mask\\n function setBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit, bool _value) public {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n if (_value) {\\n bitmask[positionOfMask] = bitmask[positionOfMask] | (1 << positionOfBit);\\n } else {\\n bitmask[positionOfMask] = bitmask[positionOfMask] & ~(1 << positionOfBit);\\n }\\n }\\n\\n /// @notice Get a bit in the bit mask\\n function getBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit) public view returns (bool) {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n return ((bitmask[positionOfMask] & (1 << positionOfBit)) != 0);\\n }\\n}\\n\",\"keccak256\":\"0x606a3967f7444ce1dc07726e6c5cdcf48360000817c65b631e6ebd8fb96f6e1d\",\"license\":\"Apache-2.0\"}},\"version\":1}", 24 | "bytecode": "0x61020461003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 25 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 26 | "devdoc": { 27 | "author": "Stephen Chen", 28 | "kind": "dev", 29 | "methods": {}, 30 | "title": "Bit Mask Library", 31 | "version": 1 32 | }, 33 | "userdoc": { 34 | "kind": "user", 35 | "methods": { 36 | "getBit(mapping(uint256 => uint256) storage,uint256)": { 37 | "notice": "Get a bit in the bit mask" 38 | }, 39 | "setBit(mapping(uint256 => uint256) storage,uint256,bool)": { 40 | "notice": "Set a bit in the bit mask" 41 | } 42 | }, 43 | "notice": "Implements bit mask with dynamic array", 44 | "version": 1 45 | }, 46 | "storageLayout": { 47 | "storage": [], 48 | "types": null 49 | } 50 | } -------------------------------------------------------------------------------- /packages/contracts/deployments/metis_goerli/.chainId: -------------------------------------------------------------------------------- 1 | 599 -------------------------------------------------------------------------------- /packages/contracts/deployments/metis_goerli/Bitmask.json: -------------------------------------------------------------------------------- 1 | { 2 | "address": "0xF5B2d8c81cDE4D6238bBf20D3D77DB37df13f735", 3 | "abi": [], 4 | "transactionHash": "0xc6fcd9181f2feef4fab55e4ed6dbbf2eec87c1cdc6a00b304672eaf1de1dded0", 5 | "receipt": { 6 | "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", 7 | "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", 8 | "contractAddress": null, 9 | "transactionIndex": 0, 10 | "gasUsed": "165171", 11 | "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 12 | "blockHash": "0x35d9e6db7cf97366f4dc673a0e830225d4580ea26a1e2eeb5971395a16fcd344", 13 | "transactionHash": "0xc6fcd9181f2feef4fab55e4ed6dbbf2eec87c1cdc6a00b304672eaf1de1dded0", 14 | "logs": [], 15 | "blockNumber": 1732982, 16 | "cumulativeGasUsed": "165171", 17 | "status": 1, 18 | "byzantium": true 19 | }, 20 | "args": [], 21 | "numDeployments": 2, 22 | "solcInputHash": "18c7b3fb984a9ee861b83d1058d152f0", 23 | "metadata": "{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"author\":\"Stephen Chen\",\"kind\":\"dev\",\"methods\":{},\"title\":\"Bit Mask Library\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"getBit(mapping(uint256 => uint256) storage,uint256)\":{\"notice\":\"Get a bit in the bit mask\"},\"setBit(mapping(uint256 => uint256) storage,uint256,bool)\":{\"notice\":\"Set a bit in the bit mask\"}},\"notice\":\"Implements bit mask with dynamic array\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/Bitmask.sol\":\"Bitmask\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/Bitmask.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\"); you may not use\\n// this file except in compliance with the License. You may obtain a copy of the\\n// License at http://www.apache.org/licenses/LICENSE-2.0\\n\\n// Unless required by applicable law or agreed to in writing, software distributed\\n// under the License is distributed on an \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR\\n// CONDITIONS OF ANY KIND, either express or implied. See the License for the\\n// specific language governing permissions and limitations under the License.\\n\\npragma solidity ^0.8.0;\\n\\n/// @title Bit Mask Library\\n/// @author Stephen Chen\\n/// @notice Implements bit mask with dynamic array\\nlibrary Bitmask {\\n /// @notice Set a bit in the bit mask\\n function setBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit, bool _value) public {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n if (_value) {\\n bitmask[positionOfMask] = bitmask[positionOfMask] | (1 << positionOfBit);\\n } else {\\n bitmask[positionOfMask] = bitmask[positionOfMask] & ~(1 << positionOfBit);\\n }\\n }\\n\\n /// @notice Get a bit in the bit mask\\n function getBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit) public view returns (bool) {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n return ((bitmask[positionOfMask] & (1 << positionOfBit)) != 0);\\n }\\n}\\n\",\"keccak256\":\"0x606a3967f7444ce1dc07726e6c5cdcf48360000817c65b631e6ebd8fb96f6e1d\",\"license\":\"Apache-2.0\"}},\"version\":1}", 24 | "bytecode": "0x61020461003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 25 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 26 | "devdoc": { 27 | "author": "Stephen Chen", 28 | "kind": "dev", 29 | "methods": {}, 30 | "title": "Bit Mask Library", 31 | "version": 1 32 | }, 33 | "userdoc": { 34 | "kind": "user", 35 | "methods": { 36 | "getBit(mapping(uint256 => uint256) storage,uint256)": { 37 | "notice": "Get a bit in the bit mask" 38 | }, 39 | "setBit(mapping(uint256 => uint256) storage,uint256,bool)": { 40 | "notice": "Set a bit in the bit mask" 41 | } 42 | }, 43 | "notice": "Implements bit mask with dynamic array", 44 | "version": 1 45 | }, 46 | "storageLayout": { 47 | "storage": [], 48 | "types": null 49 | } 50 | } -------------------------------------------------------------------------------- /packages/contracts/deployments/optimism/.chainId: -------------------------------------------------------------------------------- 1 | 10 -------------------------------------------------------------------------------- /packages/contracts/deployments/optimism/Bitmask.json: -------------------------------------------------------------------------------- 1 | { 2 | "address": "0xF5B2d8c81cDE4D6238bBf20D3D77DB37df13f735", 3 | "abi": [], 4 | "transactionHash": "0x64d8e38a2560a9aa41770e52d23607756eb7bccb6cc61e6c78b533cec66f5010", 5 | "receipt": { 6 | "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", 7 | "from": "0x0e28A8f88C6266dF0FE274c15c1d4b27f8B373C0", 8 | "contractAddress": null, 9 | "transactionIndex": 5, 10 | "gasUsed": "165171", 11 | "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 12 | "blockHash": "0xae8a855ee872476fa4cb3ef4a153210c9e6d790da7a69cd0586b8ab100406fd0", 13 | "transactionHash": "0x64d8e38a2560a9aa41770e52d23607756eb7bccb6cc61e6c78b533cec66f5010", 14 | "logs": [], 15 | "blockNumber": 107308917, 16 | "cumulativeGasUsed": "1452096", 17 | "status": 1, 18 | "byzantium": true 19 | }, 20 | "args": [], 21 | "numDeployments": 2, 22 | "solcInputHash": "18c7b3fb984a9ee861b83d1058d152f0", 23 | "metadata": "{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"author\":\"Stephen Chen\",\"kind\":\"dev\",\"methods\":{},\"title\":\"Bit Mask Library\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"getBit(mapping(uint256 => uint256) storage,uint256)\":{\"notice\":\"Get a bit in the bit mask\"},\"setBit(mapping(uint256 => uint256) storage,uint256,bool)\":{\"notice\":\"Set a bit in the bit mask\"}},\"notice\":\"Implements bit mask with dynamic array\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/Bitmask.sol\":\"Bitmask\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/Bitmask.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\"); you may not use\\n// this file except in compliance with the License. You may obtain a copy of the\\n// License at http://www.apache.org/licenses/LICENSE-2.0\\n\\n// Unless required by applicable law or agreed to in writing, software distributed\\n// under the License is distributed on an \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR\\n// CONDITIONS OF ANY KIND, either express or implied. See the License for the\\n// specific language governing permissions and limitations under the License.\\n\\npragma solidity ^0.8.0;\\n\\n/// @title Bit Mask Library\\n/// @author Stephen Chen\\n/// @notice Implements bit mask with dynamic array\\nlibrary Bitmask {\\n /// @notice Set a bit in the bit mask\\n function setBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit, bool _value) public {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n if (_value) {\\n bitmask[positionOfMask] = bitmask[positionOfMask] | (1 << positionOfBit);\\n } else {\\n bitmask[positionOfMask] = bitmask[positionOfMask] & ~(1 << positionOfBit);\\n }\\n }\\n\\n /// @notice Get a bit in the bit mask\\n function getBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit) public view returns (bool) {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n return ((bitmask[positionOfMask] & (1 << positionOfBit)) != 0);\\n }\\n}\\n\",\"keccak256\":\"0x606a3967f7444ce1dc07726e6c5cdcf48360000817c65b631e6ebd8fb96f6e1d\",\"license\":\"Apache-2.0\"}},\"version\":1}", 24 | "bytecode": "0x61020461003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 25 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 26 | "devdoc": { 27 | "author": "Stephen Chen", 28 | "kind": "dev", 29 | "methods": {}, 30 | "title": "Bit Mask Library", 31 | "version": 1 32 | }, 33 | "userdoc": { 34 | "kind": "user", 35 | "methods": { 36 | "getBit(mapping(uint256 => uint256) storage,uint256)": { 37 | "notice": "Get a bit in the bit mask" 38 | }, 39 | "setBit(mapping(uint256 => uint256) storage,uint256,bool)": { 40 | "notice": "Set a bit in the bit mask" 41 | } 42 | }, 43 | "notice": "Implements bit mask with dynamic array", 44 | "version": 1 45 | }, 46 | "storageLayout": { 47 | "storage": [], 48 | "types": null 49 | } 50 | } -------------------------------------------------------------------------------- /packages/contracts/deployments/optimism_goerli/.chainId: -------------------------------------------------------------------------------- 1 | 420 -------------------------------------------------------------------------------- /packages/contracts/deployments/optimism_goerli/Bitmask.json: -------------------------------------------------------------------------------- 1 | { 2 | "address": "0xF5B2d8c81cDE4D6238bBf20D3D77DB37df13f735", 3 | "abi": [], 4 | "transactionHash": "0x211f749c902a0c8ab172574200795b9f22da7ab8b915e2af4239f9b5bee26270", 5 | "receipt": { 6 | "to": "0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7", 7 | "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", 8 | "contractAddress": null, 9 | "transactionIndex": 1, 10 | "gasUsed": "165171", 11 | "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 12 | "blockHash": "0xf411f1e917e33ff0d0221bffdca2f94ab01cab3073562294d6b64e10214780d1", 13 | "transactionHash": "0x211f749c902a0c8ab172574200795b9f22da7ab8b915e2af4239f9b5bee26270", 14 | "logs": [], 15 | "blockNumber": 12400256, 16 | "cumulativeGasUsed": "212072", 17 | "status": 1, 18 | "byzantium": true 19 | }, 20 | "args": [], 21 | "numDeployments": 4, 22 | "solcInputHash": "18c7b3fb984a9ee861b83d1058d152f0", 23 | "metadata": "{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"author\":\"Stephen Chen\",\"kind\":\"dev\",\"methods\":{},\"title\":\"Bit Mask Library\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"getBit(mapping(uint256 => uint256) storage,uint256)\":{\"notice\":\"Get a bit in the bit mask\"},\"setBit(mapping(uint256 => uint256) storage,uint256,bool)\":{\"notice\":\"Set a bit in the bit mask\"}},\"notice\":\"Implements bit mask with dynamic array\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/Bitmask.sol\":\"Bitmask\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/Bitmask.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\"); you may not use\\n// this file except in compliance with the License. You may obtain a copy of the\\n// License at http://www.apache.org/licenses/LICENSE-2.0\\n\\n// Unless required by applicable law or agreed to in writing, software distributed\\n// under the License is distributed on an \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR\\n// CONDITIONS OF ANY KIND, either express or implied. See the License for the\\n// specific language governing permissions and limitations under the License.\\n\\npragma solidity ^0.8.0;\\n\\n/// @title Bit Mask Library\\n/// @author Stephen Chen\\n/// @notice Implements bit mask with dynamic array\\nlibrary Bitmask {\\n /// @notice Set a bit in the bit mask\\n function setBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit, bool _value) public {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n if (_value) {\\n bitmask[positionOfMask] = bitmask[positionOfMask] | (1 << positionOfBit);\\n } else {\\n bitmask[positionOfMask] = bitmask[positionOfMask] & ~(1 << positionOfBit);\\n }\\n }\\n\\n /// @notice Get a bit in the bit mask\\n function getBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit) public view returns (bool) {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n return ((bitmask[positionOfMask] & (1 << positionOfBit)) != 0);\\n }\\n}\\n\",\"keccak256\":\"0x606a3967f7444ce1dc07726e6c5cdcf48360000817c65b631e6ebd8fb96f6e1d\",\"license\":\"Apache-2.0\"}},\"version\":1}", 24 | "bytecode": "0x61020461003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 25 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 26 | "devdoc": { 27 | "author": "Stephen Chen", 28 | "kind": "dev", 29 | "methods": {}, 30 | "title": "Bit Mask Library", 31 | "version": 1 32 | }, 33 | "userdoc": { 34 | "kind": "user", 35 | "methods": { 36 | "getBit(mapping(uint256 => uint256) storage,uint256)": { 37 | "notice": "Get a bit in the bit mask" 38 | }, 39 | "setBit(mapping(uint256 => uint256) storage,uint256,bool)": { 40 | "notice": "Set a bit in the bit mask" 41 | } 42 | }, 43 | "notice": "Implements bit mask with dynamic array", 44 | "version": 1 45 | }, 46 | "storageLayout": { 47 | "storage": [], 48 | "types": null 49 | } 50 | } -------------------------------------------------------------------------------- /packages/contracts/deployments/optimism_sepolia/.chainId: -------------------------------------------------------------------------------- 1 | 11155420 -------------------------------------------------------------------------------- /packages/contracts/deployments/polygon/.chainId: -------------------------------------------------------------------------------- 1 | 137 -------------------------------------------------------------------------------- /packages/contracts/deployments/polygon_mumbai/.chainId: -------------------------------------------------------------------------------- 1 | 80001 -------------------------------------------------------------------------------- /packages/contracts/deployments/sepolia/.chainId: -------------------------------------------------------------------------------- 1 | 11155111 -------------------------------------------------------------------------------- /packages/contracts/deployments/sepolia/Bitmask.json: -------------------------------------------------------------------------------- 1 | { 2 | "address": "0xF5B2d8c81cDE4D6238bBf20D3D77DB37df13f735", 3 | "abi": [], 4 | "args": [], 5 | "numDeployments": 4, 6 | "solcInputHash": "18c7b3fb984a9ee861b83d1058d152f0", 7 | "metadata": "{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"author\":\"Stephen Chen\",\"kind\":\"dev\",\"methods\":{},\"title\":\"Bit Mask Library\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"getBit(mapping(uint256 => uint256) storage,uint256)\":{\"notice\":\"Get a bit in the bit mask\"},\"setBit(mapping(uint256 => uint256) storage,uint256,bool)\":{\"notice\":\"Set a bit in the bit mask\"}},\"notice\":\"Implements bit mask with dynamic array\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/Bitmask.sol\":\"Bitmask\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/Bitmask.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\"); you may not use\\n// this file except in compliance with the License. You may obtain a copy of the\\n// License at http://www.apache.org/licenses/LICENSE-2.0\\n\\n// Unless required by applicable law or agreed to in writing, software distributed\\n// under the License is distributed on an \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR\\n// CONDITIONS OF ANY KIND, either express or implied. See the License for the\\n// specific language governing permissions and limitations under the License.\\n\\npragma solidity ^0.8.0;\\n\\n/// @title Bit Mask Library\\n/// @author Stephen Chen\\n/// @notice Implements bit mask with dynamic array\\nlibrary Bitmask {\\n /// @notice Set a bit in the bit mask\\n function setBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit, bool _value) public {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n if (_value) {\\n bitmask[positionOfMask] = bitmask[positionOfMask] | (1 << positionOfBit);\\n } else {\\n bitmask[positionOfMask] = bitmask[positionOfMask] & ~(1 << positionOfBit);\\n }\\n }\\n\\n /// @notice Get a bit in the bit mask\\n function getBit(mapping(uint256 => uint256) storage bitmask, uint256 _bit) public view returns (bool) {\\n // calculate the number of bits has been store in bitmask now\\n uint256 positionOfMask = uint256(_bit / 256);\\n uint256 positionOfBit = _bit % 256;\\n\\n return ((bitmask[positionOfMask] & (1 << positionOfBit)) != 0);\\n }\\n}\\n\",\"keccak256\":\"0x606a3967f7444ce1dc07726e6c5cdcf48360000817c65b631e6ebd8fb96f6e1d\",\"license\":\"Apache-2.0\"}},\"version\":1}", 8 | "bytecode": "0x61020461003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 9 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 10 | "devdoc": { 11 | "author": "Stephen Chen", 12 | "kind": "dev", 13 | "methods": {}, 14 | "title": "Bit Mask Library", 15 | "version": 1 16 | }, 17 | "userdoc": { 18 | "kind": "user", 19 | "methods": { 20 | "getBit(mapping(uint256 => uint256) storage,uint256)": { 21 | "notice": "Get a bit in the bit mask" 22 | }, 23 | "setBit(mapping(uint256 => uint256) storage,uint256,bool)": { 24 | "notice": "Set a bit in the bit mask" 25 | } 26 | }, 27 | "notice": "Implements bit mask with dynamic array", 28 | "version": 1 29 | }, 30 | "storageLayout": { 31 | "storage": [], 32 | "types": null 33 | } 34 | } -------------------------------------------------------------------------------- /packages/contracts/export/artifacts/contracts/Bitmask.sol/Bitmask.json: -------------------------------------------------------------------------------- 1 | { 2 | "contractName": "Bitmask", 3 | "sourceName": "contracts/Bitmask.sol", 4 | "abi": [], 5 | "bytecode": "0x61020461003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 6 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806303fbaf73146100455780636449da101461006c575b600080fd5b610058610053366004610130565b61008e565b604051901515815260200160405180910390f35b81801561007857600080fd5b5061008c610087366004610152565b6100ce565b005b60008061009d610100846101a6565b905060006100ad610100856101ba565b6000928352602095909552506040902054600190931b909216151592915050565b60006100dc610100846101a6565b905060006100ec610100856101ba565b9050821561011057600082815260208690526040902080546001831b179055610129565b600082815260208690526040902080546001831b191690555b5050505050565b6000806040838503121561014357600080fd5b50508035926020909101359150565b60008060006060848603121561016757600080fd5b83359250602084013591506040840135801515811461018557600080fd5b809150509250925092565b634e487b7160e01b600052601260045260246000fd5b6000826101b5576101b5610190565b500490565b6000826101c9576101c9610190565b50069056fea26469706673582212205733658d60667e5a9dc993e1c9ccf5fec105a4cfb880312e0e59e783894e9f8664736f6c63430008140033", 7 | "linkReferences": {}, 8 | "deployedLinkReferences": {}, 9 | "devdoc": { 10 | "author": "Stephen Chen", 11 | "kind": "dev", 12 | "methods": {}, 13 | "title": "Bit Mask Library", 14 | "version": 1 15 | }, 16 | "userdoc": { 17 | "kind": "user", 18 | "methods": { 19 | "getBit(mapping(uint256 => uint256) storage,uint256)": { 20 | "notice": "Get a bit in the bit mask" 21 | }, 22 | "setBit(mapping(uint256 => uint256) storage,uint256,bool)": { 23 | "notice": "Set a bit in the bit mask" 24 | } 25 | }, 26 | "notice": "Implements bit mask with dynamic array", 27 | "version": 1 28 | }, 29 | "evm": { 30 | "gasEstimates": { 31 | "creation": { 32 | "codeDepositCost": "103200", 33 | "executionCost": "184", 34 | "totalCost": "103384" 35 | }, 36 | "external": { 37 | "getBit(mapping(uint256 => uint256) storage,uint256)": "2605", 38 | "setBit(mapping(uint256 => uint256) storage,uint256,bool)": "24782" 39 | } 40 | }, 41 | "methodIdentifiers": { 42 | "getBit(mapping(uint256 => uint256) storage,uint256)": "03fbaf73", 43 | "setBit(mapping(uint256 => uint256) storage,uint256,bool)": "6449da10" 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /packages/contracts/export/artifacts/contracts/test/TestBitmask.sol/TestBitmask.json: -------------------------------------------------------------------------------- 1 | { 2 | "contractName": "TestBitmask", 3 | "sourceName": "contracts/test/TestBitmask.sol", 4 | "abi": [ 5 | { 6 | "inputs": [ 7 | { 8 | "internalType": "uint256", 9 | "name": "_bit", 10 | "type": "uint256" 11 | } 12 | ], 13 | "name": "getBit", 14 | "outputs": [ 15 | { 16 | "internalType": "bool", 17 | "name": "", 18 | "type": "bool" 19 | } 20 | ], 21 | "stateMutability": "view", 22 | "type": "function" 23 | }, 24 | { 25 | "inputs": [ 26 | { 27 | "internalType": "uint256", 28 | "name": "_bit", 29 | "type": "uint256" 30 | } 31 | ], 32 | "name": "setBit", 33 | "outputs": [], 34 | "stateMutability": "nonpayable", 35 | "type": "function" 36 | }, 37 | { 38 | "inputs": [ 39 | { 40 | "internalType": "uint256", 41 | "name": "_bit", 42 | "type": "uint256" 43 | } 44 | ], 45 | "name": "unsetBit", 46 | "outputs": [], 47 | "stateMutability": "nonpayable", 48 | "type": "function" 49 | } 50 | ], 51 | "bytecode": "0x608060405234801561001057600080fd5b5061024c806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c8063428be8071461004657806383363ef61461005b578063d991aeee1461006e575b600080fd5b6100596100543660046101d4565b610095565b005b6100596100693660046101d4565b61010a565b61008161007c3660046101d4565b610150565b604051901515815260200160405180910390f35b6040516306449da160e41b815260006004820181905260248201839052604482015273__$42c89e72d697364e16223415bf9649dea2$__90636449da10906064015b60006040518083038186803b1580156100ef57600080fd5b505af4158015610103573d6000803e3d6000fd5b5050505050565b6040516306449da160e41b815260006004820152602481018290526001604482015273__$42c89e72d697364e16223415bf9649dea2$__90636449da10906064016100d7565b6040516303fbaf7360e01b8152600060048201819052602482018390529073__$42c89e72d697364e16223415bf9649dea2$__906303fbaf7390604401602060405180830381865af41580156101aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101ce91906101ed565b92915050565b6000602082840312156101e657600080fd5b5035919050565b6000602082840312156101ff57600080fd5b8151801515811461020f57600080fd5b939250505056fea264697066735822122085936affc4f8f6b4a2f2e789769acaa2c40693f0a34c7b8e955e093b6bfebc9964736f6c63430008140033", 52 | "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c8063428be8071461004657806383363ef61461005b578063d991aeee1461006e575b600080fd5b6100596100543660046101d4565b610095565b005b6100596100693660046101d4565b61010a565b61008161007c3660046101d4565b610150565b604051901515815260200160405180910390f35b6040516306449da160e41b815260006004820181905260248201839052604482015273__$42c89e72d697364e16223415bf9649dea2$__90636449da10906064015b60006040518083038186803b1580156100ef57600080fd5b505af4158015610103573d6000803e3d6000fd5b5050505050565b6040516306449da160e41b815260006004820152602481018290526001604482015273__$42c89e72d697364e16223415bf9649dea2$__90636449da10906064016100d7565b6040516303fbaf7360e01b8152600060048201819052602482018390529073__$42c89e72d697364e16223415bf9649dea2$__906303fbaf7390604401602060405180830381865af41580156101aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101ce91906101ed565b92915050565b6000602082840312156101e657600080fd5b5035919050565b6000602082840312156101ff57600080fd5b8151801515811461020f57600080fd5b939250505056fea264697066735822122085936affc4f8f6b4a2f2e789769acaa2c40693f0a34c7b8e955e093b6bfebc9964736f6c63430008140033", 53 | "linkReferences": { 54 | "contracts/Bitmask.sol": { 55 | "Bitmask": [ 56 | { 57 | "length": 20, 58 | "start": 217 59 | }, 60 | { 61 | "length": 20, 62 | "start": 334 63 | }, 64 | { 65 | "length": 20, 66 | "start": 400 67 | } 68 | ] 69 | } 70 | }, 71 | "deployedLinkReferences": { 72 | "contracts/Bitmask.sol": { 73 | "Bitmask": [ 74 | { 75 | "length": 20, 76 | "start": 185 77 | }, 78 | { 79 | "length": 20, 80 | "start": 302 81 | }, 82 | { 83 | "length": 20, 84 | "start": 368 85 | } 86 | ] 87 | } 88 | }, 89 | "devdoc": { 90 | "kind": "dev", 91 | "methods": {}, 92 | "version": 1 93 | }, 94 | "userdoc": { 95 | "kind": "user", 96 | "methods": {}, 97 | "version": 1 98 | }, 99 | "evm": { 100 | "gasEstimates": { 101 | "creation": { 102 | "codeDepositCost": "117600", 103 | "executionCost": "165", 104 | "totalCost": "117765" 105 | }, 106 | "external": { 107 | "getBit(uint256)": "infinite", 108 | "setBit(uint256)": "infinite", 109 | "unsetBit(uint256)": "infinite" 110 | } 111 | }, 112 | "methodIdentifiers": { 113 | "getBit(uint256)": "d991aeee", 114 | "setBit(uint256)": "83363ef6", 115 | "unsetBit(uint256)": "428be807" 116 | } 117 | } 118 | } -------------------------------------------------------------------------------- /packages/contracts/foundry.toml: -------------------------------------------------------------------------------- 1 | [profile.default] 2 | src = 'contracts' 3 | out = 'out' 4 | cache_path = 'forge-cache' 5 | solc_version = '0.8.20' 6 | evm_version = 'paris' 7 | use_literal_content = true 8 | optimizer = true 9 | auto_detect_remappings = false 10 | -------------------------------------------------------------------------------- /packages/contracts/hardhat.config.ts: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy 3 | // of the license at http://www.apache.org/licenses/LICENSE-2.0 4 | 5 | // Unless required by applicable law or agreed to in writing, software 6 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 7 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 8 | // License for the specific language governing permissions and limitations 9 | // under the License. 10 | 11 | import { HardhatUserConfig } from "hardhat/config"; 12 | import { HttpNetworkUserConfig } from "hardhat/types"; 13 | import { getSingletonFactoryInfo } from "@safe-global/safe-singleton-factory"; 14 | 15 | import { 16 | Chain, 17 | arbitrum, 18 | arbitrumGoerli, 19 | arbitrumSepolia, 20 | avalanche, 21 | avalancheFuji, 22 | base, 23 | baseSepolia, 24 | bsc, 25 | bscTestnet, 26 | celo, 27 | celoAlfajores, 28 | fantom, 29 | fantomTestnet, 30 | gnosis, 31 | gnosisChiado, 32 | goerli, 33 | iotex, 34 | iotexTestnet, 35 | mainnet, 36 | metis, 37 | metisGoerli, 38 | optimism, 39 | optimismGoerli, 40 | optimismSepolia, 41 | polygon, 42 | polygonMumbai, 43 | sepolia, 44 | } from "viem/chains"; 45 | 46 | import "@nomicfoundation/hardhat-chai-matchers"; 47 | import "@nomicfoundation/hardhat-ethers"; 48 | import "@nomicfoundation/hardhat-verify"; 49 | import "@typechain/hardhat"; 50 | import "hardhat-deploy"; 51 | import "solidity-coverage"; 52 | 53 | // read MNEMONIC from file or from env variable 54 | let mnemonic = process.env.MNEMONIC; 55 | 56 | const networkConfig = (chain: Chain): HttpNetworkUserConfig => { 57 | let url = chain.rpcUrls.default.http.at(0); 58 | 59 | // support for infura and alchemy URLs through env variables 60 | if (process.env.INFURA_ID && chain.rpcUrls.infura?.http) { 61 | url = `${chain.rpcUrls.infura.http}/${process.env.INFURA_ID}`; 62 | } else if (process.env.ALCHEMY_ID && chain.rpcUrls.alchemy?.http) { 63 | url = `${chain.rpcUrls.alchemy.http}/${process.env.ALCHEMY_ID}`; 64 | } 65 | 66 | return { 67 | chainId: chain.id, 68 | url, 69 | accounts: mnemonic ? { mnemonic } : undefined, 70 | }; 71 | }; 72 | 73 | const config: HardhatUserConfig = { 74 | networks: { 75 | hardhat: mnemonic ? { accounts: { mnemonic } } : {}, 76 | localhost: { 77 | url: process.env.RPC_URL || "http://localhost:8545", 78 | accounts: mnemonic ? { mnemonic } : undefined, 79 | }, 80 | arbitrum: networkConfig(arbitrum), 81 | arbitrum_goerli: networkConfig(arbitrumGoerli), 82 | arbitrum_sepolia: networkConfig(arbitrumSepolia), 83 | avalanche: networkConfig(avalanche), 84 | avalanche_fuji: networkConfig(avalancheFuji), 85 | base: networkConfig(base), 86 | base_sepolia: networkConfig(baseSepolia), 87 | bsc: networkConfig(bsc), 88 | bsc_testnet: networkConfig(bscTestnet), 89 | celo: networkConfig(celo), 90 | celo_testnet: networkConfig(celoAlfajores), 91 | chiado: networkConfig(gnosisChiado), 92 | fantom: networkConfig(fantom), 93 | fantom_testnet: networkConfig(fantomTestnet), 94 | gnosis: networkConfig(gnosis), 95 | goerli: networkConfig(goerli), 96 | iotex: networkConfig(iotex), 97 | iotex_testnet: networkConfig(iotexTestnet), 98 | mainnet: networkConfig(mainnet), 99 | metis: networkConfig(metis), 100 | metis_goerli: networkConfig(metisGoerli), 101 | optimism: networkConfig(optimism), 102 | optimism_goerli: networkConfig(optimismGoerli), 103 | optimism_sepolia: networkConfig(optimismSepolia), 104 | polygon: networkConfig(polygon), 105 | polygon_mumbai: networkConfig(polygonMumbai), 106 | sepolia: networkConfig(sepolia), 107 | }, 108 | solidity: { 109 | compilers: [ 110 | { 111 | version: "0.8.20", 112 | settings: { 113 | optimizer: { 114 | enabled: true, 115 | }, 116 | evmVersion: "paris", 117 | }, 118 | }, 119 | ], 120 | }, 121 | deterministicDeployment: (network: string) => { 122 | // networks will use another deterministic deployment proxy 123 | // https://github.com/safe-global/safe-singleton-factory 124 | const chainId = parseInt(network); 125 | const info = getSingletonFactoryInfo(chainId); 126 | if (info) { 127 | return { 128 | factory: info.address, 129 | deployer: info.signerAddress, 130 | funding: ( 131 | BigInt(info.gasPrice) * BigInt(info.gasLimit) 132 | ).toString(), 133 | signedTx: info.transaction, 134 | }; 135 | } else { 136 | console.warn( 137 | `unsupported deterministic deployment for network ${network}`, 138 | ); 139 | return undefined; 140 | } 141 | }, 142 | paths: { 143 | artifacts: "artifacts", 144 | deploy: "deploy", 145 | deployments: "deployments", 146 | }, 147 | typechain: { 148 | outDir: "src/types", 149 | target: "ethers-v6", 150 | }, 151 | etherscan: { 152 | apiKey: process.env.ETHERSCAN_API_KEY, 153 | customChains: [ 154 | { 155 | chainId: 421614, 156 | network: "arbitrum_sepolia", 157 | urls: { 158 | apiURL: "https://api-sepolia.arbiscan.io/api", 159 | browserURL: "https://sepolia.arbiscan.io", 160 | }, 161 | }, 162 | { 163 | chainId: 11155420, 164 | network: "optimism_sepolia", 165 | urls: { 166 | apiURL: "https://api-sepolia-optimistic.etherscan.io/api", 167 | browserURL: "https://sepolia-optimism.etherscan.io", 168 | }, 169 | }, 170 | ], 171 | }, 172 | namedAccounts: { 173 | deployer: { 174 | default: 0, 175 | }, 176 | user: { 177 | default: 1, 178 | }, 179 | }, 180 | }; 181 | 182 | export default config; 183 | -------------------------------------------------------------------------------- /packages/contracts/test/TestBitmask.ts: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy 3 | // of the license at http://www.apache.org/licenses/LICENSE-2.0 4 | 5 | // Unless required by applicable law or agreed to in writing, software 6 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 7 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 8 | // License for the specific language governing permissions and limitations 9 | // under the License. 10 | 11 | import { expect } from "chai"; 12 | import { deployments, ethers } from "hardhat"; 13 | 14 | import { TestBitmask } from "../src/types/test/TestBitmask"; 15 | import { TestBitmask__factory } from "../src/types/factories/test/TestBitmask__factory"; 16 | 17 | describe("TestBitmask", async () => { 18 | let TestBitmask: TestBitmask; 19 | 20 | beforeEach(async () => { 21 | await deployments.fixture(); 22 | 23 | const [user] = await ethers.getSigners(); 24 | 25 | const BitmaskAddress = (await deployments.get("Bitmask")).address; 26 | const { deploy } = deployments; 27 | const { address } = await deploy("TestBitmask", { 28 | from: user.address, 29 | log: true, 30 | libraries: { 31 | ["Bitmask"]: BitmaskAddress, 32 | }, 33 | }); 34 | 35 | TestBitmask = TestBitmask__factory.connect(address, user); 36 | }); 37 | 38 | it("setting and getting bits", async () => { 39 | const testBits = [ 40 | "0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe", 41 | 510, 42 | 511, 43 | 512, 44 | 513, 45 | 0, 46 | 1, 47 | 254, 48 | 255, 49 | 256, 50 | 257, 51 | ]; 52 | for (const bit of testBits) { 53 | // bit should not be set by default 54 | expect(await TestBitmask.getBit(bit)).to.be.false; 55 | 56 | // set bit 57 | await TestBitmask.setBit(bit); 58 | expect(await TestBitmask.getBit(bit)).to.be.true; 59 | 60 | // unset bit 61 | await TestBitmask.unsetBit(bit); 62 | expect(await TestBitmask.getBit(bit)).to.be.false; 63 | } 64 | }); 65 | }); 66 | -------------------------------------------------------------------------------- /packages/contracts/test/TestLogarithm.ts: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use 3 | // this file except in compliance with the License. You may obtain a copy of the 4 | // License at http://www.apache.org/licenses/LICENSE-2.0 5 | 6 | // Unless required by applicable law or agreed to in writing, software distributed 7 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 8 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | // specific language governing permissions and limitations under the License. 10 | 11 | import { expect } from "chai"; 12 | import { deployments, ethers } from "hardhat"; 13 | import { MaxUint256 } from "ethers"; 14 | import Decimal from "decimal.js"; 15 | 16 | import { UnrolledCordic } from "../src/types/UnrolledCordic"; 17 | import { UnrolledCordic__factory } from "../src/types/factories/UnrolledCordic__factory"; 18 | 19 | Decimal.set({ precision: 120 }); 20 | 21 | const groundTruthRaw = require("./ground-truth.json"); 22 | const groundTruth = groundTruthRaw.map(([first, second]: [string, string]) => [ 23 | first, 24 | new Decimal(second), 25 | ]); 26 | 27 | const decToBN = (v: Decimal) => BigInt(v.floor().toFixed()); 28 | const bnToDec = (v: bigint) => new Decimal(v.toString()); 29 | 30 | const baseMultiplierDec = new Decimal("1e+18"); 31 | const baseMultiplierBN = decToBN(baseMultiplierDec); 32 | 33 | describe("Test Logarithms Algorithms", async () => { 34 | let cordic: UnrolledCordic; 35 | 36 | before(async () => { 37 | await deployments.fixture(); 38 | const [user] = await ethers.getSigners(); 39 | const UnrolledCordicAddress = (await deployments.get("UnrolledCordic")) 40 | .address; 41 | cordic = UnrolledCordic__factory.connect(UnrolledCordicAddress, user); 42 | }); 43 | 44 | it("Check ground truth logs for Cordic", async () => { 45 | let max_err = new Decimal(0); 46 | let max_gas = 0n; 47 | let min_gas = MaxUint256; 48 | const tasks = groundTruth.map(async ([x, logx]: [string, Decimal]) => { 49 | const raw = await cordic.log2Times1e18(x); 50 | const gas = await cordic.log2Times1e18.estimateGas(x); 51 | const result = bnToDec(raw).dividedBy("1e18"); 52 | const err = Decimal.abs(result.minus(logx)); 53 | if (err.greaterThan(max_err)) max_err = err; 54 | if (gas > max_gas) max_gas = gas; 55 | if (gas < min_gas) min_gas = gas; 56 | }); 57 | await Promise.all(tasks); 58 | let errString = max_err.toSignificantDigits(10); 59 | console.debug( 60 | `\t\tGround truth logs of Cordic: Max error ${errString}`, 61 | ); 62 | console.debug( 63 | `\t\t Max Gas: ${max_gas.toString()}, Min Gas: ${min_gas.toString()}`, 64 | ); 65 | expect(max_err.lessThan("1e-17"), "error larger than 1e-17").to.be.true; 66 | }).timeout(60 * 1000 * 60); 67 | 68 | it("Check random logs in 2^i, i =[0,255], for Cordic", async () => { 69 | let max_err = new Decimal(0); 70 | let max_gas = 0n; 71 | let min_gas = MaxUint256; 72 | const tasks = [...Array(255).keys()].map(async (i) => { 73 | const x = Decimal.pow(2, Decimal.random().add(i)).floor(); 74 | const gas = await cordic.log2Times1e18.estimateGas(x.toFixed()); 75 | const raw = await cordic.log2Times1e18(x.toFixed()); 76 | const result = bnToDec(raw).dividedBy("1e18"); 77 | const logx = Decimal.log2(x); 78 | const err = Decimal.abs(result.minus(logx)); 79 | if (err.greaterThan(max_err)) max_err = err; 80 | if (gas > max_gas) max_gas = gas; 81 | if (gas < min_gas) min_gas = gas; 82 | }); 83 | await Promise.all(tasks); 84 | let errString = max_err.toSignificantDigits(10); 85 | console.debug(`\t\tRandom Logs of Cordic: Max error ${errString}`); 86 | console.debug( 87 | `\t\t Max Gas: ${max_gas.toString()}, Min Gas: ${min_gas.toString()}`, 88 | ); 89 | expect(max_err.lessThan("1e-17"), "error larger than 1e-17").to.be.true; 90 | }).timeout(60 * 1000 * 60); 91 | }); 92 | -------------------------------------------------------------------------------- /packages/contracts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "declaration": true, 4 | "target": "es2020", 5 | "module": "commonjs", 6 | "allowJs": true, 7 | "strict": true, 8 | "resolveJsonModule": true, 9 | "esModuleInterop": true, 10 | "outDir": "dist", 11 | "skipLibCheck": true 12 | }, 13 | "exclude": ["dist", "node_modules"] 14 | } 15 | -------------------------------------------------------------------------------- /packages/ethers-v5/.gitignore: -------------------------------------------------------------------------------- 1 | /dist 2 | /types 3 | -------------------------------------------------------------------------------- /packages/ethers-v5/.prettierignore: -------------------------------------------------------------------------------- 1 | dist 2 | types 3 | -------------------------------------------------------------------------------- /packages/ethers-v5/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@cartesi/util-ethers-v5", 3 | "version": "6.4.0", 4 | "description": "Cartesi Solidity Util Typechain Ethers V5", 5 | "main": "dist/index.js", 6 | "types": "dist/index.d.ts", 7 | "author": "Danilo Tuler", 8 | "license": "Apache-2.0", 9 | "scripts": { 10 | "codegen": "typechain --target=ethers-v5 '../contracts/export/artifacts/**/*.json'", 11 | "compile": "tsc", 12 | "build": "run-s codegen compile", 13 | "prepack": "run-s build" 14 | }, 15 | "dependencies": { 16 | "@cartesi/util": "workspace:*", 17 | "ethers": "^5", 18 | "tslib": "^2.8.1" 19 | }, 20 | "devDependencies": { 21 | "@typechain/ethers-v5": "^11", 22 | "npm-run-all": "^4", 23 | "tsconfig": "workspace:*", 24 | "typechain": "^8", 25 | "typescript": "^5" 26 | }, 27 | "peerDependencies": { 28 | "@ethersproject/abi": "^5.7.0", 29 | "@ethersproject/providers": "^5.7.2" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /packages/ethers-v5/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "tsconfig/base.json", 3 | "include": ["types/**/*.ts"], 4 | "exclude": ["node_modules"], 5 | "compilerOptions": { 6 | "module": "es2020", 7 | "importHelpers": true, 8 | "outDir": "dist" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/ethers-v6/.gitignore: -------------------------------------------------------------------------------- 1 | /dist 2 | /types 3 | -------------------------------------------------------------------------------- /packages/ethers-v6/.prettierignore: -------------------------------------------------------------------------------- 1 | dist 2 | types 3 | -------------------------------------------------------------------------------- /packages/ethers-v6/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@cartesi/util-ethers-v6", 3 | "version": "6.4.0", 4 | "description": "Cartesi Solidity Util Typechain Ethers V6", 5 | "main": "dist/index.js", 6 | "types": "dist/index.d.ts", 7 | "author": "Danilo Tuler", 8 | "license": "Apache-2.0", 9 | "scripts": { 10 | "codegen": "typechain --target=ethers-v6 '../contracts/export/artifacts/**/*.json'", 11 | "compile": "tsc", 12 | "build": "run-s codegen compile", 13 | "prepack": "run-s build" 14 | }, 15 | "dependencies": { 16 | "@cartesi/util": "workspace:*", 17 | "ethers": "^6" 18 | }, 19 | "devDependencies": { 20 | "@typechain/ethers-v6": "^0.5", 21 | "npm-run-all": "^4", 22 | "tsconfig": "workspace:*", 23 | "typechain": "^8", 24 | "typescript": "^5" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /packages/ethers-v6/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "tsconfig/base.json", 3 | "include": ["types/**/*.ts"], 4 | "exclude": ["node_modules"], 5 | "compilerOptions": { 6 | "module": "es2020", 7 | "importHelpers": true, 8 | "outDir": "dist" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/tsconfig/README.md: -------------------------------------------------------------------------------- 1 | # `tsconfig` 2 | 3 | These are base shared `tsconfig.json`s from which all other `tsconfig.json`'s inherit from. 4 | -------------------------------------------------------------------------------- /packages/tsconfig/base.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "display": "Default", 4 | "compilerOptions": { 5 | "composite": false, 6 | "declaration": true, 7 | "declarationMap": true, 8 | "esModuleInterop": true, 9 | "forceConsistentCasingInFileNames": true, 10 | "inlineSources": false, 11 | "isolatedModules": true, 12 | "moduleResolution": "node", 13 | "noUnusedLocals": false, 14 | "noUnusedParameters": false, 15 | "preserveWatchOutput": true, 16 | "skipLibCheck": true, 17 | "strict": true 18 | }, 19 | "exclude": ["node_modules"] 20 | } 21 | -------------------------------------------------------------------------------- /packages/tsconfig/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tsconfig", 3 | "version": "0.0.0", 4 | "private": true, 5 | "files": [ 6 | "base.json" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /packages/wagmi/.gitignore: -------------------------------------------------------------------------------- 1 | /dist 2 | /node_modules 3 | src/index.ts 4 | -------------------------------------------------------------------------------- /packages/wagmi/.prettierignore: -------------------------------------------------------------------------------- 1 | dist 2 | src 3 | -------------------------------------------------------------------------------- /packages/wagmi/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@cartesi/util-wagmi", 3 | "version": "6.4.0", 4 | "description": "Cartesi Solidity Util Wagmi Bindings", 5 | "main": "dist/index.js", 6 | "author": "Danilo Tuler", 7 | "license": "Apache-2.0", 8 | "scripts": { 9 | "codegen": "wagmi generate", 10 | "compile": "tsc", 11 | "build": "run-s codegen compile", 12 | "prepack": "run-s build" 13 | }, 14 | "dependencies": { 15 | "@cartesi/util": "workspace:*" 16 | }, 17 | "devDependencies": { 18 | "@wagmi/cli": "^2.1.4", 19 | "npm-run-all": "^4", 20 | "tsconfig": "workspace:*", 21 | "typescript": "^5" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/wagmi/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "tsconfig/base.json", 3 | "include": ["src/**/*.ts"], 4 | "exclude": ["node_modules"], 5 | "compilerOptions": { 6 | "module": "es2020", 7 | "importHelpers": true, 8 | "outDir": "dist", 9 | "rootDir": "src" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/wagmi/wagmi.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from "@wagmi/cli"; 2 | import { hardhat } from "@wagmi/cli/plugins"; 3 | 4 | export default defineConfig({ 5 | out: "src/index.ts", 6 | contracts: [], 7 | plugins: [hardhat({ project: "../contracts" })], 8 | }); 9 | -------------------------------------------------------------------------------- /pnpm-workspace.yaml: -------------------------------------------------------------------------------- 1 | packages: 2 | - "packages/*" 3 | -------------------------------------------------------------------------------- /turbo.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://turbo.build/schema.json", 3 | "globalEnv": ["NODE_ENV"], 4 | "pipeline": { 5 | "build": { 6 | "dependsOn": ["^build"], 7 | "outputs": ["build/**", "dist/**", ".next/**"] 8 | }, 9 | "start": { 10 | "dependsOn": ["^build"] 11 | }, 12 | "lint": { 13 | "outputs": [] 14 | }, 15 | "dev": { 16 | "cache": false 17 | } 18 | } 19 | } 20 | --------------------------------------------------------------------------------