-
Notifications
You must be signed in to change notification settings - Fork 7
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
5af10cd
commit c169888
Showing
1 changed file
with
108 additions
and
0 deletions.
There are no files selected for viewing
108 changes: 108 additions & 0 deletions
108
src/base/DecodersAndSanitizers/Protocols/TempestDecoderAndSanitizer.sol
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,108 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.21; | ||
|
||
import { BaseDecoderAndSanitizer } from "src/base/DecodersAndSanitizers/BaseDecoderAndSanitizer.sol"; | ||
|
||
abstract contract TempestDecoderAndSanitizer is BaseDecoderAndSanitizer { | ||
error TempestDecoderAndSanitizer__CheckSlippageRequired(); | ||
|
||
function deposit( | ||
uint256 amount, | ||
address receiver, | ||
bool checkSlippage | ||
) | ||
external | ||
pure | ||
virtual | ||
returns (bytes memory addressesFound) | ||
{ | ||
if (checkSlippage) { | ||
addressesFound = abi.encodePacked(receiver); | ||
} else { | ||
revert TempestDecoderAndSanitizer__CheckSlippageRequired(); | ||
} | ||
} | ||
|
||
// deposit with ETH | ||
function deposit( | ||
uint256 amount, | ||
address receiver, | ||
bytes merkleProofs | ||
) | ||
external | ||
pure | ||
virtual | ||
returns (bytes memory addressesFound) | ||
{ | ||
addressesFound = abi.encodePacked(receiver); | ||
} | ||
|
||
function redeemWithoutSwap( | ||
uint256 shares, | ||
address receiver, | ||
address owner, | ||
bool checkSlippage | ||
) | ||
external | ||
pure | ||
virtual | ||
returns (bytes memory addressesFound) | ||
{ | ||
if (checkSlippage) { | ||
addressesFound = abi.encodePacked(receiver); | ||
} else { | ||
revert TempestDecoderAndSanitizer__CheckSlippageRequired(); | ||
} | ||
} | ||
|
||
function deposits( | ||
uint256[] calldata amounts, | ||
address receiver, | ||
bool checkSlippage | ||
) | ||
external | ||
pure | ||
virtual | ||
returns (bytes memory addressesFound) | ||
{ | ||
if (checkSlippage) { | ||
addressesFound = abi.encodePacked(receiver); | ||
} else { | ||
revert TempestDecoderAndSanitizer__CheckSlippageRequired(); | ||
} | ||
} | ||
|
||
function redeem( | ||
uint256 shares, | ||
address receiver, | ||
address owner, | ||
uint256 minimumReceive, | ||
bool checkSlippage | ||
) | ||
external | ||
pure | ||
virtual | ||
returns (bytes memory addressesFound) | ||
{ | ||
if (checkSlippage) { | ||
addressesFound = abi.encodePacked(receiver); | ||
} else { | ||
revert TempestDecoderAndSanitizer__CheckSlippageRequired(); | ||
} | ||
} | ||
|
||
// redeem with ETH | ||
function redeem( | ||
uint256 shares, | ||
address receiver, | ||
address owner, | ||
bytes merkleProofs | ||
) | ||
external | ||
pure | ||
virtual | ||
returns (bytes memory addressesFound) | ||
{ | ||
addressesFound = abi.encodePacked(receiver); | ||
} | ||
} |