Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
lidangzzz committed Feb 17, 2024
1 parent 83c2c61 commit 2194a2f
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 181 deletions.
5 changes: 5 additions & 0 deletions darc-docs/docs/DARC Protocol/Condition Nodes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
sidebar_position: 3
---

# Condition Nodes
82 changes: 40 additions & 42 deletions darc-docs/docs/DARC Protocol/OpCodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ sidebar_position: 2

# OpCodes

## What is an OpCode?
### 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.

Expand All @@ -16,44 +16,42 @@ Furthermore, the opcode instruction set includes operations for handling monetar

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.

## Opcode List

| Opcode | Opcode ID | Parameters | Description |
|------------------------|-----------|--------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------|
| UNDEFINED | 0 | N/A | Invalid Operation |
| BATCH_MINT_TOKENS | 1 | `toAddressArray`: address[]<br/>`tokenClassArray`: uint256[]<br/>`amountArray`: uint256[] | Batch Mint Token Operation |
| BATCH_CREATE_TOKEN_CLASSES | 2 | `nameArray`: string[]<br/>`tokenIndexArray`: uint256[]<br/>`votingWeightArray`: uint256[]<br/>`dividendWeightArray`: uint256[] | Batch Create Token Class Operation |
| BATCH_TRANSFER_TOKENS | 3 | `toAddressArray`: address[]<br/>`tokenClassArray`: uint256[]<br/>`amountArray`: uint256[] | Batch Transfer Token Operation |
| BATCH_TRANSFER_TOKENS_FROM_TO | 4 | `fromAddressArray`: address[]<br/>`toAddressArray`: address[]<br/>`tokenClassArray`: uint256[]<br/>`amountArray`: uint256[] | Batch Transfer Token From Addr A to Addr B Operation |
| BATCH_BURN_TOKENS | 5 | `tokenClassArray`: uint256[]<br/>`amountArray`: uint256[] | Batch Burn Token Operation |
| BATCH_BURN_TOKENS_FROM | 6 | `fromAddressArray`: address[]<br/>`tokenClassArray`: uint256[]<br/>`amountArray`: uint256[] | Batch Burn Token From Addr A Operation |
| BATCH_ADD_MEMBERSHIPS | 7 | `memberAddressArray`: address[]<br/>`memberRoleArray`: uint256[]<br/>`memberNameArray`: string[] | Batch Add Member Operation |
| BATCH_SUSPEND_MEMBERSHIPS | 8 | `memberAddressArray`: address[] | Batch Suspend Member Operation |
| BATCH_RESUME_MEMBERSHIPS | 9 | `memberAddressArray`: address[] | Batch Resume Member Operation |
| BATCH_CHANGE_MEMBER_ROLES | 10 | `memberAddressArray`: address[]<br/>`memberRoleArray`: uint256[] | Batch Change Member Role Operation |
| BATCH_CHANGE_MEMBER_NAMES | 11 | `memberAddressArray`: address[]<br/>`memberNameArray`: string[] | Batch Change Member Name Operation |
| BATCH_ADD_PLUGINS | 12 | `pluginList`: Plugin[] | Batch Add Emergency Agent Operation |
| BATCH_ENABLE_PLUGINS | 13 | `pluginIndexArray`: uint256[]<br/>`isBeforeOperationArray`: bool[] | Batch Enable Plugin Operation |
| BATCH_DISABLE_PLUGINS | 14 | `pluginIndexArray`: uint256[]<br/>`isBeforeOperationArray`: bool[] | Batch Disable Plugin Operation |
| BATCH_ADD_AND_ENABLE_PLUGINS | 15 | `pluginList`: Plugin[] | Batch Add and Enable Plugin Operation |
| BATCH_SET_PARAMETERS | 16 | `parameterNameArray`: MachineParameter[]<br/>`parameterValueArray`: uint256[] | Batch Set Parameter Operation |
| BATCH_ADD_WITHDRAWABLE_BALANCES | 17 | `addressArray`: address[]<br/>`amountArray`: uint256[] | Batch Add Withdrawable Balance Operation |
| BATCH_REVOKE_WITHDRAWABLE_BALANCE | 18 | `addressArray`: address[] | Batch Revoke Withdrawable Balance Operation |
| BATCH_WITHDRAW_FROM_BALANCE | 19 | `addressArray`: address[]<br/>`amountArray`: uint256[] | Batch Withdraw From Balance Operation |
| BATCH_PAY_TO_MINT_TOKENS | 20 | `addressArray`: address[]<br/>`tokenClassArray`: uint256[]<br/>`amountArray`: uint256[]<br/>`priceArray`: uint256[] | Batch Pay to Mint Tokens Operation |
| BATCH_PAY_TO_TRANSFER_TOKENS | 21 | `toAddressArray`: address[]<br/>`tokenClassArray`: uint256[]<br/>`amountArray`: uint256[]<br/>`priceArray`: uint256[] | Pay Some Cash to Transfer Tokens Operation |
| ADD_EMERGENCY | 22 | `addressArray`: address[] | Add an Array of Addresses as Emergency Agents |
| RESERVED_ID_23 | 23 | `addressArray`: address[]<br/>`amountArray`: uint256[] | Withdraw Cash from the Contract's Cash Balance |
| CALL_EMERGENCY | 24 | `addressArray`: address[] | Call Emergency Agents to Handle Emergency Situations |
| CALL_CONTRACT_ABI | 25 | `contractAddress`: address<br/>`abi`: bytes | Call a Contract with the Given ABI |
| PAY_CASH | 26 | `amount`: uint256<br/>`paymentType`: uint256<br/>`dividendable`: uint256 | Pay Some Cash |
| OFFER_DIVIDENDS | 27 | N/A | Calculate Dividends and Offer to Token Holders |
| RESERVED_ID_28 | 28 | `addressArray`: address[]<br/>`amountArray`: uint256[] | Withdraw Dividends from the Withdrawable Dividends Balance |
| SET_APPROVAL_FOR_ALL_OPERATIONS | 29 | `address`: address | Set Approval for All Transfer Operations by Address |
| BATCH_BURN_TOKENS_AND_REFUND | 30 | `tokenClassArray`: uint256[] <br/> | Batch Burn Tokens and Refund |
| ADD_STORAGE_STRING | 31 | `address`: string[] | Add Storage IPFS Hash |
| VOTE | 32 | `voteArray`: bool[] | Vote for a Voting Pending Program |
| EXECUTE_PENDING_PROGRAM | 33 | N/A | Execute a Program that has been Voted and Approved |



| 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 |
92 changes: 0 additions & 92 deletions darc-docs/docs/darc.js/Access to a deployed DARC.md

This file was deleted.

Loading

0 comments on commit 2194a2f

Please sign in to comment.