-
Notifications
You must be signed in to change notification settings - Fork 24
docs: add comprehensive generalized wrappers documentation #595
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
9e9d980
4248b8f
8e0fcdd
44a2d3b
5563ab8
ad8f9e6
3e58601
aba6279
9678bb8
e65d348
2bc9013
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,99 @@ | ||||||
| --- | ||||||
| sidebar_position: 7 | ||||||
| --- | ||||||
|
|
||||||
| # Generalized Wrappers | ||||||
|
|
||||||
| Generalized wrappers is a new framework to allow custom logic to execute before and/or after order settlement on CoW Protocol. They enable complex DeFi workflows—like flash loans, leveraged positions, and progmatic orders--all while preserving the security and assurances granted by CoW Protocol. | ||||||
|
|
||||||
| ## What are Wrappers? | ||||||
|
|
||||||
| Wrappers are smart contracts that "wrap" the settlement process, executing custom logic surrounding settlement contract. When a solver executes a settlement that includes a wrapper, they call the wrapper contract instead of the settlement contract directly. The wrapper calls the settlement contract on behalf of the solver. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing article: "surrounding settlement contract" → "surrounding the settlement contract". -Wrappers are smart contracts that "wrap" the settlement process, executing custom logic surrounding settlement contract.
+Wrappers are smart contracts that "wrap" the settlement process, executing custom logic surrounding the settlement contract.📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
|
|
||||||
| This mechanism extends CoW Protocol's functionality in a modular way, allowing new features and integrations to be added without modifying the core settlement contract or requiring any changes to solver implementations. | ||||||
|
|
||||||
| ### Wrapper Authentication | ||||||
|
|
||||||
| For security, all wrappers must be approved through CoW Protocol's `GPv2AllowlistAuthenticator` before they can be used. This ensures that only audited and wrappers can interact with the settlement contract, protecting users, solver, and the protocol from malicious contracts. Unlike [hooks](./cow-hooks.mdx), Wrapper functionality can revert the execution of a transaction, ensuring sensitive user operations such as cross-chain operations can be guarenteed to be completed. | ||||||
|
||||||
| For security, all wrappers must be approved through CoW Protocol's `GPv2AllowlistAuthenticator` before they can be used. This ensures that only audited and wrappers can interact with the settlement contract, protecting users, solver, and the protocol from malicious contracts. Unlike [hooks](./cow-hooks.mdx), Wrapper functionality can revert the execution of a transaction, ensuring sensitive user operations such as cross-chain operations can be guarenteed to be completed. | |
| For security, all wrappers must be approved through CoW Protocol's `GPv2AllowlistAuthenticator` before they can be used. This ensures that only audited wrappers can interact with the settlement contract, protecting users, solvers, and the protocol from malicious contracts. Unlike [hooks](./cow-hooks.mdx), wrapper functionality can revert the execution of a transaction, ensuring sensitive user operations such as cross-chain operations can be guaranteed to be completed. |
🧰 Tools
🪛 LanguageTool
[grammar] ~17-~17: Ensure spelling is correct
Context: ...s such as cross-chain operations can be guarenteed to be completed. ### Wrapper Nesting ...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
🤖 Prompt for AI Agents
In `@docs/cow-protocol/concepts/order-types/wrappers.md` at line 17, Fix typos and
minor wording in the paragraph: change "guarenteed" to "guaranteed", remove the
extra space before "wrappers" so it reads "audited and wrappers" properly as
"audited wrappers" (or "audited and wrappers" -> remove stray "and" if
intended), change "solver" to plural "solvers", and lowercase "Wrapper
functionality" to "wrapper functionality" for consistency; update the sentence
in the docs content (the paragraph referencing GPv2AllowlistAuthenticator and
settlement contract) accordingly.
kaze-cow marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
kaze-cow marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
kaze-cow marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
kaze-cow marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should make it clear that these are hypothetical and there isn't a corresponding feature out. Overall, I get the feeling this section should be much shorter since most of the people don't need a detailed description of hypothetical use cases, a bullet list would be enough. Later, we can link here to the concrete Euler implementation.
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
kaze-cow marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, that's a lot, I expect much less for an empty wrapper. Sure, we can get any number here if the calldata is large enough. How was the number computed?
Anyway, I think we should try to be more specific here. It would be nice to try a few different settlement data size, which should be the only real parameter in the case of an empty wrapper. (Something like this.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, maybe this is too specific for this very general page, but then I'd remove the concrete gas amount and do a more detailed analysis in another page.
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
kaze-cow marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needed section: something like
### On-Chain Protocol Does Not Validate Settlement
where we say that a malicious solver can change the settlement data and that a wrapper should not trust that to be executed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be extra clear, I'd mention that this isn't needed for people looking to implement wrappers.
Uh oh!
There was an error while loading. Please reload this page.