# Detailed Architecture

![](https://235261325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0e6xGwT9SH6efEAJwHuR%2Fuploads%2F63qDkSjvgZ5LcFc6cNbY%2FDetailed%20Architecture.png?alt=media\&token=69249bc6-c2a3-4e4e-94ea-241c4ada5789)

Our smart contract has two vaults for each strategy



A. **User\_vault**&#x20;

Properties :&#x20;

1. Holds users funds
2. Only users can invest or withdraw funds from this vault
3. The trades taken by Trader\_Vault gets replicated by the invested funds
4. Custody: Users

B. **Trader\_Vault**

Properties :&#x20;

1. Holds traders funds
2. Only traders can invest or withdraw funds from this vault
3. Invested funds will be used to take trades which will be replicated and scaled to User\_vault
4. Custody: Trader

The asset managers trade on decentralized exchanges to generate returns based on the selected investment strategies. These trades are taken from Trader\_vault. These trades are replicated to User\_vault at the same time and depending on the User\_vault to Trader\_vault fund ratio, the positions are scaled up or scaled down. When positions are closed from Trader\_vault the same gets replicated & scaled to User\_vault as well.

Users can add or withdraw funds from the User\_vault and traders can do so from the Trader\_vault respectively. These transactions are processed every 3 hours and we call this event a ‘rollover of funds’.

**What is the rollover of funds?**

All the fresh deposits and withdrawal requests are processed together in a batch every 3 hours. This is called the rollover of funds. All the deposited funds and withdrawal requests remain in pending state till the rollover is processed by the smart contract.

**How are returns calculated?**

Total Returns will increase and decrease in the current value of the user's shares.

New shares are minted for each user based on the amount they have invested. Also, the shares are burnt based on the amount they have withdrawn. Returns are calculated based on the current value of shares held by the users.

Shares given to users = Current NAV / Invested amount

NAV= Total User\_vault funds / Total number of shares

Total User\_vault funds = Traded funds + Unused funds

Traded funds: Funds deployed in open positions

Unused funds: Idle funds in User\_vault

**How are trades scaled up or scaled down?**

UV/TV ratio is tracked at all times. Trade taken in Trader\_vault is scaled up at UV/TV ratio and replicated to User\_vault. UV: User\_vault total value TV: Trader\_vault total value Trade value taken in User\_vault = (UV/TV) x Trade value taken in Trader\_vault

In order to scale down the trades, the closing trades are replicated from Trader\_vault to User\_vault at the ratio of UOP/TOP.

UOP: User\_vault open positions TOP: Trader\_vault open positions

Trade vault taken in User\_vault = (UOP/TOP) x Closing position taken in Trade\_vault

