Alluo Explained
Search
⌃K

Onchain data verifcation

Now that the data has been submitted from Github Automation, the DAO verifies it and executes the data
As described before, the data gets submitted to the Vote Executor on Ethereum mainnet. You may be concerned that Github Actions is centralised and therefore puts the system at the hands of Github. However, this completely untrue.

How is this decentralised?

Even though we automated the process using Github Actions, the vote execution system remains decentralised because ANYONE can submit data to be executed on chain.
1
/// @notice Allows anyone to submit data for execution of votes
2
/// @dev Attempts to parse at high level and then confirm hash before submitting to queue
3
/// @param data Payload fully encoded as required (see formatting using encoding functions below)
4
​
5
function submitData(bytes memory data) external {
6
​
7
(bytes32 hashed, Message[] memory _messages) = abi.decode(data, (bytes32, Message[]));
8
​
9
require(hashed == keccak256(abi.encode(_messages)), "Hash doesn't match");
10
​
11
SubmittedData memory newSubmittedData;
12
newSubmittedData.data = data;
13
newSubmittedData.time = block.timestamp;
14
submittedData.push(newSubmittedData);
15
}
16
​
By passing in data that is parsed through encoding messages using the helper view functions provided, anyone can submit data.
​

How does the DAO verify submitted data?

When someone submits data to be executed, they receive a hash of the data.
The DAO confirms that the data indeed reflects the outcome of the votes and only then signs this hash and submits it to the Vote Executor on chain.
VoteExecutorMaster.sol
1
/// @notice Allow anyone to approve data for execution given off-chain signatures
2
/// @dev Checks against existing sigs submitted and only allow non-duplicate multisig owner signatures to approve the payload
3
/// @param _dataId Id of data payload to be approved
4
/// @param _signs Array of off-chain EOA signatures to approve the payload.
5
​
6
function approveSubmittedData(uint256 _dataId, bytes[] memory _signs) external {
7
(bytes32 dataHash,) = abi.decode(submittedData[_dataId].data, (bytes32, Message[]));
8
​
9
address[] memory owners = IGnosis(gnosis).getOwners();
10
​
11
bytes[] memory submittedSigns = submittedData[_dataId].signs;
12
address[] memory uniqueSigners = new address[](owners.length);
13
uint256 numberOfSigns;
14
​
15
for (uint256 i; i< submittedSigns.length; i++) {
16
numberOfSigns++;
17
uniqueSigners[i]= _getSignerAddress(dataHash, submittedSigns[i]);
18
}
19
​
20
for (uint256 i; i < _signs.length; i++) {
21
for (uint256 j; j < owners.length; j++) {
22
if(_verify(dataHash, _signs[i], owners[j]) && _checkUniqueSignature(uniqueSigners, owners[j])){
23
submittedData[_dataId].signs.push(_signs[i]);
24
uniqueSigners[numberOfSigns] = owners[j];
25
numberOfSigns++;
26
break;
27
}
28
}
29
}
30
}
Simply, the contract checks if a member of the multisig of the DAO has signed the hash and - if it is valid - it approves the data. The data requires 2 multisig signers to approve it before it can be executed using executeSpecificHash():
VoteExecutorMaster.sol
1
function executeSpecificData(uint256 index) external {
2
(bytes32 hashed, Message[] memory messages) = abi.decode(submittedData[index].data, (bytes32, Message[]));
3
require(submittedData[index].time + timeLock < block.timestamp, "Under timelock");
4
require(hashExecutionTime[hashed] == 0, "Duplicate Hash");
5
​
6
if(submittedData[index].signs.length >= minSigns){
7
for (uint256 j; j < messages.length; j++) {
8
if(messages[j].commandIndex == 0){
9
(string memory ibAlluoSymbol, uint256 newAnnualInterest, uint256 newInterestPerSecond) = abi.decode(messages[j].commandData, (string, uint256, uint256));
10
IIbAlluo ibAlluo = IIbAlluo(ibAlluoSymbolToAddress[ibAlluoSymbol]);
11
if(ibAlluo.annualInterest() != newAnnualInterest){
12
ibAlluo.setInterest(newAnnualInterest, newInterestPerSecond);
13
}
14
}
15
else if(messages[j].commandIndex == 1){
16
(uint256 mintAmount, uint256 period) = abi.decode(messages[j].commandData, (uint256, uint256));
17
IAlluoToken(ALLUO).mint(locker, mintAmount);
18
ILocker(locker).setReward(mintAmount / period);
19
}
20
}
21
hashExecutionTime[hashed] = block.timestamp;
22
bytes memory finalData = abi.encode(submittedData[index].data, submittedData[index].signs);
23
IAnyCall(bridgingInfo.anyCallAddress).anyCall(bridgingInfo.nextChainExecutor, finalData, address(0), bridgingInfo.nextChain, 0);
24
}
25
}