Developers Documentation
  • Overview
    • Contracts Overview
    • Public Repositories
    • Smart Contract Addresses
      • Polygon PoS
  • Core protocol
    • Architecture Overview
    • Blocks
    • Vault Strategy
    • Vault Configuration
    • Vault Deployment
    • Vault Operations
    • Access Manager
    • Contracts
      • StrategVault
      • StrategERC3525
      • StrategVaultFactory
      • StrategAssetBuffer
      • StrategBlockRegistry
      • StrategUserInteractions
      • StrategOperatorProxy
      • StrategOperatorDataAggregator
  • Borrow module
    • Architecture Overview
    • Aave V3 Position manager
    • Smart Contract Docs
      • StrategPositionManagerFactory
      • StrategAaveV3PositionManager
      • StrategAaveV3PositionManagerInfo
  • Portal Module
    • Architecture Overview
    • Swap
      • Features
      • Functions
    • Oracle
      • Architecture design
      • Functions
  • Tools
    • Developer kit
Powered by GitBook
On this page
  • Smart contracts deployment
  • 1. StrategVault & ERC3525 deployment
  • 2. Position manager deployment
  • 3. Vault strategy setup
  • 4. Edit Vault parameters
  • 5. Give StrategOperatingPaymentToken operation allowance
  1. Core protocol

Vault Deployment

Smart contracts deployment

1. StrategVault & ERC3525 deployment

The vault creation is done by calling deployNewVault on the StrategUserInteractions contract:

function deployNewVault(string _name, string _symbol, address _asset, uint256 _middlewareStrategy, uint256 _bufferSize, uint256 _creatorFees, uint256 _harvestFees, string _ipfsHash) external nonpayable

where

  • _name and _symbol are ERC20 corresponding attributes

  • _asset is the vault asset

  • _middlewareStrategy, _creatorFees and _harvestFees are vault configuration described here

  • _ipfsHash IPFS hash of the file containing vault's metadatas

When a vault is created, an ERC3525 contract is also deployed. This ERC3525 token is used for defining the current owner of the vault (tokenId 1), who has the authority to modify vaults parameters and manage the distribution of creator fees through the values assigned to different tokenIds of the ERC3525.

2. Position manager deployment

If the need need position manager(s) in its strategy, they have to be deployed after the vault deployment to set the vault as the owner of itself.

To have more informations about position managers, check in borrow module documentation

3. Vault strategy setup

Each vault's strategy comprises two lists of blocks: one for executing the strategy itself and another for executing the harvest process.

A "block" is a standardized contract that performs a specific action on a DeFi protocol. There are two types of blocks: StrategyBlock and HarvestBlock, each dedicated to execution in their respective block lists.

For blocks to be utilized in vaults, they must first be registered in the block registry.

So, after being deployed, a vault need to have a strategy configured by calling setVaultStrategy on the StrategUserInteractions contract

setVaultStrategy(
    address vault,
    address[] memory _positionManagers,
    address[] memory _stratBlocks,
    bytes[] memory _stratBlocksParameters,
    bool[] memory _isFinalBlock,
    address[] memory _harvestBlocks,
    bytes[] memory _harvestBlocksParameters
) external;

where:

  • _vault is the vault's address

  • _positionManagers: List of position managers owned by the vault. This addresses have the possibility to call protected function in the position manager rebalance context.

  • _stratBlocks: Ordered list of block addresses executed on the strategy execution.

  • _stratBlocksParameters: Ordered list of bytes containing encoded parameters of block in the same index in _stratBlocks list

  • _isFinalBlock: Ordered list of boolean to set a block in the stratBlocks as a final block. This is used only on strategy exit. When a block is a final block, it will receive the real percent to exit else it will receive 100% as exit percentage.

  • _harvestBlocks: Ordered list of block addresses executed on the harvest execution.

  • _harvestBlocksParameters: Ordered list of bytes containing encoded parameters of block in the same index in harvestBlocks list

NB: Since the vault strategy is setup, it will be immutable.

4. Edit Vault parameters

A Vault has many configuration editable by its owner (described here) and to change them after the vault deployment, the vault owner have to call the following function:

function editVaultParams(
    address _vault,
    IStrategVault.StrategVaultSettings[] memory _settings,
    bytes[] memory _data
) public

where:

  • _vault is the vault's address

  • _settings is the ordered list of setting ids to edits

  • _data is the ordered list of settings data to apply on the vault

5. Give StrategOperatingPaymentToken operation allowance

The gas cost of vaults operations isn't handle by the protocol.

To be operated, a vault need to have a minimal operation approval from an address holding StrategOperatingPaymentToken tokens.

Basically, SOPT is a wrapped gas token giving the possibility to operator to get refunded of operation gas cost. See this section to have more information

PreviousVault ConfigurationNextVault Operations

Last updated 1 year ago