refactor(archive): move historical contracts and adapters to archive directory
- Archived multiple non-EVM adapters (Algorand, Hedera, Tron, TON, Cosmos, Solana) and compliance contracts (IndyVerifier) to `archive/solidity/contracts/`. - Updated documentation to reflect the historical status of archived components. - Adjusted `foundry.toml` and `README.md` for clarity on historical dependencies and configurations. - Enhanced Makefile and package.json scripts for improved contract testing and building processes. - Removed obsolete contracts (AlltraCustomBridge, CommodityCCIPBridge, ISO4217WCCIPBridge, VaultBridgeAdapter) from the main directory. - Updated implementation reports to indicate archived status for various components.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
|
||||
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
||||
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
||||
|
||||
@@ -85,7 +86,7 @@ interface IAaveAtomicBridgeCoordinator {
|
||||
* @notice Aave V3 flash-loan receiver for the quote-push workflow:
|
||||
* flash borrow quote (`flashLoan` single-asset) -> buy PMM base -> unwind base externally -> repay lender, retaining any surplus.
|
||||
*/
|
||||
contract AaveQuotePushFlashReceiver is IAaveFlashLoanSimpleReceiver, IAaveFlashLoanReceiver {
|
||||
contract AaveQuotePushFlashReceiver is IAaveFlashLoanSimpleReceiver, IAaveFlashLoanReceiver, Ownable {
|
||||
using SafeERC20 for IERC20;
|
||||
|
||||
address public immutable pool;
|
||||
@@ -120,6 +121,7 @@ contract AaveQuotePushFlashReceiver is IAaveFlashLoanSimpleReceiver, IAaveFlashL
|
||||
error BadParams();
|
||||
error InsufficientToRepay();
|
||||
error InvalidAtomicBridge();
|
||||
error NothingToSweep();
|
||||
|
||||
event QuotePushExecuted(
|
||||
address indexed quoteToken,
|
||||
@@ -137,8 +139,11 @@ contract AaveQuotePushFlashReceiver is IAaveFlashLoanSimpleReceiver, IAaveFlashL
|
||||
uint256 bridgeAmount,
|
||||
uint256 minDestinationAmount
|
||||
);
|
||||
event TokenSwept(address indexed token, address indexed to, uint256 amount);
|
||||
event SurplusSwept(address indexed token, address indexed to, uint256 amount, uint256 reserveRetained);
|
||||
|
||||
constructor(address pool_) {
|
||||
constructor(address pool_, address initialOwner) Ownable(initialOwner) {
|
||||
if (pool_ == address(0) || initialOwner == address(0)) revert BadParams();
|
||||
pool = pool_;
|
||||
}
|
||||
|
||||
@@ -155,6 +160,31 @@ contract AaveQuotePushFlashReceiver is IAaveFlashLoanSimpleReceiver, IAaveFlashL
|
||||
);
|
||||
}
|
||||
|
||||
function quoteSurplusBalance(address quoteToken, uint256 reserveRetained) public view returns (uint256 surplus) {
|
||||
uint256 quoteBal = IERC20(quoteToken).balanceOf(address(this));
|
||||
if (quoteBal > reserveRetained) {
|
||||
surplus = quoteBal - reserveRetained;
|
||||
}
|
||||
}
|
||||
|
||||
function sweepQuoteSurplus(address quoteToken, address to, uint256 reserveRetained)
|
||||
external
|
||||
onlyOwner
|
||||
returns (uint256 amount)
|
||||
{
|
||||
if (quoteToken == address(0) || to == address(0)) revert BadParams();
|
||||
amount = quoteSurplusBalance(quoteToken, reserveRetained);
|
||||
if (amount == 0) revert NothingToSweep();
|
||||
IERC20(quoteToken).safeTransfer(to, amount);
|
||||
emit SurplusSwept(quoteToken, to, amount, reserveRetained);
|
||||
}
|
||||
|
||||
function sweepToken(address token, address to, uint256 amount) external onlyOwner {
|
||||
if (token == address(0) || to == address(0) || amount == 0) revert BadParams();
|
||||
IERC20(token).safeTransfer(to, amount);
|
||||
emit TokenSwept(token, to, amount);
|
||||
}
|
||||
|
||||
function executeOperation(
|
||||
address[] calldata assets,
|
||||
uint256[] calldata amounts,
|
||||
|
||||
Reference in New Issue
Block a user