owned this note
owned this note
Published
Linked with GitHub
# 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...)