Repository: Project-DARC/DARC Branch: main Commit: 482bd1acfcf3 Files: 163 Total size: 2.4 MB Directory structure: gitextract_poekpy89/ ├── .github/ │ ├── ISSUE_TEMPLATE/ │ │ ├── bug_report.md │ │ ├── custom.md │ │ └── feature_request.md │ └── workflows/ │ └── ReleaseAWSS3.yml ├── .gitignore ├── LICENSE ├── README.md ├── README_cn.md ├── README_ja.md ├── darc-docs/ │ ├── README.md │ ├── babel.config.js │ ├── blog/ │ │ ├── 2019-05-28-first-blog-post.md │ │ ├── 2019-05-29-long-blog-post.md │ │ ├── 2021-08-01-mdx-blog-post.mdx │ │ ├── 2021-08-26-welcome/ │ │ │ └── index.md │ │ └── authors.yml │ ├── docs/ │ │ ├── By-law Script/ │ │ │ ├── Getting Started.md │ │ │ └── _category_.json │ │ ├── DARC Protocol/ │ │ │ ├── Condition Nodes.md │ │ │ ├── Getting Started.md │ │ │ ├── OpCodes.md │ │ │ └── _category_.json │ │ ├── Overview/ │ │ │ ├── Overview.md │ │ │ └── _category_.json │ │ └── darc.js/ │ │ ├── Getting Started.md │ │ └── _category_.json │ ├── docusaurus.config.js │ ├── package.json │ ├── sidebars.js │ ├── src/ │ │ ├── components/ │ │ │ └── HomepageFeatures/ │ │ │ ├── index.js │ │ │ └── styles.module.css │ │ ├── css/ │ │ │ └── custom.css │ │ ├── pages/ │ │ │ ├── index.js │ │ │ ├── index.module.css │ │ │ └── markdown-page.md │ │ └── theme.ts │ └── static/ │ └── .nojekyll ├── darc-js/ │ ├── README.md │ ├── package.json │ ├── src/ │ │ ├── DARC/ │ │ │ └── DARC.ts │ │ ├── SDK/ │ │ │ ├── Node.ts │ │ │ ├── conditionNodes/ │ │ │ │ ├── Condition_BatchOp.ts │ │ │ │ ├── Condition_CreateTokenClass.ts │ │ │ │ ├── Condition_MachineState.ts │ │ │ │ ├── Condition_MembershipOp.ts │ │ │ │ ├── Condition_Operation.ts │ │ │ │ ├── Condition_OperationLog.ts │ │ │ │ ├── Condition_Operator.ts │ │ │ │ ├── Condition_PluginAndVoting.ts │ │ │ │ ├── Condition_Program.ts │ │ │ │ ├── Condition_TokenAndCash.ts │ │ │ │ └── Condition_Withdrawable.ts │ │ │ ├── includes.ts │ │ │ ├── opcodes/ │ │ │ │ ├── opcodeTable.ts │ │ │ │ ├── pluginProcessor.ts │ │ │ │ └── utils.ts │ │ │ ├── plugins/ │ │ │ │ ├── ConditionNode.ts │ │ │ │ └── Expression.ts │ │ │ ├── runtime.ts │ │ │ └── transpiler.ts │ │ ├── darcBinary/ │ │ │ ├── DARC-latest.json │ │ │ ├── DARC-test.json │ │ │ └── darcBinary.ts │ │ ├── darcjs.ts │ │ ├── deployDARC/ │ │ │ └── deployDARC.ts │ │ ├── index.ts │ │ ├── sdk.ts │ │ └── types/ │ │ └── basicTypes.ts │ ├── tests/ │ │ ├── basic-DARC-test/ │ │ │ ├── dashboard-test.ts │ │ │ └── deploy-DARC-test.ts │ │ ├── deploy-test.ts │ │ ├── expression-test/ │ │ │ └── expression-test.ts │ │ ├── runtime-test/ │ │ │ ├── basic-runtime-test.ts │ │ │ ├── pressure-mint-token-test.ts │ │ │ ├── pressure-offer-dividends-test.ts │ │ │ ├── transpileAndRun.ts │ │ │ └── transpiler-operator-test.ts │ │ └── sdk-test/ │ │ ├── basic-node-test.ts │ │ ├── sdk-node-generation-test.ts │ │ └── sdk-test.ts │ └── tsconfig.json └── darc-protocol/ ├── README.md ├── contracts/ │ ├── protocol/ │ │ ├── DARC.sol │ │ ├── Dashboard/ │ │ │ └── Dashboard.sol │ │ ├── MachineState.sol │ │ ├── MachineStateManager.sol │ │ ├── Opcodes.sol │ │ ├── Plugin/ │ │ │ ├── ConditionExpressionFactory.sol │ │ │ ├── Condition_BatchOp.sol │ │ │ ├── Condition_CreateTokenClass.sol │ │ │ ├── Condition_External.sol │ │ │ ├── Condition_MachineState.sol │ │ │ ├── Condition_MembershipOp.sol │ │ │ ├── Condition_Operation.sol │ │ │ ├── Condition_OperationLog.sol │ │ │ ├── Condition_Operator.sol │ │ │ ├── Condition_PluginAndVoting.sol │ │ │ ├── Condition_Program.sol │ │ │ ├── Condition_TokenAndCash.sol │ │ │ ├── Condition_Withdrawable.sol │ │ │ ├── EnumConditionExpression.sol.old │ │ │ ├── PluginFactory.sol │ │ │ └── PluginSystem.sol │ │ ├── Plugin.sol │ │ ├── Program.sol │ │ ├── Runtime/ │ │ │ ├── Executable/ │ │ │ │ ├── Executable.sol │ │ │ │ ├── InstructionMachine.sol │ │ │ │ └── Instructions/ │ │ │ │ ├── MembershipInstructions.sol │ │ │ │ ├── MoneyInstructions.sol │ │ │ │ ├── OfferDividendsInstructions.sol │ │ │ │ ├── ParameterInstructions.sol │ │ │ │ ├── PluginInstructions.sol │ │ │ │ ├── TokenInstructions.sol │ │ │ │ └── UtilityInstructions.sol │ │ │ ├── PaymentCheck/ │ │ │ │ └── PaymentCheck.sol │ │ │ ├── ProgramValidator/ │ │ │ │ └── ProgramValidator.sol │ │ │ ├── Runtime.sol │ │ │ └── VotingMachine/ │ │ │ └── VotingMachine.sol │ │ ├── TokenOwnerListManager.sol │ │ ├── Utilities/ │ │ │ ├── ArrayUtils.sol │ │ │ ├── ErrorMsg.sol │ │ │ ├── ExternalValueReader.sol │ │ │ ├── OpcodeMap.sol │ │ │ └── StringUtils.sol │ │ └── VirtualMachine.sol │ └── test-contracts/ │ ├── TestBaseContract.sol │ ├── TestOracleContract.sol │ ├── test-ABI-call/ │ │ └── ABICallTestContract.sol │ └── test-voting/ │ ├── VotingTest.sol.old │ └── VotingTestBase.sol ├── hardhat.config.ts ├── package.json ├── scripts/ │ ├── deployDARC.ts │ └── getABI.ts ├── test/ │ ├── MultiDARCTest/ │ │ ├── Multi_DARC_call_test.ts │ │ └── Multi_DARC_call_with_payment_test.ts │ ├── conditionTest/ │ │ ├── externalCallTest.ts │ │ └── operationLogTest.ts │ ├── operationUnitTest/ │ │ ├── batch_add_and_enable_plugin_test.ts │ │ ├── batch_add_membership_test.ts │ │ ├── batch_add_withdrawable_balances_test.ts │ │ ├── batch_burn_tokens_from_test.ts │ │ ├── batch_burn_tokens_test.ts │ │ ├── batch_create_token_class_test.ts │ │ ├── batch_mint_token_test.ts │ │ ├── batch_pay_to_mint_tokens_test.ts │ │ ├── batch_pay_to_transfer_tokens_test.ts │ │ ├── batch_transfer_tokens.ts │ │ ├── batch_transfer_tokens_from_to.ts │ │ ├── call_contract_abi_test.ts │ │ └── offer_dividends_test.ts │ ├── paymentUnitTest/ │ │ └── payment_pay_cash_test.ts │ ├── pluginTest/ │ │ ├── operator_AND_test.ts │ │ └── operator_OR_test.ts │ ├── votingTest/ │ │ ├── multiAddressVotingTest.ts │ │ ├── multiClassTokenVotingTest.ts │ │ ├── multiItemVotingNegativeTest.ts │ │ ├── multiItemVotingTest.ts │ │ ├── singleVoteNegativeTest.ts │ │ └── singleVotingTest.ts │ └── withdrawTest/ │ ├── withdrawCashTest.ts │ └── withdrawDividendTest.ts └── tsconfig.json ================================================ FILE CONTENTS ================================================ ================================================ FILE: .github/ISSUE_TEMPLATE/bug_report.md ================================================ --- name: Bug report about: Create a report to help us improve title: '' labels: '' assignees: '' --- **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior: 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' 4. See error **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Desktop (please complete the following information):** - OS: [e.g. iOS] - Browser [e.g. chrome, safari] - Version [e.g. 22] **Smartphone (please complete the following information):** - Device: [e.g. iPhone6] - OS: [e.g. iOS8.1] - Browser [e.g. stock browser, safari] - Version [e.g. 22] **Additional context** Add any other context about the problem here. ================================================ FILE: .github/ISSUE_TEMPLATE/custom.md ================================================ --- name: Custom issue template about: Describe this issue template's purpose here. title: '' labels: '' assignees: '' --- ================================================ FILE: .github/ISSUE_TEMPLATE/feature_request.md ================================================ --- name: Feature request about: Suggest an idea for this project title: '' labels: '' assignees: '' --- **Is your feature request related to a problem? Please describe.** A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] **Describe the solution you'd like** A clear and concise description of what you want to happen. **Describe alternatives you've considered** A clear and concise description of any alternative solutions or features you've considered. **Additional context** Add any other context or screenshots about the feature request here. ================================================ FILE: .github/workflows/ReleaseAWSS3.yml ================================================ # This is a basic workflow to help you get started with Actions name: ReleaseAWSS3 on: push: branches: - main jobs: deploy: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 - name: Use Node.js 20.x uses: actions/setup-node@v3 with: node-version: '20.x' - name: Install Dependencies working-directory: ./darc-docs run: | npm install - name: Build working-directory: ./darc-docs run: npm run build env: CI: true - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v1 with: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: us-east-1 - name: Deploy static site to S3 bucket working-directory: ./darc-docs run: aws s3 sync ./build s3://darc-website --delete ================================================ FILE: .gitignore ================================================ node_modules .env coverage coverage.json typechain typechain-types # Hardhat files cache artifacts # Docusaurus files darc-docs/.docusaurus # Idea files .idea/ # Darc docs Compiled output darc-docs/build darc-docs/static/api darc-js/dist ================================================ FILE: LICENSE ================================================ Business Source License 1.1 License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved. "Business Source License" is a trademark of MariaDB Corporation Ab. ----------------------------------------------------------------------------- Parameters Licensor: DARC Team Licensed Work: DARC Additional Use Grant: TBA Change Date: The earlier of 2038-01-01 or a date specified at TBA Change License: GNU General Public License v3.0 or later ----------------------------------------------------------------------------- Terms The Licensor hereby grants you the right to copy, modify, create derivative works, redistribute, and make non-production use of the Licensed Work. The Licensor may make an Additional Use Grant, above, permitting limited production use. Effective on the Change Date, or the fourth anniversary of the first publicly available distribution of a specific version of the Licensed Work under this License, whichever comes first, the Licensor hereby grants you rights under the terms of the Change License, and the rights granted in the paragraph above terminate. If your use of the Licensed Work does not comply with the requirements currently in effect as described in this License, you must purchase a commercial license from the Licensor, its affiliated entities, or authorized resellers, or you must refrain from using the Licensed Work. All copies of the original and modified Licensed Work, and derivative works of the Licensed Work, are subject to this License. This License applies separately for each version of the Licensed Work and the Change Date may vary for each version of the Licensed Work released by Licensor. You must conspicuously display this License on each original or modified copy of the Licensed Work. If you receive the Licensed Work in original or modified form from a third party, the terms and conditions set forth in this License apply to your use of that work. Any use of the Licensed Work in violation of this License will automatically terminate your rights under this License for the current and all other versions of the Licensed Work. This License does not grant you any right in any trademark or logo of Licensor or its affiliates (provided that you may use a trademark or logo of Licensor as expressly required by this License). TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND TITLE. MariaDB hereby grants you permission to use this License’s text to license your works, and to refer to it using the trademark "Business Source License", as long as you comply with the Covenants of Licensor below. ----------------------------------------------------------------------------- Covenants of Licensor In consideration of the right to use this License’s text and the "Business Source License" name and trademark, Licensor covenants to MariaDB, and to all other recipients of the licensed work to be provided by Licensor: 1. To specify as the Change License the GPL Version 2.0 or any later version, or a license that is compatible with GPL Version 2.0 or a later version, where "compatible" means that software provided under the Change License can be included in a program with software provided under GPL Version 2.0 or a later version. Licensor may specify additional Change Licenses without limitation. 2. To either: (a) specify an additional grant of rights to use that does not impose any additional restriction on the right granted in this License, as the Additional Use Grant; or (b) insert the text "None". 3. To specify a Change Date. 4. Not to modify this License in any other way. ----------------------------------------------------------------------------- Notice The Business Source License (this document, or the "License") is not an Open Source license. However, the Licensed Work will eventually be made available under an Open Source License, as stated in this License. ================================================ FILE: README.md ================================================ # Decentralized Autonomous Regulated Company (DARC) Welcome to the official repository for the Decentralized Autonomous Regulated Company (DARC) project. DARC is a project that aims to create a decentralized autonomous company that is regulated by a plugin system based on commercial laws. The project is currently in the early stages of development and is not yet ready for production use. English | [简体中文](./README_cn.md) | [日本語](./README_ja.md) ## Star History [![Star History Chart](https://api.star-history.com/svg?repos=project-darc/darc&type=Date)](https://star-history.com/#project-darc/darc&Date) ## Join our community Telegram: [https://t.me/projectdarc](https://t.me/projectdarc) Discord: [https://discord.gg/QzKbTHVgGG](https://discord.gg/QzKbTHVgGG) ## Whitepaper English: [darc-whitepaper.pdf](https://github.com/Project-DARC/DARC-whitepaper/blob/release/darc-whitepaper.pdf) Chinese(中文版): [darc-whitepaper-cn.pdf](https://github.com/Project-DARC/DARC-whitepaper/blob/release/darc-whitepaper-cn.pdf) ## What is DARC? Decentralized Autonomous Regulated Company (DARC) is a company virtual machine that can be compiled and deployed to EVM-compatible blockchains with following features: - **Multi-level tokens**, each level token can be used as common stock, preferred stock, convertible bonds, board of directors, product tokens, non-fungible tokens (NFT), with different prices, voting power and dividend power, which are defined by the company's plugin(law) system. - **Program** composed of a series of DARC instructions that include managing tokens, dividends, voting, legislation, purchasing, withdrawing cash, and other company operations. - **Dividend Mechanism** for distributing dividends to token holders according to certain rules. - **Plugin-as-a-Law**.The plugin system serves as the by-law or commercial contract that supervises all operations. All company operations need to be approved by the plugin system or corresponding voting process. ## By-Law Script By-law script is a JavaScript-like programming language that is used to define the company's commercial rules and operations on DARC. For example: ```javascript mint_tokens( // mint token operation [addr1, addr2, addr3], // token address [0, 0, 0], // token class [500, 300, 200] // number of tokens ); pay_cash(100000000, 0, 1); // pay 0.1 ETH as purchase transfer_tokens( // transfer token operation [addr1, addr2, addr3], // token address [0, 0, 0], // token class [100, 100, 200] // number of tokens ); add_withdraw_cash(10000000); // add 0.01 ETH to withdraw balance withdraw_cash_to( // withdraw cash from my account to other address [addr4, addr5], // withdraw cash to addr4, addr5 [10000000, 10000000] // withdraw amount 0.01 ETH, 0.01 ETH ); ``` Above By-law Script will be transpiled via code generator and sent to corresponding DARC VM contract. The DARC will execute the program if the plugin system approves. To add plugin and voting rules to the DARC, we can simple compose the plugin conditions and voting rules, then send them via operation `add_voting_rule()`, `add_and_enable_plugins()` or `add_plugins()`, and they will be deployed and effective immediately if the current plugin system approves the operation. Here is a quick example, assume we need to limit the transfer of tokens by major shareholders (>25%) by asking the board of directors for an all-hand vote (assuming 5 tokens in total), and it requires 100% approval (5 out of 5) in 1 hour. We can add a new plugin and corresponding voting rule to the DARC VM contract: ```javascript add_voting_rule( // add a voting rule (as index 5) [ { voting_class: [1], // voting token class: 1, level-1 token owners (board of directors) are required to vote approve_percentage: 99, // 99% voting power is required to approve voting_duration: 3600, // voting duration: 1 hour (3600 seconds) execute_duration: 3600, // pending duration for execution: 1 hour (3600 seconds) is_absolute_majority: true, // absolute majority is required, not relative majority } ] ) add_and_enable_plugins( // add and enable plugins (as index 7) [ { condition: // define the condition: (operation == "transfer_tokens") // if operation is transfer_tokens & (operator_total_voting_power_percentage > 25), // and addr1's voting power > 25% return_type: voting_needed, // return type: requires a vote return_level: 100, // priority: 100 votingRuleIndex: 5 // voting rule index 5 (ask board of directors to vote and must 100% approve) note: "100% Approval is needed by board members to transfer tokens by major shareholders (>25%)" is_before_operation: false, // check the plugin after the operation is executed in sandbox } ] ) ``` After above By-Law Script is executed, the DARC VM contract will add a new plugin and voting rule, and the plugin will be effective immediately (if there exists any voting procedure related to `add_voting_rule()` and `add_and_enable_plugins()`, the plugin will be effective after the voting process is approved). If the operator (`addr1`) tries to transfer tokens to addr2, the plugin will check the condition and return `voting_needed` to the DARC VM contract, and the DARC VM contract will ask the board of directors (level-1 token owners) to vote. If the board of directors approves the operation, the operation will be executed in the sandbox, otherwise the operation will be rejected. For example, if there are 3 voting rules are triggerd, the voting operation will be: ```javascript vote([true, true, true]) ``` If the voting process is approved by the existing voting rules and plugins, the new program will be approved to execute in the next execution pending duration (1 hour in this example), and the program owner or any other members can execute the program in the next 1 hour, or the program will be ignored and removed from the pending list. ## "Plugin-as-a-Law" The law of DARC is defined in below pseudo-code: ```javascript if (plugin_condition == true) { plugin_decision = allows / denies / requires a vote } ``` Each plugin contains a condition expression tree and a corresponding decision (return type). When the condition tree is evaluated to true while the program is submitted before running, the plugin will make a decision by allows, denies or requires a vote. For example: ### Example 1: Anti-Dilutive shares Anti-Dilutive shares is a basic mechanism to prevent the company (including DAO and other on-chain "tokenomics") from issuing too many shares and dilute the ownership of the existing shareholders. In DARC, the company and early-stage investors can define a law of "anti-dilutive shares", and the law can be abolished by certain process. ***Law 1 (Anti-Dilutive Shares): Shareholder X should always holds 10% of the total stock.*** *Design of Plugin: If operation is minting new level-0 tokens, plugin should check the state of token ownerships, X should always keep a minimum total voting power of 10%, as well as dividend power of 10% after executing the operation* In By-law script, we can define the plugin with following conditions: ```javascript // define X's address const x_addr = "0x1234567890123456789012345678901234567890"; // define the plugin const anti_delutive = { // define the trigger condition condition: ((operation == "mint_tokens") // if operator is minting new tokens | (operation == "pay_to_mint_tokens")) // or operator is paying to mint new tokens & // and ((total_voting_power_percentage(x) < 10) // X's total voting power < 10% | (total_dividend_power_percentage(x) < 10)), // or X's total dividend power < 10% // define the decision: reject the operation return_type: NO, // define the priority: 100 return_level: 100, // check the plugin after the operation is executed in sandbox is_before_operation: false, } ``` Since it checks the state of token ownerships, the plugin should be executed after the operation is executed inside the DARC's sandbox. If the plugin's condition is evaluated to true, the plugin will deny the operation after executing in the sandbox, and the operation will be rejected to be executed in the real environment. Otherwise, "minting new tokens" will be allowed to execute. When this plugin is added to the DARC, the operator (the author of current program) must mint extra tokens to address `x_addr` to satisfy the **Law 1** above, otherwise it will be rejected. For example, the DARC has only one level of tokens (level 0, voting power = 1, dividend power = 1), the stock ownerships are: | ShareHolders | Number of tokens | Percentage | |--------------|------------------|------------| | CEO | 400 | 40% | | CTO | 300 | 30% | | CFO | 200 | 20% | | VC X | 100 | 10% | | **Total** | **1000** | **100%** | If the operator want to mint 200 tokens and issue them to VC Y, the operator must mint 20 tokens to address `x_addr` to satisfy the **Law 1** above, otherwise the operation will be rejected. Here is a sample investment program by VC Y: ```javascript pay_cash(1000000000000) // pay 1000 ETH to the DARC mint_tokens(20, 0, x_addr) // mint 20 level-0 tokens to address x_addr mint_tokens(180, 0, y_addr) // mint 180 level-0 tokens to address y_addr add_and_enable_plugin([new_law_1, new_law_2, new_law_3]) // investment laws by VC Y ``` After the operation, the stock ownerships are: | ShareHolders | Number of tokens | Percentage | |--------------|------------------|------------| | CEO | 400 | 33.33% | | CTO | 300 | 25% | | CFO | 200 | 16.67% | | VC X | 120 | 10% | | VC Y | 180 | 15% | | **Total** | **1200** | 100% | Also another plugin should be added to the DARC to define the legislation of the "Abolish Law 1": ***Law 1.1(Law 1 Appendix): Both Law 1 and Law 1 Appendix (current Law) can be abolished if and only if the operator is X*** *Design of Plugin: If operation is "disable_plugins", and the plugin that to be disabled is with `id == 1` or `id == 2`, and the operator is not X, then the plugin should reject the operation (assume the anti dilutive law index is 1, and the appendix law index is 2, both are before-operation plugins)* ```javascript const law_1_appendix = { // define the trigger condition condition: (operation == "disable_plugins") & ((disable_after_op_plugin_id == 1) | (disable_after_op_plugin_id == 2)) & (operator != x_addr), // define the decision return_type: no, // define the priority return_level: 100, // reject the operation before sandbox is_before_operation: true, } ``` ### Example 2: Bet-on Agreement/Valuation-Adjustment Mechanism(VAM) Agreement ***Law2: If total revenue < 1000 ETH by 2035/01/01, shareholder X can take over 75% of total voting power and 90% of dividend power.*** *Design of Plugin: After executing in sandbox, check the following conditions:* - *timestamp >= 2035/01/01* - *revenue since 2000/01/01 < 1000 ETH* - *operation is "mint_tokens"* - *total voting power of x <= 75%* - *the dividend power of x <= 90%* *then the plugin should approve the operation* In By-law script, we can define the above plugin as following: ```javascript const bet_on_2 = { // define the trigger condition condition: (timestamp >= toTimestamp('2035/01/01')) & (revenue_since(946706400) < 1000000000000) & // 1000000000000 Gwei = 1000 ETH (operation == "mint_tokens") & (total_voting_power_percentage(x) < 75) & (total_dividend_power_percentage(x) < 90), // define the decision return_type: yes, // define the priority return_level: 100, // approve the operation after executing in sandbox is_before_operation: false, } ``` ### Example 3: Employee Payroll ***Law 3: The payroll for employees with role level X should be 10 ETH per month.*** *Design of Plugin: If operation is "add withdrawable cash", the amount is less than or equals to 10 ETH, and the last operation was at least 30 days, then this operation should be approved and skip sandbox check* In By-law script, we can define the plugin with following conditions (for example, level X = 2 can withdraw 10 ETH per 30 days): ```javascript const payroll_law_level_2 = { condition: (operation == "add_withdrawable_cash") & // operation is "add withdrawable cash" (member_role_level == 2) & // the operator address is in role level 2 // add cash by < every 30 days = 2592000 seconds (operator_last_operation_window("add_withdrawable_cash") >= 2592000) & // each time add < 10000000000 Gwei = 10 ETH to the account (add_withdrawable_cash_amount <= 10000000000), // approve the operation and skip sandbox check return_type: yes_and_skip_sandbox, return_level: 1 is_before_operation: true, } ``` With the plugin above, the operator can add withdrawable cash to the employee's account with amount less than or equals to 10 ETH, and the last operation was at least 30 days. The plugin will approve the operation and skip the sandbox check. When the employee address is disable, removed from role level X, or other plugins with higher priority deny the operation, these operations will be rejected. ### Example 4: Voting and legislation For daily operations, the board of directors can be defined as a group of addresses, and the voting mechanism can be used to make decisions. For example, let's design the voting mechanism for the following scenario: 1. Any address X with more than 10% total voting power can be added to the board by minting 1 token (level 2, board voting token), if and only if the behavior is approved by 2/3 of all the board members (voting rule 1). ```javascript const add_board_member = { condition: (operation == "mint_tokens") & // operation is "mint_tokens" (mint_tokens_level == 2) & // the token level is 2 (mint_tokens_amount == 1) & // the amount is 1 (operator_total_voting_power_percentage >= 10), // the operator address holds at least 10% of the total voting power return_type: voting_needed, voting_rule: 1, // Under the voting rule 1, the operation will be approved if and only if 2/3 of all the board members approve the operation return_level: 100, is_before_operation: false, // make the decision after executing in sandbox } ``` 2. Any operator with more than 7% of all voting power can submit `enable_plugins()` , and it needs to be approved by 100% of all the board members. Each operator can try to activate plugin per 10 days. ```javascript const enable_plugin = { condition: (operation == "enable_plugins") & // operation is "enable_plugins" (operator_total_voting_power_percentage >= 7) & // the operator address holds at least 7% of the total voting power (operator_last_operation_window("enable_plugin") >= 864000), // each operator can try to enable plugins once per 864000 seconds (10 days) return_type: voting_needed, voting_rule: 2, // Under the voting rule 2, the operation will be approved if and only if 100% of all the board members approve the operation return_level: 100, is_before_operation: false, // make the decision after executing in sandbox } ``` 3. To disable plugins 2,3 and 4, the operator needs to hold at least 20% of total voting power, and the operation needs to be approved by 70% of all common stock token(level-0) voters as relative majority(voting rule 2). For each member of DARC, this operation can be executed once per 15 days (1296000 seconds). ```javascript const disable_2_3_4 = { condition: (operation == "disable_plugins") & // operation is "disable_plugins" ( disable_after_op_plugin_id == 2 | disable_after_op_plugin_id == 3 | disable_after_op_plugin_id == 4 ) & // disable after operation plugins 2,3 and 4 (operator_total_voting_power_percentage >= 20) & // the operator address holds at least 20% of the total voting power (operator_last_operation_window("disable_plugins") >= 1296000), // each operator can try to disable plugins once per 1296000 seconds (15 days) return_type: voting_needed, voting_rule: 3, // Under the voting rule 3, the operation will be approved if and only if 70% of all the common stock holders approve the operation is_before_operation: false, // make the decision after sandbox check } ``` ### Example 5: Multi-level Tokens: Product tokens and Non-fungible tokens Here is an example of how to design a token with different levels of voting power and dividend power. The voting power and dividend power are used to calculate the voting power and dividend power of each token holder. Here is the table of the token levels: | Level | Token | Voting Power | Dividend Power | Total Supply | |-------|----------------------------------|--------------|----------------|--------------| | 0 | Level-0 Common Stock | 1 | 1 | 100,000 | | 1 | Level-1 Stock | 20 | 1 | 10,000 | | 2 | Board of Directors | 1 | 0 | 5 | | 3 | Executives | 1 | 0 | 5 | | 4 | Non-Voting Shares | 0 | 1 | 200,000 | | 5 | Product Token A (0.01 ETH/token) | 0 | 0 | ∞ | | 6 | Product Token B (10 ETH/token) | 0 | 0 | ∞ | | 7 | Non-Fungible Token #1 | 0 | 0 | 1 | | 8 | Non-Fungible Token #2 | 0 | 0 | 1 | | 9 | Non-Fungible Token #3 | 0 | 0 | 1 | | 10 | Non-Fungible Token #4 | 0 | 0 | 1 | | 11 | Non-Fungible Token #5 | 0 | 0 | 1 | | ... | ... | ... | ... | ... | To pay for service or prochase for products, customers can use `pay_cash()` to pay for the service directly, or use `pay_to_mint_tokens()` as a payment method and receive product tokens/NFTs. Here is an example about how to define "Product Token A" and "NFT" price and total supply. ```javascript const product_token_A_price_law = { condition: (operation == "pay_to_mint_tokens") & // operation is "pay_to_mint_tokens" (pay_to_mint_tokens_level == 5) & // the token level is 5 (pay_to_mint_price_per_token >= 10000000000000000), // price per token >= 0.01 ETH = 10000000000000000 wei return_type: yes_and_skip_sandbox, // approve the operation and skip sandbox check return_level: 1, is_before_operation: true, // approve the operation and skip sandbox check } const NFT_price_law = { condition: (operation == "pay_to_mint_tokens") & // operation is "pay_to_mint_tokens" (pay_to_mint_tokens_level >= 7) & // the token level is 7 or higher (pay_to_mint_token_amount == 1) & // only allow to mint 1 token at a time (pay_to_mint_current_level_total_supply == 0) & // current total supply is 0 (pay_to_mint_price_per_token >= 10000000000000000000), // price per token >= 10 ETH = 10000000000000000000 wei return_type: yes_and_skip_sandbox, // approve the operation and skip sandbox check return_level: 1, is_before_operation: true, // approve the operation and skip sandbox check } ``` ### Example 6: Lock dividend yield rate for 5 years The dividend mechanism is designed to distribute dividends to token holders under certain rules: 1. For each `X` purchase transactions, take Y‱ of the total income as the dividendable cash 2. The `offer_dividend()` operation can be called, which will distribute the dividendable cash to token holders' dividend withdraw balance 3. The amount of dividends per token holder (X) is calculated by the following formula: `dividend_X = dividendable_cash * dividend_power(X) / total_dividend_power` 4. After the `offer_dividend()` operation is called, the dividendable cash and dividendable transaction counter will be set to 0, and the dividend withdraw balance of each token holder will be increased by `dividend_X` To make sure the dividend yield rate is stable, we can add a plugin to the DARC to lock the dividend yield rate for 5 years by limiting the `set_parameters()` function. ***Law 6: The dividend yield rate should be locked > 500‱ (5%) before 2030-01-01.*** ```javascript const dividend_yield_rate_law = { condition: (operation == "set_parameters") & // operation is "set_parameters" (set_parameters_key == "dividendPermyriadPerTransaction") & // the key is "dividend_yield_rate" (set_parameters_value < 500) & // the value is < 500‱ (5%) (timestamp < 1893477600), // the timestamp < unix timestamp 2030-01-01 00:00:00 (UTC) return_type: no, // reject the operation return_level: 1, is_before_operation: true, // reject the operation and skip sandbox check } ``` ### Example 7: Investment program package Here is an unofficial example program of **Simple agreement for future equity (SAFE)**, a common investment contract by a VC firm: 1. The VC firm will pay 1000 ETH (1000000000000 Gwei) cash to the DARC as investment 2. The VC firm will be granted 100,000,000 level-0 tokens (common stock) and 1 level-2 token (board of members) 3. The VC firm will be granted the right to disable plugins 5, 6, 7 4. The VC firm will be granted the right to enable plugins 8, 9, 10, 11 5. The VC firm will be granted the right to change its role to level-5 (majority shareholder level) 6. It's recommended to sign and scan a PDF document to record the agreement, upload the PDF document to IPFS, and add the IPFS hash `QmcpxHN3a5HYnPurtuDs3jDfDSg1LPDe2KVBUG4RifcSbC` to the DARC permanent storage array. This can help the emergency agent to verify and fix DARC technical issues if needed. ```javascript const vc_addr = "0x1234567890123456789012345678901234567890"; // define my address pay_cash(1000000000000, 0, 1); // pay 1000 ETH = 1000000000000 Gwei cash mint_token([vc_addr], [100000000], [0]); // mint 100,000,000 level-0 tokens (common stock) to VC firm mint_token([vc_addr], [1], [2]); // mint a single 2-level token (board of members) to VC firm disable_plugins([5, 6, 7], [false, false, false]) // disable previes after-operation plugins 5, 6, 7 enable_plugins([8, 9, 10, 11], [false, false, false, false]) // enable new added plugins 8, 9, 10, which were added before this program change_member_role(vc_addr, 5); // change the role of VC firm to level-5 (majority shareholder level) /** Finally, sign and scan a SAFE document, * upload and pin on IPFS, and add the IPFS hash value to the DARC * just in case if DARC needs emergency agent to take over the DARC */ add_storage(['QmcpxHN3a5HYnPurtuDs3jDfDSg1LPDe2KVBUG4RifcSbC']); ``` ## Building the source Since Hardhat and OpenZeppelin are used, the project can be built using the following commands: 1. Install dependencies We recommend that you use `pnpm` instead of `npm`, but `npm` can also work. `pnpm` is a newer package manager that has some advantages over npm. It is faster, more efficient, and disk-space friendly. ```shell cd darc-protocol npm install ``` 2. Compile the contracts ```shell npx hardhat compile ``` 3. Run the Darc test network ```shell npm run node ``` 4. Test contracts ```shell npx hardhat test REPORT_GAS=true npm run test ``` 5. Deploy contracts ```shell npm run deploy ``` ================================================ FILE: README_cn.md ================================================ # Decentralized Autonomous Regulated Company (DARC) 去中心化的自动监管公司 这是 Decentralized Autonomous Regulated Company (DARC) 项目的官方代码库。DARC 是一个项目,旨在创建一个去中心化的自动监管公司,该公司由基于商业法律的插件系统监管。该项目目前处于早期开发阶段,尚未准备好用于生产环境。 [English](./README.md) | 简体中文 | [日本語](./README_ja.md) ## 加入社区 Telegram: [https://t.me/projectdarc](https://t.me/projectdarc) ## 什么是 DARC? Decentralized Autonomous Regulated Company (去中心化的自动监管公司,英文简称DARC) 是一个公司模型的虚拟机,可以编译部署到任何 EVM (以太坊虚拟机)兼容的区块链公链上,具有以下特点: - **多级代币(Multi-level tokens)**, 每个级别的代币可以用作通用股份、优先股、特权股、债券、股票期权、董事会、商品代币、非同质化代币(NFT)等等。以上所有代币均可以有不同的价格、投票权和分红权,并且是由公司的插件系统(即法律)来定义; - **执行程序(Program)** ,每个执行程序是由一系列的 DARC 指令组成的,包括管理代币、分红、投票、提交法律、提款、购买和其他公司日常操作; - **分红机制(Dividend Mechanism)**,根据已有的法律协议和参数,为代币持有者提供分红; - **插件即法律(Plugin-as-a-Law)**,插件系统就是 DARC 的公司章程与合约,监督和管理公司所有日常操作。所有公司操作需要经过插件系统,或插件系统定义的投票程序的批准后,才能成功执行。 ## By-Law Script(章程语言) By-law Script(章程语言)是一个类似于 JavaScript 语法的编程语言,可以用来定义公司的章程、规则、合约和 DARC 上的公司管理操作。例如: ```javascript mint_tokens( // 铸造代币 [addr1, addr2, addr3], // 铸造代币发往的地址 [0, 0, 0], // 代币等级 [500, 300, 200] // 铸造代币数量 ); pay_cash(100000000, 0, 1); // 支付 0.1 ETH 作为客户采购 transfer_tokens( // 转让代币 [addr1, addr2, addr3], // 代币转让的目标地址 [0, 0, 0], // 代币等级 [100, 100, 200] // 代币数量 ); add_withdraw_cash(10000000); // 申请 0.01 ETH 的提款 withdraw_cash_to( // 把我的账户中的 ETH 提款到对应地址 [addr4, addr5], // 提款地址 [10000000, 10000000] // 提款金额: 0.01 ETH, 0.01 ETH ); ``` 以上 By-law Script 代码将被转译并解释运行在 DARC 虚拟机的智能合约上。如果以上代码全部被 DARC 插件系统批准,那么将会被执行。如果有任何一条指令被插件系统拒绝,那么整个程序(Program)操作都会被拒绝。 如果需要添加插件和投票规则,我们可以简单地写成插件和投票规则,并且通过 `add_voting_rule()` 或 `add_and_enable_plugins()` 或 `add_plugins()` 操作来发送到 DARC 虚拟机的智能合约上,如果当前的插件系统批准了这些操作,那么这些插件和投票规则将会被部署并立即生效。 下面是一个简单快速的例子。假设我们需要限制大股东(>25%)的代币转让,需要董事会进行全体投票(假设总共5票),并且需要 1 小时内 100% 的投票通过(5票中必须有5票投票通过)。我们可以通过添加一个新的插件和相应的投票规则到 DARC 虚拟机的智能合约上: ```javascript add_voting_rule( // 新增投票规则(序号为 5) [ { voting_class: [1], // 投票代币等级:1级代币,即公司董事会被要求投票 approve_percentage: 99, // 投票通过需要 >= 99% 的投票权通过 voting_duration: 3600, // 投票时常:1 小时 execute_duration: 3600, // 投票通过后,执行操作的时常:1 小时 is_absolute_majority: true, // 绝对多数投票制(而不是相对多数制) } ] ); add_and_enable_plugins( // 新增插件并立即生效 [ { condition: // 定义插件生效条件 (operation == "transfer_tokens") // 如果是代币转让操作 & (operator_total_voting_power_percentage > 25), // 并且操作者地址的投票权 > 25% return_type: voting_needed, // 返回类型:需要投票 return_level: 100, // 优先级:100 votingRuleIndex: 5 // 使用投票规则序号为 5 的投票规则(即 100% 的董事会成员们必须投票通过) note: "100% Approval is needed by board members to transfer tokens by major shareholders (>25%)" is_before_operation: false, // 是否在沙箱(sandbox)试运行之前检查执行:否(这个插件要求在沙箱(sandbox)试运行之后检查执行) } ] ); ``` 执行以上的 By-law Script 程序后,DARC VM 合约将添加一个新的插件和投票规则,并且插件将立即生效(如果存在与 add_voting_rule() 和 add_and_enable_plugins() 相关的任何投票程序,则插件将在投票流程通过后生效)。如果操作员(addr1)尝试将代币转移给 addr2,插件将检查条件并返回 voting_needed 给 DARC VM 合约,DARC VM 合约将要求董事会(一级代币所有者)进行投票。如果董事会批准该操作,则该操作将在沙盒中执行,否则该操作将被拒绝。例如,如果触发了3个投票规则,则投票操作将是: ```javascript vote([true, true, true]) ``` 如果现有的投票规则和插件批准了投票过程,则新程序将被批准在下一个执行等待期(例如1小时)内执行,程序所有者或任何其他成员可以在下一个1小时内执行该程序,否则该程序将被忽略并从待处理列表中移除。 ## “插件即法律”("Plugin-as-a-Law") 在 DARC 中,法律是由以下伪代码来定义的: ```javascript if (插件条件 == true) { 插件决定 = 批准 / 拒绝 / 等待投票 } ``` 每个插件中,都包含一个条件树(condition expression tree)和一个决策(返回类型)。当在程序(Program)运行之前提交程序时,如果条件树被评估为真(true),则插件将做出决策:允许、拒绝或要求进行投票。例如: ### 例1: 反稀释股权 在公司法律中,反稀释股份是一个基本机制,可以防止公司(也包括 DAO 和其他链上的“代币经济学”)发行过多的股份,从而稀释削弱掉现有股东们的股权和利益。在 DARC 中,公司和早期投资者们可以定义一个“反稀释股份”的法律,并且同时制定一个特定的流程来在适当时候废除掉这条法律。 ***法律条款1 (反稀释股权法): 股东X应当永久持有该公司的10%股份*** *插件设计思路: 如果操作者(operation)增发了0级代币(公司普通股),则插件应该检查代币的持有者(token ownerships),X应该永远保持10%的总投票权和10%的分红权* 在 By-law Script 的语法中,我们可以如下定义这个条件和法律: ```javascript // 定义 X 的地址 const x_addr = "0x1234567890123456789012345678901234567890"; // 定义插件 const anti_delutive = { // 定义出发条件 condition: ((operation == "mint_tokens") // 如果正在“增发代币” | (operation == "pay_to_mint_tokens")) // 或者正在“付费增发代币” & // 并且 ((total_voting_power_percentage(x) < 10) // X的总投票权 < 10% | (total_dividend_power_percentage(x) < 10)), // 或者 X的总分红权 < 10% // 定义插件决策:否决该操作 return_type: NO, // 定义优先级:100 return_level: 100, // 是否在沙箱(sandbox)试运行之前检查执行:否(这个插件要求在沙箱试运行之后检查执行) is_before_operation: false, }; ``` 由于这个插件需要检查代币所有权的状态,因此应该在 DARC 沙盒中执行操作后执行插件。如果插件的条件被评估为真,则当这个程序(Program)在沙箱(sandbox)执行后会被拒绝,并且该操作将被拒绝在真实环境中执行。否则,将允许“铸造新代币”执行。 当将此插件添加到 DARC 中时,操作员(operator,也就是当前程序的提交者)必须铸造额外的代币并将其发送到 x_addr 地址,以满足上述的 **法律条款1**,否则操作将被拒绝。例如,DARC 只有一级代币(级别 0,投票权 = 1,红利权 = 1),股权情况如下: | 股东 | 持股数量 | 百分比 | |--------|----------|----------| | CEO | 400 | 40% | | CTO | 300 | 30% | | CFO | 200 | 20% | | VC X | 100 | 10% | | **总共** | **1000** | **100%** | 如果操作员想要铸造 200 个代币并将它们发放给 VC Y,则操作员必须铸造 20 个代币并将它们发送到 x_addr 地址,以满足上述的* *法律条款1**,否则该操作将被拒绝。以下是 VC Y 提供的示例投资方案: ```javascript pay_cash(1000000000000) // 支付 1000 ETH 给 DARC mint_tokens(20, 0, x_addr) // 增发 20 个 0 级代币给 x_addr mint_tokens(180, 0, y_addr) // 增发 180 个 0 级代币给 y_addr add_and_enable_plugin([new_law_1, new_law_2, new_law_3]) // VC Y 提出了新的法律 ``` 在以上操作后,股权情况如下:: | 股东 | 持股数量 | 百分比 | |--------|----------|--------| | CEO | 400 | 33.33% | | CTO | 300 | 25% | | CFO | 200 | 16.67% | | VC X | 120 | 10% | | VC Y | 180 | 15% | | **总共** | **1200** | 100% | 与此同时,另一个插件也应该添加到 DARC 中,以定义“废除法律1”的法律流程: ***法律条款1.1 (法律条款1附录): 如果废除法律1和法律1附录(当前的法律),当且仅当操作者是 X*** *插件设计思路: 如果操作是“disable_plugins”,并且企图被废除的法律条款序号是 `id == 1` 或者 `id == 2`,并且操作者不是 X,则插件应该拒绝该操作(假设反稀释法律索引为 1,法律1附录索引为 2,两者都是在操作之前的插件)* ```javascript const law_1_appendix = { // 定义法律触发条件 condition: (operation == "disable_plugins") & ((disable_after_op_plugin_id == 1) | (disable_after_op_plugin_id == 2)) & (operator != x_addr), // 定义插件决策 return_type: no, // 定义优先级 return_level: 100, // 在沙箱试运行之前检查执行:是 is_before_operation: true, }; ``` ### 例2: 对赌协议(Bet-on Agreement,或者称为Valuation-Adjustment Mechanism(VAM) Agreement) ***法律条文2: 如果在2035年1月1日之前,总共营收(revenue)少于1000 ETH,那么股东X可以获得超过75%的投票权和90%的分红权*** ***Law2: If total revenue < 1000 ETH by 2035/01/01, shareholder X can take over 75% of total voting power and 90% of dividend power.*** *插件设计思路:在沙箱(sandbox)操作之后,检查以下条件:* - *时间戳(timestamp)>= 2035/01/01* - *自 2000/01/01 起的总收入 < 1000 ETH* - *操作为 "mint_tokens"* - *x 的总投票权 <= 75%* - *x 的红利权 <= 90%* *那么插件应该批准该操作* 在 By-law 脚本中,我们可以定义上述插件如下: ```javascript const bet_on_2 = { // 定义该插件的触发条件 condition: (timestamp >= toTimestamp('2035/01/01')) & (revenue_since(946706400) < 1000000000000) & // 1000000000000 Gwei = 1000 ETH (operation == "mint_tokens") & (total_voting_power_percentage(x) < 75) & (total_dividend_power_percentage(x) < 90), // 定义最终决策 return_type: yes, // 定义优先级 return_level: 100, // 在沙箱试运行之后检查执行:是 is_before_operation: false, } ``` ### 例3: 员工工资 ***法律条文3: 对于级别为 X 的员工,每个月可以领 10 ETH 现金作为工资*** *插件设计思路:如果操作是“添加可提款现金”,并且添加现金数量少于 10 ETH,并且该地址操作员(operator)上次操作在 30 天之前,那么这个操作应该在沙箱(sandbox)运行之前直接批准,并且跳过沙箱检查* 在 By-law Script 程序中,我们可以定义具有以下条件的插件(例如,级别 X = 2 可以每 30 天提取 10 ETH): ```javascript const payroll_law_level_2 = { condition: (operation == "add_withdrawable_cash") & // 操作指令是 "add withdrawable cash" (member_role_level == 2) & // operator 操作程序的作者是级别为 2 的成员 // 并且操作员上次执行 “add_withdrawable_cash” 的时间是 30 天 = 2592000 秒 (operator_last_operation_window("add_withdrawable_cash") >= 2592000) & // 并且本次添加金额 < 10000000000 Gwei = 10 ETH (add_withdrawable_cash_amount <= 10000000000), return_type: yes_and_skip_sandbox, return_level: 1 is_before_operation: true, //在沙箱检查之前直接允许 } ``` 使用上述插件,操作员(即员工)可以将可提取现金添加到员工帐户中,金额小于或等于 10 ETH,上一个操作至少在 30 天之前。插件将批准操作并跳过沙盒检查。当员工地址被禁用、从角色级别 X 中删除或其他优先级更高的插件拒绝操作时,这些操作将被拒绝。 ### 例4: 投票与立法 "对于日常运营,董事会可以定义为一组地址,并使用投票机制做出决策。例如,让我们为以下情景设计投票机制: 1. 对于拥有超过10%总投票权的地址X,能通过铸造1个代币(代币级别为2,也就是董事会投票代币)的方式,添加到董事会,但前提是该行为经过董事会三分之二成员的批准(即依据投票规则1进行投票)。 ```javascript const add_board_member = { condition: (operation == "mint_tokens") & // 操作等于 "增发代币" (mint_tokens_level == 2) & // 增发代币级别为2 (mint_tokens_amount == 1) & // 增发数量为1 (operator_total_voting_power_percentage >= 10), // 操作者拥有的总投票权大于等于10% // 插件决策:需要投票 return_type: voting_needed, voting_rule: 1, // 在决策投票规则1下,超过2/3的董事会成员批准该操作,则该操作被批准 return_level: 100, is_before_operation: false, // 沙箱检查之后才进行投票 } ``` 2. 任何持有超过所有投票权7%的用户地址,都可以提交`enable_plugins()`指令,但需要获得所有董事会成员100%的批准。每个用户可以每隔10天尝试使用这条指令一次。 ```javascript const enable_plugin = { condition: (operation == "enable_plugins") & // 操作是 "enable_plugins()" (operator_total_voting_power_percentage >= 7) & // 该用户拥有的总投票权大于等于7% (operator_last_operation_window("enable_plugin") >= 864000), //每个用户可以每 864000 seconds (10 days) 天尝试一次 return_type: voting_needed, voting_rule: 2, // 在投票规则2下,超过所有董事会成员的100%批准该操作,则该操作被批准 return_level: 100, is_before_operation: false, // 沙箱检查之后才进行投票 } ``` 3. 要禁用插件2、3和4,程序操作者需要持有总投票权的至少20%,并且操作需要获得所有普通股代币(级别为0的代币)所有投票人的70%的相对多数(投票规则2)批准。对于DARC的每个成员,该操作每15天(1296000秒)可以执行一次。 ```javascript const disable_2_3_4 = { condition: (operation == "disable_plugins") & // 发起操作是 "disable_plugins" ( disable_after_op_plugin_id == 2 | disable_after_op_plugin_id == 3 | disable_after_op_plugin_id == 4 ) & // 废除插件2、3 或者 4 (operator_total_voting_power_percentage >= 20) & // 操作者拥有的总投票权大于等于20% (operator_last_operation_window("disable_plugins") >= 1296000), // 每个用户可以每 1296000 seconds (15 days) 天尝试一次 return_type: voting_needed, voting_rule: 3, // 在投票规则3下,超过所有普通股代币(级别为0的代币)所有投票人的70%的相对多数批准该操作,则该操作被批准 is_before_operation: false, // 沙箱检查之后才进行投票 } ``` ### 例5: 多级代币:商品代币和非同质化代币(NFT) 以下是如何设计一个拥有不同投票和分红权力级别的代币的示例。投票权(voting power)和分红权(dividend power) 用于计算每个代币持有者的投票权和分红权。以下是一个代币级别的表格: | 等级 | 代币 | 投票权 | 分红权 | 总币供应量 | |-----|--------------------------------------|-----|-----|---------| | 0 | 0级普通股份(Level-0 Common Stock) | 1 | 1 | 100,000 | | 1 | 1级特别表决权股份(Level-1 Stock) | 20 | 1 | 10,000 | | 2 | 董事会成员票(Board of Directors) | 1 | 0 | 5 | | 3 | 行政人员投票权(Executives) | 1 | 0 | 5 | | 4 | 非投票股份(Non-Voting Shares) | 0 | 1 | 200,000 | | 5 | 商品代币A(Product Token A) 价格是0.01 ETH/个 | 0 | 0 | ∞ | | 5 | 商品代币B(Product Token B) 价格是 10 ETH/个 | 0 | 0 | ∞ | | 7 | Non-Fungible Token #1 | 0 | 0 | 1 | | 8 | Non-Fungible Token #2 | 0 | 0 | 1 | | 9 | Non-Fungible Token #3 | 0 | 0 | 1 | | 10 | Non-Fungible Token #4 | 0 | 0 | 1 | | 11 | Non-Fungible Token #5 | 0 | 0 | 1 | | ... | ... | ... | ... | ... | 为了支付服务或购买产品,客户可以使用`pay_cash()`直接支付服务费用,或使用 `pay_to_mint_tokens()`作为支付方式并获得商品代币/非同质化代币(NFT)。 这里给一个简单的例子,来定义同质化商品代币A以及NFT的价格法则和总代币供应量。 ```javascript const product_token_A_price_law = { condition: (operation == "pay_to_mint_tokens") & // 操作指令是 "pay_to_mint_tokens" (pay_to_mint_tokens_level == 5) & // 代币级别是5 (pay_to_mint_price_per_token >= 10000000000000000), // 每个代币价格 >= 0.01 ETH = 10000000000000000 wei return_type: yes_and_skip_sandbox, // 准许操作并跳过沙箱检查 return_level: 1, is_before_operation: true, // 在沙箱运行检查前执行本插件 } const NFT_price_law = { condition: (operation == "pay_to_mint_tokens") & // 操作指令是 "pay_to_mint_tokens" (pay_to_mint_tokens_level >= 7) & // 代币级别是7或者更高 (pay_to_mint_token_amount == 1) & // 代币只能一次性付费铸造一个 (pay_to_mint_current_level_total_supply == 0) & // 目前总代币供应量为0 (pay_to_mint_price_per_token >= 10000000000000000000), // 每枚代币价格 >= 10 ETH = 10000000000000000000 wei return_type: yes_and_skip_sandbox, // 准许操作并跳过沙箱检查 return_level: 1, is_before_operation: true, // 在沙箱运行检查前执行本插件 } ``` ### 例6: 在 5 年内锁定分红比率 股息机制是根据一定规则向代币持有者分配股息的设计: 每进行 X 笔购买交易,将总收入的 Y‱ 设为可分配股息的现金 可以调用 offer_dividend() 操作,将可分配股息的现金分配给代币持有者的股息提取余额 每个代币持有者(X)的股息金额计算公式如下:dividend_X = dividendable_cash * dividend_power(X) / total_dividend_power 在调用 offer_dividend() 操作后,可分配股息的现金和可分配股息交易计数器将被设置为0,并且每个代币持有者的股息提取余额将增加 dividend_X 为了确保股息收益率稳定,我们可以添加一个插件到 DARC 中,通过限制 set_parameters() 函数来锁定股息收益率5年。 ***法律条文6: 在 2030-01-01 之前,本实体的收入分红比率必须保持 > 500‱ (5%) 以上*** ```javascript const dividend_yield_rate_law = { condition: (operation == "set_parameters") & // 操作指令是 "set_parameters" (set_parameters_key == "dividendPermyriadPerTransaction") & // 设置参数的键值为 "dividend_yield_rate" (set_parameters_value < 500) & // the value is < 500‱ (5%) (timestamp < 1893477600), // 时间戳小于 < unix timestamp 2030-01-01 00:00:00 (UTC) return_type: no, // 拒绝这个操作 return_level: 1, is_before_operation: true, // 在进入沙箱检查前执行本插件 } ``` ### 例7: 一个投资计划项目 这里提供一个非正式的**未来股权简单协议(Simple agreement for future equity,或者简称SAFE)** 。这种协议经常被风险投资机构用来当作投资合同: 1. 本 VC 同意支付 1000 ETH (1000000000000 Gwei) 现金作为投资 2. 本 VC 将会获得 100,000,000 枚 level-0 代币 (普通股份) 和 1 枚 level-2 代币 (作为董事会成员投票权代币) 3. 本 VC 将会被允许批准废除已有的 5, 6, 7 三条法律 4. 本 VC 将会被允许批准提交 8, 9, 10, 11 四条法律,并当即生效 5. 本 VC 将会被允许在公司名录概念中加入为 5 级成员权限 (主要大股东成员权限) 6. 我们通常建议扫描并签字一份电子版的文字 PDF 文档,作为本次交易的记录,上传这份 PDF 文档到 IPFS 上面,并且把 IPFS 对应的 hash value `QmcpxHN3a5HYnPurtuDs3jDfDSg1LPDe2KVBUG4RifcSbC` 加入到 DARC 的永久存储数组中。这样可以帮助紧急代理人(Emergency Agent)在需要的时候,验证并修复 DARC 技术问题。 ```javascript const vc_addr = "0x1234567890123456789012345678901234567890"; // 定义 VC 地址 pay_cash(1000000000000, 0, 1); // 支付 1000 ETH = 1000000000000 Gwei cash mint_token([vc_addr], [100000000], [0]); // 增发 100,000,000 level-0 tokens (common stock) 给 VC mint_token([vc_addr], [1], [2]); // 增发一枚 2-level token (董事会成员) 给 VC disable_plugins([5, 6, 7], [false, false, false]) // 取消合同 5, 6, 7 enable_plugins([8, 9, 10, 11], [false, false, false, false]) // 增加合同 8, 9, 10, 11 change_member_role(vc_addr, 5); // 把 VC 加入到公司名录概念中,作为 5 级成员权限 (主要大股东成员权限) // 把 PDF 文档的 IPFS hash 加入到 DARC 的永久存储数组中 add_storage(['QmcpxHN3a5HYnPurtuDs3jDfDSg1LPDe2KVBUG4RifcSbC']); ``` ## 编译源代码 由于本项目使用了 Hardhat 和 Openzeppelin,所以你需要安装 Node.js 和 npm。然后执行以下命令: 1. 安装依赖 我们建议您使用 `pnpm` 而不是 `npm`,但 `npm` 也可以工作。 `pnpm` 是一个较新的包管理器,相较于 npm 具有一些优势。它更快、更高效,并且节省磁盘空间。 ```shell cd darc-protocol npm install ``` 2. 编译智能合约 ```shell npx hardhat compile ``` 3. 运行 Darc 测试网络 ```shell npm run node ``` 4. 测试合约 ```shell npm run test REPORT_GAS=true npm run test ``` 5. 部署合约 ```shell npm run deploy ``` ================================================ FILE: README_ja.md ================================================ # Decentralized Autonomous Regulated Company (DARC) Decentralized Autonomous Regulated Company (DARC) プロジェクトの公式リポジトリへようこそ。DARC は、 商法に基づくプラグインシステムによって規制される分散型自律企業の創設を目指すプロジェクトである。 このプロジェクトは現在、開発の初期段階にあり、まだ生産に使用できる段階ではありません。 [English](./README.md) | [简体中文](./README_cn.md) | 日本語 ## コミュニティに参加 Telegram: [https://t.me/projectdarc](https://t.me/projectdarc) ## DARC とは? Decentralized Autonomous Regulated Company (DARC) は、EVM 互換のブロックチェーンにコンパイルしてデプロイできる企業仮想マシンで、次のような特徴があります: - **Multi-level tokens** 各レベルのトークンは、普通株式、優先株式、転換社債、取締役会、製品トークン、非可菌トークン(NFT)として使用することができ、価格、議決権、配当権は会社のプラグイン(法)システムによって定義されます。 - **Program** トークンの管理、配当、投票、立法、購入、現金の引き出し、その他の企業運営を含む一連のDARC指示で構成される。 - **Dividend Mechanism** 一定の規則に従ってトークン保有者に配当金を分配する。 - **Plugin-as-a-Law** プラグインシステムは、すべてのオペレーションを監督する規約や商業契約の役割を果たす。 会社の運営はすべて、プラグインシステムまたはそれに対応する投票プロセスによって承認される必要がある。 ## By-Law Script By-law Script は JavaScript のようなプログラミング言語であり、DARC 上での会社の商業ルールやオペレーションを定義するために使用されます。例えば: ```javascript mint_tokens( // ミントのトークン操作 [addr1, addr2, addr3], // トークンアドレス [0, 0, 0], // トークンクラス [500, 300, 200] // トークン数 ); pay_cash(100000000, 0, 1); // 0.1 ETH を購入代金として支払う transfer_tokens( // 転送トークン操作 [addr1, addr2, addr3], // トークンアドレス [0, 0, 0], // トークンクラス [100, 100, 200] // トークン数 ); add_withdraw_cash(10000000); // 0.01 ETH を引き出し残高に追加する withdraw_cash_to( // 自分の口座から他のアドレスに現金を引き出す [addr4, addr5], // 現金を addr4、addr5 に引き出す [10000000, 10000000] // 引き出し額 0.01 ETH, 0.01 ETH ); ``` 上記付則のスクリプトはコードジェネレーターで変換され、対応する DARC の VM 契約に送られます。プラグインシステムが承認すれば、DARC はプログラムを実行します。 DARC にプラグインと投票ルールを追加するには、単純にプラグイン条件と投票ルールを組み合わせ `add_voting_rule()`、`add_and_enable_plugins()`、`add_plugins()` の操作で送信します そして、現在のプラグインシステムがその操作を承認すれば、即座にデプロイされ、有効になる。 ここで簡単な例を挙げます。取締役会にオールハンド投票(全部で 5 つのトークンを想定)を求めることで、大株主(25% 以上)によるトークンの譲渡を制限する必要があり、1 時間以内に 100% の承認(5 人中 5 人)が必要だとします。 DARC VM 契約に新しいプラグインと対応する投票ルールを追加することができます: ```javascript add_voting_rule( // 投票ルールを追加する(インデックス 5 として) [ { voting_class: [1], // 投票トークンクラス: 1、レベル 1 のトークン所有者(取締役会)には投票義務がある approve_percentage: 99, // 承認には 99% の議決権が必要 voting_duration: 3600, // 投票時間: 1 時間(3600 秒) execute_duration: 3600, // 実行保留期間: 1 時間(3600 秒) is_absolute_majority: true, // 相対多数ではなく絶対多数が必要 } ] ) add_and_enable_plugins( // プラグインの追加と有効化(インデックス 7 と同様) [ { condition: // 条件を定義する: (operation == "transfer_tokens") // 操作が transfer_tokens の場合 & (operator_total_voting_power_percentage > 25), // かつ addr1 の議決権 >25 return_type: voting_needed, // 戻り値の型: 要投票 return_level: 100, // 優先度: 100 votingRuleIndex: 5 // 投票規則インデックス 5(取締役会に投票を依頼し、100% 賛成しなければならない) note: "100% Approval is needed by board members to transfer tokens by major shareholders (>25%)" is_before_operation: false, // サンドボックス内で操作が実行された後、プラグインをチェックする } ] ) ``` 上記のBy-Lawスクリプトが実行されると、DARC VMコントラクトは新しいプラグインと投票規則を追加し、プラグインは直ちに有効となる (`add_voting_rule()` と `add_and_enable_plugins()` に関連する投票手続きが存在する場合、プラグインは投票手続きが承認された後に有効となる)。 オペレータ(`addr1`)が addr2 にトークンを転送しようとすると、プラグインはその条件をチェックして `voting_needed` を DARC VM 契約に返し、 DARC VM 契約は理事会(レベル 1 のトークン所有者)に投票を依頼する。理事会が承認すれば、サンドボックス内で作戦が実行され、そうでなければ作戦は却下される。 例えば、3 つの投票ルールがトリガーされた場合、投票操作は次のようになる: ```javascript vote([true, true, true]) ``` 投票プロセスが既存の投票ルールとプラグインによって承認された場合、新しいプログラムは次の実行保留期間(この例では 1 時間) での実行が承認され、プログラム所有者または他のメンバーは次の1時間以内にプログラムを実行することができます。 ## "Plugin-as-a-Law" DARC の法的規定は以下の擬似コードで定義される: ```javascript if (plugin_condition == true) { plugin_decision = allows / denies / requires a vote } ``` 各プラグインには、条件式ツリーと対応するデシジョン(戻り値の型)が含まれる。実行前にプログラムがサブミットされている間に 条件ツリーが真と評価されると、プラグインは許可、拒否、または投票を要求する決定を下す。例えば: ### 例 1: 希薄化防止株式 希薄化防止株式とは、企業(DAO や他のオンチェーン「トークノミクス」を含む)が株式を発行しすぎて、既存株主の所有権が希薄化するのを防ぐための基本的な仕組みである。 DARC では、企業とアーリーステージの投資家は "反希薄化株式" の法的規定を定義することができ、一定のプロセスを経て法的規定を廃止することができる。 ***法的規定 1 (希薄化防止株式): 株主 X は常に全株式の 10% を保有しているはずである。*** *プラグインの設計: オペレーションが新しいレベル 0 トークンを鋳造する場合、プラグインはトークンの所有者の状態をチェックし、 X はオペレーション実行後、常に 10% の総議決権および 10% の配当権を最低限維持すべきである。* By-Law script では、以下の条件でプラグインを定義することができる: ```javascript // X のアドレスを定義する const x_addr = "0x1234567890123456789012345678901234567890"; // プラグインを定義する const anti_delutive = { // トリガー条件を定義する condition: ((operation == "mint_tokens") // オペレータが新しいトークンをミントしている場合 | (operation == "pay_to_mint_tokens")) // またはオペレータが新しいトークンをミントするために支払っている & // 及び ((total_voting_power_percentage(x) < 10) // X の総議決権 <10 | (total_dividend_power_percentage(x) < 10)), // または X の配当総額 <10 // 決断の定義: 操作の拒否 return_type: NO, // 優先順位の定義: 100 return_level: 100, // サンドボックス内で操作が実行された後、プラグインをチェックする is_before_operation: false, } ``` このプラグインはトークン所有権の状態をチェックするため、DARCのサンドボックス内で操作が実行された後に実行されなければならない。 プラグインの条件がtrueと評価された場合、プラグインはサンドボックス内で実行した後に操作を拒否し、実際の環境での実行は拒否されます。 そうでなければ、"minting new tokens" の実行が許可される。 このプラグインが DARC に追加された場合、オペレーター(現在のプログラムの作者)は、上記の**法的規定 1** を満たすために、アドレス `x_addr` に余分なトークンを追加しなければならない。 例えば、DARC には 1 つのレベルのトークンしかなく(レベル 0、議決権 = 1、配当権 = 1)、株式の所有権は次のとおりである: | 株式所有者 | トークン数 | 比率 | |--------------|------------------|------------| | CEO | 400 | 40% | | CTO | 300 | 30% | | CFO | 200 | 20% | | VC X | 100 | 10% | | **合計** | **1000** | **100%** | オペレータが 200 トークンをミントして VC Y に発行したい場合、上記の**法的規定 1** を満たすために、オペレータはアドレス `x_addr` に 20 トークンを鋳造しなければならない。 以下は VC Y による投資プログラムのサンプルである: ```javascript pay_cash(1000000000000) // DARC に 1000 ETH を支払う mint_tokens(20, 0, x_addr) // レベル 0 トークン 20 個をアドレスx_addr にミントする mint_tokens(180, 0, y_addr) // レベル 0 トークン 180 個をアドレスy_addr にミントする add_and_enable_plugin([new_law_1, new_law_2, new_law_3]) // VC Yによる投資法 ``` 手術後、株式の所有権は次のようになる: | 株式所有者 | トークン数 | 比率 | |--------------|------------------|------------| | CEO | 400 | 33.33% | | CTO | 300 | 25% | | CFO | 200 | 16.67% | | VC X | 120 | 10% | | VC Y | 180 | 15% | | **合計** | **1200** | 100% | また、"廃止法 1"の立法を定義するために、DARC に別のプラグインを追加すべきである: ***法的規定 1.1(法的規定 1 Appendix): 法的規定 1 と法則付則 1(現行法的規定)の両方が廃止できるのは、オペレータが X である場合に限られる*** *プラグインの設計: 操作が "disable_plugins" で、無効にするプラグインが `id == 1` または `id == 2` で、操作者が X でない場合、プラグインは操作を拒否するはずです(希釈防止法のインデックスが 1、付録法のインデックスが 2 で、どちらも操作前のプラグインであると仮定します)* ```javascript const law_1_appendix = { // トリガー条件を定義する condition: (operation == "disable_plugins") & ((disable_after_op_plugin_id == 1) | (disable_after_op_plugin_id == 2)) & (operator != x_addr), // 決断の定義 return_type: no, // 優先度の定義 return_level: 100, // サンドボックスの前に操作を拒否する is_before_operation: true, } ``` ### 例 2: ベットオン契約/評価調整メカニズム(VAM)契約 ***法的規定: 2035年1月1日までに総収入が 1000 ETH 未満であれば、株主 X は総議決権の 75%、配当権の 90% を握ることができる。*** *プラグインの設計: サンドボックス内で実行した後、以下の条件をチェックする:* - *タイムスタンプ >= 2035/01/01* - *2000年1月1日以降の収入 < 1000 ETH* - *操作は "mint_tokens"* - *X の総議決権 <= 75%* - *x の配当力 <= 90%* *その場合、プラグインはその操作を承認しなければならない* By-law script では、上記のプラグインを次のように定義できる: ```javascript const bet_on_2 = { // トリガー条件を定義する condition: (timestamp >= toTimestamp('2035/01/01')) & (revenue_since(946706400) < 1000000000000) & // 1000000000000 Gwei = 1000 ETH (operation == "mint_tokens") & (total_voting_power_percentage(x) < 75) & (total_dividend_power_percentage(x) < 90), // 決断の定義 return_type: yes, // 優先度の定義 return_level: 100, // サンドボックスで実行後、操作を承認する is_before_operation: false, } ``` ### 例 3: 従業員給与計算 ***法的規定 3: ロールレベル X の従業員の給与は月 10 ETH でなければならない。*** *プラグインの設計: 操作が "add withdrawable cash" であり、金額が 10 ETH 以下であり、最後の操作が少なくとも 30 日前である場合、この操作は承認され、サンドボックスのチェックをスキップする必要があります* By-law script では、以下の条件でプラグインを定義することができます(例えば、レベル X = 2 は、30 日あたり 10 ETH を引き出すことができます): ```javascript const payroll_law_level_2 = { condition: (operation == "add_withdrawable_cash") & // 操作は "add withdrawable cash" (member_role_level == 2) & // オペレータアドレスがロールレベル 2である // 現金を加える < 30 日ごとに = 2592000 秒 (operator_last_operation_window("add_withdrawable_cash") >= 2592000) & // 毎回 < 10000000000 Gwei = 10 ETH を口座に追加する (add_withdrawable_cash_amount <= 10000000000), // 操作を承認し、サンドボックスチェックをスキップする return_type: yes_and_skip_sandbox, return_level: 1 is_before_operation: true, } ``` 上記のプラグインを使用すると、オペレータは従業員のアカウントに 10 ETH 以下の金額で引き出し可能な現金を追加することができます。 プラグインは操作を承認し、サンドボックスチェックをスキップします。従業員アドレスが無効化された場合、ロールレベル X から削除された場合、 または優先順位の高い他のプラグインが操作を拒否した場合、これらの操作は拒否されます。 ### 例 4: 投票と法案 日常業務では、取締役会をアドレスのグループとして定義し、議決権行使メカニズムを使って意思決定を行うことができる。 例えば、次のようなシナリオで投票メカニズムを設計する: 1. 総議決権の 10% 以上を持つアドレス X は、全理事会メンバーの 2/3 がその行動を承認した場合に限り、 1 トークン(レベル 2、理事会投票トークン)を鋳造することで理事会に加えることができる(投票ルール 1)。 ```javascript const add_board_member = { condition: (operation == "mint_tokens") & // 操作は "mint_tokens" (mint_tokens_level == 2) & // トークンレベルは 2 (mint_tokens_amount == 1) & // 量は 1 (operator_total_voting_power_percentage >= 10), // 事業者の住所が総議決権の 10% 以上を保有すること return_type: voting_needed, voting_rule: 1, // 議決権行使ルール 1 では、全取締役の 2/3 以上の賛成があった場合にのみ承認される return_level: 100, is_before_operation: false, // サンドボックスで実行した後に判断する } ``` 2. 全投票数の 7% 以上の投票権を持つ運営者は、`enable_plugins()` を提出することができ、全理事の 100% の承認を得る必要があります。 各オペレータは 10 日ごとにプラグインの有効化を試みることができる。 ```javascript const enable_plugin = { condition: (operation == "enable_plugins") & // 操作は "enable_plugins" (operator_total_voting_power_percentage >= 7) & // 事業者の住所が総議決権の 7% 以上を保有していること (operator_last_operation_window("enable_plugin") >= 864000), // 各オペレーターは、864000 秒(10 日間)に一度、プラグインを有効にしようとすることができます return_type: voting_needed, voting_rule: 2, // 議決権行使ルール 2 では、全理事会メンバーの 100% が承認した場合にのみ、その事業が承認される return_level: 100, is_before_operation: false, // サンドボックスで実行した後に判断する } ``` 3. プラグイン 2,3,4 を無効化するためには、運営者が総議決権の 20% 以上を保有し、かつ、相対多数決(議決権行使ルール 2)として 全普通株式トークン(レベル 0)投票者の 70% の賛成を得る必要がある。DARC の各メンバーについて、この操作は 15 日(1296000 秒)に 1 回実行できる。 ```javascript const disable_2_3_4 = { condition: (operation == "disable_plugins") & // 操作は "disable_plugins" ( disable_after_op_plugin_id == 2 | disable_after_op_plugin_id == 3 | disable_after_op_plugin_id == 4 ) & // プラグイン 2,3,4 を操作後に無効にする (operator_total_voting_power_percentage >= 20) & // 事業者の住所が総議決権の 20% 以上を保有すること (operator_last_operation_window("disable_plugins") >= 1296000), // 各オペレーターは 1296000 秒(15 日間)に一度、プラグインの無効化を試みることができる return_type: voting_needed, voting_rule: 3, // 議決権行使ルール 3 では、全普通株式保有者の 70% が賛成した場合にのみ、本運用が承認される is_before_operation: false, // サンドボックスチェック後に決断を下す } ``` ### 例 5: マルチレベルトークン: 製品トークンと非代替性トークン 以下は、議決権と配当権のレベルが異なるトークンの設計方法の例である。議決権および配当権は、各トークンホルダーの議決権および配当権を計算するために使用される。 以下はトークンレベルの表である: | レベル | トークン | 投票権 | 配当力 | 総供給量 | |-------|------------------------------------|--------------|----------------|--------------| | 0 | レベル0 普通株式 | 1 | 1 | 100,000 | | 1 | レベル1株式 | 20 | 1 | 10,000 | | 2 | 取締役会 | 1 | 0 | 5 | | 3 | 経営陣 | 1 | 0 | 5 | | 4 | 無議決権株式 | 0 | 1 | 200,000 | | 5 | プロダクトトークン A (0.01 ETH/token) | 0 | 0 | ∞ | | 6 | プロダクトトークン B (10 ETH/token) | 0 | 0 | ∞ | | 7 | Non-Fungible Token #1 | 0 | 0 | 1 | | 8 | Non-Fungible Token #2 | 0 | 0 | 1 | | 9 | Non-Fungible Token #3 | 0 | 0 | 1 | | 10 | Non-Fungible Token #4 | 0 | 0 | 1 | | 11 | Non-Fungible Token #5 | 0 | 0 | 1 | | ... | ... | ... | ... | ... | サービス料金の支払いや商品の購入には、`pay_cash()` を使って直接支払うか、`pay_to_mint_tokens()` を支払い方法として使い、商品トークン/NFT を受け取ることができる。 以下は、"Product Token A" と "NFT" の価格と総供給量を定義する方法の例である。 ```javascript const product_token_A_price_law = { condition: (operation == "pay_to_mint_tokens") & // 操作は "pay_to_mint_tokens" (pay_to_mint_tokens_level == 5) & // トークンレベルは 5 (pay_to_mint_price_per_token >= 10000000000000000), // トークン1個あたりの価格 >= 0.01 ETH = 1000000000000 wei return_type: yes_and_skip_sandbox, // 操作を承認し、サンドボックスチェックをスキップする return_level: 1, is_before_operation: true, // 操作を承認し、サンドボックスチェックをスキップする } const NFT_price_law = { condition: (operation == "pay_to_mint_tokens") & // 操作は "pay_to_mint_tokens" (pay_to_mint_tokens_level >= 7) & // トークンレベルが 7 以上 (pay_to_mint_token_amount == 1) & // 一度に 1 トークンしかミントできない (pay_to_mint_current_level_total_supply == 0) & // 現在の総供給量は 0 (pay_to_mint_price_per_token >= 10000000000000000000), // トークン 1 個あたりの価格 >= 10 ETH = 1000000000000000 wei return_type: yes_and_skip_sandbox, // 操作を承認し、サンドボックスチェックをスキップする return_level: 1, is_before_operation: true, // 操作を承認し、サンドボックスチェックをスキップする } ``` ### 例 6: 配当利回りを 5 年間固定 配当メカニズムは、一定のルールの下でトークン保有者に配当を分配するように設計されている: 1. 各 `X` の購入取引について、総収入の Y‱ を配当可能な現金とする 2. `offer_dividend()` オペレーションを呼び出すことで、配当可能な現金をトークン保有者の配当引き出し残高に分配することができる 3. トークン保有者一人当たりの配当額(X)は、以下の式で計算される: `dividend_X = dividendable_cash * dividend_power(X) / total_dividend_power` 4. `offer_dividend()` が呼ばれた後、配当可能な現金と配当可能な取引のカウンタは 0 になり、各トークンホルダーの配当引き出し残高は `dividend_X` だけ増加する 配当利回りが安定していることを確認するために、DARC にプラグインを追加し、`set_parameters()` 関数を制限することで、配当利回りを 5 年間固定することができます ***法的規定 6: 配当利回りは2030年1月1日までに 500‱(5%)以上に固定される必要がある。*** ```javascript const dividend_yield_rate_law = { condition: (operation == "set_parameters") & // 操作は "set_parameters" (set_parameters_key == "dividendPermyriadPerTransaction") & // キーは "dividend_yield_rate" (set_parameters_value < 500) & // 値が< 500‱ (5%) (timestamp < 1893477600), // タイムスタンプ < unix タイムスタンプ 2030-01-01 00:00:00 (UTC) return_type: no, // 操作を拒否する return_level: 1, is_before_operation: true, // 操作を拒否し、サンドボックスチェックをスキップする } ``` ### 例 7: 投資プログラムパッケージ 以下は、VC による一般的な投資契約である **Simple agreement for future equity (SAFE)** の非公式なプログラム例である: 1. VC は 1000 ETH(10000000000 Gwei)の現金を投資として DARC に支払う 2. VC は、100,000,000 レベル 0 トークン(普通株式)と 1 レベル 2 トークン(取締役会)を付与される 3. VC は、プラグイン 5、6、7 を無効にする権利を有する 4. VC には、プラグイン 8、9、10、11 を有効にする権利が与えられる 5. VC には、その役割をレベル 5(大株主レベル)に変更する権利が与えられる 6. 契約を記録するために PDF 文書に署名してスキャンし、PDF 文書を IPFS にアップロードし、IPFS ハッシュ `QmcpxHN3a5HYnPurtuDs3jDfDSg1LPDe2KVBUG4RifcSbC` を DARC パーマネントストレージ配列に追加することを推奨する。 これは、必要に応じて緊急エージェントが DARC の技術的問題を検証し、修正するのに役立つ。 ```javascript const vc_addr = "0x1234567890123456789012345678901234567890"; // 自分のアドレスを定義する pay_cash(1000000000000, 0, 1); // 1000 ETH = 1000000000000 Gwei cash を支払う mint_token([vc_addr], [100000000], [0]); // 100,000,000 レベル 0 トークン(普通株)を VC ファームにミントする mint_token([vc_addr], [1], [2]); // 2 レベルのトークン(役員会)を 1 つ VC ファームにミントする disable_plugins([5, 6, 7], [false, false, false]) // 操作後のプラグイン 5、6、7 を無効にする enable_plugins([8, 9, 10, 11], [false, false, false, false]) // このプログラム以前に追加されたプラグイン 8、9、10 を有効にする change_member_role(vc_addr, 5); // VC の役割をレベル 5(大株主レベル)に変更する /** 最後に、DARC が DARC を引き継ぐために緊急エージェントを必要とする場合に備え、 * SAFE 文書に署名し、スキャンし、IPFS にアップロードし、ピンを立て、 * IPFS のハッシュ値を DARC に追加する */ add_storage(['QmcpxHN3a5HYnPurtuDs3jDfDSg1LPDe2KVBUG4RifcSbC']); ``` ## ソースのビルド Hardhat と OpenZeppelin を使用しているので、プロジェクトは以下のコマンドでビルドできます: 1. 依存関係のインストール `npm` の代わりに `pnpm` を使うことを推奨しますが、`npm` でも動作します。 `pnpm` は新しいパッケージマネージャーで、npm よりも優れている点がいくつかある。より速く、より効率的で、ディスクスペースに優しいです。 ```shell cd darc-protocol npm install ``` 2. コントラクトのコンパイル ```shell npx hardhat compile ``` 3. Darc テストネットワークの実行 ```shell npm run node ``` 4. コントラクトのテスト ```shell npx hardhat test REPORT_GAS=true npm run test ``` 5. コントラクトのデプロイ ```shell npm run deploy ``` ================================================ FILE: darc-docs/README.md ================================================ # Darc Docs ![img.png](img.png) ## Tech Stack - [React](https://reactjs.org/) - [Nodejs](https://nodejs.org/) - [Docusaurus](https://docusaurus.io/) ## Installation ```bash npm install ``` ## Run Locally ```bash npm run start ``` ## Build ```bash npm run build ``` ## Deploy ```bash npm run deploy ``` ================================================ FILE: darc-docs/babel.config.js ================================================ module.exports = { presets: [require.resolve('@docusaurus/core/lib/babel/preset')], }; ================================================ FILE: darc-docs/blog/2019-05-28-first-blog-post.md ================================================ --- slug: first-blog-post title: First Blog Post authors: name: Gao Wei title: Docusaurus Core Team url: https://github.com/wgao19 image_url: https://github.com/wgao19.png tags: [hola, docusaurus] --- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet ================================================ FILE: darc-docs/blog/2019-05-29-long-blog-post.md ================================================ --- slug: long-blog-post title: Long Blog Post authors: endi tags: [hello, docusaurus] --- This is the summary of a very long blog post, Use a `` comment to limit blog post size in the list view. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet ================================================ FILE: darc-docs/blog/2021-08-01-mdx-blog-post.mdx ================================================ --- slug: mdx-blog-post title: MDX Blog Post authors: [slorber] tags: [docusaurus] --- Blog posts support [Docusaurus Markdown features](https://docusaurus.io/docs/markdown-features), such as [MDX](https://mdxjs.com/). :::tip Use the power of React to create interactive blog posts. ```js ``` ::: ================================================ FILE: darc-docs/blog/2021-08-26-welcome/index.md ================================================ --- slug: welcome title: Welcome authors: [slorber, yangshun] tags: [facebook, hello, docusaurus] --- [Docusaurus blogging features](https://docusaurus.io/docs/blog) are powered by the [blog plugin](https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-content-blog). Simply add Markdown files (or folders) to the `blog` directory. Regular blog authors can be added to `authors.yml`. The blog post date can be extracted from filenames, such as: - `2019-05-30-welcome.md` - `2019-05-30-welcome/index.md` A blog post folder can be convenient to co-locate blog post images: ![Docusaurus Plushie](./docusaurus-plushie-banner.jpeg) The blog supports tags as well! **And if you don't want a blog**: just delete this directory, and use `blog: false` in your Docusaurus config. ================================================ FILE: darc-docs/blog/authors.yml ================================================ endi: name: Endilie Yacop Sucipto title: Maintainer of Docusaurus url: https://github.com/endiliey image_url: https://github.com/endiliey.png yangshun: name: Yangshun Tay title: Front End Engineer @ Facebook url: https://github.com/yangshun image_url: https://github.com/yangshun.png slorber: name: Sébastien Lorber title: Docusaurus maintainer url: https://sebastienlorber.com image_url: https://github.com/slorber.png ================================================ FILE: darc-docs/docs/By-law Script/Getting Started.md ================================================ --- sidebar_position: 1 --- import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; # Getting Started ### By-law Script = JavaScript + Operator Overloading By-law Script is the first programming language for describing the operations and rules for a DARC-based crypto company. It is a domain-specific language (DSL) that is designed to be easy to read and write, and to be used by non-programmers. It is based on JavaScript, and adds operator overloading to make it easier to write and read. ### Setup There are two ways to write and execute By-law Script programs. The first is to use the By-law Script IDE at [https://darc.app](https://darc.app), which is a web-based IDE that allows you to write, compile, and execute By-law Script programs. The second is to use the darcjs SDK, which is a command-line tool that allows you to write By-law Script programs in a text editor and then compile and execute them. To install darcjs, you can use npm: ```shell npm install darcjs ``` ```shell yarn add darcjs ``` ```shell pnpm install darcjs ``` Then you can import darcjs and use `transpileAndRun()` to compile and execute By-law Script programs. ```javascript import { transpileAndRun, ethers } from 'darcjs'; await transpileAndRun( // By-law Script code ` batch_transfer_tokens( [Address_B], // the addresses of the recipients [0], // the token index [100]); // the amounts `, // signer new ethers.Wallet( YOUR_PRIVATE_KEY, new ethers.providers.JsonRpcProvider( YOUR_JSON_RPC_PROVIDER_URL ) ), // DARC address "0x123...", // DARC version DARC_VERSION.Latest ); ``` ### Your first By-law Script program Here is a simple By-law Script program that defines the common stock of a company. Each share of common stock has voting weight 1 and dividend weight 1. This token class is called `token_0`, and the token index is 0. ```javascript batch_create_token_classes( ['token_0'], // token names [0], // token index [1], // voting weights [1]); // dividend weights ``` Next let's issue 1000 shares of `token_0` to the company's founder, 500 shares to Address_A, 400 shares to Address_B, and 100 shares to Address_C. ```javascript cosnt Address_A = "0x123..."; cosnt Address_B = "0x51c..."; cosnt Address_C = "0x374..."; batch_mint_tokens( [ Address_A, Address_B, Address_C], // the addresses of the recipients [0,0,0], // the token index [500,400,100]); // the amounts ``` Then Address_A executes the following By-law Script on this DARC to transfer 100 shares of `token_0` to Address_B. ```javascript batch_transfer_tokens( [Address_B], // the addresses of the recipients [0], // the token index [100]); // the amounts ``` As a customer, Address_D needs to pay 1000000 wei to the DARC for the service. The following By-law Script is executed by Address_D. ```javascript pay_cash( 1000000, // the amount = 1000000 wei 0, // the payment type = 0, the default native token 1); // the dividendable flag, 1 means the payment is dividendable ``` Finally, Address_C wants to issue dividends to all token holders. The following By-law Script is executed by Address_C. ```javascript offer_dividends(); ``` ### Package operations into a program The above examples of code all execute single operations. For a program, it can contain multiple operations, and all operations will be executed sequentially, one after another. The advantage of doing this is that if an operator needs to execute a program and the program consists of multiple operations, it is necessary to ensure that all operations contained in this program are successfully approved for execution by voting, or the entire program is rejected as a whole. Here is the translation of the example you provided: **Address_E decides to invest in DARC. The investment agreement needs to complete four tasks**: 1. Address_E pays 50000000 wei as venture capital. 2. Address_E will receive 10000 shares of level-0 tokens (common stock). 3. Address_E will receive 1 share of level-1 tokens (board seat). 4. Address_E will receive 20000 shares of level-2 tokens (dividendable-only stock)." For the aforementioned four operations, we aspire for either all four operations to be simultaneously approved and successfully executed, or all four operations to be simultaneously rejected with none executed. For investor Address_E, it is absolutely undesirable to have a scenario where a single-operation program pays 50000000 wei to DARC, followed by the subsequent rejection of the three operations by the DARC manager. Therefore, in this scenario, the four operations must be bundled into a single program. If this program requires voting, the entire program must undergo the voting process. Upon rejection, Address_E will neither acquire shares nor a board seat, and the cash will be refunded to Address_E. Below is a complete By-law Script Program containing the four operations mentioned above: ```javascript // pay 50000000 wei to DARC pay_cash( 50000000, // the amount = 50000000 wei 0, // the payment type = 0, the default native token 0); // the dividendable flag, 0 means the payment is non-dividendable // mint 10000 shares of level-0, // 1 share of level-1, // and 20000 shares of level-2 tokens to Address_E batch_mint_tokens( [Address_E, Address_E, Address_E], // the addresses of the recipients [0, 1, 2], // the token index [10000, 1, 20000]); // the amounts ``` This script encapsulates all the operations into a single program, ensuring that they are either all approved and executed successfully or all rejected without any execution. If the program requires voting, it must undergo the voting process as a whole. If rejected, Address_E will not obtain shares, a board seat, nor pay the cash, which will be refunded to Address_E. ### Write By-law Script, just like writing JavaScript By-law Script is based on JavaScript, so most of the syntax and grammar are the same as JavaScript, including the use of variables, constants, and functions. Below is a batch script that paying cash to different addresses with different amounts. The amount is saved in a map, and the payment is executed in a loop. ```javascript const balance = new Map( [ [address_X1, 1000000], [address_X2, 2000000], [address_X3, 3000000], [address_X4, 4000000] ] ); for (const [address, amount] of balance) { batch_add_withdrawable_balances( // if you don't want to package all operations into a batch operation [address], // the addresses of the recipients [amount]); // the amounts } ``` ### Remember to add notes to the program When you write a By-law Script program, it is important to add notes to the program to explain the purpose of the program. This is especially important when the program requires voting. The notes will be displayed to the voters during the voting process, and will help them to understand the purpose of the program and make a decision. By adding notes, you can just call the `setNote()` function in any place of the program. Below is an example of adding notes to the program. ```javascript setNote("Investment agreement for Address_E"); ``` ### Your first Plugin-as-a-Law Plugin is the core mechanism of DARC and serves as its legal framework. All rules within DARC are based on the plugin system. By-law Script supports operator overload to make the composition and design of plugins simpler and more convenient. In By-law Script, each plugin is an object body. Below is the simplest example: ```javascript const plugin_0 = { returnType: NO, // return type: NO level: 3, // level 3 votingRuleIndex: 0, // voting rule index, if voting is required notes: "disable all operations", // the notes of the plugin bIsEnabled: true, // the plugin is enabled. this is the default value bIsBeforeOperation: true, // if the plugin is executed before the operation conditionNodes: boolean_true() // condition: always true }, ``` In the above plugin, we define conditionNodes with only one node, which is the object TRUE() we created. This plugin signifies that before any program or operation is executed, this plugin will be triggered. The returnType of this plugin is NO, indicating that whenever this plugin is triggered, it will be rejected. Therefore, when this plugin is successfully deployed in DARC, if no plugin of a higher level than level 3 is triggered to allow execution, then any operation will be rejected. One of the most important features of By-law Script is its ability to use operator overloading to write condition nodes. Each condition node is an expression with parameters, and condition nodes are a series of expressions connected by logical operators such as AND, OR, and NOT. Therefore, by supporting operator overload at the transpiler level, developers can easily write condition nodes as triggering conditions for plugins. Below is an example of composing plugins with condition nodes using operator overloading. It contains four plugins, establishing a set of rules for address_A to maintain a 20% non-dilutable ownership of the company's shares. ```javascript const plugin_before_op_1 = { returnType: SANDBOX_NEEDED, // return type: SANDBOX_NEEDED level: 4, // level 3 votingRuleIndex: 0, // voting rule index, if voting is required notes: "minting tokens should be checked", // the notes of the plugin bIsEnabled: true, // the plugin is enabled. this is the default value bIsBeforeOperation: true, // if the plugin is executed before the operation conditionNodes: // if the operation is minting tokens or creating token classes (operation_equals(EnumOpcode.BATCH_MINT_TOKENS) | operation_equals(EnumOpcode.BATCH_PAY_TO_MINT_TOKENS)) // and the token index is in range [0, 3], which means the token index is 0, 1, 2, or 3 & batch_op_any_token_class_in_range(0, 3) } const plugin_after_op_1 = { returnType: NO, level: 6, votingRuleIndex: 0, notes: "address_A must holds at least 20% of total voting and dividend weight", bIsEnabled: true, bIsBeforeOperation: false, // after-operation plugin conditionNodes: // if the address_A's voting weight percentage is less than 20% // or the address_A's dividend weight percentage is less than 20% address_voting_weight_percenrage_less_than(address_A, 20) | address_dividend_weight_percenrage_less_than(address_A, 20) } const plugin_before_op_2 = { returnType: NO, level: 6, votingRuleIndex: 0, notes: "no one can disable before-op plugin 1,2,3 or after-op plugin 1", bIsEnabled: true, bIsBeforeOperation: true, // before-operation plugin conditionNodes: operation_equals(EnumOpcode.BATCH_DISABLE_PLUGINS) & ( disable_any_before_op_plugin_index_in_list([1,2,3]) | disable_any_after_op_plugin_index_in_list([1]) ) & not(operator_address_equals(address_A)) } const plugin_before_op_3 = { returnType: YES_AND_SKIP_SANDBOX, level: 7, votingRuleIndex: 0, notes: "only address_A can disable before-op plugin 1,2,3 and after-op plugin 1", bIsEnabled: true, bIsBeforeOperation: true, // before-operation plugin conditionNodes: operation_equals(EnumOpcode.BATCH_DISABLE_PLUGINS) & ( disable_any_before_op_plugin_index_in_list([1,2,3]) | disable_any_after_op_plugin_index_in_list([1]) ) & operator_address_equals(address_A) } ``` In the example provided, we have defined four plugins: 1. The first plugin marks any operation as SANDBOX_NEEDED if it is either batch_mint_tokens or batch_pay_to_mint_tokens, and the token level is 0, 1, 2, or 3. This plugin ensures that any addition to the supply of tokens at these levels must undergo sandbox checks. 2. The second plugin marks any operation as NO if, after the execution of any program, the total voting or total dividend rights of address_A fall below 20% in the sandbox. This ensures that address_A retains anti-dilution ownership of 20% of the total shares, regardless of how other operators increase share issuance. 3. The third plugin directly rejects any operation that is batch_disable_plugins, and the disabled plugin indexes are 1, 2, 3 in the before-operation plugin list, or 1 in the after-operation plugin list, and the operator address is not equal to address_A. This plugin ensures that no one other than address_A can disable this set of four plugins, thereby securing the 20% non-dilutable ownership of address_A. 4. The fourth plugin allows any operation that is batch_disable_plugins, and the disabled plugin indexes are 1, 2, 3 in the before-operation plugin list, or 1 in the after-operation plugin list, and the operator address is equal to address_A. This plugin ensures that this set of four plugins can be disabled by anyone other than address_A, allowing address_A to waive the anti-dilution feature of its ownership by disabling these four plugins. After the plugin is defined, it can be added to the plugin list of the DARC. Below is an example of adding the above four plugins to the plugin list of the DARC. Make sure that the existing before-operation plugin list only contains 1 plugin, and the existing after-operation plugin list also only contains 1 plugin. ```javascript batch_add_and_enable_plugins( [plugin_before_op_1, plugin_after_op_1, plugin_before_op_2, plugin_before_op_3]); ``` ### How does operator overloading work in By-law Script? There are three types of condition nodes in the By-law Script, all of which are inherited from the base class `Node` 1. Expression, a condition node that is a single expression with parameters, without any child nodes, such as `operator_address_equals(inputAddress)`. 2. Logical operators(`and`, `or`, `not`), a condition node that is a series of expressions connected by logical operators. 3. Boolean constants(`boolean_true`, `boolean_false`), a condition node that is a boolean constant. The transpiler of By-law Script supports operator overloading for the base `Node` type with bit-and `&` and bit-or `|`, and will be overloaded to the logical operators `and` and `or` respectively. For example, the following expression: ```javascript expression1() & (expression2() | expression3() ) & expression4() ``` will be transpiled and overloaded to: ```javascript and( expression1(), or(expression2(), expression3()), expression4() ) ``` Since each lower-case function is actually the wrapper of the constructor of the corresponding object, the above code is equivalent to the following code: ```javascript new AND( new Expression1(), new OR(new Expression2(), new Expression3()), new Expression4() ) ``` And when the condition nodes are set to plugin, the runtime will automatically serialize the tree-like structure of the condition nodes to the list of nodes(if the type of condition nodes value is `Node`), which is the actual format of the condition nodes in the plugin for DARC interface. The above example will be transpiled to (in pseudo-code): ```javascript [ // node index 0: the root node, the AND node { nodeType: "LOGICAL_OPERATOR", logialOperator: "AND", childList: [1, 2, 5] }, // node index 1: expression 1 { nodeType: "EXPRESSION", expression: "expression1" param: {} childList: [] }, // node index 2: OR node { nodeType: "LOGICAL_OPERATOR", logialOperator: "OR", childList: [3, 4] }, // node index 3: expression 2 { nodeType: "EXPRESSION", expression: "expression2" param: {} childList: [] }, // node index 4: expression 3 { nodeType: "EXPRESSION", expression: "expression3" param: {} childList: [] }, // node index 5: expression 4 { nodeType: "EXPRESSION", expression: "expression4" param: {} childList: [] } ] ``` In this way, the transpiler of By-law Script supports operator overloading for the condition nodes, and runtime generate the actual format of the condition nodes in the plugin for DARC interface. ================================================ FILE: darc-docs/docs/By-law Script/_category_.json ================================================ { "label": "By-law Script", "position": 3, "collapsed": false, "collapsible": false, "link": { "type": "generated-index", "description": "Everything about the By-law Script" } } ================================================ FILE: darc-docs/docs/DARC Protocol/Condition Nodes.md ================================================ --- sidebar_position: 3 --- # Condition Nodes ### What is a Condition Node? Plugins are the laws of the DARC protocol. Each plugin contains an array of condition nodes and a return type. Each condition node can be a condition expression, a logical operator, or a boolean value. The condition array can be reconstructed into a logical tree, representing the trigger conditions of the plugin. Each expression node is composed with a opcode(condition node ID) and one or a few parameters. The struct of the node parameter is defined as follows: ``` struct NodeParam { string[] STRING_ARRAY; uint256[][] UINT256_2DARRAY; address[][] ADDRESS_2DARRAY; bytes BYTES; } ``` ### Logical Operators There are three logical operators in the DARC protocol: `AND`, `OR`, and `NOT`. The `AND` operator returns true if all of its children are true. The `OR` operator returns true if any of its children are true. The `NOT` operator returns true if its child is false. There must be at least one child for the `AND` and `OR` operators, and only one child for the `NOT` operator. In both By-law Script and darc.js SDK, you can use the `and()`, `or()`, and `not()` wrapper functions to create the logical operators, for example: In darc.js SDK: ```ts import {and, or, not, AND, OR, NOT} from 'darcjs'; const conditionTree = and( or( expression1(), expression2() ), expression3(), not( expression4() ) ); // or using the class constructor const conditionTree = new And( new OR( expression1(), expression2() ), expression3(), new NOT( expression4() ) ); ``` In By-law Script: ```ts const conditionTree = and( or( expression1(), expression2() ), expression3(), not( expression4() ) ); // or using the class constructor const conditionTree = new AND( new OR( expression1(), expression2() ), expression3(), new NOT( expression4() ) ); ``` Also you can use `|` for `OR`, `&` for `AND`, and `!` for `NOT` in By-law Script, and these operators will be parsed into the corresponding condition nodes. For example, the above By-law Script can be written as: ```ts const conditionTree = expression1() & ( expression2() | expression3() ) & ( ! expression4() ); ``` ### Boolean Values There are two boolean values in the DARC protocol: class `TRUE` and class `FALSE`, or wrapper function `boolean_true()` and `boolean_false()`. They are used to represent a boolean node in the condition tree. ### Condition Expression 1. There are multiple batch-operations, including: - Batch Mint Tokens - Batch Create Token Classes - Batch Transfer Tokens - Batch Transfer Tokens From To - Batch Burn Tokens - Batch Burn Tokens From - Batch Add Membership - Batch Suspend Membership - Batch Resume Membership - Batch Change Member Roles - Batch Change Member Names - Batch Add Plugins - Batch Enable Plugins - Batch Disable Plugins - Batch Add and Enable Plugins - Batch Set Parameters - Batch Add Withdrawable Balances - Batch Reduce Withdrawable Balances - Batch Add Voting Rules - Batch Pay to Mint Tokens - Batch Pay to Transfer Tokens - Batch Burn Tokens and Refund For more details, please refer to [DARC Instruction Set Opcode Table(opcode.md)](OpCodes.md) 2. Placeholders are reserved for future use. 3. The range [staringValue, endingValue] is inclusive. For example, if the range is [1, 3], then the value 1, 2, 3 are all included. 4. In the DARC protocol, all expressions are named with upper case, and in darc.js SDK and By-law Script, all expressions are named with lower case. For example, `OPERATOR_NAME_EQUALS` in the DARC protocol is `operator_name_equals` in darc.js SDK and By-law Script. | ID | Expression Name | Parameter| Notes| Ready | |------------|------|------|-------| ---- | | 0 | UNDEFINED | | Invalid Operation | | 1 | OPERATOR_NAME_EQUALS| STRING_ARRAY[0] operatorName | The operator name is exactly the same as the given string | | 2 | OPERATOR_ROLE_EQUALS| UINT256_2DARRAY[0][0] operatorRoleIndex | The operator role index is exactly the same as operatorRoleIndex | | 3 | OPERATOR_ADDRESS_EQUALS | ADDRESS_2DARRAY[0][0] operatorAddress | The operator address equals operatorAddress| | 4 | OPERATOR_ROLE_GREATER_THAN | UINT256_2DARRAY[0][0] operatorRoleIndex | The operator role index is greater than operatorRoleIndex| | 5 | OPERATOR_ROLE_LESS_THAN | UINT256_2DARRAY[0][0] operatorRoleIndex | The operator role index is less than operatorRoleIndex| | 6 | OPERATOR_ROLE_IN_RANGE| UINT256_2DARRAY[0][0] startingOperatorRoleIndex, UINT256_2DARRAY[0][1] endingOperatorRoleIndex | The operator role index is in the range of [startingOperatorRoleIndex, endingOperatorRoleIndex]| | 7 | OPERATOR_ROLE_IN_LIST | UINT256_2DARRAY[0] operatorRoleIndexArray| The operator role index is in the list of operatorRoleIndexArray| | 8 | OPERATOR_TOKEN_X_AMOUNT_GREATER_THAN | UINT256_2DARRAY[0][0] tokenClass, UINT256_2DARRAY[0][1] amount | The operator has more than amount of token at tokenClass| | 9 | OPERATOR_TOKEN_X_AMOUNT_LESS_THAN | UINT256_2DARRAY[0][0] tokenClass, UINT256_2DARRAY[0][1] amount || | 10 | OPERATOR_TOKEN_X_AMOUNT_IN_RANGE | UINT256_2DARRAY[0][0] tokenClass, UINT256_2DARRAY[0][1] startingAmount, UINT256_2DARRAY[0][2] endingAmount | The operator has token amount in the range of [startingAmount, endingAmount] at tokenClass| | 11 | OPERATOR_TOKEN_X_AMOUNT_EQUALS| UINT256_2DARRAY[0][0] tokenClass, UINT256_2DARRAY[0][1] amount | The operator has exactly amount of token at tokenClass| | 12 | OPERATOR_TOKEN_X_PERCENTAGE_GREATER_THAN | UINT256_2DARRAY[0][0] tokenClass, UINT256_2DARRAY[0][1] percentage | The operator has more than percentage of token at tokenClass| | 13 | OPERATOR_TOKEN_X_PERCENTAGE_LESS_THAN | UINT256_2DARRAY[0][0] tokenClass, UINT256_2DARRAY[0][1] percentage | The operator has less than percentage of token at tokenClass| | 14 | OPERATOR_TOKEN_X_PERCENTAGE_IN_RANGE | UINT256_2DARRAY[0][0] tokenClass, UINT256_2DARRAY[0][1] percentageStartingValue, UINT256_2DARRAY[0][2] percentageEndingValue | The operator has token percentage in the range of [percentageStartingValue, percentageEndingValue] at tokenClass| | 15 | OPERATOR_TOKEN_X_PERCENTAGE_EQUALS| UINT256_2DARRAY[0][0] tokenClass, UINT256_2DARRAY[0][1] percentage | The operator has exactly percentage of token at tokenClass| | 16 | OPERATOR_VOTING_WEIGHT_GREATER_THAN| UINT256_2DARRAY[0][0] amount | The operator has more than amount of voting weight| | 17 | OPERATOR_VOTING_WEIGHT_LESS_THAN | UINT256_2DARRAY[0][0] amount | The operator has less than amount of voting weight| | 18 | OPERATOR_VOTING_WEIGHT_IN_RANGE | UINT256_2DARRAY[0][0] startingAmount, UINT256_2DARRAY[0][1] endingAmount | The operator has voting weight in the range of [startingAmount, endingAmount]| | 19 | OPERATOR_DIVIDEND_WEIGHT_GREATER_THAN | UINT256_2DARRAY[0][0] amount | The operator has more than amount of dividend weight| | 20 | OPERATOR_DIVIDEND_WEIGHT_LESS_THAN| UINT256_2DARRAY[0][0] amount | The operator has less than amount of dividend weight| | 21 | OPERATOR_DIVIDEND_WEIGHT_IN_RANGE | UINT256_2DARRAY[0][0] startingAmount, UINT256_2DARRAY[0][1] endingAmount | The operator has dividend weight in the range of [startingAmount, endingAmount]| | 22 | Placeholder22 | | | | 23 | Placeholder23 | | | | 24 | Placeholder24 | | | | 25 | OPERATOR_WITHDRAWABLE_CASH_GREATER_THAN | UINT256_2DARRAY[0][0] amount | The operator has more than amount of withdrawable cash| | 26 | OPERATOR_WITHDRAWABLE_CASH_LESS_THAN | UINT256_2DARRAY[0][0] amount | The operator has less than amount of withdrawable cash| | 27 | OPERATOR_WITHDRAWABLE_CASH_IN_RANGE| UINT256_2DARRAY[0][0] startingAmount, UINT256_2DARRAY[0][1] endingAmount | The operator has withdrawable cash in the range of [startingAmount, endingAmount]| | 28 | OPERATOR_WITHDRAWABLE_DIVIDENDS_GREATER_THAN| UINT256_2DARRAY[0][0] amount | The operator has more than amount of withdrawable dividends| | 29 | OPERATOR_WITHDRAWABLE_DIVIDENDS_LESS_THAN | UINT256_2DARRAY[0][0] amount | The operator has less than amount of withdrawable dividends| | 30 | OPERATOR_WITHDRAWABLE_DIVIDENDS_IN_RANGE | UINT256_2DARRAY[0][0] amount | The operator has withdrawable dividends in the range of [startingAmount, endingAmount]| | 31 | OPERATOR_ADDRESS_IN_LIST | ADDRESS_2DARRAY[0] addressArray | The operator address is in the list of addressArray| | 32 | Placeholder32 | | | | 33 | Placeholder33 | | | | 34 | Placeholder34 | | | | 35 | Placeholder35 | | | | 36 | Placeholder36 | | | | 37 | Placeholder37 | | | | 38 | Placeholder38 | | | | 39 | Placeholder39 | | | | 40 | Placeholder40 | | | | 41 | Placeholder41 | | | | 42 | Placeholder42 | | | | 43 | Placeholder43 | | | | 44 | Placeholder44 | | | | 45 | Placeholder45 | | | | 46 | Placeholder46 | | | | 47 | Placeholder47 | | | | 48 | Placeholder48 | | | | 49 | Placeholder49 | | | | 50 | Placeholder50 | | | | 51 | TIMESTAMP_GREATER_THAN | UINT256_2DARRAY[0][0] timestamp | The current timestamp is greater than timestamp| | 52 | TIMESTAMP_LESS_THAN | UINT256_2DARRAY[0][0] timestamp | The current timestamp is less than timestamp| | 53 | TIMESTAMP_IN_RANGE | UINT256_2DARRAY[0][0] startTimestamp, UINT256_2DARRAY[0][0] endTimestamp | The current timestamp is in the range of [startTimestamp, endTimestamp]| | 54 | DATE_YEAR_GREATER_THAN | UINT256_2DARRAY[0][0] year | The current year is greater than year| | 55 | DATE_YEAR_LESS_THAN | UINT256_2DARRAY[0][0] year | The current year is less than year| | 56 | DATE_YEAR_IN_RANGE | UINT256_2DARRAY[0][0] startYear, UINT256_2DARRAY[0][0] endYear | The current year is in the range of [startYear, endYear]| | 57 | DATE_MONTH_GREATER_THAN | UINT256_2DARRAY[0][0] month | The current month is greater than month| | 58 | DATE_MONTH_LESS_THAN | UINT256_2DARRAY[0][0] month | The current month is less than month| | 59 | DATE_MONTH_IN_RANGE | UINT256_2DARRAY[0][0] startMonth, UINT256_2DARRAY[0][0] endMonth | The current month is in the range of [startMonth, endMonth]| | 60 | DATE_DAY_GREATER_THAN | UINT256[0][0] day | The current day is greater than day| | 61 | DATE_DAY_LESS_THAN | UINT256[0][0] day | The current day is less than day| | 62 | DATE_DAY_IN_RANGE | UINT256[0][0] startDay, UINT256[0][0] endDay | The current day is in the range of [startDay, endDay]| | 63 | DATE_HOUR_GREATER_THAN | uint256 hour | The current hour is greater than hour| | 64 | DATE_HOUR_LESS_THAN | uint256 hour | The current hour is less than hour| | 65 | DATE_HOUR_IN_RANGE | uint256 startHour, uint256 endHour | The current hour is in the range of [startHour, endHour]| | 66 | ADDRESS_VOTING_WEIGHT_GREATER_THAN | UINT256_2DARRAY[0][0] amount, ADDRESS_2DARRAY[0][0] address | The address has more than amount of voting weight| | 67 | ADDRESS_VOTING_WEIGHT_LESS_THAN | UINT256_2DARRAY[0][0] amount, ADDRESS_2DARRAY[0][0] address | The address has less than amount of voting weight| | 68 | ADDRESS_VOTING_WEIGHT_IN_RANGE | UINT256_2DARRAY[0][0] amount, ADDRESS_2DARRAY[0][0] address | The address has voting weight in the range of [startingAmount, endingAmount]| | 69 | ADDRESS_DIVIDEND_WEIGHT_GREATER_THAN | UINT256_2DARRAY[0][0] amount, ADDRESS_2DARRAY[0][0] address | The address has more than amount of dividend weight| | 70 | ADDRESS_DIVIDEND_WEIGHT_LESS_THAN| UINT256_2DARRAY[0][0] amount, ADDRESS_2DARRAY[0][0] address | The address has less than amount of dividend weight| | 71 | ADDRESS_DIVIDEND_WEIGHT_IN_RANGE | UINT256_2DARRAY[0][0] amount , ADDRESS_2DARRAY[0][0] address || | 72 | ADDRESS_TOKEN_X_GREATER_THAN | UINT256_2DARRAY[0][0] tokenClass, UINT256_2DARRAY[0][1] amount, ADDRESS_2DARRAY[0][0] address || | 73 | ADDRESS_TOKEN_X_LESS_THAN | UINT256_2DARRAY[0][0] tokenClass, UINT256_2DARRAY[0][1] amount, ADDRESS_2DARRAY[0][0] address || | 74 | ADDRESS_TOKEN_X_IN_RANGE | UINT256_2DARRAY[0][0] tokenClass, UINT256_2DARRAY[0][1] amount, ADDRESS_2DARRAY[0][0] address || | 75 | TOTAL_VOTING_WEIGHT_GREATER_THAN| UINT256_2DARRAY[0][0] amount || | 76 | TOTAL_VOTING_WEIGHT_LESS_THAN | UINT256_2DARRAY[0][0] amount || | 77 | TOTAL_VOTING_WEIGHT_IN_RANGE | UINT256_2DARRAY[0][0] amount || | 78 | TOTAL_DIVIDEND_WEIGHT_GREATER_THAN | UINT256_2DARRAY[0][0] amount || | 79 | TOTAL_DIVIDEND_WEIGHT_LESS_THAN| UINT256_2DARRAY[0][0] amount || | 80 | TOTAL_DIVIDEND_WEIGHT_IN_RANGE | UINT256_2DARRAY[0][0] amount || | 81 | TOTAL_CASH_GREATER_THAN | UINT256_2DARRAY[0][0] amount || NOT READY, DO NOT USE | 82 | TOTAL_CASH_LESS_THAN | UINT256_2DARRAY[0][0] amount || NOT READY, DO NOT USE | 83 | TOTAL_CASH_IN_RANGE| UINT256_2DARRAY[0][0] amount || NOT READY, DO NOT USE | 84 | TOTAL_CASH_EQUALS| UINT256_2DARRAY[0][0] amount || NOT READY, DO NOT USE | 85 | TOKEN_IN_LIST_VOTING_WEIGHT_GREATER_THAN| UINT256_2DARRAY[0] tokenClassList, UINT256_2DARRAY[1][0] amount || | 86 | TOKEN_IN_LIST_VOTING_WEIGHT_LESS_THAN | UINT256_2DARRAY[0] tokenClassList, UINT256_2DARRAY[1][0] amount || | 87 | TOKEN_IN_LIST_VOTING_WEIGHT_IN_RANGE | UINT256_2DARRAY[0] tokenClassList, UINT256_2DARRAY[1][0] startAmount, UINT256_2DARRAY[1][1] endAmount || | 88 | TOKEN_IN_LIST_DIVIDEND_WEIGHT_GREATER_THAN | UINT256_2DARRAY[0] tokenClassList, UINT256_2DARRAY[1][0] amount || | 89 | TOKEN_IN_LIST_DIVIDEND_WEIGHT_LESS_THAN| UINT256_2DARRAY[0] tokenClassList, UINT256_2DARRAY[1][0] amount || | 90 | TOKEN_IN_LIST_DIVIDEND_WEIGHT_IN_RANGE | UINT256_2DARRAY[0] tokenClassList, UINT256_2DARRAY[1][0] amount || | 91 | TOKEN_IN_LIST_AMOUNT_GREATER_THAN | UINT256_2DARRAY[0] tokenClassList, UINT256_2DARRAY[1][0] amount || | 92 | TOKEN_IN_LIST_AMOUNT_LESS_THAN | UINT256_2DARRAY[0] tokenClassList, UINT256_2DARRAY[1][0] amount || | 93 | TOKEN_IN_LIST_AMOUNT_IN_RANGE | UINT256_2DARRAY[0] tokenClassList, UINT256_2DARRAY[1][0] amount || | 94 | TOKEN_IN_LIST_AMOUNT_EQUALS| UINT256_2DARRAY[0] tokenClassList, UINT256_2DARRAY[1][0] amount || | 95 | ADDRESS_VOTING_WEIGHT_PERCENTAGE_GREATER_THAN| UINT256_2DARRAY[0][0] amount, ADDRESS_2DARRAY[0][0] address || | 96 | ADDRESS_VOTING_WEIGHT_PERCENTAGE_LESS_THAN | UINT256_2DARRAY[0][0] amount, ADDRESS_2DARRAY[0][0] address || | 97 | ADDRESS_VOTING_WEIGHT_PERCENTAGE_IN_RANGE | UINT256_2DARRAY[0][0] amount, ADDRESS_2DARRAY[0][0] address || | 98 | ADDRESS_DIVIDEND_WEIGHT_PERCENTAGE_GREATER_THAN | UINT256_2DARRAY[0][0] amount, ADDRESS_2DARRAY[0][0] address || | 99 | ADDRESS_DIVIDEND_WEIGHT_PERCENTAGE_LESS_THAN| UINT256_2DARRAY[0][0] amount, ADDRESS_2DARRAY[0][0] address || | 100 | ADDRESS_DIVIDEND_WEIGHT_PERCENTAGE_IN_RANGE | UINT256_2DARRAY[0][0] amount, ADDRESS_2DARRAY[0][0] address || | 101 | Placeholder101 | | | | 102 | Placeholder102 | | | | 103 | Placeholder103 | | | | 104 | Placeholder104 | | | | 105 | Placeholder105 | | | | 106 | Placeholder106 | | | | 107 | Placeholder107 | | | | 108 | Placeholder108 | | | | 109 | Placeholder109 | | | | 110 | Placeholder110 | | | | 111 | Placeholder111 | | | | 112 | Placeholder112 | | | | 113 | Placeholder113 | | | | 114 | Placeholder114 | | | | 115 | Placeholder115 | | | | 116 | Placeholder116 | | | | 117 | Placeholder117 | | | | 118 | Placeholder118 | | | | 119 | Placeholder119 | | | | 120 | Placeholder120 | | | | 121 | Placeholder121 | | | | 122 | Placeholder122 | | | | 123 | Placeholder123 | | | | 124 | Placeholder124 | | | | 125 | Placeholder125 | | | | 126 | Placeholder126 | | | | 127 | Placeholder127 | | | | 128 | Placeholder128 | | | | 129 | Placeholder129 | | | | 130 | Placeholder130 | | | | 131 | Placeholder131 | | | | 132 | Placeholder132 | | | | 133 | Placeholder133 | | | | 134 | Placeholder134 | | | | 135 | Placeholder135 | | | | 136 | Placeholder136 | | | | 137 | Placeholder137 | | | | 138 | Placeholder138 | | | | 139 | Placeholder139 | | | | 140 | Placeholder140 | | | | 141 | Placeholder141 | | | | 142 | Placeholder142 | | | | 143 | Placeholder143 | | | | 144 | Placeholder144 | | | | 145 | Placeholder145 | | | | 146 | Placeholder146 | | | | 147 | Placeholder147 | | | | 148 | Placeholder148 | | | | 149 | Placeholder149 | | | | 150 | Placeholder150 | | | | 151 | OPERATION_EQUALS | uint256 value || | 152 | OPERATION_IN_LIST | uint256[] values || | 153 | Placeholder153 | | | | 154 | Placeholder154 | | | | 155 | Placeholder155 | | | | 156 | Placeholder156 | | | | 157 | Placeholder157 | | | | 158 | Placeholder158 | | | | 159 | Placeholder159 | | | | 160 | Placeholder160 | | | | 161 | Placeholder161 | | | | 162 | Placeholder162 | | | | 163 | Placeholder163 | | | | 164 | Placeholder164 | | | | 166 | Placeholder166 | | | | 167 | Placeholder167 | | | | 168 | Placeholder168 | | | | 169 | Placeholder169 | | | | 170 | Placeholder170 | | | | 171 | Placeholder171 | | | | 172 | Placeholder172 | | | | 173 | Placeholder173 | | | | 174 | Placeholder174 | | | | 175 | Placeholder175 | | | | 176 | Placeholder176 | | | | 177 | Placeholder177 | | | | 178 | Placeholder178 | | | | 179 | Placeholder179 | | | | 180 | Placeholder180 | | | | 181 | EXTERNAL_CALL_UINT256_RESULT_EQUALS | ADDRESS_2DARRAY[0][0] externalAddress, BYTES encodedParameters, UINT256_2DARRAY[0][0] value || NOT READY, DO NOT USE | 182 | EXTERNAL_CALL_UINT256_RESULT_GREATER_THAN | sADDRESS_2DARRAY[0][0] externalAddress, BYTES encodedParameters, UINT256_2DARRAY[0][0] value || NOT READY, DO NOT USE | 183 | EXTERNAL_CALL_UINT256_RESULT_LESS_THAN | ADDRESS_2DARRAY[0][0] externalAddress, BYTES encodedParameters, UINT256_2DARRAY[0][0] value || NOT READY, DO NOT USE | 184 | EXTERNAL_CALL_UINT256_RESULT_IN_RANGE | ADDRESS_2DARRAY[0][0] externalAddress, BYTES encodedParameters, UINT256_2DARRAY[0][0] minValue, UINT256_2DARRAY[0][1] maxValue || NOT READY, DO NOT USE | 185 | EXTERNAL_CALL_STRING_RESULT_EQUALS | string external, string method, string[] args, string expectedValue || NOT READY, DO NOT USE | 186 | Placeholder186 | | | | 187 | Placeholder187 | | | | 188 | Placeholder188 | | | | 189 | Placeholder189 | | | | 190 | Placeholder190 | | | | 191 | Placeholder191 | | | | 192 | Placeholder192 | | | | 193 | Placeholder193 | | | | 194 | Placeholder194 | | | | 195 | Placeholder195 | | | | 196 | Placeholder196 | | | | 197 | Placeholder197 | | | | 198 | Placeholder198 | | | | 199 | Placeholder199 | | | | 200 | Placeholder200 | | | | 201 | Placeholder201 | | | | 202 | Placeholder202 | | | | 203 | Placeholder203 | | | | 204 | Placeholder204 | | | | 205 | Placeholder205 | | | | 206 | Placeholder206 | | | | 207 | Placeholder207 | | | | 208 | Placeholder208 | | | | 209 | Placeholder209 | | | | 210 | Placeholder210 | | | | 211 | BATCH_OP_SIZE_GREATER_THAN | UINT256_2DARRAY[0][0] batchSize || | 212 | BATCH_OP_SIZE_LESS_THAN | UINT256_2DARRAY[0][0] batchSize || | 213 | BATCH_OP_SIZE_IN_RANGE | UINT256_2DARRAY[0][0] startBatchSize, UINT256_2DARRAY[0][0] endBatchSize || | 214 | BATCH_OP_SIZE_EQUALS | UINT256_2DARRAY[0][0] batchSize || | 215 | BATCH_OP_EACH_TARGET_ADDRESSES_EQUALS | ADDRESS_2DARRAY[0][0] targetAddress || | 216 | BATCH_OP_EACH_TARGET_ADDRESSES_IN_LIST | ADDRESS_2DARRAY[0] targetAddressArray || | 217 | BATCH_OP_EACH_TARGET_ADDRESSES_IN_MEMBER_ROLE | UINT256_2DARRAY[0][0] memberRole || | 218 | BATCH_OP_ANY_TARGET_ADDRESS_EQUALS | ADDRESS_2DARRAY[0][0] targetAddress || | 219 | BATCH_OP_ANY_TARGET_ADDRESS_IN_LIST | ADDRESS_2DARRAY[0] targetAddressArray || | 220 | BATCH_OP_ANY_TARGET_ADDRESS_IN_MEMBER_ROLE | UINT256_2DARRAY[0][0] memberRole || | 221 | BATCH_OP_EACH_TARGET_ADDRESS_TO_ITSELF | || | 222 | BATCH_OP_ANY_TARGET_ADDRESS_TO_ITSELF | || | 223 | BATCH_OP_EACH_SOURCE_ADDRESS_EQUALS | ADDRESS_2DARRAY[0][0] sourceAddress || | 224 | BATCH_OP_EACH_SOURCE_ADDRESS_IN_LIST | ADDRESS_2DARRAY[0] sourceAddressArray || | 225 | BATCH_OP_EACH_SOURCE_ADDRESS_IN_MEMBER_ROLE | UINT256_2DARRAY[0][0] memberRole || | 226 | BATCH_OP_ANY_SOURCE_ADDRESS_EQUAL | ADDRESS_2DARRAY[0][0] sourceAddress || | 227 | BATCH_OP_ANY_SOURCE_ADDRESS_IN_LIST | ADDRESS_2DARRAY[0] sourceAddressArray || | 228 | BATCH_OP_ANY_SOURCE_ADDRESS_IN_MEMBER_ROLE | UINT256_2DARRAY[0][0] memberRole || | 229 | BATCH_OP_EACH_SOURCE_ADDRESS_FROM_ITSELF | || | 230 | BATCH_OP_ANY_SOURCE_ADDRESS_FROM_ITSELF | | | 231 | BATCH_OP_EACH_TOKEN_CLASS_EQUALS | UINT256_2DARRAY[0][0] tokenClass || | 232 | BATCH_OP_EACH_TOKEN_CLASS_IN_LIST | UINT256_2DARRAY[0] tokenClassArray || | 233 | BATCH_OP_EACH_TOKEN_CLASS_IN_RANGE | UINT256_2DARRAY[0][0] startTokenClass, UINT256_2DARRAY[0][0] endTokenClass || | 234 | BATCH_OP_EACH_TOKEN_CLASS_GREATER_THAN | UINT256_2DARRAY[0][0] tokenClass || | 235 | BATCH_OP_EACH_TOKEN_CLASS_LESS_THAN | UINT256_2DARRAY[0][0] tokenClass || | 236 | BATCH_OP_TOTAL_TOKEN_AMOUNT_GREATER_THAN | UINT256_2DARRAY[0][0] amount || | 237 | BATCH_OP_TOTAL_TOKEN_AMOUNT_LESS_THAN | UINT256_2DARRAY[0][0] amount || | 238 | BATCH_OP_TOTAL_TOKEN_AMOUNT_IN_RANGE | UINT256_2DARRAY[0][0] startAmount, UINT256_2DARRAY[0][0] endAmount || | 239 | BATCH_OP_TOTAL_TOKEN_AMOUNT_EQUALS | UINT256_2DARRAY[0][0] amount || | 240 | BATCH_OP_ANY_TOKEN_AMOUNT_GREATER_THAN | UINT256_2DARRAY[0][0] amount || | 241 | BATCH_OP_ANY_TOKEN_AMOUNT_LESS_THAN | UINT256_2DARRAY[0][0] amount || | 242 | BATCH_OP_ANY_TOKEN_AMOUNT_IN_RANGE | UINT256_2DARRAY[0][0] startAmount, UINT256_2DARRAY[0][0] endAmount || | 243 | BATCH_OP_ANY_TOKEN_AMOUNT_EQUALS | UINT256_2DARRAY[0][0] amount || | 244 | BATCH_OP_ANY_TOKEN_CLASS_GREATER_THAN | UINT256_2DARRAY[0][0] tokenClass || | 245 | BATCH_OP_ANY_TOKEN_CLASS_LESS_THAN | UINT256_2DARRAY[0][0] tokenClass || | 246 | BATCH_OP_ANY_TOKEN_CLASS_IN_RANGE | UINT256_2DARRAY[0][0] startTokenClass, UINT256_2DARRAY[0][0] endTokenClass || | 247 | BATCH_OP_ANY_TOKEN_CLASS_EQUALS | UINT256_2DARRAY[0][0] tokenClass || | 248 | BATCH_OP_ANY_TOKEN_CLASS_IN_LIST | UINT256_2DARRAY[0] tokenClassArray || | 249 | BATCH_OP_EACH_SOURCE_ADDRESS_IN_MEMBER_ROLE_LIST | UINT256_2DARRAY[0] memberRoleArray || | 250 | BATCH_OP_ANY_SOURCE_ADDRESS_IN_MEMBER_ROLE_LIST | UINT256_2DARRAY[0] memberRoleArray || | 251 | BATCH_OP_EACH_TARGET_ADDRESS_IN_MEMBER_ROLE_LIST | UINT256_2DARRAY[0] memberRoleArray || | 252 | BATCH_OP_ANY_TARGET_ADDRESS_IN_MEMBER_ROLE_LIST | UINT256_2DARRAY[0] memberRoleArray || | 253 | BATCH_OP_EACH_TARGET_ADDRESS_WITHDRAWABLE_CASH_GREATER_THAN | UINT256_2DARRAY[0][0] amount || | 254 | BATCH_OP_EACH_TARGET_ADDRESS_WITHDRAWABLE_CASH_LESS_THAN | UINT256_2DARRAY[0][0] amount || | 255 | BATCH_OP_EACH_TARGET_ADDRESS_WITHDRAWABLE_CASH_IN_RANGE | UINT256_2DARRAY[0][0] startAmount, UINT256_2DARRAY[0][0] endAmount || | 256 | BATCH_OP_EACH_TARGET_ADDRESS_WITHDRAWABLE_CASH_EQUALS | UINT256_2DARRAY[0][0] amount || | 257 | BATCH_OP_ANY_TARGET_ADDRESS_WITHDRAWABLE_CASH_GREATER_THAN | UINT256_2DARRAY[0][0] amount || | 258 | BATCH_OP_ANY_TARGET_ADDRESS_WITHDRAWABLE_CASH_LESS_THAN | UINT256_2DARRAY[0][0] amount || | 259 | BATCH_OP_ANY_TARGET_ADDRESS_WITHDRAWABLE_CASH_IN_RANGE | UINT256_2DARRAY[0][0] startAmount, UINT256_2DARRAY[0][0] endAmount || | 260 | BATCH_OP_EACH_TARGET_ADDRESS_TOTAL_VOTING_WEIGHT_GREATER_THAN | UINT256_2DARRAY[0][0] amount || | 261 | BATCH_OP_EACH_TARGET_ADDRESS_TOTAL_VOTING_WEIGHT_LESS_THAN | UINT256_2DARRAY[0][0] amount || | 262 | BATCH_OP_EACH_TARGET_ADDRESS_TOTAL_VOTING_WEIGHT_IN_RANGE | UINT256_2DARRAY[0][0] startAmount, UINT256_2DARRAY[0][0] endAmount || | 263 | BATCH_OP_EACH_TARGET_ADDRESS_TOTAL_VOTING_WEIGHT_EQUALS | UINT256_2DARRAY[0][0] amount || | 264 | BATCH_OP_ANY_TARGET_ADDRESS_TOTAL_VOTING_WEIGHT_GREATER_THAN | UINT256_2DARRAY[0][0] amount || | 265 | BATCH_OP_ANY_TARGET_ADDRESS_TOTAL_VOTING_WEIGHT_LESS_THAN | UINT256_2DARRAY[0][0] amount || | 266 | BATCH_OP_ANY_TARGET_ADDRESS_TOTAL_VOTING_WEIGHT_IN_RANGE | UINT256_2DARRAY[0][0] startAmount, UINT256_2DARRAY[0][1] endAmount || | 267 | BATCH_OP_EACH_TARGET_ADDRESS_TOTAL_DIVIDEND_WEIGHT_GREATER_THAN | UINT256_2DARRAY[0][0] amount || | 268 | BATCH_OP_EACH_TARGET_ADDRESS_TOTAL_DIVIDEND_WEIGHT_LESS_THAN | UINT256_2DARRAY[0][0] amount || | 269 | BATCH_OP_EACH_TARGET_ADDRESS_TOTAL_DIVIDEND_WEIGHT_IN_RANGE | UINT256_2DARRAY[0][0] startAmount, UINT256_2DARRAY[0][1] endAmount || | 270 | BATCH_OP_ANY_TARGET_ADDRESS_TOTAL_DIVIDEND_WEIGHT_GREATER_THAN | UINT256_2DARRAY[0][0] amount || | 271 | BATCH_OP_ANY_TARGET_ADDRESS_TOTAL_DIVIDEND_WEIGHT_LESS_THAN | UINT256_2DARRAY[0][0] amount || | 272 | BATCH_OP_ANY_TARGET_ADDRESS_TOTAL_DIVIDEND_WEIGHT_IN_RANGE | UINT256_2DARRAY[0][0] startAmount, UINT256_2DARRAY[0][1] endAmount || | 273 | BATCH_OP_EACH_TARGET_ADDRESS_OWNS_TOKEN_X_GREATER_THAN | UINT256_2DARRAY[0][0] tokenClass, UINT256_2DARRAY[0][1] amount || | 274 | BATCH_OP_EACH_TARGET_ADDRESS_OWNS_TOKEN_X_LESS_THAN | UINT256_2DARRAY[0][0] tokenClass, UINT256_2DARRAY[0][1] amount || | 275 | BATCH_OP_EACH_TARGET_ADDRESS_OWNS_TOKEN_X_IN_RANGE | UINT256_2DARRAY[0][0] tokenClass, UINT256_2DARRAY[0][1] startAmount, UINT256_2DARRAY[0][2] endAmount || | 276 | BATCH_OP_ANY_TARGET_ADDRESS_OWNS_TOKEN_X_GREATER_THAN | UINT256_2DARRAY[0][0] tokenClass, UINT256_2DARRAY[0][1] amount | | 277 | BATCH_OP_ANY_TARGET_ADDRESS_OWNS_TOKEN_X_LESS_THAN | UINT256_2DARRAY[0][0] tokenClass, UINT256_2DARRAY[0][1] amount | | 278 | BATCH_OP_ANY_TARGET_ADDRESS_OWNS_TOKEN_X_IN_RANGE | UINT256_2DARRAY[0][0] tokenClass, UINT256_2DARRAY[0][1] startAmount, UINT256_2DARRAY[0][2] endAmount | | 279 | Placeholder279 | | | | 280 | Placeholder280 | | | | 281 | Placeholder281 | | | | 282 | Placeholder282 | | | | 283 | Placeholder283 | | | | 284 | Placeholder284 | | | | 285 | Placeholder285 | | | | 286 | Placeholder286 | | | | 287 | Placeholder287 | | | | 288 | Placeholder288 | | | | 289 | Placeholder289 | | | | 290 | Placeholder290 | | | | 291 | Placeholder291 | | | | 292 | Placeholder292 | | | | 293 | Placeholder293 | | | | 294 | Placeholder294 | | | | 295 | Placeholder295 | | | | 296 | Placeholder296 | | | | 297 | Placeholder297 | | | | 298 | Placeholder298 | | | | 299 | Placeholder299 | | | | 300 | Placeholder300 | | | | 301 | ENABLE_ANY_BEFORE_OP_PLUGIN_INDEX_IN_LIST | UINT256_2DARRAY[0] pluginIndexList | Only for checking "BATCH_ENABLE_PLUGINS" operation. | 302 | ENABLE_ANY_AFTER_OP_PLUGIN_INDEX_IN_LIST | UINT256_2DARRAY[0] pluginIndexList | Only for checking "BATCH_ENABLE_PLUGINS" operation. | 303 | ENABLE_EACH_BEFORE_OP_PLUGIN_INDEX_IN_LIST | UINT256_2DARRAY[0][0] startPluginIndex | Only for checking "BATCH_ENABLE_PLUGINS" operation. | 304 | ENABLE_EACH_AFTER_OP_PLUGIN_INDEX_IN_LIST | UINT256_2DARRAY[0] pluginIndexList | Only for checking "BATCH_ENABLE_PLUGINS" operation. | 305 | DISABLE_ANY_BEFORE_OP_PLUGIN_INDEX_IN_LIST | UINT256_2DARRAY[0] pluginIndexList | Only for checking "BATCH_DISABLE_PLUGINS" operation. | 306 | DISABLE_ANY_AFTER_OP_PLUGIN_INDEX_IN_LIST | UINT256_2DARRAY[0] pluginIndexList | Only for checking "BATCH_DISABLE_PLUGINS" operation. | 307 | DISABLE_EACH_BEFORE_OP_PLUGIN_INDEX_IN_LIST | UINT256_2DARRAY[0] pluginIndexList | Only for checking "BATCH_DISABLE_PLUGINS" operation. | 308 | DISABLE_EACH_AFTER_OP_PLUGIN_INDEX_IN_LIST | UINT256_2DARRAY[0] pluginIndexList | Only for checking "BATCH_DISABLE_PLUGINS" operation. | 309 | ENABLE_ANY_BEFORE_OP_PLUGIN_INDEX_IN_RANGE | UINT256_2DARRAY[0][0] startPluginIndex, UINT256_2DARRAY[0][1] endPluginIndex | Only for checking "BATCH_ENABLE_PLUGINS" operation. | 310 | ENABLE_ANY_AFTER_OP_PLUGIN_INDEX_IN_RANGE | UINT256_2DARRAY[0][0] startPluginIndex, UINT256_2DARRAY[0][1] endPluginIndex | Only for checking "BATCH_ENABLE_PLUGINS" operation. | 311 | ENABLE_EACH_BEFORE_OP_PLUGIN_INDEX_IN_RANGE | UINT256_2DARRAY[0][0] startPluginIndex, UINT256_2DARRAY[0][1] endPluginIndex | Only for checking "BATCH_ENABLE_PLUGINS" operation. | 312 | ENABLE_EACH_AFTER_OP_PLUGIN_INDEX_IN_RANGE | UINT256_2DARRAY[0][0] startPluginIndex, UINT256_2DARRAY[0][1] endPluginIndex | Only for checking "BATCH_ENABLE_PLUGINS" operation. | 313 | DISABLE_ANY_BEFORE_OP_PLUGIN_INDEX_IN_RANGE | UINT256_2DARRAY[0][0] startPluginIndex, UINT256_2DARRAY[0][1] endPluginIndex | Only for checking "BATCH_DISABLE_PLUGINS" operation. | 314 | DISABLE_ANY_AFTER_OP_PLUGIN_INDEX_IN_RANGE | UINT256_2DARRAY[0][0] startPluginIndex, UINT256_2DARRAY[0][1] endPluginIndex | Only for checking "BATCH_DISABLE_PLUGINS" operation. | 315 | DISABLE_EACH_BEFORE_OP_PLUGIN_INDEX_IN_RANGE | UINT256_2DARRAY[0][0] startPluginIndex, UINT256_2DARRAY[0][1] endPluginIndex | Only for checking "BATCH_DISABLE_PLUGINS" operation. | 316 | DISABLE_EACH_AFTER_OP_PLUGIN_INDEX_IN_RANGE | UINT256_2DARRAY[0][0] startPluginIndex, UINT256_2DARRAY[0][1] endPluginIndex | Only for checking "BATCH_DISABLE_PLUGINS" operation. | 317 | ARE_ALL_PLUGINS_BEFORE_OPERATION | | This can be used for checking "BATCH_ENABLE_PLUGINS", "BATCH_DISABLE_PLUGINS", "BATCH_ADD_PLUGINS" and "BATCH_ADD_AND_ENABLE_PLUGINS" operations. | 318 | ARE_ALL_PLUGINS_AFTER_OPERATION | | This can be used for checking "BATCH_ENABLE_PLUGINS", "BATCH_DISABLE_PLUGINS", "BATCH_ADD_PLUGINS" and "BATCH_ADD_AND_ENABLE_PLUGINS" operations. | 319 | IS_ANY_PLUGIN_BEFORE_OPERATION | | This can be used for checking "BATCH_ENABLE_PLUGINS", "BATCH_DISABLE_PLUGINS", "BATCH_ADD_PLUGINS" and "BATCH_ADD_AND_ENABLE_PLUGINS" operations. | 320 | IS_ANY_PLUGIN_AFTER_OPERATION | | This can be used for checking "BATCH_ENABLE_PLUGINS", "BATCH_DISABLE_PLUGINS", "BATCH_ADD_PLUGINS" and "BATCH_ADD_AND_ENABLE_PLUGINS" operations. | 321 | ADD_PLUGIN_ANY_LEVEL_EQUALS | UINT256_2DARRAY[0][0] pluginIndex, UINT256_2DARRAY[0][0] level || | 322 | ADD_PLUGIN_ANY_LEVEL_IN_LIST | UINT256_2DARRAY[0] pluginIndexList || | 323 | ADD_PLUGIN_ANY_LEVEL_IN_RANGE | UINT256_2DARRAY[0][0] startPluginIndex, UINT256_2DARRAY[0][0] endPluginIndex, UINT256_2DARRAY[0][0] level || | 324 | ADD_PLUGIN_ANY_LEVEL_GREATER_THAN | UINT256_2DARRAY[0][0] pluginIndex, UINT256_2DARRAY[0][0] level || | 325 | ADD_PLUGIN_ANY_LEVEL_LESS_THAN | UINT256_2DARRAY[0][0] pluginIndex, UINT256_2DARRAY[0][0] level || | 326 | ADD_PLUGIN_ANY_RETURN_TYPE_EQUALS | UINT256_2DARRAY[0][0] pluginIndex, UINT256_2DARRAY[0][0] returnType || | 327 | ADD_PLUGIN_ANY_VOTING_RULE_INDEX_IN_LIST | UINT256_2DARRAY[0] votingRuleIndexList || | 328 | Placeholder320 | | | | 321 | Placeholder321 | | | | 322 | Placeholder322 | | | | 323 | Placeholder323 | | | | 324 | Placeholder324 | | | | 325 | Placeholder325 | | | | 326 | Placeholder326 | | | | 327 | Placeholder327 | | | | 328 | Placeholder328 | | | | 329 | Placeholder329 | | | | 330 | Placeholder330 | | | | 331 | Placeholder331 | | | | 332 | Placeholder332 | | | | 333 | Placeholder333 | | | | 334 | Placeholder334 | | | | 335 | Placeholder335 | | | | 336 | Placeholder336 | | | | 337 | Placeholder337 | | | | 338 | Placeholder338 | | | | 339 | Placeholder339 | | | | 340 | Placeholder340 | | | | 341 | Placeholder341 | | | | 342 | Placeholder342 | | | | 343 | Placeholder343 | | | | 344 | Placeholder344 | | | | 345 | Placeholder345 | | | | 346 | Placeholder346 | | | | 347 | Placeholder347 | | | | 348 | Placeholder348 | | | | 349 | Placeholder349 | | | | 350 | Placeholder350 | | | | 351 | Placeholder351 | | | | 352 | Placeholder352 | | | | 353 | Placeholder353 | | | | 354 | Placeholder354 | | | | 355 | Placeholder355 | | | | 356 | Placeholder356 | | | | 357 | Placeholder357 | | | | 358 | Placeholder358 | | | | 359 | Placeholder359 | | | | 360 | Placeholder360 | | | | 361 | Placeholder361 | | | | 362 | Placeholder362 | | | | 363 | Placeholder363 | | | | 364 | Placeholder364 | | | | 365 | Placeholder365 | | | | 366 | Placeholder366 | | | | 367 | Placeholder367 | | | | 368 | Placeholder368 | | | | 369 | Placeholder369 | | | | 370 | Placeholder370 | | | | 371 | ADD_ANY_VOTING_RULE_IS_ABSOLUTE_MAJORITY | || | 372 | ADD_ANY_VOTING_RULE_APPROVAL_PERCENTAGE_IN_RANGE | UINT256_2DARRAY[0][0] startPercentage, UINT256_2DARRAY[0][1] endPercentage || | 373 | ADD_ANY_VOTING_RULE_TOKEN_CLASS_CONTAINS | UINT256_2DARRAY[0][0] tokenClass || | 374 | Placeholder374 | | | | 375 | Placeholder375 | | | | 376 | Placeholder376 | | | | 377 | Placeholder377 | | | | 378 | Placeholder378 | | | | 379 | Placeholder379 | | | | 380 | Placeholder380 | | | | 381 | Placeholder381 | | | | 382 | Placeholder382 | | | | 383 | Placeholder383 | | | | 384 | Placeholder384 | | | | 385 | Placeholder385 | | | | 386 | Placeholder386 | | | | 387 | Placeholder387 | | | | 388 | Placeholder388 | | | | 389 | Placeholder389 | | | | 390 | Placeholder390 | | | | 391 | Placeholder391 | | | | 392 | Placeholder392 | | | | 393 | Placeholder393 | | | | 394 | Placeholder394 | | | | 395 | Placeholder395 | | | | 396 | Placeholder396 | | | | 397 | Placeholder397 | | | | 398 | Placeholder398 | | | | 399 | Placeholder399 | | | | 400 | Placeholder400 | | | | 401 | CHANGE_MEMBER_ROLE_TO_ANY_ROLE_EQUALS | ADDRESS_2DARRAY[0][0] targetAddress || | 402 | CHANGE_MEMBER_ROLE_TO_ANY_ROLE_IN_LIST | ADDRESS_2DARRAY[0] targetAddressArray || | 403 | CHANGE_MEMBER_ROLE_TO_ANY_ROLE_IN_RANGE | ADDRESS_2DARRAY[0][0] startTargetAddress, ADDRESS_2DARRAY[0][1] endTargetAddress || | 404 | Placeholder404 | | | | 405 | Placeholder405 | | | | 406 | CHANGE_MEMBER_NAME_TO_ANY_STRING_IN_LIST | STRING_ARRAY nameList || | 407 | CHANGE_MEMBER_NAME_TO_ANY_STRING_CONTAINS | STRING_ARRAY[0] subString || | 408 | Placeholder408 | | | | 409 | Placeholder409 | | | | 410 | Placeholder410 | | | | 411 | Placeholder411 | | | | 412 | Placeholder412 | | | | 413 | Placeholder413 | | | | 414 | Placeholder414 | | | | 415 | Placeholder415 | | | | 416 | Placeholder416 | | | | 417 | Placeholder417 | | | | 418 | Placeholder418 | | | | 419 | Placeholder419 | | | | 420 | Placeholder420 | | | | 421 | Placeholder421 | | | | 422 | Placeholder422 | | | | 423 | Placeholder423 | | | | 424 | Placeholder424 | | | | 425 | Placeholder425 | | | | 426 | Placeholder426 | | | | 427 | Placeholder427 | | | | 428 | Placeholder428 | | | | 429 | Placeholder429 | | | | 430 | Placeholder430 | | | | 431 | ADD_WITHDRAWABLE_BALANCE_ANY_AMOUNT_GREATER_THAN | UINT256_2DARRAY[0][0] amount || | 432 | ADD_WITHDRAWABLE_BALANCE_ANY_AMOUNT_LESS_THAN | UINT256_2DARRAY[0][0] amount || | 433 | ADD_WITHDRAWABLE_BALANCE_ANY_AMOUNT_IN_RANGE | UINT256_2DARRAY[0][0] startAmount, UINT256_2DARRAY[0][0] endAmount || | 434 | ADD_WITHDRAWABLE_BALANCE_ANY_AMOUNT_EQUALS | UINT256_2DARRAY[0][0] amount || | 435 | REDUCE_WITHDRAWABLE_BALANCE_ANY_AMOUNT_GREATER_THAN | UINT256_2DARRAY[0][0] amount || | 436 | REDUCE_WITHDRAWABLE_BALANCE_ANY_AMOUNT_LESS_THAN | UINT256_2DARRAY[0][0] amount || | 437 | REDUCE_WITHDRAWABLE_BALANCE_ANY_AMOUNT_IN_RANGE | UINT256_2DARRAY[0][0] startAmount, UINT256_2DARRAY[0][0] endAmount || | 438 | REDUCE_WITHDRAWABLE_BALANCE_ANY_AMOUNT_EQUALS | UINT256_2DARRAY[0][0] amount || | 439 | Placeholder439 | | | | 440 | Placeholder440 | | | | 441 | Placeholder441 | | | | 442 | Placeholder442 | | | | 443 | Placeholder443 | | | | 444 | Placeholder444 | | | | 445 | Placeholder445 | | | | 446 | Placeholder446 | | | | 447 | Placeholder447 | | | | 448 | Placeholder448 | | | | 449 | Placeholder449 | | | | 450 | Placeholder450 | | | | 451 | Placeholder451 | | | | 452 | Placeholder452 | | | | 453 | Placeholder453 | | | | 454 | Placeholder454 | | | | 455 | Placeholder455 | | | | 456 | Placeholder456 | | | | 457 | Placeholder457 | | | | 458 | Placeholder458 | | | | 459 | Placeholder459 | | | | 460 | Placeholder460 | | | | 461 | TOKEN_X_OP_ANY_PRICE_GREATER_THAN | UINT256_2DARRAY[0][0] tokenClass, UINT256_2DARRAY[0][1] price | For three operations: "BATCH_PAY_TO_MINT_TOKENS", "BATCH_PAY_TO_TRANSFER_TOKENS" and "BATCH_BURN_TOKENS_AND_REFUND". | 462 | TOKEN_X_OP_ANY_PRICE_LESS_THAN | UINT256_2DARRAY[0][0] tokenClass, UINT256_2DARRAY[0][1] price | For three operations: "BATCH_PAY_TO_MINT_TOKENS", "BATCH_PAY_TO_TRANSFER_TOKENS" and "BATCH_BURN_TOKENS_AND_REFUND". | 463 | TOKEN_X_OP_ANY_PRICE_IN_RANGE | UINT256_2DARRAY[0][0] tokenClass, UINT256_2DARRAY[0][1] startPrice, UINT256_2DARRAY[0][2] endPrice | For three operations: "BATCH_PAY_TO_MINT_TOKENS", "BATCH_PAY_TO_TRANSFER_TOKENS" and "BATCH_BURN_TOKENS_AND_REFUND". | 464 | TOKEN_X_OP_ANY_PRICE_EQUALS | UINT256_2DARRAY[0][0] tokenClass, UINT256_2DARRAY[0][1] price | For three operations: "BATCH_PAY_TO_MINT_TOKENS", "BATCH_PAY_TO_TRANSFER_TOKENS" and "BATCH_BURN_TOKENS_AND_REFUND". | 465 | TOKEN_X_OP_ANY_PRICE_GREATER_THAN_EXTERNAL_VALUE_UINT256 | UINT256_2DARRAY[0][0] tokenClass, ADDRESS_2DARRAY[0][0] externalContractAddress, BYTES abiEncodedParameters | For three operations: "BATCH_PAY_TO_MINT_TOKENS", "BATCH_PAY_TO_TRANSFER_TOKENS" and "BATCH_BURN_TOKENS_AND_REFUND". | 466 | TOKEN_X_OP_ANY_PRICE_LESS_THAN_EXTERNAL_VALUE_UINT256 | UINT256_2DARRAY[0][0] tokenClass, ADDRESS_2DARRAY[0][0] externalContractAddress, BYTES abiEncodedParameters | For three operations: "BATCH_PAY_TO_MINT_TOKENS", "BATCH_PAY_TO_TRANSFER_TOKENS" and "BATCH_BURN_TOKENS_AND_REFUND". | 467 | TOKEN_X_OP_ANY_PRICE_EQUALS_EXTERNAL_VALUE_UINT256 | UINT256_2DARRAY[0][0] tokenClass, ADDRESS_2DARRAY[0][0] externalContractAddress, BYTES abiEncodedParameters | For three operations: "BATCH_PAY_TO_MINT_TOKENS", "BATCH_PAY_TO_TRANSFER_TOKENS" and "BATCH_BURN_TOKENS_AND_REFUND". | 468 | Placeholder468 | | | | 469 | Placeholder469 | | | | 470 | Placeholder470 | | | | 471 | Placeholder471 | | | | 472 | Placeholder472 | | | | 473 | Placeholder473 | | | | 474 | Placeholder474 | | | | 475 | Placeholder475 | | | | 476 | Placeholder476 | | | | 477 | Placeholder477 | | | | 478 | Placeholder478 | | | | 479 | Placeholder479 | | | | 480 | Placeholder480 | | | | 481 | Placeholder481 | | | | 482 | Placeholder482 | | | | 483 | Placeholder483 | | | | 484 | Placeholder484 | | | | 485 | Placeholder485 | | | | 486 | Placeholder486 | | | | 487 | Placeholder487 | | | | 488 | Placeholder488 | | | | 489 | Placeholder489 | | | | 490 | Placeholder490 | | | | 491 | Placeholder491 | | | | 492 | Placeholder492 | | | | 493 | Placeholder493 | | | | 494 | Placeholder494 | | | | 495 | Placeholder495 | | | | 496 | Placeholder496 | | | | 497 | Placeholder497 | | | | 498 | Placeholder498 | | | | 499 | Placeholder499 | | | | 500 | Placeholder500 | | | | 501 | CREATE_TOKEN_CLASSES_ANY_TOKEN_DIVIDEND_WEIGHT_GREATER_THAN | UINT256_2DARRAY[0][0] weight | For "BATCH_CREATE_TOKEN_CLASSES" operation. | 502 | CREATE_TOKEN_CLASSES_ANY_TOKEN_DIVIDEND_WEIGHT_LESS_THAN | UINT256_2DARRAY[0][0] weight | For "BATCH_CREATE_TOKEN_CLASSES" operation. | 503 | CREATE_TOKEN_CLASSES_ANY_TOKEN_DIVIDEND_WEIGHT_IN_RANGE | UINT256_2DARRAY[0][0]startWeight, UINT256_2DARRAY[0][1] endWeight | For "BATCH_CREATE_TOKEN_CLASSES" operation. | 504 | CREATE_TOKEN_CLASSES_ANY_TOKEN_DIVIDEND_WEIGHT_EQUALS | UINT256_2DARRAY[0][0] weight | For "BATCH_CREATE_TOKEN_CLASSES" operation. | 505 | CREATE_TOKEN_CLASSES_ANY_VOTING_WEIGHT_GREATER_THAN | UINT256_2DARRAY[0][0] weight | For "BATCH_CREATE_TOKEN_CLASSES" operation. | 506 | CREATE_TOKEN_CLASSES_ANY_VOTING_WEIGHT_LESS_THAN | UINT256_2DARRAY[0][0] weight | For "BATCH_CREATE_TOKEN_CLASSES" operation. | 507 | CREATE_TOKEN_CLASSES_ANY_VOTING_WEIGHT_IN_RANGE | UINT256_2DARRAY[0][0] startWeight, UINT256_2DARRAY[0][1] endWeight | For "BATCH_CREATE_TOKEN_CLASSES" operation. | 508 | CREATE_TOKEN_CLASSES_ANY_VOTING_WEIGHT_EQUALS | UINT256_2DARRAY[0][0] weight | For "BATCH_CREATE_TOKEN_CLASSES" operation. | 509 | Placeholder509 | | | | 510 | Placeholder510 | | | | 511 | Placeholder511 | | | | 512 | Placeholder512 | | | | 513 | Placeholder513 | | | | 514 | Placeholder514 | | | | 515 | Placeholder515 | | | | 516 | Placeholder516 | | | | 517 | Placeholder517 | | | | 518 | Placeholder518 | | | | 519 | Placeholder519 | | | | 520 | Placeholder520 | | | | 521 | Placeholder521 | | | | 522 | Placeholder522 | | | | 523 | Placeholder523 | | | | 524 | Placeholder524 | | | | 525 | Placeholder525 | | | | 526 | Placeholder526 | | | | 527 | Placeholder527 | | | | 528 | Placeholder528 | | | | 529 | Placeholder529 | | | | 530 | Placeholder530 | | | | 531 | Placeholder531 | | | | 532 | Placeholder532 | | | | 533 | Placeholder533 | | | | 534 | Placeholder534 | | | | 535 | Placeholder535 | | | | 536 | Placeholder536 | | | | 537 | Placeholder537 | | | | 538 | Placeholder538 | | | | 539 | Placeholder539 | | | | 540 | Placeholder540 | | | | 541 | Placeholder541 | | | | 542 | Placeholder542 | | | | 543 | Placeholder543 | | | | 544 | Placeholder544 | | | | 545 | Placeholder545 | | | | 546 | Placeholder546 | | | | 547 | Placeholder547 | | | | 548 | Placeholder548 | | | | 549 | Placeholder549 | | | | 550 | Placeholder550 | | | | 551 | Placeholder551 | | | | 552 | Placeholder552 | | | | 553 | Placeholder553 | | | | 554 | Placeholder554 | | | | 555 | Placeholder555 | | | | 556 | Placeholder556 | | | | 557 | Placeholder557 | | | | 558 | Placeholder558 | | | | 559 | Placeholder559 | | | | 560 | Placeholder560 | | | | 561 | Placeholder561 | | | | 562 | Placeholder562 | | | | 563 | Placeholder563 | | | | 564 | Placeholder564 | | | | 565 | Placeholder565 | | | | 566 | Placeholder566 | | | | 567 | Placeholder567 | | | | 568 | Placeholder568 | | | | 569 | Placeholder569 | | | | 570 | Placeholder570 | | | | 571 | Placeholder571 | | | | 572 | Placeholder572 | | | | 573 | Placeholder573 | | | | 574 | Placeholder574 | | | | 575 | Placeholder575 | | | | 576 | Placeholder576 | | | | 577 | Placeholder577 | | | | 578 | Placeholder578 | | | | 579 | Placeholder579 | | | | 580 | Placeholder580 | | | | 581 | Placeholder581 | | | | 582 | Placeholder582 | | | | 583 | Placeholder583 | | | | 584 | Placeholder584 | | | | 585 | Placeholder585 | | | | 586 | Placeholder586 | | | | 587 | Placeholder587 | | | | 588 | Placeholder588 | | | | 589 | Placeholder589 | | | | 590 | Placeholder590 | | | | 591 | Placeholder591 | | | | 592 | Placeholder592 | | | | 593 | Placeholder593 | | | | 594 | Placeholder594 | | | | 595 | Placeholder595 | | | | 596 | Placeholder596 | | | | 597 | Placeholder597 | | | | 598 | Placeholder598 | | | | 599 | Placeholder599 | | | | 600 | Placeholder600 | | | | 601 | PROGRAM_OP_LENGTH_GREATER_THAN | UINT256_2DARRAY[0][0] length || | 602 | PROGRAM_OP_LENGTH_LESS_THAN | UINT256_2DARRAY[0][0] length || | 603 | PROGRAM_OP_LENGTH_IN_RANGE | UINT256_2DARRAY[0][0] startLength, UINT256_2DARRAY[0][1] endLength || | 604 | PROGRAM_OP_LENGTH_EQUALS | UINT256_2DARRAY[0][0] length || | 605 | PROGRAM_CONTAINS_OP | UINT256_2DARRAY[0][0] opCode || | 606 | PROGRAM_CONTAINS_OP_IN_LIST | UINT256_2DARRAY[0] opCodeList || | 607 | PROGRAM_EVERY_OP_EQUALS | UINT256_2DARRAY[0][0] opCode || | 608 | PROGRAM_EVERY_OP_IN_LIST | UINT256_2DARRAY[0] opCodeList || | 609 | Placeholder609 | | | | 610 | Placeholder610 | | | | 611 | Placeholder611 | | | | 612 | Placeholder612 | | | | 613 | Placeholder613 | | | | 614 | Placeholder614 | | | | 615 | Placeholder615 | | | | 616 | Placeholder616 | | | | 617 | Placeholder617 | | | | 618 | Placeholder618 | | | | 619 | Placeholder619 | | | | 620 | Placeholder620 | | | | 621 | Placeholder621 | | | | 622 | Placeholder622 | | | | 623 | Placeholder623 | | | | 624 | Placeholder624 | | | | 625 | Placeholder625 | | | | 626 | Placeholder626 | | | | 627 | Placeholder627 | | | | 628 | Placeholder628 | | | | 629 | Placeholder629 | | | | 630 | Placeholder630 | | | | 631 | Placeholder631 | | | | 632 | Placeholder632 | | | | 633 | Placeholder633 | | | | 634 | Placeholder634 | | | | 635 | Placeholder635 | | | | 636 | Placeholder636 | | | | 637 | Placeholder637 | | | | 638 | Placeholder638 | | | | 639 | Placeholder639 | | | | 640 | Placeholder640 | | | | 641 | Placeholder641 | | | | 642 | Placeholder642 | | | | 643 | Placeholder643 | | | | 644 | Placeholder644 | | | | 645 | Placeholder645 | | | | 646 | Placeholder646 | | | | 647 | Placeholder647 | | | | 648 | Placeholder648 | | | | 649 | Placeholder649 | | | | 650 | Placeholder650 | | | | 651 | Placeholder651 | | | | 652 | Placeholder652 | | | | 653 | Placeholder653 | | | | 654 | Placeholder654 | | | | 655 | Placeholder655 | | | | 656 | Placeholder656 | | | | 657 | Placeholder657 | | | | 658 | Placeholder658 | | | | 659 | Placeholder659 | | | | 660 | Placeholder660 | | | | 661 | Placeholder661 | | | | 662 | Placeholder662 | | | | 663 | Placeholder663 | | | | 664 | Placeholder664 | | | | 665 | Placeholder665 | | | | 666 | Placeholder666 | | | | 667 | Placeholder667 | | | | 668 | Placeholder668 | | | | 669 | Placeholder669 | | | | 670 | Placeholder670 | | | | 671 | Placeholder671 | | | | 672 | Placeholder672 | | | | 673 | Placeholder673 | | | | 674 | Placeholder674 | | | | 675 | Placeholder675 | | | | 676 | Placeholder676 | | | | 677 | Placeholder677 | | | | 678 | Placeholder678 | | | | 679 | Placeholder679 | | | | 680 | Placeholder680 | | | | 681 | Placeholder681 | | | | 682 | Placeholder682 | | | | 683 | Placeholder683 | | | | 684 | Placeholder684 | | | | 685 | Placeholder685 | | | | 686 | Placeholder686 | | | | 687 | Placeholder687 | | | | 688 | Placeholder688 | | | | 689 | Placeholder689 | | | | 690 | Placeholder690 | | | | 691 | Placeholder691 | | | | 692 | Placeholder692 | | | | 693 | Placeholder693 | | | | 694 | Placeholder694 | | | | 695 | Placeholder695 | | | | 696 | Placeholder696 | | | | 697 | Placeholder697 | | | | 698 | Placeholder698 | | | | 699 | Placeholder699 | | | | 700 | Placeholder700 | | | | 701 | OPERATION_BY_OPERATOR_SINCE_LAST_TIME_GREATER_THAN | uint256 timestamp || | 702 | OPERATION_BY_OPERATOR_SINCE_LAST_TIME_LESS_THAN | uint256 timestamp || | 703 | OPERATION_BY_OPERATOR_SINCE_LAST_TIME_IN_RANGE | uint256 startTimestamp, uint256 endTimestamp || | 704 | OPERATION_GLOBAL_SINCE_LAST_TIME_GREATER_THAN | uint256 timestamp || | 705 | OPERATION_GLOBAL_SINCE_LAST_TIME_LESS_THAN | uint256 timestamp || | 706 | OPERATION_GLOBAL_SINCE_LAST_TIME_IN_RANGE | uint256 startTimestamp, uint256 endTimestamp || | 707 | OPERATION_BY_ANY_ADDRESS_IN_LIST_SINCE_LAST_TIME_GREATER_THAN | address[] addressList, uint256 timestamp || | 708 | OPERATION_BY_ANY_ADDRESS_IN_LIST_SINCE_LAST_TIME_LESS_THAN | address[] addressList, uint256 timestamp || | 709 | OPERATION_BY_ANY_ADDRESS_IN_LIST_SINCE_LAST_TIME_IN_RANGE | address[] addressList, uint256 startTimestamp, uint256 endTimestamp || | 710 | OPERATION_BY_EACH_ADDRESS_IN_LIST_SINCE_LAST_TIME_GREATER_THAN | address[] addressList, uint256 timestamp || | 711 | OPERATION_BY_EACH_ADDRESS_IN_LIST_SINCE_LAST_TIME_LESS_THAN | address[] addressList, uint256 timestamp || | 712 | OPERATION_BY_EACH_ADDRESS_IN_LIST_SINCE_LAST_TIME_IN_RANGE | address[] addressList, uint256 startTimestamp, uint256 endTimestamp || | 713 | Placeholder713 | | | | 714 | Placeholder714 | | | | 715 | Placeholder715 | | | | 716 | Placeholder716 | | | | 717 | Placeholder717 | | | | 718 | Placeholder718 | | | | 719 | Placeholder719 | | | | 720 | Placeholder720 | | | | 721 | Placeholder721 | | | | 722 | Placeholder722 | | | | 723 | Placeholder723 | | | | 724 | Placeholder724 | | | | 725 | Placeholder725 | | | | 726 | Placeholder726 | | | | 727 | Placeholder727 | | | | 728 | Placeholder728 | | | | 729 | Placeholder729 | | | | 730 | Placeholder730 | | | | 731 | Placeholder731 | | | | 732 | Placeholder732 | | | | 733 | Placeholder733 | | | | 734 | Placeholder734 | | | | 735 | Placeholder735 | | | | 736 | Placeholder736 | | | | 737 | Placeholder737 | | | | 738 | Placeholder738 | | | | 739 | Placeholder739 | | | | 740 | Placeholder740 | | | | 741 | Placeholder741 | | | | 742 | Placeholder742 | | | | 743 | Placeholder743 | | | | 744 | Placeholder744 | | | | 745 | Placeholder745 | | | | 746 | Placeholder746 | | | | 747 | Placeholder747 | | | | 748 | Placeholder748 | | | | 749 | Placeholder749 | | | | 750 | Placeholder750 | | | | 751 | Placeholder751 | | | | 752 | Placeholder752 | | | | 753 | Placeholder753 | | | | 754 | Placeholder754 | | | | 755 | Placeholder755 | | | | 756 | Placeholder756 | | | | 757 | Placeholder757 | | | | 758 | Placeholder758 | | | | 759 | Placeholder759 | | | | 760 | Placeholder760 | | | | 761 | Placeholder761 | | | | 762 | Placeholder762 | | | | 763 | Placeholder763 | | | | 764 | Placeholder764 | | | | 765 | Placeholder765 | | | | 766 | Placeholder766 | | | | 767 | Placeholder767 | | | | 768 | Placeholder768 | | | | 769 | Placeholder769 | | | | 770 | Placeholder770 | | | | 771 | Placeholder771 | | | | 772 | Placeholder772 | | | | 773 | Placeholder773 | | | | 774 | Placeholder774 | | | | 775 | Placeholder775 | | | | 776 | Placeholder776 | | | | 777 | Placeholder777 | | | | 778 | Placeholder778 | | | | 779 | Placeholder779 | | | | 780 | Placeholder780 | | | | 781 | Placeholder781 | | | | 782 | Placeholder782 | | | | 783 | Placeholder783 | | | | 784 | Placeholder784 | | | | 785 | Placeholder785 | | | | 786 | Placeholder786 | | | | 787 | Placeholder787 | | | | 788 | Placeholder788 | | | | 789 | Placeholder789 | | | | 790 | Placeholder790 | | | | 791 | Placeholder791 | | | | 792 | Placeholder792 | | | | 793 | Placeholder793 | | | | 794 | Placeholder794 | | | | 795 | Placeholder795 | | | | 796 | Placeholder796 | | | | 797 | Placeholder797 | | | | 798 | Placeholder798 | | | | 799 | Placeholder799 | | | | 800 | Placeholder800 | | | | 801 | Placeholder801 | | | | 802 | Placeholder802 | | | | 803 | Placeholder803 | | | | 804 | Placeholder804 | | | | 805 | Placeholder805 | | | | 806 | Placeholder806 | | | | 807 | Placeholder807 | | | | 808 | Placeholder808 | | | | 809 | Placeholder809 | | | | 810 | Placeholder810 | | | | 811 | Placeholder811 | | | | 812 | Placeholder812 | | | | 813 | Placeholder813 | | | | 814 | Placeholder814 | | | | 815 | Placeholder815 | | | | 816 | Placeholder816 | | | | 817 | Placeholder817 | | | | 818 | Placeholder818 | | | | 819 | Placeholder819 | | | | 820 | Placeholder820 | | | | 821 | Placeholder821 | | | | 822 | Placeholder822 | | | | 823 | Placeholder823 | | | | 824 | Placeholder824 | | | | 825 | Placeholder825 | | | | 826 | Placeholder826 | | | | 827 | Placeholder827 | | | | 828 | Placeholder828 | | | | 829 | Placeholder829 | | | | 830 | Placeholder830 | | | | 831 | Placeholder831 | | | | 832 | Placeholder832 | | | | 833 | Placeholder833 | | | | 834 | Placeholder834 | | | | 835 | Placeholder835 | | | | 836 | Placeholder836 | | | | 837 | Placeholder837 | | | | 838 | Placeholder838 | | | | 839 | Placeholder839 | | | | 840 | Placeholder840 | | | | 841 | Placeholder841 | | | | 842 | Placeholder842 | | | | 843 | Placeholder843 | | | | 844 | Placeholder844 | | | | 845 | Placeholder845 | | | | 846 | Placeholder846 | | | | 847 | Placeholder847 | | | | 848 | Placeholder848 | | | | 849 | Placeholder849 | | | | 850 | Placeholder850 | | | | 851 | Placeholder851 | | | | 852 | Placeholder852 | | | | 853 | Placeholder853 | | | | 854 | Placeholder854 | | | | 855 | Placeholder855 | | | | 856 | Placeholder856 | | | | 857 | Placeholder857 | | | | 858 | Placeholder858 | | | | 859 | Placeholder859 | | | | 860 | Placeholder860 | | | | 861 | Placeholder861 | | | | 862 | Placeholder862 | | | | 863 | Placeholder863 | | | | 864 | Placeholder864 | | | | 865 | Placeholder865 | | | | 866 | Placeholder866 | | | | 867 | Placeholder867 | | | | 868 | Placeholder868 | | | | 869 | Placeholder869 | | | | 870 | Placeholder870 | | | | 871 | Placeholder871 | | | | 872 | Placeholder872 | | | | 873 | Placeholder873 | | | | 874 | Placeholder874 | | | | 875 | Placeholder875 | | | | 876 | Placeholder876 | | | | 877 | Placeholder877 | | | | 878 | Placeholder878 | | | | 879 | Placeholder879 | | | | 880 | Placeholder880 | | | | 881 | Placeholder881 | | | | 882 | Placeholder882 | | | | 883 | Placeholder883 | | | | 884 | Placeholder884 | | | | 885 | Placeholder885 | | | | 886 | Placeholder886 | | | | 887 | Placeholder887 | | | | 888 | Placeholder888 | | | | 889 | Placeholder889 | | | | 890 | Placeholder890 | | | | 891 | Placeholder891 | | | | 892 | Placeholder892 | | | | 893 | Placeholder893 | | | | 894 | Placeholder894 | | | | 895 | Placeholder895 | | | | 896 | Placeholder896 | | | | 897 | Placeholder897 | | | | 898 | Placeholder898 | | | | 899 | Placeholder899 | | | | 900 | Placeholder900 | | | | 901 | Placeholder901 | | | | 902 | Placeholder902 | | | | 903 | Placeholder903 | | | | 904 | Placeholder904 | | | | 905 | Placeholder905 | | | | 906 | Placeholder906 | | | | 907 | Placeholder907 | | | | 908 | Placeholder908 | | | | 909 | Placeholder909 | | | | 910 | Placeholder910 | | | | 911 | Placeholder911 | | | | 912 | Placeholder912 | | | | 913 | Placeholder913 | | | | 914 | Placeholder914 | | | | 915 | Placeholder915 | | | | 916 | Placeholder916 | | | | 917 | Placeholder917 | | | | 918 | Placeholder918 | | | | 919 | Placeholder919 | | | | 920 | Placeholder920 | | | | 921 | Placeholder921 | | | | 922 | Placeholder922 | | | | 923 | Placeholder923 | | | | 924 | Placeholder924 | | | | 925 | Placeholder925 | | | | 926 | Placeholder926 | | | | 927 | Placeholder927 | | | | 928 | Placeholder928 | | | | 929 | Placeholder929 | | | | 930 | Placeholder930 | | | | 931 | Placeholder931 | | | | 932 | Placeholder932 | | | | 933 | Placeholder933 | | | | 934 | Placeholder934 | | | | 935 | Placeholder935 | | | | 936 | Placeholder936 | | | | 937 | Placeholder937 | | | | 938 | Placeholder938 | | | | 939 | Placeholder939 | | | | 940 | Placeholder940 | | | | 941 | Placeholder941 | | | | 942 | Placeholder942 | | | | 943 | Placeholder943 | | | | 944 | Placeholder944 | | | | 945 | Placeholder945 | | | | 946 | Placeholder946 | | | | 947 | Placeholder947 | | | | 948 | Placeholder948 | | | | 949 | Placeholder949 | | | | 950 | Placeholder950 | | | | 951 | Placeholder951 | | | | 952 | Placeholder952 | | | | 953 | Placeholder953 | | | | 954 | Placeholder954 | | | | 955 | Placeholder955 | | | | 956 | Placeholder956 | | | | 957 | Placeholder957 | | | | 958 | Placeholder958 | | | | 959 | Placeholder959 | | | | 960 | Placeholder960 | | | | 961 | Placeholder961 | | | | 962 | Placeholder962 | | | | 963 | Placeholder963 | | | | 964 | Placeholder964 | | | | 965 | Placeholder965 | | | | 966 | Placeholder966 | | | | 967 | Placeholder967 | | | | 968 | Placeholder968 | | | | 969 | Placeholder969 | | | | 970 | Placeholder970 | | | | 971 | Placeholder971 | | | | 972 | Placeholder972 | | | | 973 | Placeholder973 | | | | 974 | Placeholder974 | | | | 975 | Placeholder975 | | | | 976 | Placeholder976 | | | | 977 | Placeholder977 | | | | 978 | Placeholder978 | | | | 979 | Placeholder979 | | | | 980 | Placeholder980 | | | | 981 | Placeholder981 | | | | 982 | Placeholder982 | | | | 983 | Placeholder983 | | | | 984 | Placeholder984 | | | | 985 | Placeholder985 | | | | 986 | Placeholder986 | | | | 987 | Placeholder987 | | | | 988 | Placeholder988 | | | | 989 | Placeholder989 | | | | 990 | Placeholder990 | | | | 991 | Placeholder991 | | | | 992 | Placeholder992 | | | | 993 | Placeholder993 | | | | 994 | Placeholder994 | | | | 995 | Placeholder995 | | | | 996 | Placeholder996 | | | | 997 | Placeholder997 | | | | 998 | Placeholder998 | | | | 999 | Placeholder999 | | | | 1000 | Placeholder1000 | | | ================================================ FILE: darc-docs/docs/DARC Protocol/Getting Started.md ================================================ --- sidebar_position: 1 --- # Getting Started ### What is the DARC Protocol? ### Building the source Since Hardhat and OpenZeppelin are used, the project can be built using the following commands: 1. Install dependencies We recommend that you use `pnpm` instead of `npm`, but `npm` can also work. `pnpm` is a newer package manager that has some advantages over npm. It is faster, more efficient, and disk-space friendly. ```shell cd darc-protocol npm install ``` 2. Compile the contracts ```shell npx hardhat compile ``` 3. Host a local devnet node with hardhat configuration: ```shell npx hardhat node ``` 4. Test contracts ```shell REPORT_GAS=true npx hardhat test --network localhost ``` ### Deploy To deploy the DARC protocol, you can use the following commands: ```shell npx hardhat run scripts/deploy.js --network ``` If you want to deploy the DARC protocol to the local devnet, you can use the following command: ```shell npx hardhat run scripts/deploy.js --network localhost ``` Make sure you have a local devnet node running before deploying the DARC protocol. If you want to deploy the DARC protocol to the Ethereum mainnet, you can use the following command: ```shell npx hardhat run scripts/deploy.js --network mainnet ``` ================================================ FILE: darc-docs/docs/DARC Protocol/OpCodes.md ================================================ --- sidebar_position: 2 --- # OpCodes ### What is an OpCode? Decentralized Autonomous Regulated Corporation (DARC) is a protocol that enables the creation and management of autonomous entities with built-in governance and regulatory mechanisms. One of the key components of the DARC protocol is the opcode instruction set, which defines the basic operations for managing tokens, money, and law within the system. The opcode instruction set provides a standardized way to interact with the DARC protocol and perform various actions. These instructions define the operations that can be executed by participants within the DARC, allowing for the creation, transfer, and burning of tokens, as well as the management of membership, roles, and plugins. With the opcode instruction set, users can mint new tokens, create token classes with specific properties such as voting and dividend weights, transfer tokens between addresses, and burn tokens to remove them from circulation. It also allows for the addition and suspension of membership, changing member roles and names, and enabling or disabling plugins for additional functionality. Furthermore, the opcode instruction set includes operations for handling monetary transactions, such as withdrawing cash to designated addresses, paying cash, offering dividends, and setting approval for all operations. Additionally, it provides mechanisms for adding storage IPFS hashes, voting on proposals, executing programs, and performing other essential functions within the DARC ecosystem. By defining these operations through opcodes, the DARC protocol ensures consistency, transparency, and security in managing tokens, money, and law within autonomous entities. These instructions form the foundation for the decentralized governance and regulation of corporations, providing a framework for transparent and auditable decision-making processes. ### Notes In DARC protocol, the operations are named with uppercase letters, and in By-law Script and darcjs SDK, the operations are named with lowercase letters. For example, the operation `BATCH_MINT_TOKENS` in DARC protocol are named `batch_mint_tokens` in both By-law Script and darcjs SDK. | Opcode ID | Opcode Name | Opcode Parameter | Opcode Notes | |-----------|----------------------------------------------|----------------------------------------------------------|------------------------------------------------------------| | 0 | UNDEFINED | | Invalid Operation | | 1 | BATCH_MINT_TOKENS | ADDRESS_2DARRAY[0] toAddressArray, UINT256_2DARRAY[0] tokenClassArray, UINT256_2DARRAY[1] amountArray | Batch Mint Token Operation | | 2 | BATCH_CREATE_TOKEN_CLASSES | STRING_ARRAY[] nameArray, UINT256_2DARRAY[0] tokenIndexArray, UINT256_2DARRAY[1] votingWeightArray, UINT256_2DARRAY[2] dividendWeightArray | Batch Create Token Class Operation | | 3 | BATCH_TRANSFER_TOKENS | ADDRESS_2DARRAY[0] toAddressArray, UINT256_2DARRAY[0] tokenClassArray, UINT256_2DARRAY[1] amountArray | Batch Transfer Token Operation | | 4 | BATCH_TRANSFER_TOKENS_FROM_TO | ADDRESS_2DARRAY[0] fromAddressArray, ADDRESS_2DARRAY[1] toAddressArray, UINT256_2DARRAY[0] tokenClassArray, UINT256_2DARRAY[1] amountArray | Batch Transfer Token From Addr A to Addr B Operation | | 5 | BATCH_BURN_TOKENS | UINT256_2DARRAY[0] tokenClassArray, UINT256_2DARRAY[1] amountArray | Batch Burn Token Operation | | 6 | BATCH_BURN_TOKENS_FROM | ADDRESS_2DARRAY[0] fromAddressArray, UINT256_2DARRAY[0] tokenClassArray, UINT256_2DARRAY[1] amountArray | Batch Burn Token From Addr A Operation | | 7 | BATCH_ADD_MEMBERSHIPS | ADDRESS_2DARRAY[0] memberAddressArray, UINT256_2DARRAY[0] memberRoleArray, STRING_ARRAY memberNameArray | Batch Add Member Operation | | 8 | BATCH_SUSPEND_MEMBERSHIPS | ADDRESS_2DARRAY[0] memberAddressArray | Batch Suspend Member Operation | | 9 | BATCH_RESUME_MEMBERSHIPS | ADDRESS_2DARRAY[0] memberAddressArray | Batch Resume Member Operation | | 10 | BATCH_CHANGE_MEMBER_ROLES | ADDRESS_2DARRAY[0] memberAddressArray, UINT256_2DARRAY[0] memberRoleArray | Batch Change Member Role Operation | | 11 | BATCH_CHANGE_MEMBER_NAMES | ADDRESS_2DARRAY[0] memberAddressArray, STRING_ARRAY memberNameArray | Batch Change Member Name Operation | | 12 | BATCH_ADD_PLUGINS | Plugin[] pluginList | Batch Add Emergency Agent Operation | | 13 | BATCH_ENABLE_PLUGINS | UINT256_ARRAY[0] pluginIndexArray, BOOL_ARRAY isBeforeOperationArray | Batch Enable Plugin Operation | | 14 | BATCH_DISABLE_PLUGINS | UINT256_ARRAY[0] pluginIndexArray, BOOL_ARRAY isBeforeOperationArray | Batch Disable Plugin Operation | | 15 | BATCH_ADD_AND_ENABLE_PLUGINS | Plugin[] pluginList | Batch Add and Enable Plugin Operation | | 16 | BATCH_SET_PARAMETERS | MachineParameter[] parameterNameArray, UINT256_2DARRAY[0] parameterValueArray | Batch Set Parameter Operation | | 17 | BATCH_ADD_WITHDRAWABLE_BALANCES | ADDRESS_2DARRAY[0] addressArray, UINT256_2DARRAY[0] amountArray | Batch Add Withdrawable Balance Operation | | 18 | BATCH_REDUCE_WITHDRAWABLE_BALANCES | ADDRESS_2DARRAY[0] addressArray, UINT256_2DARRAY[0] amountArray | Batch Reduce Withdrawable Balance Operation | | 19 | BATCH_ADD_VOTING_RULES | VotingRule[] votingRuleList | Batch Add Voting Rules Operation | | 20 | BATCH_PAY_TO_MINT_TOKENS | ADDRESS_2DARRAY[0] addressArray, UINT256_2DARRAY[0] tokenClassArray, UINT256_2DARRAY[1] amountArray, UINT256_2DARRAY[2] priceArray, UINT256_2DARRAY[3] dividendableFlag | Batch Pay to Mint Tokens Operation | | 21 | BATCH_PAY_TO_TRANSFER_TOKENS | ADDRESS_2DARRAY[0] toAddressArray, UINT256_2DARRAY[0] tokenClassArray, UINT256_2DARRAY[1] amountArray, UINT256_2DARRAY[2] priceArray, UINT256_2DARRAY[3] dividendableFlag | Pay some cash to transfer tokens Operation (product coins) | | 22 | ADD_EMERGENCY | ADDRESS_2DARRAY[0] addressArray | Add an array of address as emergency agents Operation | | 23 | RESERVED_ID_23 | | Reserved ID 23 DO NOT USE | | 24 | CALL_EMERGENCY | UINT256_2DARRAY[0][0] emergencyAgentIndex | Call emergency agents to handle emergency situations | | 25 | CALL_CONTRACT_ABI | ADDRESS_2D[0][0] contractAddress, bytes abi, UINT256_2DARRAY[0][0] value | Call a contract with the given abi Operation | | 26 | PAY_CASH | uint256 amount, uint256 paymentType, uint256 dividendable | Pay some cash Operation | | 27 | OFFER_DIVIDENDS | | Calculate the dividends and offer to token holders Operation| | 28 | RESERVED_ID_28 | | Reserved ID 28 DO NOT USE | | 29 | SET_APPROVAL_FOR_ALL_OPERATIONS | ADDRESS_2DARRAY[0][0] targetAddress | Set the approval for all transfer operations by address Operation | | 30 | BATCH_BURN_TOKENS_AND_REFUND | UINT256_2D[0] tokenClassArray, UINT256_2D[1] amountArray, UINT256_2D[2] priceArray | Batch Burn tokens and Refund Operation | | 31 | ADD_STORAGE_STRING | STRING_ARRAY[0][0] IFPSHash | Add storage IPFS hash to the storage list permanently Operation | | 32 | VOTE | bool[] voteArray | Vote for a voting pending program Operation | | 33 | EXECUTE_PENDING_PROGRAM | | Execute a program that has been voted and approved Operation | | 34 | END_EMERGENCY | | Emergency mode termination Operation | | 35 | UPGRADE_TO_ADDRESS | ADDRESS_2DARRAY[0][0] targetAddress | Upgrade the contract to a new contract address Operation | | 36 | CONFIRM_UPGRAED_FROM_ADDRESS | ADDRESS_2DARRAY[0][0] fromAddress | Accepting current DARCs to be upgraded from the old contract address Operation | ================================================ FILE: darc-docs/docs/DARC Protocol/_category_.json ================================================ { "label": "DARC Protocol", "position": 2, "collapsed": false, "collapsible": false, "link": { "type": "generated-index", "description": "Everything about the DARC Protocol" } } ================================================ FILE: darc-docs/docs/Overview/Overview.md ================================================ # Overview ### What is DARC? Decentralized Autonomous Regulated Corporation(DARC) is a virtual machine that written in Solidity. It is a smart contract that can be deployed on Ethereum or EVM-compatible blockchain. It is fully open source and can be used by anyone under the license. ### DARC Project Goals and Features The ultimate goal of the DARC project is to design a comprehensive, self-regulating corporate governance system that liberates itself from the textual contracts and external regulations imposed by government and legal registrations such as C-corp, LLC, and foundations. It aims to achieve a complete, internal, trustworthy, and programmable plugin system for self-regulation within DARC instances. Therefore, it possesses the following characteristics: 1. Multi-level tokens: DARC can configure multiple levels of tokens, each with its own voting weight and dividend weight. Through various configurations and combinations, tokens at different levels can serve as common stock, class A/B stock, company bonds, board of directors positions, preferred stock, and various other company assets and ownership structures defined by complex rules. Similarly, multi-level tokens can be commodities and services sold by DARC, whether they are fungible or non-fungible tokens. 2. Plugin-as-a-Law: Plugin is the central mechanism of the DARC protocol, governing and establishing all rules within DARC, including the addition, enabling, and disabling of plugins themselves. Plugins define the operations permitted or prohibited within DARC under specific conditions. In the DARC framework, users can set up and add a complete set of plugins to define the daily operations of DARC, including board operations, company bylaws, shareholder agreements, complex investment agreements with various conditions, dividend regulations, employment contracts, procurement contracts, and more. By designing comprehensive and diverse plugins, DARC can be perfected much like real-world company legal contracts, regulating all operations of DARC members such as shareholders, the board of directors, employees, customers, and suppliers. 3. Operation and Program: In the context of the DARC protocol, all operations are abstracted into a series of operations, including opcodes and parameters. Users can design, compile, and run all daily management and operations of DARC, including equity operations, member operations, cash operations, plugin design and maintenance, voting operations, and more, using By-law Script. These scripts are deployed and executed on the DARC virtual machine instance deployed on the blockchain. ### DARC Project Structure The entire DARC Project ([https://github.com/project-darc](https://github.com/project-darc)) is divided into four parts: 1. DARC Protocol: This is the core component of DARC and serves as the virtual machine that interprets and executes all operations and programs. This part is written and completed in Solidity. Users can choose to deploy the prebuilt DARC binary or modify and compile their own DARC protocol for one-click deployment to an EVM-compatible blockchain. 2. By-law Script: By-law Script is a programming language used to write DARC programs and plugins. The basic syntax of By-law Script is almost identical to JavaScript, and it uniquely supports operator overloading. Therefore, users can easily write complex boolean logic and comprehensive conditional statements. By-law Script is the first programming language designed to write executable and deployable legal code within legal entities. 3. darcjs: darcjs: darcjs is a toolkit and SDK for developers and users to interact with the DARC protocol. With darcjs, users can easily compile and run By-law Script, deploy the DARC protocol on specified EVM-compatible blockchains, or embed core functionalities related to DARC in developer projects, such as payments, voting, asset transfers, legal updates, cash withdrawals, and more. 4. DARC Studio: DARC Studio is a visual web frontend. With DARC Studio, users can easily write and run By-law Script in the browser without installing darcjs. It visualizes various information about deployed DARC instances, such as recent activities, assets, equity distributions, legal documents, and more. ### Community Telegram: [https://t.me/projectdarc](https://t.me/projectdarc) Github: [https://github.com/project-darc](https://github.com/project-darc) Github Discussions: [https://github.com/orgs/Project-DARC/discussions](https://github.com/orgs/Project-DARC/discussions) ================================================ FILE: darc-docs/docs/Overview/_category_.json ================================================ { "label": "Overview", "position": 1, "collapsed": false, "collapsible": false, "link": { "type": "generated-index", "description": "Overview about darc.js" } } ================================================ FILE: darc-docs/docs/darc.js/Getting Started.md ================================================ --- sidebar_position: 1 --- import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; # Getting Started ### What is darc.js? **darc.js** is a TypeScript/JavaScript library for interacting with the DARC virtual machine for node.js and the browser environment. ### Installation You need to install **ethers.js** with version 5.7.2 or 5.x.x toghether with **darc.js**. ```shell npm install darcjs ``` ```shell yarn add darcjs ``` ```shell pnpm install darcjs ``` ### Usage To use darc.js supports ESM, import it as follows: ```ts import * as darcjs from 'darcjs'; ``` Or if you are using CommonJS: ```js const darcjs = require('darcjs'); ``` ### Deploy your DARC To deploy DARC on an EVM-compatible blockchain, you need to use the `deployDARC(DARC_VERSION, signer)` function, in which `DARC_VERSION` is the version of DARC you want to deploy and signer is the signer of the transaction. If you are using the browser environment and want to get the signer from the **MetaMask** wallet, you can use the `getSigner()` function from `ethers.js`, for example: ```ts import { deployDARC, ethers } from 'darcjs'; // Get signer from MetaMask wallet const signer = (new ethers.providers.Web3Provider(window.ethereum)).getSigner(); // deploy DARC const darc_contract_address = await darcjs.deployDARC( DARC_VERSION.Latest, signer ); ``` If you are using the node.js environment, you need to use `ethers.providers` to construct a provider, then use the `ethers.Wallet` class from `ethers.js` to create a signer with a private key, for example: ```ts import { deployDARC, ethers } from 'darcjs'; // Construct the provider via JsonRpcProvider on local devnet node const provider = new ethers.providers.JsonRpcProvider('http://127.0.0.1:8545/'); // Construct the signer via Wallet class and private key const signer = new ethers.Wallet('0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80', provider); // deploy DARC const darc_contract_address = await deployDARC( DARC_VERSION.Latest, signer ); // print the address of the deployed DARC console.log("The deployed DARC address: " + darc_contract_address); ``` ### Access to a deployed DARC(read only) To access a deployed DARC on an EVM-compatible blockchain, you need to constrcut a `DARC` object via the `DARC` class, in which the constructor takes the address of the deployed DARC and the signer or provider as parameters. Also you need to specify the version of the DARC you want to access, and the provider for accessing the EVM-compatible blockchain. Since you do not need to write anyting to the blockchain or execute any DARC program, you can just use the `provider` to access the DARC, and it is not necessary to use the `signer` for the DARC constructor. For example: ```ts import { DARC, ethers } from 'darcjs'; // Construct a provider via JsonRpcProvider on local devnet node const provider = new ethers.providers.JsonRpcProvider('http://127.0.0.1:8545/'); // Get the deployed DARC address const darc_contract_address = '0x5FbDB2315678afecb367f032d93F642f64180aa3'; // Construct a DARC object const myDARC_readOnly = new DARC({ address: darc_contract_address, provider: provider, version: DARC_VERSION.Latest, }); // Read the member address list of the DARC const memberList = await myDARC_readOnly.getMemberList(); // Read the member name via member address for (let i = 0; i < memberList.length; i++) { const memberInfo = await myDARC_readOnly.getMemberInfo(memberList[i]); console.log("The member name of " + memberList[i] + " is " + memberInfo.name); } ``` ### Access to a deployed DARC(with signer) If you want to access a deployed DARC on an EVM-compatible blockchain, and run the program or withdraw some cash from the DARC, you need to use the `signer` to construct the `DARC` object via the `DARC` class, in which the constructor takes the address of the deployed DARC, the signer and the version of the DARC you want to access as parameters. Since the signer contains the private key and provider information, it is not necessary to use the `provider` for the DARC constructor. Here is an example of how to access a deployed DARC with a signer: ```ts import { DARC, ethers } from 'darcjs'; // Construct a provider via JsonRpcProvider on local devnet node const provider = new ethers.providers.JsonRpcProvider('http://127.0.0.1:8545/'); // Construct the signer via Wallet class and private key const signer = new ethers.Wallet('0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80', provider); // Get the deployed DARC address const darc_contract_address = '0x5FbDB2315678afecb367f032d93F642f64180aa3'; // Construct a DARC object const myDARC = new DARC({ address: darc_contract_address, wallet: signer, // pass the signer to the DARC constructor version: DARC_VERSION.Latest, }); ``` Then you can use the `darc` object to access the deployed DARC, not only read the data of the DARC, but also run the program on the DARC. For example: ```ts import {transpileAndRun} from 'darcjs'; // Write a code snippet of DARC program let byLawScript = ` // define address 1 and 2 for minting tokens const addr1 = '0x0000'; const addr2 = '0x0001'; // mint tokens to address addr1 and addr2 batch_mint_tokens( [0,0,1,1], [1000,1000,2000,2000], [addr1, addr2, addr1, addr2] ); // enable plugins 3, 4 before sandbox checking operation // and disable plugins 5, 6 after sandbox checking operation batch_enable_plugins( [3,4,5,6], [true, true, false, false] ); // finally, offer dividends to every token holder offer_dividends(); ` // Transpile and run the By-law Script program on the DARC deployed on the chain const result = await myDARC.transpileAndRun( byLawScript, signer, dart_contract_address, DARC_VERSION.Latest ); ``` ### Execute a By-law Script program on the DARC The `transpileAndRun` function is used to execute a By-law Script program on the DARC. It takes the By-law Script program, the signer, the address of the deployed DARC and the version of the DARC as parameters. Here is an example of how to execute a By-law Script program on the DARC: ```ts import {transpileAndRun} from 'darcjs'; // Write a code snippet of DARC program let byLawScript = ` batch_transfer_tokens( ["0x0123..."], // the addresses of the recipients [0], // the token index [100]); // the amounts ` // Execute the By-law Script program on the DARC deployed on the chain const result = await transpileAndRun( byLawScript, signer, dart_contract_address, DARC_VERSION.Latest ); ``` The `transpileAndRun` function contains two parts: the first part is to transpile the By-law Script program into the operation list, do parsing for the By-law Script and replace the operator `|`, `&` with condition node constructor `or()`, `and()` respectively, and the second part is to execute the operation list on the DARC, pushing each operation with opcode and parameters into a list, and send the big chunk of object body with all operations to the DARC entrance. ### Execute an operation list via SDK Also you can execute an operation list on the DARC via the SDK, without the By-law Script syntax. The `executeOperationList` function is used to execute an operation list on the DARC. It takes the operation list, the signer, the address of the deployed DARC and the version of the DARC as parameters. You can just import all the operations and plugins you need from the `darcjs` library, and then use the `executeOperationList` function to execute the operation list on the DARC. Here is an example in TypeScript about how to execute an operation list via SDK: ```ts import { executeOperationList, batch_transfer_tokens, operator_address_equals, batch_add_and_enable_plugins } from 'darcjs'; const result = executeOperationList( [ // first operation: batch transfer tokens batch_transfer_tokens( ["0x0123..."], // the addresses of the recipients [0], // the token index [100]), // the amounts batch_add_and_enable_plugins( [ { returnType: EnumReturnType.YES_AND_SKIP_SANDBOX, // yes and skip sandbox level: BigInt(103), votingRuleIndex: BigInt(0), notes: "allow operatorAddress == target1 | operatorAddress == target2", bIsEnabled: true, bIsBeforeOperation: true, conditionNodes: or( operator_address_equals(target1), operator_address_equals(target2) ).generateConditionNodeList() } ] ) ], signer, dart_contract_address, DARC_VERSION.Latest ); ``` ### Development Notes: To run the test for darcjs, you need to clone the darcjs repository from the GitHub, and then run the test with the following commands: ```shell git clone https://github.com/Project-DARC/DARC.git ``` Then first install the dependencies for `darc-protocol` project ```shell cd darc-protocol npm install ``` And start a local devnet node with the following command: ```shell npx hardhat node ``` Then run the test for `darc-protocol` project ```shell npx hardhat test ``` Then switch to the `darcjs` project and install the dependencies for `darcjs` project ```shell cd ../darcjs pnpm install ``` And run the test for `darcjs` project ```shell pnpm run test ``` Remember, you need to install `pnpm` before running the test for `darcjs` project, and you can install `pnpm` with the following command: ```shell npm install -g pnpm ``` Also do not forget to initialize the `darc-protocol` project and start a local devnet node before running the test for `darcjs` project. ================================================ FILE: darc-docs/docs/darc.js/_category_.json ================================================ { "label": "darc.js", "position": 4, "collapsed": false, "collapsible": false, "link": { "type": "generated-index", "description": "Everything about darc.js" } } ================================================ FILE: darc-docs/docusaurus.config.js ================================================ // @ts-check // Note: type annotations allow type checking and IDEs autocompletion const lightCodeTheme = require('prism-react-renderer/themes/github'); const darkCodeTheme = require('prism-react-renderer/themes/dracula'); /** @type {import('@docusaurus/types').Config} */ const config = { title: 'DARC Docs', tagline: 'Decentralized Autonomous Regulated Corporation (DARC), your on-chain company.', favicon: 'img/darc-logo.png', // Set the production url of your site here url: 'https://your-docusaurus-test-site.com', // Set the // pathname under which your site is served // For GitHub pages deployment, it is often '//' baseUrl: '/', // GitHub pages deployment config. // If you aren't using GitHub pages, you don't need these. organizationName: 'project-darc', // Usually your GitHub org/user name. projectName: 'darc', // Usually your repo name. onBrokenLinks: 'throw', onBrokenMarkdownLinks: 'warn', // Even if you don't use internalization, you can use this field to set useful // metadata like html lang. For example, if your site is Chinese, you may want // to replace "en" with "zh-Hans". i18n: { defaultLocale: 'en', locales: ['en'], }, presets: [ [ 'classic', /** @type {import('@docusaurus/preset-classic').Options} */ ({ docs: { sidebarPath: require.resolve('./sidebars.js'), // Please change this to your repo. // Remove this to remove the "edit this page" links. editUrl: 'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/', }, blog: { showReadingTime: true, // Please change this to your repo. // Remove this to remove the "edit this page" links. editUrl: 'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/', }, theme: { customCss: require.resolve('./src/css/custom.css'), }, }), ], ], themeConfig: /** @type {import('@docusaurus/preset-classic').ThemeConfig} */ ({ colorMode: { disableSwitch: true }, algolia: { // The application ID provided by Algolia appId: 'JYQVEBDKBP', // Public API key: it is safe to commit it apiKey: '695a3556e6bf7d738b5c67b00996ed0a', indexName: 'darc', // Optional: see doc section below contextualSearch: true, }, // Replace with your project's social card image: 'img/docusaurus-social-card.jpg', navbar: { logo: { src: 'img/darc-logo.png', }, items: [ { label: 'Home', to: '/', }, { label: 'Docs', to: '/docs/Overview', }, { type: 'dropdown', label: 'API', position: 'left', items: [ { label: 'Darcjs API', href: '/api/darcjs/index.html', prependBaseUrlToHref: true, target: '_blank', }, ], }, { href: 'https://github.com/project-darc/darc', label: 'GitHub', position: 'right', }, ], }, // footer: { // style: 'dark', // links: [ // { // title: 'Docs', // items: [ // { // label: 'Tutorial', // to: '/docs/intro', // }, // ], // }, // { // title: 'Community', // items: [ // { // label: 'Stack Overflow', // href: 'https://stackoverflow.com/questions/tagged/docusaurus', // }, // { // label: 'Discord', // href: 'https://discordapp.com/invite/docusaurus', // }, // { // label: 'Twitter', // href: 'https://twitter.com/docusaurus', // }, // ], // }, // { // title: 'More', // items: [ // { // label: 'Blog', // to: '/blog', // }, // { // label: 'GitHub', // href: 'https://github.com/facebook/docusaurus', // }, // ], // }, // ], // copyright: `Copyright © ${new Date().getFullYear()} DARC Team. Built with Docusaurus.`, // }, prism: { theme: lightCodeTheme, darkTheme: darkCodeTheme, }, }), }; module.exports = config; ================================================ FILE: darc-docs/package.json ================================================ { "name": "darc-docs", "version": "0.0.3", "private": true, "scripts": { "docusaurus": "docusaurus", "prestart": "npm run generate:darcjs-api", "start": "docusaurus start", "prebuild": "npm run generate:darcjs-api", "build": "docusaurus build", "swizzle": "docusaurus swizzle", "deploy": "docusaurus deploy", "clear": "docusaurus clear", "serve": "docusaurus serve", "write-translations": "docusaurus write-translations", "write-heading-ids": "docusaurus write-heading-ids", "generate:darcjs-api": "typedoc --out ../darc-docs/static/api/darcjs --entryPointStrategy expand ../darc-js/src --tsconfig ../darc-js/tsconfig.json --skipErrorChecking", "postinstall": "npm run generate:darcjs-api" }, "dependencies": { "@docusaurus/core": "2.4.0", "@docusaurus/plugin-pwa": "^2.4.0", "@docusaurus/preset-classic": "2.4.0", "@emotion/react": "^11.10.8", "@emotion/styled": "^11.10.8", "@mdx-js/react": "^1.6.22", "@mui/joy": "5.0.0-alpha.78", "clsx": "^1.2.1", "prism-react-renderer": "^1.3.5", "react": "^17.0.2", "react-dom": "^17.0.2", "react-icons": "^4.8.0", "react-use": "^17.4.0", "typedoc": "^0.24.7" }, "devDependencies": { "@docusaurus/module-type-aliases": "2.4.0" }, "browserslist": { "production": [ ">0.5%", "not dead", "not op_mini all" ], "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ] }, "engines": { "node": ">=16.14" } } ================================================ FILE: darc-docs/sidebars.js ================================================ /** * Creating a sidebar enables you to: - create an ordered group of docs - render a sidebar for each doc of that group - provide next/previous navigation The sidebars can be generated from the filesystem, or explicitly defined here. Create as many sidebars as you want. */ // @ts-check /** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */ const sidebars = { // By default, Docusaurus generates a sidebar from the docs folder structure tutorialSidebar: [ { type: 'autogenerated', dirName: '.', // '.' means the current docs folder }, ], // But you can create a sidebar manually /* tutorialSidebar: [ 'intro', 'hello', { type: 'category', label: 'Tutorial', items: ['tutorial-basics/create-a-document'], }, ], */ }; module.exports = sidebars; ================================================ FILE: darc-docs/src/components/HomepageFeatures/index.js ================================================ import React from 'react'; import clsx from 'clsx'; import styles from './styles.module.css'; const FeatureList = [ { title: 'Easy to Use', Svg: require('@site/static/img/undraw_docusaurus_mountain.svg').default, description: ( <> Docusaurus was designed from the ground up to be easily installed and used to get your website up and running quickly. ), }, { title: 'Focus on What Matters', Svg: require('@site/static/img/undraw_docusaurus_tree.svg').default, description: ( <> Docusaurus lets you focus on your docs, and we'll do the chores. Go ahead and move your docs into the docs directory. ), }, { title: 'Powered by React', Svg: require('@site/static/img/undraw_docusaurus_react.svg').default, description: ( <> Extend or customize your website layout by reusing React. Docusaurus can be extended while reusing the same header and footer. ), }, ]; function Feature({Svg, title, description}) { return (

{title}

{description}

); } export default function HomepageFeatures() { return (
{FeatureList.map((props, idx) => ( ))}
); } ================================================ FILE: darc-docs/src/components/HomepageFeatures/styles.module.css ================================================ .features { display: flex; align-items: center; padding: 2rem 0; width: 100%; } .featureSvg { height: 200px; width: 200px; } ================================================ FILE: darc-docs/src/css/custom.css ================================================ /** * Any CSS included here will be global. The classic template * bundles Infima by default. Infima is a CSS framework designed to * work well for content-centric websites. */ /* You can override the default Infima variables here. */ :root { --ifm-color-primary: #2e8555; --ifm-color-primary-dark: #29784c; --ifm-color-primary-darker: #277148; --ifm-color-primary-darkest: #205d3b; --ifm-color-primary-light: #33925d; --ifm-color-primary-lighter: #359962; --ifm-color-primary-lightest: #3cad6e; --ifm-code-font-size: 95%; --docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1); } /* For readability concerns, you should choose a lighter palette in dark mode. */ [data-theme='dark'] { --ifm-color-primary: #25c2a0; --ifm-color-primary-dark: #21af90; --ifm-color-primary-darker: #1fa588; --ifm-color-primary-darkest: #1a8870; --ifm-color-primary-light: #29d5b0; --ifm-color-primary-lighter: #32d8b4; --ifm-color-primary-lightest: #4fddbf; --docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3); } .navbar { backdrop-filter: blur(30px); background: transparent; } ================================================ FILE: darc-docs/src/pages/index.js ================================================ import React from 'react'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; import Layout from '@theme/Layout'; import { Badge, Box, Button, Card, Container, CssVarsProvider, Grid, Input, Sheet, Stack, styled, Typography } from "@mui/joy"; import {GiChaingun} from "react-icons/gi"; import {AiOutlineSafety} from "react-icons/ai"; import {FaFileContract} from "react-icons/fa"; import {FiCheck, FiChevronRight, FiCopy} from "react-icons/fi"; import {GoTelescope} from "react-icons/go"; import {useCopyToClipboard} from "react-use"; import Link from "@docusaurus/Link"; import {customTheme} from "../theme"; // styled docusaurus link without underline and default color const PlainLink = styled(Link)(({theme}) => ({ textDecoration: 'none', '&:hover': { textDecoration: 'none', color: 'inherit', } })) function HomepageHeader() { const {siteConfig} = useDocusaurusContext(); const [text, setText] = React.useState('npm install darcjs ethers@5.7.2'); const [state, copyToClipboard] = useCopyToClipboard(); const [isCopy, setIsCopy] = React.useState(false); // When user copies to clipboard, show tooltip and closed after 1 second const handleCopy = () => { copyToClipboard(text); setIsCopy(true); setTimeout(() => { setIsCopy(false); }, 1000); } return ( <> Decentralized
Autonomous
Regulated Corporation
({ color: theme.vars.palette.text.tertiary })}> From accountability and transparency to innovative decision-making, DARC is
revolutionizing the way we approach corporate structures. Join the movement
and discover the power of decentralized autonomous corporations.
handleCopy()}> : } placeholder={text}/>
); } const Footer = () => { return ( © 2023 DARC. All rights reserved. ) } const featureCardData = [ { title: 'Decentralization', description: 'Enjoy the benefits of a decentralized operating framework with DARC, eliminating intermediaries and increasing efficiency for businesses.', icon: }, { title: 'Transparency', description: 'DARC offers a transparent operating environment for businesses, providing greater trust and accountability for all parties involved.', icon: }, { title: 'Trustless Transactions', description: 'Experience a trustless environment for transactions with DARC, where parties can transact and interact with each other without the need for intermediaries or third parties.', icon: }, { title: 'Smart Contracts', description: 'Automate business processes and reduce costs with DARC\'s smart contract technology, providing a more efficient and effective way of conducting business.', icon: } ] const featureCardData2 = [ { title: 'Docs', description: 'Simplify your documentation process with Darc\'s user-friendly and efficient documentation tools.', to: '/docs/Overview/', }, { title: 'Github', description: 'Darc\'s open and decentralized ecosystem empowers businesses with transparency, collaboration, and regulatory compliance.', to: 'https://github.com/project-darc/darc' } ] export default function Home() { const {siteConfig} = useDocusaurusContext(); return ( Features of DARC {featureCardData.map((item, index) => ( {item.icon} {item.title} {item.description} ))} Accelerate delivery
of your corporation
({ color: theme.vars.palette.text.tertiary })}> Unlock the potential of Darc's tools within the DARC ecosystem, optimizing efficiency and compliance for blockchain-based businesses. Experience a streamlined approach to project delivery and take your business to the next level with Darc's innovative tools.
({ '& a': { textDecoration: 'none', }, })}> {featureCardData2.map((item, index) => ( ({ p: 2, borderRadius: 20, height: '100%' })}> {item.title} {item.description} Learn more ))}