📄Solidity Architecture
An In-Depth Look at Our Solidity Smart Contract Architecture
Last updated
An In-Depth Look at Our Solidity Smart Contract Architecture
Last updated
Our architecture capitalizes on the advanced capabilities of EIP-2535 (Diamond Standard), enabling our team to seamlessly integrate new protocols without altering the existing implementations. This approach not only enhances the scalability and flexibility of our project but also significantly improves maintainability. In the event of a security breach, our team can rapidly isolate and disconnect the compromised protocol from the diamond framework, blocking managers from creating vaults that use exploited software. This swift response mechanism ensures an added layer of safety for our users, positioning our platform as a more secure choice than industry standard. Our architecture's design prioritizes adaptability, efficiency, and security, providing a robust foundation for our project's long-term success and reliability.
The selection of enabled modules for a strategy occurs at the inception of each vault. This critical step ensures that the Manager is committed to utilizing only those protocols that were explicitly proposed at the time of the vault's creation, fostering a framework of fairness and simplicity. Upon the establishment of the vault, the strategy contract is linked to the pre-approved modules, thereby granting the manager access to a defined set of tools for trading. This approach not only enforces a disciplined adherence to the proposed investment strategy but also enhances transparency and trust between managers and investors. By setting these parameters from the outset, Vaultus ensures that the trading activities within each vault remain within the agreed-upon boundaries, aligning with investors' expectations and the platform's standards of integrity and accountability. The following diagram gives a visual representation of the creation of a vault and strategy contract with 2 DeFi protcols integrated; namely GMX and Camelot.
The operational dynamics of the vault are structured into distinct phases within each Cycle. Initially, the vault enters a deposit phase, where it is primed to accept contributions in its designated native asset from investors. Embodying the principles of the ERC4626 standard is the issuance of a specialized receipt token at the time of deposit, serving as a definitive proof of the investor's stake in the vault. This phase pools the resources necessary to fund the vault's strategic objectives.
Following the accumulation of deposits, the vault transitions into a custody phase. In this critical juncture, the collected funds are securely transferred from the vault contract to the strategy contract. This transfer marks the commencement of the active management period, where the funds are deployed according to the predetermined investment strategy outlined by the vault manager.
As the strategy unfolds and reaches the conclusion of its epoch, the vault shifts into the withdrawal phase. It is during this phase that investors are entitled to redeem their funds. The investors can then exchange their previously issued receipt token for the native vault asset at withdrawal, reflecting the accrued value of their investment.
A pivotal role in this process is reserved for the vault manager, who is endowed with the exclusive privilege to allocate the vault's funds to the strategy contract once the initial funding period has concluded. This mechanism ensures that the strategic deployment of assets is both deliberate and aligned with the investment goals, further enhancing the integrity and potential for growth within our ecosystem.
The lifecycle of a vault unfolds as follows:
Opening Phase: The vault initiates operations, welcoming investors to deposit the vault's native asset, such as USDC. In return, the Manager will set additional parameters such as cycle duration, protocols to integrates, whether the vault is public or restricted to whitelisted addresses.
Deposit Phase: Investors contribute the vault's native asset. Investors receive a transferable share token, signifying their proportional ownership of the vault's collective assets.
Closure and Custody Phase: Upon closure, the Strategy Contract assumes control over the collected funds, marking the transition to active fund management.
Strategy Execution Phase: Through a dedicated Manager interface dapp, designated Managers, as specified in the vault's Prospectus, implement strategies. The Strategy Contract limits Manager actions to approved DeFi protocols and tokens, aligning with the vault's investment mandate.
Trading Phase: Managers deploy the funds in strategic trades, adhering to the vault's predefined guidelines.
Unwinding Phase: All positions are closed out, and the Strategy Contract reallocates funds and any resultant profits or losses, after deducting applicable fees, back to the Vault Contract.
Withdrawal Phase: The vault enters a withdrawal-only state, awaiting the next funding opportunity.
Upon the successful transfer of funds to the strategy, managers gain access to an expansive arsenal of trading and investment tools. These tools are encapsulated within modules, chosen by the manager during the vault's initial setup. All actions taken by these tools are transparent and can be verified by anyone via blockchain explorers by interacting with the contract. Our platform offers an unparalleled suite of instruments, including advanced swapping capabilities, liquidity pool participation, yield generation mechanisms, and sophisticated trading tools. This diverse toolkit empowers managers to seize a broad spectrum of investment opportunities.
As the end of the investment epoch nears, or once the manager deems the strategy objectives have been met, a signal is sent indicating readiness to revert the funds back to the vault. At this juncture, our team conducts a thorough review to ensure all parameters for fund return are correctly aligned. The final step in the process involves the authorization of the fund transfer back to the vault through our secure multisig admin wallet, ensuring an additional layer of oversight and security. In future, this last step will be fully implemented onchain, thus providing an additional level of decentralisation and robustness.
The culmination of the investment cycle sees the distribution of any profits or the absorption of losses, proportionally shared among the vault's investors upon withdrawal.