Alluo Explained
  • Welcome
    • 🧭 The Basics
  • Getting Started
    • πŸ’» The DeFi Web App
      • ❓ Connecting to the app
      • 🚜 Depositing into the farms
      • πŸ™Œ Other basics
      • 🏦 Importing your Mobile app wallet to Metamask
      • 🧬 Add the polygon network manually in Metamask.
      • ⛓️ Bridging Stablecoins from another chain
    • πŸ“±The Mobile app
      • πŸ—οΈ Setting up your account
      • 🏦 Depositing money into the app
      • πŸ™Œ Other basics
      • πŸ” Exporting your private key
    • πŸ“–Tech deep dive: Contract Address Library
  • Understanding Alluo
    • πŸ’΅ How does Alluo get the yield?
      • 🐰 Going deeper into the Alluo protocol rabbit hole
    • 🧐 FAQ
  • Tokens & Tokenomics
    • πŸͺ™ The tokens
    • πŸ‘¨β€πŸ”¬Tech deep dive: Interest Bearing {asset} token
      • Depositing
      • Withdrawals
      • IbAlluo on different chains
      • StIbAlluo and Superfluid
        • A closer look at the integration between IbAlluo and StIbAlluo
      • Using the IbAlluo contract directly to create streams
      • Liquidity Handler and adapters
        • Deposit process with the Liquidity Handler
        • Withdraw process with the Liquidity Handler
    • πŸ“ˆ Tokenomics
    • πŸ‘¨β€πŸ”¬Tech deep dive: Boosting yield by compounding rewards
      • Deposit into the Vault
      • Withdraw from the Vault
      • Redeem rewards
      • Automatic boosting with Alluo
      • FraxConvex Vaults
      • Managing withdrawal requests in IERC4626
  • Decentralisation and Trust
    • πŸ—³οΈ Trustless governance and execution
    • πŸ‘¨β€πŸ”¬Tech deep dive: Vote Executor Architecture
      • Off chain votes to on chain data
      • Onchain data verifcation
      • Automated execution of votes
        • Tokenomics
        • Liquidity Direction
        • Setting APYs on farms
      • Cross chain execution of votes
      • Manually submitting vote results onchain
    • ↔️Alluo Exchange
      • Interacting with the Exchange
    • vlAlluo Architecture
    • Contracts upgrades
    • Investment strategies
      • πŸ“ˆFrax Convex Finance
        • Adding new pools into the strategy
        • Investing into a pool
  • More Advanced Features
    • πŸ” Repeat payments, streaming IbAlluo
  • Product Updates
    • πŸ‘Œ Product Roadmap: Building the right products
    • πŸ’» Web App releases
    • πŸ“± Mobile App releases
    • 🏎️ Alluo Boost
  • tutorial projects
    • Example: USDC to streaming 1 IbAlluo per second
    • Example: Using IbAlluoUSD and Ricochet to do capital efficient DCA into ETH
Powered by GitBook
On this page
  1. Decentralisation and Trust
  2. Tech deep dive: Vote Executor Architecture

Automated execution of votes

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
function executeSpecificData(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);
                    }
                }
                else if(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;
            bytes memory 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?

  1. The data is checked for legitimacy then decoded.

  2. Any actions to be immediately taken on the current chain happens first.

3. Any actions that must occur on another chain is passed on through Multichain crosschain messaging.

PreviousOnchain data verifcationNextTokenomics

Last updated 2 years ago

πŸ‘¨β€πŸ”¬
Tokenomics
Liquidity Direction
Setting APYs on farms
Cross chain execution of votes