feat: docs - #20
Conversation
anxolin
left a comment
There was a problem hiding this comment.
For now I only review the OVERVIEW, I gave some feedback, in general I feel a lot of context is taken from granted.
For now maybe is fine to have these docs here, but probably we want to move to https://docs.cow.fi
Wrappers should definetly be in https://docs.cow.fi and we could reference from here.
|
|
||
| ### Base Framework: CowWrapper | ||
|
|
||
| `CowWrapper.sol` is a self-contained abstract base contract provided by the CoW DAO which should be used for all wrappers. In particular it ensures: |
There was a problem hiding this comment.
I think is nice to link to the file
There was a problem hiding this comment.
linked to the specific file
|
|
||
| ### EVC Integration Base: CowEvcBaseWrapper | ||
|
|
||
| `CowEvcBaseWrapper.sol` extends `CowWrapper` with: |
There was a problem hiding this comment.
linked to the specific file
|
|
||
| **Result**: User's debt is repaid and remaining collateral is returned | ||
|
|
||
| **Example**: User closes a 5 ETH short position (ETH = $1000). Around 5000 USDC collateral is swapped to exactly the user's debt of 5 ETH. The debt is repaid, and remaining USDC ($1000) is returned to the owner's account. |
There was a problem hiding this comment.
I would prefer the example before the detailed flow, as it helps to picture better the flow
There was a problem hiding this comment.
Why here the debt is $4000?
There was a problem hiding this comment.
Sorry, I didnt clarify here the starting case is same as where the open position wrapper left off. 5 ETH at $1000 is around $5000 of debt, so starting with $6000 of debt, you end up with $1000 left over. added some clarification.
fedgiac
left a comment
There was a problem hiding this comment.
I've read the overview so far and I like it. I think it gives the right amount of context. Will be reading 02 to 05 tomorrow.
|
|
||
| ## Introduction | ||
|
|
||
| This repository contains **Euler-CoW Protocol integration contracts** that enable leveraged position management (opening, closing, growing, and shrinking) and collateral swaps through CoW Protocol settlements combined with [Ethereum Vault Connector (EVC)](https://evc.wtf/) operations. The contracts, using CoW's [Generalized Wrappers](https://docs.cow.fi/cow-protocol/concepts/order-types/wrappers) architecture, coordinate complex multi-step DeFi operations atomically around a CoW settlement operation. Through its |
There was a problem hiding this comment.
The link to generalized wrapper is broken, which makes sense since they are introduced in this repo as well. Since they're also audited, they should also be documented and they probably deserve their own page in the current docs structure.
There was a problem hiding this comment.
ok makes sense. Will try and draft something up.
|
|
||
| ### 1. CowEvcOpenPositionWrapper | ||
|
|
||
| The [`CowEvcOpenPositionWrapper`](../../src/CowEvcOpenPositionWrapper.sol) opens or grows leveraged positions (long or short). |
There was a problem hiding this comment.
Maybe stupid question but what does long or short mean here?
In the example below, I'd say the position is short in ETH. It can arguably be said to be long in USDC but anyway, I'd think of this mainly as a short.
I'm even considering if we should call the OpenPosition wrapper a Short wrapper. (But then it isn't nicely symmetric with the next one, so maybe not.)
There was a problem hiding this comment.
obviously I am not a trading expert. When I say "long x", it means that I am creating exposure to x such that as x price rises, I get money, and when "short x", I gain money when x price falls. Generally there is some "safe haven" collateral asset that is used , which is generally USD, which is why I suppose its kind of unusual to say you are "long USD" because if X's price falls, that doesn't necessarily mean that you gained money because USD went up.
I'm even considering if we should call the OpenPosition wrapper a Short wrapper. (But then it isn't nicely symmetric with the next one, so maybe not.)
I suppose it would make sense here to give examples of how it works both "long" and "short". The open position wrapper can also be a long wrapper. Consider if the user started with ETH and then borrowed USD, its wierd to say you are "short USD" because USD is not a volatile asset, so instead we just say you are long ETH. So whatever asset is used as collateral is always "long" and the collateral used as debt is always "short", but that doesn't make it a "short wrapper" I would say.
|
|
||
| ## Security Model | ||
|
|
||
| ### Trusted Actor: Solvers |
There was a problem hiding this comment.
Nit, just because all the items in the list are unrelated to solvers.
| ### Trusted Actor: Solvers | |
| ### Trusted Components |
There was a problem hiding this comment.
the purpose of this section is intended to explain why solvers can be trusted (both by onchain and offchain processes). The examples given are specific onchain safeguards designed to prevent solvers from having incentive to steal funds, and the mentioning of slashing is explaining that solvers are constrained by that offchain. Seems reasonable to me?
dc09157 to
4538990
Compare
Co-authored-by: Federico Giacon <58218759+fedgiac@users.noreply.github.com>
## Description We received feedback from the auditors. This PR contains commits to resolve any findings that they had. ## Out of Scope This is only covering changes to the code; any changes to the docs will be done as part of the #20 PR (separately committed, tbd) ## Testing Instructions Browse through the audit findings. I included commit hashes with every fix that was implemented. If anything seems amiss please feel free to comment either here (for specific feedback) or on the finding itself (for more general/overarching choices). --------- Co-authored-by: Federico Giacon <58218759+fedgiac@users.noreply.github.com>
Description
Detailed documentation (based on internal notion page which has been updated over time) covers parameters, authorization flows, transaction execution, error handling, and real-world examples for integrators and auditors.
Context
As we prepare for audit, it is good to finalize our documentation. I tried to organize the docs that we alreayd had internally into an organized, easily digested set of markdowns which will provide the best starting point for potential integrators and auditors.
Testing Instructions
Best thing we can probably do is try using this guide in combination with the playground to try setting up new CoW orders with Euler. I have a branch
feat/playground-use-stagingsuitable for this.