-
Notifications
You must be signed in to change notification settings - Fork 2
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
MainnetSwapSteward #3
base: main
Are you sure you want to change the base?
Conversation
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.
these two errors mean the same thing as i get it.
@sakulstra after discussing internally, we've added the budget limitation to the contract. for deployment, we'll prepare an ARFC with the right parameters for the initial budgets based on historical swaps the DAO has conducted. |
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.
After looking into Swapper
honestly to me the design of this is not so optimal.
The permissioned steward calls a permissioned, upgreadable contract(that in fact does not use upgreadable variants of the contracts).
My suggestion would be the following:
- merge this steward & aave swapper together.
- use a permissionless rescuable as on ClinicSteward, because the contract should never hold funds, right?
- this will simplify the contract a bit as e.g. recipient can be hardcoded (i think there's probably more that can be simplified)
- inline the
CollectorUtils
swap.
- swapper will always be the contract itself
- oracle decimals are already checked when registering the oracle
- the uint.max path should probably be moved to
tokenSwap
and take into account available budget
import {ICollector} from "aave-v3-origin/contracts/treasury/ICollector.sol"; | ||
import {CollectorUtils as CU} from "aave-helpers/src/CollectorUtils.sol"; | ||
import {MiscEthereum} from "aave-address-book/MiscEthereum.sol"; | ||
import {IAggregatorInterface} from "src/finance/interfaces/IAggregatorInterface.sol"; |
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.
better to do relative imports, otherwise remappings are hell to work with.
import {CollectorUtils as CU} from "aave-helpers/src/CollectorUtils.sol"; | ||
import {MiscEthereum} from "aave-address-book/MiscEthereum.sol"; | ||
import {IAggregatorInterface} from "src/finance/interfaces/IAggregatorInterface.sol"; | ||
|
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.
tokenBudget[fromToken] -= amount; | ||
|
||
COLLECTOR.swap( | ||
address(SWAPPER), CU.SwapInput(milkman, priceChecker, fromToken, toToken, fromOracle, toOracle, amount, slippage) |
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.
when using so many params, better to use {} object format to ensure they are passed in correct order.
Changelog
Add mainnet steward to perform swaps.
Add interface.
Add tests.