Smart contract
DeFund protocol is an intelligent contract system composed of many libraries, which together complete the functions implemented by the protocol.
Core contracts mainly provide core implementation functions for the protocol. They define the generation and operation logic of the Fund.
Extension contracts are mainly contracts that connect to third party contracts, currently Uniswap's PathFinder, PriceOracle and PositionViewer.
The data processing contract is mainly used to capture the Fund's data.
Library contracts are mainly used by third party libraries, such as OpenZeppelin, Uniswap.
Core contract
The core contract of DeFund Protocol mainly consists of the following parts:
- FundAccount
- FundProxy
- FundManager
FundAccount
A FundAccount is a contract for a single fund that holds all of the fund's assets.
FundProxy
FundProxy is a contract that operates fund contracts. GP and LP mainly operate funds in this contract.
Module | function |
---|---|
ProxyConfig.sol | Manage official maintainable and updated configuration items |
FundData.sol | Keep the core data of the fund |
NavCalculator.sol | Handle the calculation of the net value of the fund |
CallExecutor.sol | Handles calls to fund contracts |
FundManager
FundManager is a management contract used to create fund accounts and perform operations such as authorization and transaction security verification.
Module | function |
---|---|
ManagerConfig.sol | Manage official maintainable and updated configuration Settings |
FundFactory.sol | Handle fund creation and other processes |
ProtocolAdapter.sol | Performs security checks on user-initiated transactions |
RoleFundViewer.sol | Record the association between the user and the fund according to the role |
PositionHolder.sol | Record the liquidity pool created by the fund |
CalldataDecoder.sol | Resolution fund transaction |
AssetPriority.sol | Manage the redemption priority of assets within the fund |
Extension contract
Extension contracts are mainly used to connect to third party contracts, currently Uniswap's PathFinder and PriceOracle.
FundViewer
The contract is mainly used for data processing, mainly for queries to obtain fund data.
PathFinder
PathFinder is Uniswap V3's Pathfinder contract that finds the best path based on the borrower's asset value and the borrower's asset value.
PriceOracle
PriceOracle is Uniswap's price prognosticator contract that uses Uniswap's price prognosticator to forecast borrowing prices and evaluate the asset value of the borrower's loan account.
Library
Library contracts are mainly used for third-party libraries, such as OpenZeppelin, Uniswap.