---
# System prepended metadata

title: Duet protocol contract read

---

# Duet protocol contract read

## 分類
- app
- interfaces
- lib
- mock
- strategy
- vault


## app
### Duet.sol -> Duet Token
- mint
- burn
- burnme

### AppController.sol
EVENT
- UnderlyingDTokenChanged
- UnderlyingStrategyChanged
- DTokenVaultChanged
- ValueConfChanged
- LiquidateRateChanged
- CollateralRateChanged
- OpenLiquidateChanged
- AllowedLiquidatorChanged
- SetVaultStates

#### important function
setDYToken
setStrategy
emergencyWithdrawAll
setOpenLiquidate
updateAllowedLiquidator
setLiquidateRate
setCollateralRate
setOracles
getValueConfs
getValueConf
setVault
joinVault
exitVault
setVaultStates
userJoinedVaultInfoAt
userJoinedVaultCount
maxBorrow
userValues->获取用户Vault价值
userPendingValues->预测用户更改Vault后的价值
isNeedLiquidate->判断该用户是否需要清算
accVaultVaule->
accPendingValue
beforeDeposit->存款前风控检查
beforeBorrow->借款前风控检查
beforeWithdraw
beforeRepay
liquidate
beforeLiquidate

### DuetZap
Zap 功能->可以先不用實現
### DYTokenBase
constructor
- address _underlying
- string memory _symbol,
- address _controller

### SetConfig

## interface
IVault-> vault 的 interface

IStrategy-> Strategy 的 interface

IController-> Controller 的 interface

## libs
### HomoraMath
fmul, fdiv 不懂
fmul 在程式碼中並無被使用
fdiv 使用一次
### TransferHelper
safeApprove
safeTransfer
safeTransferFrom
safeTransferETH

## mock
DBTC
MockUSDOracle
Reader
USDC
沒有被其他合約使用,先不用看

## strategy
### BaseStrategy
ERC20的擴充
constructor
- address _controller
- address _fee
- address _want -> pancake lp 
- address _output -> cake

### StrategyForPancakeLP
BaseStrategy的擴充
- address _controller
- address _fee
- address _want
- address _router ->
- address _master ->
- uint _pid ->

## vault

LpFarmingVault(DepositVaultBase)
SingleFarmingVault(DepositVaultBase)
BTCMintVault(MintVault(MintVaultBase))
### DepositVaultBase
#### event
Deposit
Withdraw
Liquidated
FeeConfChanged
ControllerChanged
FarmChanged

#### important function
setFeeConf
setAppController
setVaultFarm
_deposit
_withdraw
_liquidate
_updateJoinStatus
