🎯User/Fee Flow
Detailed view of user interactions and protocol fees.
Glossary
TOKEN — ERC20 token.
brTOKEN — Den receipt token for TOKEN.
ARBERA — Protocol and reward token for the Den LPs.
HONEY — Token paired with brTOKEN in the Den LP.
Many tokens can be used as a Den's paired LP token, below examples are using
HONEY.
Fees
Fees taken on user actions
buy.fee — Fee on buying Den tokens (in brTOKEN).
sell.fee — Fee on selling Den tokens (in brTOKEN).
bond.fee — Fee on wrapping TOKEN for brTOKEN (in brTOKEN).
debond.fee — Fee on unwrapping brTOKEN for TOKEN (in brTOKEN).
burn.fee — Burn rate of brTOKEN (Growing Dens) on top of all of the above fees.
After the burn-fee, but before swapping for ARBERA
partner.fee— Fee for Den creator (inbrTOKEN).yield.protocol.fee— Protocol fee (inbrTOKEN).
After swapping rewards to ARBERA
Swapping path:
brTOKEN→HONEY→ARBERA.
yield.admin.fee— Future yield fee (inARBERAor other reward tokens).
The rest of fees (in ARBERA) are distributed to Den LPs.
User actions
Let's go through each user action and see the tokens and fees flow.
Wrapping into Den
User wraps
XTOKEN (callsbond()on Den contract).Den mints
Y = X/RbrTOKEN (based onTOKEN:brTOKENratioR).(Y * bond.fee) * (1 - burn.fee)brTOKEN stays in the Den contract.(Y * bond.fee) * burn.feebrTOKEN is burned (Growing Dens).
User receives
Y * (1 - bond.fee)brTOKEN.
First depositor wraps fee free.
Den creator has 7 days to wrap fee free — for first deposit only.
Unwrapping from Den
User unwraps
YbrTOKEN (callsdebond()on Den contract).Den burns
Y * (1 - debond.fee)brTOKEN.(Y * debond.fee) * (1 - burn.fee)brTOKEN stays in the Den contract.(Y * debond.fee) * burn.feebrTOKEN is burned (Growing Dens).User receives
R * Y * (1 - debond.fee)TOKEN (based onTOKEN:brTOKENratioR).Triggers Fee distribution.
No fee if unwrapping
98%brTOKEN or more.
Buying Den token
User buys
XbrTOKEN with HONEY (via Den LP).(X * buy.fee) * (1 - burn.fee)brTOKEN stays in the Den contract.(X * buy.fee) * burn.feebrTOKEN is burned (Growing Dens).User receives
X * (1 - buy.fee)brTOKEN.
Selling Den token
User sells
XbrTOKEN for HONEY (via Den LP pool).(X * sell.fee) * (1 - burn.fee)brTOKEN stays in the Den contract.Triggers Fee distribution.
(X * sell.fee) * burn.feebrTOKEN is burned (Growing Dens).User receives
X * (1 - sell.fee)brTOKEN to swap for HONEY.
Staking/Unstaking/Transferring Staked Den LP Token
User interacts with
XStaked brTOKEN-HONEY LP (callsstake(),unstake()or_transfer()).Triggers Fee distribution.
Transferring brTOKEN
User transfers
XbrTOKEN (calls_transfer()on Den contract).Triggers Fee distribution unless it's a transfer from Den LP.
Taking Flash Loan
User takes
XTOKEN flashloan paying10HONEY (callsflash()on Den contract).Triggers Fee distribution if Den LP rewards are in
HONEY,Otherwise if paired Den LP token is HONEY, fee is sent to
TokenRewardscontract.Otherwise,
HONEYis sent to the treasury.
Fee distribution
This is being called on all Den and Staked Den LP transfers (except when Buying Den token).
Wrapping TOKEN into brTOKEN also doesn't trigger Fee Distribution.
User triggers
_processPreSwapFeesAndSwap()on Den contract.If accumulated fees
AFin Den contract (in brTOKEN) are at least0.025%of Den's LP balance of brTOKENB, then Fees To SwapFTS = max(AF, 1% * B)brTOKEN.Swapping for HONEY (Den paired LP token):
FTS * partner.feebrTOKEN are sent to the Den creator address.FTS * yield.protocol.feebrTOKEN are sent to the Arbera treasury.FTS * (1 - partner.fee - yield.protocol.fee)brTOKEN are swapped to HONEY.
HONEY(from point 3.3) is swapped forYARBERA.Y * yield.admin.feeARBERA is sent to treasury for Future LP Yield.Y * (1 - yield.admin.fee)ARBERA are deposited as rewards for Staked Den LPs.
Last updated