Manually submitting vote results onchain
How to encode individual vote results:
function encodeApyCommand(
string memory _ibAlluoName,
uint256 _newAnnualInterest,
uint256 _newInterestPerSecond
) public pure returns (uint256, bytes memory) {
bytes memory encodedCommand = abi.encode(_ibAlluoName, _newAnnualInterest, _newInterestPerSecond);
return (0, encodedCommand);
}
function encodeLiquidityCommand(
string memory _codeName,
address _strategyPrimaryToken,
address _entryToken,
uint256 _delta,
bool _isDeposit
) public view returns (uint256, bytes memory) {
LiquidityDirection memory direction = liquidityDirection[_codeName];
if(!_isDeposit){
return (2, abi.encode(direction.strategyAddress, _delta, direction.chainId, _strategyPrimaryToken, _entryToken, direction.exitData));
}
else{
return (3, abi.encode(direction.strategyAddress, _delta, direction.chainId, _strategyPrimaryToken, _entryToken, direction.entryData));
}
}
function encodeMintCommand(
uint256 _newMintAmount,
uint256 _period
) public pure returns (uint256, bytes memory) {
bytes memory encodedCommand = abi.encode(_newMintAmount, _period);
return (1, encodedCommand);
}How to get the final data to be submitted from individual encoded messages:
Last updated