TokenLogic
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee
  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Introducing "Curator" by Llama --- title: Introducing "Curator" by Llama discussions: shortDescription: author: @Llamaxyz - @TokenLogic, @dydymoon and Fermin created: 2023-06-07 --- # Summary This publication introduces the 'Curator' by Llama. The Curator is a dedicated contract for managing the exchange of assets with MEV and price-impact protection, where possible. The below provides a high level overview of the functionality provided by the Curator: * Swap Assets * Acquire LSTs * Transfer Assets The contract is upgradeable and controlled by Aave's [`Short Executor`](https://docs.aave.com/developers/guides/governance-guide#the-short-executor-is-used-for-non-governance-related-proposals-such-as-asset-listing-parameter-upda) role via governance. Each function on the contract can be implemented via the `ShortExecutor` whilst also having the ability to assign and remove, a `Curator` role to a community-elected address. # Motivation As Aave DAO begins to more actively manage assets held in the Collector / Treasury Contract, Llama's research has concluded the contracts require several upgrades, across all networks, to facilitate the efficient management of the DAO's assets. After much discussion, @llamaxyz and @bgdlabs have concluded that it is not viable to upgrade the Collector Contract to facilitate the efficient management of the DAO's assets. As a result, a series of separate contracts are required. The solution is the Curator, which receives assets from the Collector Contract, performs necessary swaps, and deposits and wraps tasks before transferring the assets to another address. The first iteration of the Curator is to be deployed on Ethereum and then later introduced to other networks. On Ethereum, the Curator is to interact with CoW Swap, Lido Protocol, and Rocket Pool contracts. To limit the surface area of the contract, an `AllowList` will define which contracts can be interacted with. This is important as each contract that can be interacted with must first be added to the `AllowList` via the `ShortExecutor`. This becomes increasingly more important if the DAO decides to assign the `Curator` role to an address, which then has the ability to interact with the Curate contract. The `AllowList` eliminates the risk of the `Curator` interacting with a malicious contract or running away with the DAO's funds. The intent is to implement the highest heirarchy of control. On Ethereum at launch, Llama advocates for using the `ShortExecutor` to perform all the necessary transactions. On future deployments of the Curator on other networks, the aggregator protocol used to swap assets in a MEV protected manner does so over a lengthy time horizon which prevents any further steps performed by the same AIP submission. This can lead to multiple AIPs to achieve the desired result, in these instances the `Curator` role offers more flexibility. Each Curator deployment will exhibit different functionality tailored to that network and Aave DAO's needs. As a result, each deployment will be presented to Aave DAO as an [ARFC] proposal for the community to discuss and vote on. # Specification The Ethereum Curator will provide the following functionality to Aave Protocol: 1. Receive assets from the Treasury 2. Redeem aTokens for underlying spanning Aave v1, v2, and v3 3. Swap assets via CoW Swap with MEV protection and using Milkman 4. No reentrant 5. Cancel trade 6. Rescue tokens 7. allowTokens(address[] tokens) onlyExecutorOrAllowedCaller 8. Deposit ETH into Lido Finance Protocol to receive stETH 9. Wrap stETH to create wstETH 10. Deposit ETH into Rocket Pool's contract to receive rETH 11. Transfer assets to Treasury 12. Call a function to deposit assets in Aave v3 on behalf of Treasury 13. Allow-list tokens/contracts that can be interacted with 14. Allow-list Executor and approved multisig, CuratorRole(). The Curator will contain an `AllowList` defining which contracts the contract can interact with. The `AllowList` can only be updated by Aave Governance via the `ShortExecutor`. The below details the specific functions on the contract with a brief description on how each works. **UPGRADEABILITY?? DISCUSS WITH BGD > **function addAllowList(address[] contract)** external { Callable by governance } This function can only be called by`ShortExecutor`. Aave governance defines which contracts the `Curator` can interact with. > **function removeAllowList(address[] contract)** external { Callable by governance } This function can only be called by`ShortExecutor`. Aave governance can remove the ability of `Curator` to intereact with a specified contract. > **function assignCurator(address)** external { Callable by governance } Callable by governance, only `ShortExecutor` can assign the `Curator` role to an address. > **function revokeCurator(address)** external { Callable by governance } Callable by governance, only `ShortExecutor` can revoke the `Curator` role to an address. <!-- > **function redeem(address atoken)** external { Callable by governance or Curator Recipient can either be this contract or Collector only } --> <!-- Function shall redeem aToken for the underlying assets. --> > **function getExpectedAmountOut(fromToken, toToken, amountIn)** external { Lets users view how much they can expect out at any given time } Function shall query to determine the amount of token received from swap. > **function swap(address fromToken, address toToken, address recipient)** external { Callable by governance or Curator Validate fromToken is allowed Validate toToken is allowed Validate fromToken balance is > 0 for trade Recipient can either be this contract or Collector only } Function shall approve and swap the specified asset/s via CoW Swap using Milkman to protect against MEV attacks. > **function cancelTrade(address tradeMilkman, address fromToken, address toToken, address recipient, uint256 amount)** external { Callable by governance or Curator Validates token is allowed Reverses trade() } Function cancels a specific swap. > **function depositTokenIntoV2(address token)** external { Only callable by governance or Curator Validates token is allowed Deposits into V2 on behalf of Collector } Function deposits specified asset into Aave v2. <!-- > **function transferTokenCollectorContract(address token)** external { Only callable by governance or Curator Validates token is allowed Transfers token to V2 Collector } --> Function transfers asset to the Collector Contract. > **function depositTokenIntoV3(address token)** external { Only callable by governance or Curator Validates token is allowed Deposits into V3 on behalf of collector } Function deposits assets into Aave v3 on behalf of the Collector Contractor. Collector Contract receives the receipt token. > **function setAllowedFromToken(address token, address oracle, bool allowed)** external { Callable by governance or Curator Validates token is not zero address Validates Chainlink oracle is not zero address Sets allowed status of FROM (any ERC20) token to true/false } Sets tokens that can be swapped for others > **function setAllowedToToken(address token, address oracle, bool allowed)** external onlyAdminOrAllowedCaller { Callable by governance or Curator Validates token is not zero address Validates Chainlink oracle is not zero address Sets allowed status of TO (USDC/USDT/DAI) token to true/false } Sets tokens that can be swapped into > **function setMilkmanAddress(address _milkman)** external onlyAdmin { Only callable by governance Since Milkman is a dependency, have option to update it } Failsafe in case Milkman changes > **function transferToCollectorContract(address[] calldata tokens)** external { Only callable by governance or Curator Sends tokens in list to the Collector Used in case funds are sent here accidentally } Sends tokens in this contract to collector > **function convertETHtowstETH(address atoken,address toToken, deposit address, wrap address, receipt address) external { Only callable by governance or Curator Validates token is allowed Deposits token in list to the stETH deposit contract Deposits stETH into wstETH Transfers token to v2 Collector } This function unwraps wETH to ETH, deposits ETH into Lido Protocol stETH contract, wraps stETH to create wstETH and transfers wstETH to the Collector. > convertETHtorETH() > **function convertETHtorETH(address atoken,address toToken, deposit address, wrap address, receipt address) external { Only callable by governance or Curator Validates token is allowed Deposits token in list to the rETH deposit contract Transfers token to v2 Collector } This function unwraps wETH to ETH, deposits ETH into Rocket Pool's rETH contract and transfers rETH to the Collector. # Copyright Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). # Implementation A list of relevant links like for this proposal: * [Governance Forum Discussion](XXX) * [Test Cases](XXX) * [Payload Implementation](XXX) * [Deployed Contracts](XXX) The proposal Payload was reviewed by [Bored Ghost Developing](https://bgdlabs.com/). ###### DELETE AFTER READING ##### the collector would still hold funds when we need to "consolidate" the collector...we do one payload, to send funds to this contract, and then we swap, etc. allow specific ERC20 tokens a. allow FROM tokens (coins that aave has listed...) b. allow TO tokens (stablecoins...)

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully