# Deposit

<figure><img src="https://3616471638-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8tjfwh5kqfR9hmQCbfP7%2Fuploads%2FXSZXfp4tWuBk1rZN8deu%2FArchitecture%2021.png?alt=media&#x26;token=fbc495b0-f9c6-4041-9e51-c3852903582a" alt=""><figcaption><p>Deposit process sequence diagram</p></figcaption></figure>

Deposit process step-by-step:

1. External user deposits supported assets into the [Vault](https://docs.enjoyoors.xyz/system-architecture/public-blockchain-infrastructure/vaults) via [enjoyoors.xyz](https://enjoyoors.xyz/).
2. The [Vault](https://docs.enjoyoors.xyz/system-architecture/public-blockchain-infrastructure/vaults) emits corresponding event.
3. The [Relayer ](https://docs.enjoyoors.xyz/system-architecture/avs-relayer/relayers)reads the emitted event from [Vault](https://docs.enjoyoors.xyz/system-architecture/public-blockchain-infrastructure/vaults).
4. The [Relayer](https://docs.enjoyoors.xyz/system-architecture/avs-relayer/relayers) reaches consensus.
5. The [Relayer ](https://docs.enjoyoors.xyz/system-architecture/avs-relayer/relayers)signs and transmits a message containing deposit details to the [gigaCDP.](https://docs.enjoyoors.xyz/system-architecture/enjoyoors-orchestrator-appchain-l3/gigacdp)&#x20;
6. The [gigaCDP](https://docs.enjoyoors.xyz/system-architecture/enjoyoors-orchestrator-appchain-l3/gigacdp) adds deposited assets to the queue.
7. The [gigaCDP](https://docs.enjoyoors.xyz/system-architecture/enjoyoors-orchestrator-appchain-l3/gigacdp) processes the queue in the next epoch and updates collateral amount in the deposited assets.
8. The [gigaCDP ](https://docs.enjoyoors.xyz/system-architecture/enjoyoors-orchestrator-appchain-l3/gigacdp)aggregates CDPs to calculate actual and target circulating supply of [gigaAssets.](https://docs.enjoyoors.xyz/system-architecture/gigaassets)
9. The [gigaCDP](https://docs.enjoyoors.xyz/system-architecture/enjoyoors-orchestrator-appchain-l3/gigacdp) emits a corresponding event.
10. The [PMS](https://docs.enjoyoors.xyz/system-architecture/enjoyoors-orchestrator-appchain-l3/portfolio-management-system) reads the emitted event from [gigaCDP](https://docs.enjoyoors.xyz/system-architecture/enjoyoors-orchestrator-appchain-l3/gigacdp).
11. The [PMS](https://docs.enjoyoors.xyz/system-architecture/enjoyoors-orchestrator-appchain-l3/portfolio-management-system) recalculates portfolio allocations to target protocols and [AMM pools](https://docs.enjoyoors.xyz/system-architecture/public-blockchain-infrastructure/amm-pools) based on the data obtained from the [gigaCDP](https://docs.enjoyoors.xyz/system-architecture/enjoyoors-orchestrator-appchain-l3/gigacdp).
12. The [PMS](https://docs.enjoyoors.xyz/system-architecture/enjoyoors-orchestrator-appchain-l3/portfolio-management-system) decides on [gigaAssets](https://docs.enjoyoors.xyz/system-architecture/gigaassets) liquidity rebalancing based on new portfolio allocation details.
13. The [PMS](https://docs.enjoyoors.xyz/system-architecture/enjoyoors-orchestrator-appchain-l3/portfolio-management-system) emits a corresponding event.
14. The [Relayer ](https://docs.enjoyoors.xyz/system-architecture/avs-relayer/relayers)reads the emitted event from [PMS.](https://docs.enjoyoors.xyz/system-architecture/enjoyoors-orchestrator-appchain-l3/portfolio-management-system)
15. The [Relayer](https://docs.enjoyoors.xyz/system-architecture/avs-relayer/relayers) reaches consensus.
16. The [Relayer ](https://docs.enjoyoors.xyz/system-architecture/avs-relayer/relayers)signs and transmits a message containing rebalancing details to the [gigaAsset Manager](https://docs.enjoyoors.xyz/system-architecture/public-blockchain-infrastructure/gigaasset-manager).
17. The [gigaAsset Manager ](https://docs.enjoyoors.xyz/system-architecture/public-blockchain-infrastructure/gigaasset-manager)mints [gigaAssets](https://docs.enjoyoors.xyz/system-architecture/gigaassets) in accordance with new portfolio allocation details.
18. The [gigaAsset Manager](https://docs.enjoyoors.xyz/system-architecture/public-blockchain-infrastructure/gigaasset-manager) supplies liquidity to the [Target Protocols](https://docs.enjoyoors.xyz/system-architecture/public-blockchain-infrastructure/target-protocols) through the [Target Protocol Adapters](https://docs.enjoyoors.xyz/system-architecture/public-blockchain-infrastructure/target-protocol-adapters).
19. The [gigaAsset Manager ](https://docs.enjoyoors.xyz/system-architecture/public-blockchain-infrastructure/gigaasset-manager)supplies liquidity to the [AMM Pools](https://docs.enjoyoors.xyz/system-architecture/public-blockchain-infrastructure/amm-pools) through the [Intelligent Peg Adapters](https://docs.enjoyoors.xyz/system-architecture/public-blockchain-infrastructure/intelligent-peg-adapters).

```plant-uml
@startuml
autonumber
actor "External user"
participant Vault
participant Relayer
participant "gigaCDP"
participant PMS
participant "gigaAsset Manager"
participant "Target Protocol"
participant "AMM Pool"

== Epoch 1 ==
"External user" -> Vault: Deposit assets
Vault -> Vault: Emit event
Relayer -> Vault: Listen to events
Relayer -> Relayer: Reach consensus
Relayer -> "gigaCDP": Broadcast signed transaction
"gigaCDP" -> "gigaCDP": Add the deposited assets to the queue

== Epoch 2 ==
"gigaCDP" -> "gigaCDP": Open / update CDP
"gigaCDP" -> "gigaCDP": Calculate actual and target level of gigaAssets
"gigaCDP" -> "gigaCDP": Emit event
PMS -> "gigaCDP": Get actual and target level of gigaAssets
PMS -> PMS: Recalculate portfolio weights
PMS -> PMS: Decide on gigaAssets liquidity rebalancing
PMS -> PMS: Emit event
Relayer -> PMS: Listen to events
Relayer -> Relayer: Reach consensus
Relayer -> "gigaAsset Manager": Broadcast signed transaction
"gigaAsset Manager" -> "gigaAsset Manager": Mint gigaAssets
"gigaAsset Manager" -> "Target Protocol": Supply liquidity
"gigaAsset Manager" -> "AMM Pool": Supply liquidity
@enduml
```
