Now that the votes have been submitted either manually or automatically through Github Actions, the function executeSpecificData can be called, with the corresponding data index.
VoteExecutorMaster.sol
functionexecuteSpecificData(uint256 index) external { SubmittedData memory exactData = submittedData[index]; (bytes32 hashed, Message[] memory messages,) = abi.decode(exactData.data, (bytes32, Message[],uint256));require(exactData.time + timeLock < block.timestamp,"Under timelock");require(hashExecutionTime[hashed] ==0,"Duplicate Hash");if(exactData.signs.length >= minSigns){uint256 currentChain = generalBridgingInfo.currentChain;for (uint256 j; j < messages.length; j++) {if(messages[j].commandIndex ==1){ (uint256 mintAmount,uint256 period) = abi.decode(messages[j].commandData, (uint256,uint256));IAlluoToken(ALLUO).mint(locker, mintAmount);ILocker(locker).setReward(mintAmount / (period)); }if(messages[j].commandIndex ==2) { // Handle all withdrawals first and then add all deposit actions to an array to be executed afterwards
(address strategyAddress, uint256 delta, uint256 chainId, address strategyPrimaryToken,, bytes memory data) = abi.decode(messages[j].commandData, (address, uint256, uint256, address,address, bytes));
if (chainId == currentChain) { IAlluoStrategy(strategyAddress).exitAll(data, delta, strategyPrimaryToken, address(this), false);
} }elseif(messages[j].commandIndex ==3) {// Add all deposits to the queue. (address strategyAddress, uint256 delta, uint256 chainId, address strategyPrimaryToken, address entryToken, bytes memory data) = abi.decode(messages[j].commandData, (address, uint256, uint256, address,address, bytes));
if (chainId == currentChain) { tokenToDepositQueue[strategyPrimaryToken].depositList.push(Deposit(strategyAddress, delta, strategyPrimaryToken, entryToken, data));
} } }// Execute deposits. Only executes if we have sufficient balances. hashExecutionTime[hashed] = block.timestamp;bytesmemory finalData = abi.encode(exactData.data, exactData.signs); IAnyCall(messagingInfo.anyCallAddress).anyCall(messagingInfo.nextChainExecutor, finalData, address(0), messagingInfo.nextChain, 0);
} }
What exactly happens when executeSpecificData is called?
The data is checked for legitimacy then decoded.
Any actions to be immediately taken on the current chain happens first.