Skip to content

Commit

Permalink
commit
Browse files Browse the repository at this point in the history
  • Loading branch information
lidangzzz committed May 20, 2023
1 parent 0479238 commit eb1a8d3
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 10 deletions.
10 changes: 2 additions & 8 deletions darc-protocol/contracts/Opcodes.sol
Original file line number Diff line number Diff line change
Expand Up @@ -202,15 +202,9 @@ enum EnumOpcode {
BATCH_PAY_TO_TRANSFER_TOKENS,

/**
* @notice Pay some cash to create a new token class and mint tokens
* @notice Add an array of address as emergency agents
* (can be used as product NFTs with a new unique token class)
* @param ADDRESS_2DARRAY[0] address[] toAddressArray: the array of the address to mint tokens
* @param UINT256_2DARRAY[0] uint256[] tokenClassArray: the array of the token class index to mint tokens
* @param UINT256_2DARRAY[1] uint256[] amountArray: the array of the amount to mint tokens
* @param UINT256_2DARRAY[2] uint256[] priceArray: the price of each token class to mint
* @param UINT256_2DARRAY[3] uint256[] votingPowerArray: the voting power of each token class to mint
* @param UINT256_2DARRAY[4] uint256[] dividendPowerArray: the max supply of each token class to mint
* @param STRING_2DARRAY[0] string[] tokenClassNameArray: the array of the token class name
* @param ADDRESS_2DARRAY[0] address[] The array of the address to add as emergency agents
* ID:22
*/
ADD_EMERGENCY,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,35 @@ import "../../../Utilities/ErrorMsg.sol";
*/
contract UtilityInstructions is MachineStateManager {

/**
* @notice The implementation of the operation BATCH_ADD_VOTING_RULE
* @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_ADD_VOTING_RULE(Operation memory operation, bool bIsSandbox) internal {

VotingRule[] memory votingRules = operation.param.VOTING_RULE_ARRAY;
if (bIsSandbox) {
for (uint256 i = 0; i < votingRules.length; i++) {
sandboxMachineState.votingRuleList.push(votingRules[i]);
}
} else {
for (uint256 i = 0; i < votingRules.length; i++) {
currentMachineState.votingRuleList.push(votingRules[i]);
}
}
}

function op_ADD_EMERGENCY(Operation memory operation, bool bIsSandbox) internal {

address[] memory EmergencyAgentsAddressArray = operation.param.ADDRESS_2DARRAY[0];
if (bIsSandbox) {
for (uint256 i = 0; i < EmergencyAgentsAddressArray.length; i++) {
sandboxMachineState.machineStateParameters.emergencyAgentsAddressList.push(EmergencyAgentsAddressArray[i]);
}
} else {
for (uint256 i = 0; i < EmergencyAgentsAddressArray.length; i++) {
currentMachineState.machineStateParameters.emergencyAgentsAddressList.push(EmergencyAgentsAddressArray[i]);
}
}
}

function op_CALL_EMERGENCY(Operation memory operation, bool bIsSandbox) internal {
Expand Down

0 comments on commit eb1a8d3

Please sign in to comment.