-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #430 from morpho-org/feat/base
Base Bundler
- Loading branch information
Showing
62 changed files
with
341 additions
and
366 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"chainId": 8453, | ||
"forkBlockNumber": 14000000, | ||
"markets": [ | ||
{ | ||
"loanToken": "WETH", | ||
"collateralToken": "WETH", | ||
"lltv": 800000000000000000 | ||
} | ||
], | ||
"DAI": "0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb", | ||
"USDC": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", | ||
"LINK": "0xC9EbC2469E403DD89eAcA78C6B0b216fc7501011", | ||
"WETH": "0x4200000000000000000000000000000000000006", | ||
"wrappedNative": "WETH", | ||
"aaveV3Pool": "0xA238Dd80C259a72e81d7e4664a9801593F98d1c5", | ||
"cWETHv3": "0x46e6b214b524310239732D51387075E0e70970bf", | ||
"cbETH": "0x2Ae3F1Ec7F1F5012CFEab0185bfc7aa3cf0DEc22", | ||
"USDT": "0x0000000000000000000000000000000000000000", | ||
"WBTC": "0x0000000000000000000000000000000000000000", | ||
"stETH": "0x0000000000000000000000000000000000000000", | ||
"wstETH": "0x0000000000000000000000000000000000000000", | ||
"rETH": "0x0000000000000000000000000000000000000000", | ||
"sDai": "0x0000000000000000000000000000000000000000", | ||
"aaveV2Pool": "0x0000000000000000000000000000000000000000", | ||
"aaveV3Optimizer": "0x0000000000000000000000000000000000000000", | ||
"comptroller": "0x0000000000000000000000000000000000000000", | ||
"cDAIv2": "0x0000000000000000000000000000000000000000", | ||
"cETHv2": "0x0000000000000000000000000000000000000000", | ||
"cUSDCv2": "0x0000000000000000000000000000000000000000" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,15 +7,15 @@ import {ErrorsLib} from "./libraries/ErrorsLib.sol"; | |
import {UNSET_INITIATOR} from "./libraries/ConstantsLib.sol"; | ||
import {SafeTransferLib, ERC20} from "../lib/solmate/src/utils/SafeTransferLib.sol"; | ||
|
||
/// @title BaseBundler | ||
/// @title CoreBundler | ||
/// @author Morpho Labs | ||
/// @custom:contact [email protected] | ||
/// @notice Enables calling multiple functions in a single call to the same contract (self). | ||
/// @dev Every bundler must inherit from this contract. | ||
/// @dev Every bundler inheriting from this contract must have their external functions payable as they will be | ||
/// delegate called by the `multicall` function (which is payable, and thus might pass a non-null ETH value). It is | ||
/// recommended not to rely on `msg.value` as the same value can be reused for multiple calls. | ||
abstract contract BaseBundler is IMulticall { | ||
abstract contract CoreBundler is IMulticall { | ||
using SafeTransferLib for ERC20; | ||
|
||
/* STORAGE */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,13 +7,13 @@ import {Math} from "../lib/morpho-utils/src/math/Math.sol"; | |
import {ErrorsLib} from "./libraries/ErrorsLib.sol"; | ||
import {SafeTransferLib, ERC20} from "../lib/solmate/src/utils/SafeTransferLib.sol"; | ||
|
||
import {BaseBundler} from "./BaseBundler.sol"; | ||
import {CoreBundler} from "./CoreBundler.sol"; | ||
|
||
/// @title ERC4626Bundler | ||
/// @author Morpho Labs | ||
/// @custom:contact [email protected] | ||
/// @notice Bundler contract managing interactions with ERC4626 compliant tokens. | ||
abstract contract ERC4626Bundler is BaseBundler { | ||
abstract contract ERC4626Bundler is CoreBundler { | ||
using SafeTransferLib for ERC20; | ||
|
||
/* ACTIONS */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,13 +8,13 @@ import {MarketParams, Signature, Authorization, IMorpho} from "../lib/morpho-blu | |
import {ErrorsLib} from "./libraries/ErrorsLib.sol"; | ||
import {SafeTransferLib, ERC20} from "../lib/solmate/src/utils/SafeTransferLib.sol"; | ||
|
||
import {BaseBundler} from "./BaseBundler.sol"; | ||
import {CoreBundler} from "./CoreBundler.sol"; | ||
|
||
/// @title MorphoBundler | ||
/// @author Morpho Labs | ||
/// @custom:contact [email protected] | ||
/// @notice Bundler contract managing interactions with Morpho. | ||
abstract contract MorphoBundler is BaseBundler, IMorphoBundler { | ||
abstract contract MorphoBundler is CoreBundler, IMorphoBundler { | ||
using SafeTransferLib for ERC20; | ||
|
||
/* IMMUTABLES */ | ||
|
@@ -264,7 +264,7 @@ abstract contract MorphoBundler is BaseBundler, IMorphoBundler { | |
_multicall(abi.decode(data, (bytes[]))); | ||
} | ||
|
||
/// @inheritdoc BaseBundler | ||
/// @inheritdoc CoreBundler | ||
function _isSenderAuthorized() internal view virtual override returns (bool) { | ||
return super._isSenderAuthorized() || msg.sender == address(MORPHO); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,13 +9,13 @@ import {Permit2Lib} from "../lib/permit2/src/libraries/Permit2Lib.sol"; | |
import {SafeCast160} from "../lib/permit2/src/libraries/SafeCast160.sol"; | ||
import {ERC20} from "../lib/solmate/src/tokens/ERC20.sol"; | ||
|
||
import {BaseBundler} from "./BaseBundler.sol"; | ||
import {CoreBundler} from "./CoreBundler.sol"; | ||
|
||
/// @title Permit2Bundler | ||
/// @author Morpho Labs | ||
/// @custom:contact [email protected] | ||
/// @notice Bundler contract managing interactions with Uniswap's Permit2. | ||
abstract contract Permit2Bundler is BaseBundler { | ||
abstract contract Permit2Bundler is CoreBundler { | ||
using SafeCast160 for uint256; | ||
|
||
/* ACTIONS */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,13 +3,13 @@ pragma solidity 0.8.24; | |
|
||
import {IERC20Permit} from "../lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Permit.sol"; | ||
|
||
import {BaseBundler} from "./BaseBundler.sol"; | ||
import {CoreBundler} from "./CoreBundler.sol"; | ||
|
||
/// @title PermitBundler | ||
/// @author Morpho Labs | ||
/// @custom:contact [email protected] | ||
/// @notice Bundler contract managing interactions with tokens implementing EIP-2612. | ||
abstract contract PermitBundler is BaseBundler { | ||
abstract contract PermitBundler is CoreBundler { | ||
/// @notice Permits the given `amount` of `asset` from sender to be spent by the bundler via EIP-2612 Permit with | ||
/// the given `deadline` & EIP-712 signature's `v`, `r` & `s`. | ||
/// @param asset The address of the token to be permitted. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,13 +8,13 @@ import {Math} from "../lib/morpho-utils/src/math/Math.sol"; | |
import {ErrorsLib} from "./libraries/ErrorsLib.sol"; | ||
import {SafeTransferLib, ERC20} from "../lib/solmate/src/utils/SafeTransferLib.sol"; | ||
|
||
import {BaseBundler} from "./BaseBundler.sol"; | ||
import {CoreBundler} from "./CoreBundler.sol"; | ||
|
||
/// @title StEthBundler | ||
/// @author Morpho Labs | ||
/// @custom:contact [email protected] | ||
/// @notice Contract allowing to bundle multiple interactions with stETH together. | ||
abstract contract StEthBundler is BaseBundler { | ||
abstract contract StEthBundler is CoreBundler { | ||
using SafeTransferLib for ERC20; | ||
|
||
/* IMMUTABLES */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,14 +5,14 @@ import {Math} from "../lib/morpho-utils/src/math/Math.sol"; | |
import {ErrorsLib} from "./libraries/ErrorsLib.sol"; | ||
import {SafeTransferLib, ERC20} from "../lib/solmate/src/utils/SafeTransferLib.sol"; | ||
|
||
import {BaseBundler} from "./BaseBundler.sol"; | ||
import {CoreBundler} from "./CoreBundler.sol"; | ||
|
||
/// @title TransferBundler | ||
/// @author Morpho Labs | ||
/// @custom:contact [email protected] | ||
/// @notice Enables transfer of ERC20 and native tokens. | ||
/// @dev Assumes that any tokens left on the contract can be seized by anyone. | ||
abstract contract TransferBundler is BaseBundler { | ||
abstract contract TransferBundler is CoreBundler { | ||
using SafeTransferLib for ERC20; | ||
|
||
/* TRANSFER ACTIONS */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,13 +6,13 @@ import {IUniversalRewardsDistributor} from | |
|
||
import {ErrorsLib} from "./libraries/ErrorsLib.sol"; | ||
|
||
import {BaseBundler} from "./BaseBundler.sol"; | ||
import {CoreBundler} from "./CoreBundler.sol"; | ||
|
||
/// @title UrdBundler | ||
/// @author Morpho Labs | ||
/// @custom:contact [email protected] | ||
/// @notice Bundler that allows to claim token rewards on the Universal Rewards Distributor. | ||
abstract contract UrdBundler is BaseBundler { | ||
abstract contract UrdBundler is CoreBundler { | ||
/// @notice Claims `amount` of `reward` on behalf of `account` on the given rewards distributor, using `proof`. | ||
/// @dev Assumes the given distributor implements IUniversalRewardsDistributor. | ||
/// @param distributor The address of the reward distributor contract. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,14 +7,14 @@ import {Math} from "../lib/morpho-utils/src/math/Math.sol"; | |
import {ErrorsLib} from "./libraries/ErrorsLib.sol"; | ||
import {SafeTransferLib, ERC20} from "../lib/solmate/src/utils/SafeTransferLib.sol"; | ||
|
||
import {BaseBundler} from "./BaseBundler.sol"; | ||
import {CoreBundler} from "./CoreBundler.sol"; | ||
|
||
/// @title WNativeBundler | ||
/// @author Morpho Labs | ||
/// @custom:contact [email protected] | ||
/// @notice Bundler contract managing interactions with network's wrapped native token. | ||
/// @notice "wrapped native" refers to forks of WETH. | ||
abstract contract WNativeBundler is BaseBundler { | ||
abstract contract WNativeBundler is CoreBundler { | ||
using SafeTransferLib for ERC20; | ||
|
||
/* IMMUTABLES */ | ||
|
Oops, something went wrong.