New Architecture (workflow) #105
Locked
antoncoding
started this conversation in
General
Replies: 2 comments 3 replies
-
Old Flow of minting:New flow of minting |
Beta Was this translation helpful? Give feedback.
0 replies
-
I generally like this updated approach. After reviewing the code it feels like the more natural approach. Concerns
Some ideas:
Observations: |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
TLDR for new Architecture / workflow
Current System
Since we introduced different "margin engines" into the system, the contract flow now becomes a little bit messy. The current workflow is:
Grappa
as the entry point, it then delegates call to the corresponding engine.MarginEngine
contract need to implement corresponding logic to deal with adding collateral, minting option ...etc.Grappa
will loop through an array of actions and call the engine to update the "account" correspondingly.Grappa
is the only contract authorised to mints option tokenMarginEngine
take care of "pulling collateral"Grappa
can be used to batch settle options from different engine, but also need to eachMarginEngine
to authorised Grappa for moving the collateral.The problem
Grappa
, making "add collateral through Grappa" unnecessary and seem redundantbytes
and let each engine decode.Solution
One solution is to reverse the flow, let each margin engine become the entry point and listen to a series of user actions.
The main grappa contract will become a registry for assets, oracles and engines, possibly also handle "access management".
When user need to deposit / remove collateral, they only need to interact with each margin engine.
When it comes to minting and burning, the engines can directly call the
OptionToken
contract.OptionToken
will decide if each engine is authorised to mint a certain type of option.This will simplify the relationship between contracts by quite a lot, and add a lot of complexity to each margin engine. (almost all of the logic)
Concerns
Grappa
as a single entry point is that, in the future we can easily let user pass in different engineId and switch engine, which might be better in terms of liquidation. But this can also be achieved by having another aggregator which takes in engine id to call different address, or interact with multiple engine in the same transaction.Grappa
until it's tested to comply.Solution is implemented in #108
Beta Was this translation helpful? Give feedback.
All reactions