This is a v0 implementation of the solmate ERC4626 tokenized vault, operated by an off-chain multi agent system using the Autonolas Stack. This Off-chain multi-agent system (Also know as an "Autonomous Service") executes arbitrary transaction logic similar to how "keeper networks" work to generate profits based on some financial strategy implemented by the off-chain service and vault contract.
The Autonomous service is its own Multi Party Computation (MPC) network that comes to consensus using a temporary instance of tendermint in a shared state to then decide how to execute arbitrary logic amongst the agent operators of the autonomous service. The tokenized vault implementation (ERC4626 token) allows users to deposit a given underlying asset as collateral to receive shares of the tokenized vault that represents their ownership over future profits generated by the autonomous service. This is extensible to any arbitrary transaction flow such as running a liquidation fund, options trading strategies (like we did in this example), derivatives trading strategies and basically any other transaction flow you can imagine!
In this repo I have implemented the logic necessary to allow for the ERC4626 interface with added time restrictions (locking mechanism) on deposits/withdrawals from the tokenized vault based on the idea that the "fund" must be able to remain collaterlized/solvent when handling withdrawals while also being able to deploy deposited capital as effectively as possible to generate profits for the vault and its share holders.
In future versions I will explore upgrading the locking mechanism to make for more capital effciency in use of the deposited collateral and I will greatly expand upon the financial strategies implemented with more off-chain services.
Building & Testing
Build the foundry project with forge build
. Then you can run tests with forge test
.
Deployment & Verification
Inside the utils/
directory are a few preconfigured scripts that can be used to deploy and verify contracts.
Scripts take inputs from the cli, using silent mode to hide any sensitive information.
NOTE: These scripts are required to be executable meaning they must be made executable by running chmod +x ./utils/*
.
lib
├─ forge-std — https://github.com/foundry-rs/forge-std
├─ solmate — https://github.com/transmissions11/solmate
scripts
├─ Deploy.s.sol — Simple Vault Contract Deployment Script
src
├─ Interfaces - Rysk Protocol interfaces for use in the vault contract
├─ Libraries — Rysk Protocol libraries for use in the vault contract
├─ Vault — ERC4626 Vault Contract operated by the Autonomous Service
test
├─ Mocks - Mocks for testing the vault contract
├─ Minter - Minter Contract for testing the vault contract
└─ Vault.t — Vault Contract Tests