-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3e67c80
commit 672fe44
Showing
5 changed files
with
124 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
. | ||
└── transfer(address asset, address recipient, uint256 amount) | ||
├── if recipient == address(0) | ||
│ └── revert ZERO_ADDRESS | ||
├── if recipient == address(this) | ||
│ └── revert BULKER_ADDRESS | ||
├── amount is set to min of balance(bulker) and amount | ||
│ ├── if amount == 0 | ||
│ │ └── revert ZERO_AMOUNT | ||
│ └── if balance(bulker) == 0 | ||
│ └── revert ZERO_AMOUNT | ||
└── recipient is transferred `amount` of `asset` | ||
|
||
. | ||
└── approve2(address asset, uint256 amount, uint256 deadline, Signature calldata signature) | ||
├── if amount == 0 | ||
│ └── revert ZERO_AMOUNT | ||
└── use simplePermit2 from uniswap lib on asset to approve bulker | ||
|
||
. | ||
└── transferFrom2(address asset, uint256 amount) | ||
├── if amount == 0 | ||
│ └── revert ZERO_AMOUNT | ||
└── use transferFrom2 from uniswap lib on asset to transfer tokens from initiator to bulker |
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,3 @@ | ||
. | ||
└── constructor(address morpho) | ||
└── call constructor of MorphoBulker |
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,87 @@ | ||
. | ||
└── constructor(address morpho) | ||
├── if morpho == address(0) | ||
│ └── revert ZERO_ADDRESS | ||
└── set MORPHO to IMorpho(morpho) | ||
|
||
. | ||
└── onMorphoSupply(uint256, bytes calldata data) | ||
├── internal call checkInitiator (BaseCallbackReceiver) | ||
└── internal call multicall | ||
|
||
. | ||
└── onMorphoSupplyCollateral(uint256, bytes calldata data) | ||
├── internal call checkInitiator (BaseCallbackReceiver) | ||
└── internal call multicall | ||
|
||
. | ||
└── onMorphoRepay(uint256, bytes calldata data) | ||
├── internal call checkInitiator (BaseCallbackReceiver) | ||
└── internal call multicall | ||
|
||
. | ||
└── onMorphoFlashLoan(uint256, bytes calldata data) | ||
├── internal call checkInitiator (BaseCallbackReceiver) | ||
└── internal call multicall | ||
|
||
. | ||
└── morphoSetAuthorizationWithSig(Authorization calldata authorization, Signature calldata signature) | ||
└── call setAuthorizationWithSig(authorization, signature) on MORPHO | ||
|
||
. | ||
└── morphoSupply(Market calldata market, uint256 amount, uint256 shares, address onBehalf, bytes calldata data) | ||
├── if onBehalf == address(this) | ||
│ └── revert BULKER_ADDRESS | ||
├── internal call _approveMaxBlue(borrowableToken) | ||
└── call supply(market, amount, shares, onBehalf, data) on MORPHO | ||
├── if amount == type(uint256).max | ||
│ └── amount = balance of borrowableToken | ||
└── else amount = amount | ||
|
||
. | ||
└── morphoSupplyCollateral(Market calldata market, uint256 amount, address onBehalf, bytes calldata data) | ||
├── if onBehalf == address(this) | ||
│ └── revert BULKER_ADDRESS | ||
├── internal call _approveMaxBlue(collateralToken) | ||
└── call supplyCollateral(market, amount, onBehalf, data) on MORPHO | ||
├── if amount == type(uint256).max | ||
│ └── amount = balance of collateralToken | ||
└── else amount = amount | ||
|
||
. | ||
└── morphoBorrow(Market calldata market, uint256 amount, uint256 shares, address receiver) | ||
└── call on MORPHO borrow(market, amount, shares, _initiator, receiver) | ||
|
||
. | ||
└── morphoRepay(Market calldata market, uint256 amount, uint256 shares, address onBehalf, bytes calldata data) | ||
├── if onBehalf == address(this) | ||
│ └── revert BULKER_ADDRESS | ||
├── internal call _approveMaxBlue(borrowableToken) | ||
└── call repay(market, amount, shares, onBehalf, data) on MORPHO | ||
├── if amount == type(uint256).max | ||
│ └── amount = balance of borrowableToken | ||
└── else amount = amount | ||
|
||
. | ||
└── morphoWithdraw(Market calldata market, uint256 amount, uint256 shares, address receiver) | ||
└── call on MORPHO withdraw(market, amount, shares, _initiator, receiver) | ||
|
||
. | ||
└── morphoWithdrawCollateral(Market calldata market, uint256 amount, address receiver) | ||
└── call on MORPHO withdrawCollateral(market, amount, _initiator, receiver) | ||
|
||
. | ||
└── morphoLiquidate(Market calldata market, address borrower, uint256 seized, bytes memory data) | ||
├── internal call approveMaxBlue(borrowableToken) | ||
└── call liquidate(market, borrower, seized, data) on MORPHO | ||
|
||
. | ||
└── morphoFlashLoan(address asset, uint256 amount, bytes calldata data) | ||
├── internal call approveMaxBlue(asset) | ||
└── call flashLoan(asset, amount, data) on MORPHO | ||
|
||
. | ||
└── _approveMaxBlue(address asset) | ||
├── if allowance(address(this), address(MORPHO)) == 0 | ||
│ └── call ERC20(asset).safeApprove(address(MORPHO), type(uint256).max) | ||
└── otherwise do nothing |