In the P2P system various fees must be taken into account when facilitating a borrow transaction, i.e.,
gamma: protocol fee charged by MYSO protocol
u: upfront fee charged by lender
f: token transfer fee charged by given token (e.g., PAXG)
Let z denote the collateral send amount (input given by user). Based on z we calculate the net pledge amount x as follows:
x=zβ (1βΞ³)β (1βf)
Note that the loan amount is based on the net pledge amount, i.e.
y=xβ Ξ±
where alpha is the loan amount per net pledge collateral unit (or the corresponding LTV).
Case A: No Compartment
In case no compartment is used there's just one fee field on the borrow instructions that needs to be specified correctly, i.e. expectedProtocolAndVaultTransferFee (see figure below).
Collateral and fee flow without compartment.
Case B: With Compartment
In case a compartment is used there are two fee fields on the borrow instructions struct that need to be specified correctly, i.e. expectedProtocolAndVaultTransferFee and expectedCompartmentTransferFee (see figure below).