The Oven infrastructure manages baking, or pooled entry into a position.
The Oven accepts a single token. It uses a recipe, which can combine many steps such as swapping for several assets and depositing them in various strategies or LPs, to compose a single output token.
Receives ETH, Deposits to msg.sender
Deposits ETH to message sender
Deposits ETH to provided address
This sets the max units of inputToken to be used per round.
Acts to limit slippage
Stores each round
Maps users to rounds
onlyBaker # Modifier
onlyAdmin # Modifier
Triggers these actions:
creates empty rounds
Sets default role
Sets baker role
deposit, depositTo, _depositTo
Transfers `amount` of `inputToken` from `msg.sender` to this address
Since each `round` has a max `roundSize` to prevent slippage, deposits loop to fill each round. Break when full `amount` assigned to `rounds`
links user to `roundId` particularly useful for deposits which span into multiple rounds
withdraw, withdrawTo (`to`, `roundsLimit`)
Queries the `userRounds` and loops through participated `rounds`.
Calculates the relative share of baked asset the users deposit relates to in both `inputAmount` and `outputAmount`.
transfers `inputAmount` and `outputAmount` to entered address
emits `Withdraw` event
bake (calldata_data, memory_rounds)
Can only be called by `Baker` role
Loops through `rounds` and calculates the unbaked amount of round as `maxInputAmount`. A fee is applied if applicable.
`recipe.bake` is triggered which bakes `inputToken` to `outputToken`
`rounds` are updated with new `totalBakedInput`
if fee set, transfer to feeReceiver
only Admin can invoke
only admin call invoke
roundInputBalanceOf (round, of)
returns total input token balance of a user minus baked amount
sum of `roundInputBalanaceOf` for multiple rounds
roundOutputBalanceOf (round, of)
returns total output balance of a user minus unbaked amount
sum of `roundOutputBalanceOf` for multiple rounds
length of rounds per address
total rounds length
A recipe should route from one input token to one output token and the functionality to do so should be triggered by a `bake` function.
Max input units unbaked for the round
If a fee is set, this will have applied.
Defining units of inputToken spent
Defining units of outputToken produced.
Any additional function needed to compose the outputToken should be defined in the recipe.
For examples, please see contracts/recipes.