diff --git a/darc-docs/docs/DARC Protocol/OpCodes.md b/darc-docs/docs/DARC Protocol/OpCodes.md index 7f76b0e..9558889 100644 --- a/darc-docs/docs/DARC Protocol/OpCodes.md +++ b/darc-docs/docs/DARC Protocol/OpCodes.md @@ -22,7 +22,7 @@ By defining these operations through opcodes, the DARC protocol ensures consiste |------------------------|-----------|--------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------| | UNDEFINED | 0 | N/A | Invalid Operation | | BATCH_MINT_TOKENS | 1 | `toAddressArray`: address[]
`tokenClassArray`: uint256[]
`amountArray`: uint256[] | Batch Mint Token Operation | -| BATCH_CREATE_TOKEN_CLASS | 2 | `nameArray`: string[]
`tokenIndexArray`: uint256[]
`votingWeightArray`: uint256[]
`dividendWeightArray`: uint256[] | Batch Create Token Class Operation | +| BATCH_CREATE_TOKEN_CLASSES | 2 | `nameArray`: string[]
`tokenIndexArray`: uint256[]
`votingWeightArray`: uint256[]
`dividendWeightArray`: uint256[] | Batch Create Token Class Operation | | BATCH_TRANSFER_TOKENS | 3 | `toAddressArray`: address[]
`tokenClassArray`: uint256[]
`amountArray`: uint256[] | Batch Transfer Token Operation | | BATCH_TRANSFER_TOKENS_FROM_TO | 4 | `fromAddressArray`: address[]
`toAddressArray`: address[]
`tokenClassArray`: uint256[]
`amountArray`: uint256[] | Batch Transfer Token From Addr A to Addr B Operation | | BATCH_BURN_TOKENS | 5 | `tokenClassArray`: uint256[]
`amountArray`: uint256[] | Batch Burn Token Operation | @@ -30,14 +30,14 @@ By defining these operations through opcodes, the DARC protocol ensures consiste | BATCH_ADD_MEMBERSHIP | 7 | `memberAddressArray`: address[]
`memberRoleArray`: uint256[]
`memberNameArray`: string[] | Batch Add Member Operation | | BATCH_SUSPEND_MEMBERSHIP | 8 | `memberAddressArray`: address[] | Batch Suspend Member Operation | | BATCH_RESUME_MEMBERSHIP | 9 | `memberAddressArray`: address[] | Batch Resume Member Operation | -| BATCH_CHANGE_MEMBER_ROLE | 10 | `memberAddressArray`: address[]
`memberRoleArray`: uint256[] | Batch Change Member Role Operation | -| BATCH_CHANGE_MEMBER_NAME | 11 | `memberAddressArray`: address[]
`memberNameArray`: string[] | Batch Change Member Name Operation | -| BATCH_ADD_PLUGIN | 12 | `pluginList`: Plugin[] | Batch Add Emergency Agent Operation | -| BATCH_ENABLE_PLUGIN | 13 | `pluginIndexArray`: uint256[]
`isBeforeOperationArray`: bool[] | Batch Enable Plugin Operation | -| BATCH_DISABLE_PLUGIN | 14 | `pluginIndexArray`: uint256[]
`isBeforeOperationArray`: bool[] | Batch Disable Plugin Operation | -| BATCH_ADD_AND_ENABLE_PLUGIN | 15 | `pluginList`: Plugin[] | Batch Add and Enable Plugin Operation | -| BATCH_SET_PARAMETER | 16 | `parameterNameArray`: MachineParameter[]
`parameterValueArray`: uint256[] | Batch Set Parameter Operation | -| BATCH_ADD_WITHDRAWABLE_BALANCE | 17 | `addressArray`: address[]
`amountArray`: uint256[] | Batch Add Withdrawable Balance Operation | +| BATCH_CHANGE_MEMBER_ROLES | 10 | `memberAddressArray`: address[]
`memberRoleArray`: uint256[] | Batch Change Member Role Operation | +| BATCH_CHANGE_MEMBER_NAMES | 11 | `memberAddressArray`: address[]
`memberNameArray`: string[] | Batch Change Member Name Operation | +| BATCH_ADD_PLUGINS | 12 | `pluginList`: Plugin[] | Batch Add Emergency Agent Operation | +| BATCH_ENABLE_PLUGINS | 13 | `pluginIndexArray`: uint256[]
`isBeforeOperationArray`: bool[] | Batch Enable Plugin Operation | +| BATCH_DISABLE_PLUGINS | 14 | `pluginIndexArray`: uint256[]
`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[]
`parameterValueArray`: uint256[] | Batch Set Parameter Operation | +| BATCH_ADD_WITHDRAWABLE_BALANCES | 17 | `addressArray`: address[]
`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[]
`amountArray`: uint256[] | Batch Withdraw From Balance Operation | | BATCH_PAY_TO_MINT_TOKENS | 20 | `addressArray`: address[]
`tokenClassArray`: uint256[]
`amountArray`: uint256[]
`priceArray`: uint256[] | Batch Pay to Mint Tokens Operation | diff --git a/darc-docs/docs/darc.js/Access to a deployed DARC.md b/darc-docs/docs/darc.js/Access to a deployed DARC.md index 1111d88..b2bfc9b 100644 --- a/darc-docs/docs/darc.js/Access to a deployed DARC.md +++ b/darc-docs/docs/darc.js/Access to a deployed DARC.md @@ -43,7 +43,7 @@ batch_mint_tokens( // enable plugins 3, 4 before sandbox checking operation // and disable plugins 5, 6 after sandbox checking operation -batch_enable_plugins( +BATCH_ENABLE_PLUGINSs( [3,4,5,6], [true, true, false, false] ); diff --git a/darc-protocol/contracts/protocol/Opcodes.sol b/darc-protocol/contracts/protocol/Opcodes.sol index 46617c4..0a3eb6c 100644 --- a/darc-protocol/contracts/protocol/Opcodes.sol +++ b/darc-protocol/contracts/protocol/Opcodes.sol @@ -33,7 +33,7 @@ enum EnumOpcode { * * ID:2 */ - BATCH_CREATE_TOKEN_CLASS, + BATCH_CREATE_TOKEN_CLASSES, /** * @notice Batch Transfer Token Operation @@ -108,7 +108,7 @@ enum EnumOpcode { * * ID:10 */ - BATCH_CHANGE_MEMBER_ROLE, + BATCH_CHANGE_MEMBER_ROLES, /** * @notice Batch Change Member Name Operation @@ -117,14 +117,14 @@ enum EnumOpcode { * * ID:11 */ - BATCH_CHANGE_MEMBER_NAME, + BATCH_CHANGE_MEMBER_NAMES, /** * @notice Batch Add Emergency Agent Operation * @param Plugin[] pluginList: the array of the plugins * ID:12 */ - BATCH_ADD_PLUGIN, + BATCH_ADD_PLUGINS, /** * @notice Batch Enable Plugin Operation @@ -132,7 +132,7 @@ enum EnumOpcode { * @param BOOL_ARRAY bool[] isBeforeOperationArray: the array of the flag to indicate if the plugin is before operation * ID:13 */ - BATCH_ENABLE_PLUGIN, + BATCH_ENABLE_PLUGINS, /** * @notice Batch Disable Plugin Operation @@ -140,14 +140,14 @@ enum EnumOpcode { * @param BOOL_ARRAY bool[] isBeforeOperationArray: the array of the flag to indicate if the plugin is before operation * ID:14 */ - BATCH_DISABLE_PLUGIN, + BATCH_DISABLE_PLUGINS, /** * @notice Batch Add and Enable Plugin Operation * @param Plugin[] pluginList: the array of the plugins * ID:15 */ - BATCH_ADD_AND_ENABLE_PLUGIN, + BATCH_ADD_AND_ENABLE_PLUGINS, /** * @notice Batch Set Parameter Operation @@ -155,7 +155,7 @@ enum EnumOpcode { * @param UINT256_2DARRAY[0] uint256[] parameterValueArray: the array of the parameter value * ID:16 */ - BATCH_SET_PARAMETER, + BATCH_SET_PARAMETERS, /** * @notice Batch Add Withdrawable Balance Operation @@ -163,7 +163,7 @@ enum EnumOpcode { * @param uint256[] amountArray: the array of the amount to add withdrawable balance * ID:17 */ - BATCH_ADD_WITHDRAWABLE_BALANCE, + BATCH_ADD_WITHDRAWABLE_BALANCES, /** * @notice Batch Reduce Withdrawable Balance Operation @@ -171,14 +171,14 @@ enum EnumOpcode { * @param uint256[] amountArray: the array of the amount to substract withdrawable balance * ID:18 */ - BATCH_REDUCE_WITHDRAWABLE_BALANCE, + BATCH_REDUCE_WITHDRAWABLE_BALANCES, /** * @notice Batch Add Voting Rules * @param VotingRule[] votingRuleList: the array of the voting rules * ID:19 */ - BATCH_ADD_VOTING_RULE, + BATCH_ADD_VOTING_RULES, /** @@ -328,5 +328,11 @@ enum EnumOpcode { * @notice Upgrade the contract to the latest version * ID:37 */ - UPGRADE_TO_THE_LATEST + UPGRADE_TO_THE_LATEST, + + /** + * @notice Batch Pay to Trasnfer Tokens Operation + * ID:38 + */ + op_BATCH_PAY_TO_TRANSFER_TOKENS } diff --git a/darc-protocol/contracts/protocol/Runtime/Executable/InstructionMachine.sol b/darc-protocol/contracts/protocol/Runtime/Executable/InstructionMachine.sol index 5a271d2..10e440f 100644 --- a/darc-protocol/contracts/protocol/Runtime/Executable/InstructionMachine.sol +++ b/darc-protocol/contracts/protocol/Runtime/Executable/InstructionMachine.sol @@ -50,8 +50,8 @@ OfferDividendsInstructions } // opcode id == 2 - else if (operation.opcode == EnumOpcode.BATCH_CREATE_TOKEN_CLASS ){ - op_BATCH_CREATE_TOKEN_CLASS(operation, bIsSandbox); + else if (operation.opcode == EnumOpcode.BATCH_CREATE_TOKEN_CLASSES ){ + op_BATCH_CREATE_TOKEN_CLASSES(operation, bIsSandbox); } // opcode id == 3 @@ -90,53 +90,53 @@ OfferDividendsInstructions } // opcode id == 10 - else if (operation.opcode == EnumOpcode.BATCH_CHANGE_MEMBER_ROLE) { - op_BATCH_CHANGE_MEMBER_ROLE(operation, bIsSandbox); + else if (operation.opcode == EnumOpcode.BATCH_CHANGE_MEMBER_ROLES) { + op_BATCH_CHANGE_MEMBER_ROLES(operation, bIsSandbox); } // opcode id == 11 - else if (operation.opcode == EnumOpcode.op_BATCH_CHANGE_MEMBER_NAME) { - op_BATCH_CHANGE_MEMBER_NAME(operation, bIsSandbox); + else if (operation.opcode == EnumOpcode.BATCH_CHANGE_MEMBER_NAMES) { + op_BATCH_CHANGE_MEMBER_NAMES(operation, bIsSandbox); } // opcode id == 12 - else if (operation.opcode == EnumOpcode.BATCH_ADD_PLUGIN) { - op_BATCH_ADD_PLUGIN(operation, bIsSandbox); + else if (operation.opcode == EnumOpcode.BATCH_ADD_PLUGINS) { + op_BATCH_ADD_PLUGINS(operation, bIsSandbox); } // opcode id == 13 - else if (operation.opcode == EnumOpcode.BATCH_ENABLE_PLUGIN) { - op_BATCH_ENABLE_PLUGIN(operation, bIsSandbox); + else if (operation.opcode == EnumOpcode.BATCH_ENABLE_PLUGINS) { + op_BATCH_ENABLE_PLUGINS(operation, bIsSandbox); } // opcode id == 14 - else if (operation.opcode == EnumOpcode.BATCH_DISABLE_PLUGIN) { - op_BATCH_DISABLE_PLUGIN(operation, bIsSandbox); + else if (operation.opcode == EnumOpcode.BATCH_DISABLE_PLUGINS) { + op_BATCH_DISABLE_PLUGINS(operation, bIsSandbox); } // opcode id == 15 - else if (operation.opcode == EnumOpcode.BATCH_ADD_AND_ENABLE_PLUGIN){ - op_BATCH_ADD_AND_ENABLE_PLUGIN(operation, bIsSandbox); + else if (operation.opcode == EnumOpcode.BATCH_ADD_AND_ENABLE_PLUGINS){ + op_BATCH_ADD_AND_ENABLE_PLUGINS(operation, bIsSandbox); } // opcode id == 16 - else if (operation.opcode == EnumOpcode.BATCH_SET_PARAMETER) { - op_BATCH_SET_PARAMETER(operation, bIsSandbox); + else if (operation.opcode == EnumOpcode.BATCH_SET_PARAMETERS) { + op_BATCH_SET_PARAMETERS(operation, bIsSandbox); } // opcode id == 17 - else if (operation.opcode == EnumOpcode.BATCH_ADD_WITHDRAWABLE_BALANCE) { - op_BATCH_ADD_WITHDRAWABLE_BALANCE(operation, bIsSandbox); + else if (operation.opcode == EnumOpcode.BATCH_ADD_WITHDRAWABLE_BALANCES) { + op_BATCH_ADD_WITHDRAWABLE_BALANCES(operation, bIsSandbox); } // opcode id == 18 - else if (operation.opcode == EnumOpcode.BATCH_REDUCE_WITHDRAWABLE_BALANCE) { - op_BATCH_REDUCE_WITHDRAWABLE_BALANCE(operation, bIsSandbox); + else if (operation.opcode == EnumOpcode.BATCH_REDUCE_WITHDRAWABLE_BALANCES) { + op_BATCH_REDUCE_WITHDRAWABLE_BALANCES(operation, bIsSandbox); } // opcode id == 19 - else if (operation.opcode == EnumOpcode.BATCH_ADD_VOTING_RULE) { - op_BATCH_ADD_VOTING_RULE(operation, bIsSandbox); + else if (operation.opcode == EnumOpcode.BATCH_ADD_VOTING_RULES) { + op_BATCH_ADD_VOTING_RULES(operation, bIsSandbox); } // opcode id == 20 diff --git a/darc-protocol/contracts/protocol/Runtime/Executable/Instructions/MembershipInstructions.sol b/darc-protocol/contracts/protocol/Runtime/Executable/Instructions/MembershipInstructions.sol index a88e24e..abb33df 100644 --- a/darc-protocol/contracts/protocol/Runtime/Executable/Instructions/MembershipInstructions.sol +++ b/darc-protocol/contracts/protocol/Runtime/Executable/Instructions/MembershipInstructions.sol @@ -101,11 +101,11 @@ contract MembershipInstructions is MachineStateManager { /** - * @notice The function that executes the BATCH_CHANGE_MEMBER_ROLE operation + * @notice The function that executes the BATCH_CHANGE_MEMBER_ROLES operation * @param operation The operation to be executed * @param bIsSandbox The flag to indicate if the operation is being executed in sandbox */ - function op_BATCH_CHANGE_MEMBER_ROLE(Operation memory operation, bool bIsSandbox) internal { + function op_BATCH_CHANGE_MEMBER_ROLES(Operation memory operation, bool bIsSandbox) internal { // parameter 1 is the array of member addresses address[] memory members = operation.param.ADDRESS_2DARRAY[0]; // parameter 2 is the array of member role numbers @@ -122,11 +122,11 @@ contract MembershipInstructions is MachineStateManager { } } /** - * @notice The function that executes the BATCH_CHANGE_MEMBER_NAME operation + * @notice The function that executes the BATCH_CHANGE_MEMBER_NAMES operation * @param operation The operation to be executed * @param bIsSandbox The flag to indicate if the operation is being executed in sandbox */ - function op_BATCH_CHANGE_MEMBER_NAME(Operation memory operation, bool bIsSandbox) internal { + function op_BATCH_CHANGE_MEMBER_NAMES(Operation memory operation, bool bIsSandbox) internal { // parameter 1 is the array of member addresses address[] memory members = operation.param.ADDRESS_2DARRAY[0]; // parameter 2 is the array of member role names diff --git a/darc-protocol/contracts/protocol/Runtime/Executable/Instructions/MoneyInstructions.sol b/darc-protocol/contracts/protocol/Runtime/Executable/Instructions/MoneyInstructions.sol index a90fc04..e7434a6 100644 --- a/darc-protocol/contracts/protocol/Runtime/Executable/Instructions/MoneyInstructions.sol +++ b/darc-protocol/contracts/protocol/Runtime/Executable/Instructions/MoneyInstructions.sol @@ -15,11 +15,11 @@ import "../../../Utilities/ErrorMsg.sol"; */ contract MoneyInstructions is MachineStateManager { - function op_BATCH_ADD_WITHDRAWABLE_BALANCE(Operation memory operation, bool bIsSandbox) internal { + function op_BATCH_ADD_WITHDRAWABLE_BALANCES(Operation memory operation, bool bIsSandbox) internal { // todo } - function op_BATCH_REDUCE_WITHDRAWABLE_BALANCE(Operation memory operation, bool bIsSandbox) internal { + function op_BATCH_REDUCE_WITHDRAWABLE_BALANCES(Operation memory operation, bool bIsSandbox) internal { // todo } diff --git a/darc-protocol/contracts/protocol/Runtime/Executable/Instructions/ParameterInstructions.sol b/darc-protocol/contracts/protocol/Runtime/Executable/Instructions/ParameterInstructions.sol index 01b02d5..1ebdad5 100644 --- a/darc-protocol/contracts/protocol/Runtime/Executable/Instructions/ParameterInstructions.sol +++ b/darc-protocol/contracts/protocol/Runtime/Executable/Instructions/ParameterInstructions.sol @@ -9,18 +9,18 @@ import "../../../Plugin/Plugin.sol"; import "../../../Utilities/ErrorMsg.sol"; /** - * @title Implementation of the single instruction "BATCH_SET_PARAMETER" + * @title Implementation of the single instruction "BATCH_SET_PARAMETERS" * @author DARC Team * @notice null */ contract ParameterInstructions is MachineStateManager { /** - * @notice The implementation of the single instruction "BATCH_SET_PARAMETER" + * @notice The implementation of the single instruction "BATCH_SET_PARAMETERS" * @param operation The operation index to be executed * @param bIsSandbox The boolean flag that indicates if the operation is executed in sandbox */ - function op_BATCH_SET_PARAMETER(Operation memory operation, bool bIsSandbox) internal { + function op_BATCH_SET_PARAMETERS(Operation memory operation, bool bIsSandbox) internal { // parameter 1 is the Machine Parameter Array MachineParameter[] memory params = operation.param.PARAMETER_ARRAY; // parameter 2 is the uint256 array of the parameter UINT256_2DARRAY diff --git a/darc-protocol/contracts/protocol/Runtime/Executable/Instructions/PluginInstructions.sol b/darc-protocol/contracts/protocol/Runtime/Executable/Instructions/PluginInstructions.sol index 623906a..0110824 100644 --- a/darc-protocol/contracts/protocol/Runtime/Executable/Instructions/PluginInstructions.sol +++ b/darc-protocol/contracts/protocol/Runtime/Executable/Instructions/PluginInstructions.sol @@ -9,18 +9,18 @@ import "../../../Plugin/Plugin.sol"; import "../../../Utilities/ErrorMsg.sol"; /** - * @title Implementation of BATCH_ADD_AND_ENABLE_PLUGIN operation + * @title Implementation of BATCH_ADD_AND_ENABLE_PLUGINS operation * @author DARC Team * @notice null */ contract PluginInstructions is MachineStateManager{ /** - * @notice The function that executes the BATCH_ADD_PLUGIN operation + * @notice The function that executes the BATCH_ADD_PLUGINS operation * @param operation The operation to be executed * @param bIsSandbox The flag to indicate if the operation is being executed in sandbox */ - function op_BATCH_ADD_PLUGIN(Operation memory operation, bool bIsSandbox) internal { + function op_BATCH_ADD_PLUGINS(Operation memory operation, bool bIsSandbox) internal { // parameter 1 is the array of plugins Plugin[] memory plugins = operation.param.PLUGIN_ARRAY; for (uint256 i=0;i