Full Router
#
The FullRouter contract is capable of handling deposits, withdraws, rebalances, and restructures in strategies that contain both Synth and Debt tokens.#
RebalanceThe rebalance()
function of the router gets called by the rebalance()
function of the StrategyController. First, it repays any debt that is higher than what the strategy expects. Then it sells any tokens for WETH whose value is higher than expected. Then it buys any tokens whose value is lower than expected, and if there are synths in the strategy it exchanges SUSD for the appropriate synth. Finally, it borrows tokens that have a lower than expected debt.
#
DepositThe deposit()
function takes WETH from the StrategyController
contract and trades it for the strategy's underlying assets. First buying tokens, then synths, then borrowing tokens.
#
WithdrawThe withdraw()
function trades a percentage of the underlying assets for WETH and sends it to the StrategyController contract. First repaying debt, then selling tokens.