diff --git a/docs/smart-contracts/core/adapters.mdx b/docs/smart-contracts/core/adapters.mdx index be8e237..0b8a9b9 100644 --- a/docs/smart-contracts/core/adapters.mdx +++ b/docs/smart-contracts/core/adapters.mdx @@ -16,9 +16,6 @@ The [StrategyProxyFactory](factory) contract holds the address of the platform's ## Swap All adapters must implement the `swap()` function in order to be usable by [Router](routers/routers-overview) contracts. Since it is expected that the [Router](routers/routers-overview) will interact with the `swap()` function via a delegate call the adapter's state variables (such as external contract addresses) must be defined in the deployment bytecode as `constant` or `immutable` variables. -## Spot Price -All adapters must implement the `spotPrice()` function in order to be usable by [Router](routers/routers-overview) contracts. This function estimates the price to exchange one token for another. Exchange fees are not included in the price estimate. - ## Exchanges Enso supports the following DEXes: Uniswap V2, Uniswap V3, Sushi, Balancer, Curve, and Synthetix. Interacting with these adapters allows a strategy to trade one token for another. diff --git a/docs/smart-contracts/core/routers/generic-router.mdx b/docs/smart-contracts/core/routers/generic-router.mdx deleted file mode 100644 index 8dc2133..0000000 --- a/docs/smart-contracts/core/routers/generic-router.mdx +++ /dev/null @@ -1,19 +0,0 @@ ---- -id: generic-router -title: Generic Router -sidebar_position: 2 -custom_edit_url: https://github.com/EnsoFinance/enso-docs/blob/main/docs/smart-contracts/core/routers/generic-router.mdx ---- - -##### The GenericRouter handles all trading functions (deposits, withdraws, rebalance, and restructures) using multicalls that are passed to the functions as bytecode. - ---- - -## Call -The `Call` type is a `struct` that contains a target `address` and the `bytes` call data for a function that is on the target contract. The [Router](routers-overview) functions that are implemented by GenericRouter taked a `Call[]` array which has been encoded into a `bytes` type. Using the `aggregate()` function in the `Multicall` library it loops through each `Call` and makes a function call to the target address. - -## Delegate Swap -This contract implements the `delegateSwap` external function which wraps the internal `_delegateSwap` and allows it to be included within a `Multicall`. However, in order to prevent misuse, it restricts the address that may call it to the GenericRouter address itself. In this way it acts as an internal function while also including the function in the contract's ABI to be used for building multicalls. - -## Settlement Functions -There are several settlement functions implemented in the GenericRouter to facilitate easier multicall creation. The basic purpose of these functions is to use the contract's current balance of a given token as the input amount for commonly used token functions. The functions are `settleSwap`, `settleTransfer`, and `settleTransferFrom`. All functions can only be called by the GenericRouter and therefore can only be used as part of a multicall. diff --git a/docs/smart-contracts/core/routers/multicall-router.mdx b/docs/smart-contracts/core/routers/multicall-router.mdx new file mode 100644 index 0000000..b85f19b --- /dev/null +++ b/docs/smart-contracts/core/routers/multicall-router.mdx @@ -0,0 +1,19 @@ +--- +id: multicall-router +title: Multicall Router +sidebar_position: 2 +custom_edit_url: https://github.com/EnsoFinance/enso-docs/blob/main/docs/smart-contracts/core/routers/multicall-router.mdx +--- + +##### The MulticallRouter handles all trading functions (deposits, withdraws, rebalance, and restructures) using multicalls that are passed to the functions as bytecode. + +--- + +## Call +The `Call` type is a `struct` that contains a target `address` and the `bytes` call data for a function that is on the target contract. The [Router](routers-overview) functions that are implemented by MulticallRouter taked a `Call[]` array which has been encoded into a `bytes` type. Using the `aggregate()` function in the `Multicall` library it loops through each `Call` and makes a function call to the target address. + +## Delegate Swap +This contract implements the `delegateSwap` external function which wraps the internal `_delegateSwap` and allows it to be included within a `Multicall`. However, in order to prevent misuse, it restricts the address that may call it to the MulticallRouter address itself. In this way it acts as an internal function while also including the function in the contract's ABI to be used for building multicalls. + +## Settlement Functions +There are several settlement functions implemented in the MulticallRouter to facilitate easier multicall creation. The basic purpose of these functions is to use the contract's current balance of a given token as the input amount for commonly used token functions. The functions are `settleSwap`, `settleTransfer`, and `settleTransferFrom`. All functions can only be called by the MulticallRouter and therefore can only be used as part of a multicall.