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:
@@ -48,12 +48,12 @@ All requested components for multi-chain deployment have been **fully implemente
|
||||
|-------|---------|------|--------|
|
||||
| XRP Ledger | XRPLAdapter | `contracts/bridge/adapters/non-evm/XRPLAdapter.sol` | ✅ Complete |
|
||||
| Stellar | StellarAdapter | `contracts/bridge/adapters/non-evm/StellarAdapter.sol` | ✅ Complete |
|
||||
| Algorand | AlgorandAdapter | `contracts/bridge/adapters/non-evm/AlgorandAdapter.sol` | ✅ Complete |
|
||||
| Hedera | HederaAdapter | `contracts/bridge/adapters/non-evm/HederaAdapter.sol` | ✅ Complete |
|
||||
| Tron | TronAdapter | `contracts/bridge/adapters/non-evm/TronAdapter.sol` | ✅ Complete |
|
||||
| TON | TONAdapter | `contracts/bridge/adapters/non-evm/TONAdapter.sol` | ✅ Complete |
|
||||
| Cosmos | CosmosAdapter | `contracts/bridge/adapters/non-evm/CosmosAdapter.sol` | ✅ Complete |
|
||||
| Solana | SolanaAdapter | `contracts/bridge/adapters/non-evm/SolanaAdapter.sol` | ✅ Complete |
|
||||
| Algorand | AlgorandAdapter | `archive/solidity/contracts/bridge/adapters/non-evm/AlgorandAdapter.sol` | ✅ Complete (historical, archived) |
|
||||
| Hedera | HederaAdapter | `archive/solidity/contracts/bridge/adapters/non-evm/HederaAdapter.sol` | ✅ Complete (historical, archived) |
|
||||
| Tron | TronAdapter | `archive/solidity/contracts/bridge/adapters/non-evm/TronAdapter.sol` | ✅ Complete (historical, archived) |
|
||||
| TON | TONAdapter | `archive/solidity/contracts/bridge/adapters/non-evm/TONAdapter.sol` | ✅ Complete (historical, archived) |
|
||||
| Cosmos | CosmosAdapter | `archive/solidity/contracts/bridge/adapters/non-evm/CosmosAdapter.sol` | ✅ Complete (historical, archived) |
|
||||
| Solana | SolanaAdapter | `archive/solidity/contracts/bridge/adapters/non-evm/SolanaAdapter.sol` | ✅ Complete (historical, archived) |
|
||||
|
||||
### **4. Hyperledger Adapters** ✅ (4 adapters)
|
||||
|
||||
@@ -62,7 +62,7 @@ All requested components for multi-chain deployment have been **fully implemente
|
||||
| Firefly | FireflyAdapter | `contracts/bridge/adapters/hyperledger/FireflyAdapter.sol` | ✅ Complete |
|
||||
| Cacti | CactiAdapter | `contracts/bridge/adapters/hyperledger/CactiAdapter.sol` | ✅ Complete |
|
||||
| Fabric | FabricAdapter | `contracts/bridge/adapters/hyperledger/FabricAdapter.sol` | ✅ Complete |
|
||||
| Indy | IndyVerifier | `contracts/compliance/IndyVerifier.sol` | ✅ Complete |
|
||||
| Indy | IndyVerifier | `archive/solidity/contracts/compliance/IndyVerifier.sol` | ✅ Complete |
|
||||
|
||||
### **5. Service Integrations** ✅
|
||||
|
||||
|
||||
@@ -30,23 +30,23 @@ Successfully implemented a **production-grade, infinitely extensible cross-chain
|
||||
|
||||
### ✅ Phase 2: Bridge Infrastructure (3/3 complete)
|
||||
5. ✅ UniversalCCIPBridge - Main bridge with PMM/vault integration
|
||||
6. ✅ Specialized Bridges - 4 bridges (GRU, ISO4217W, Security, Commodity)
|
||||
6. ✅ Specialized Bridges - 4 bridges (GRU, ISO4217W, Security, Commodity); ISO4217W and Commodity variants are now historical and archived
|
||||
7. ✅ BridgeOrchestrator - Asset-type routing
|
||||
|
||||
### ✅ Phase 3: Liquidity (3/3 complete)
|
||||
8. ✅ LiquidityManager - Multi-provider orchestration
|
||||
9. ✅ DODOPMMProvider - DODO wrapper with ILiquidityProvider
|
||||
10. ✅ PoolManager - Auto-pool creation
|
||||
10. ✅ PoolManager - Auto-pool creation (historical, now archived)
|
||||
|
||||
### ✅ Phase 4: Extensibility (4/4 complete)
|
||||
11. ✅ PluginRegistry - Register handlers, providers, modules
|
||||
12. ✅ ProxyFactory - Deploy UUPS/Beacon proxies
|
||||
13. ✅ ConfigurationRegistry - Runtime configuration
|
||||
14. ✅ BridgeModuleRegistry - Pre/post hooks, validators
|
||||
11. ✅ PluginRegistry - Register handlers, providers, modules (historical, now archived)
|
||||
12. ✅ ProxyFactory - Deploy UUPS/Beacon proxies (historical, now archived)
|
||||
13. ✅ ConfigurationRegistry - Runtime configuration (historical, now archived)
|
||||
14. ✅ BridgeModuleRegistry - Pre/post hooks, validators (historical, now archived)
|
||||
|
||||
### ✅ Phase 5: Vault Integration (2/2 complete)
|
||||
15. ✅ VaultBridgeAdapter - Vault-bridge interface
|
||||
16. ✅ BridgeVaultExtension - Operation tracking
|
||||
15. ✅ VaultBridgeAdapter - Vault-bridge interface (historical, now archived)
|
||||
16. ✅ BridgeVaultExtension - Operation tracking (historical, now archived)
|
||||
|
||||
### ✅ Phase 6: Testing & Security (4/4 complete)
|
||||
17. ✅ Integration tests - Full end-to-end flows
|
||||
@@ -68,15 +68,17 @@ Successfully implemented a **production-grade, infinitely extensible cross-chain
|
||||
### Core Registry (7 contracts)
|
||||
```
|
||||
contracts/registry/
|
||||
├── UniversalAssetRegistry.sol (272 lines)
|
||||
└── UniversalAssetRegistry.sol (272 lines)
|
||||
|
||||
archive/solidity/contracts/registry/
|
||||
├── interfaces/
|
||||
│ └── IAssetTypeHandler.sol
|
||||
│ └── IAssetTypeHandler.sol (historical, archived)
|
||||
└── handlers/
|
||||
├── ERC20Handler.sol
|
||||
├── GRUHandler.sol
|
||||
├── ISO4217WHandler.sol
|
||||
├── SecurityHandler.sol
|
||||
└── CommodityHandler.sol
|
||||
├── ERC20Handler.sol (archived)
|
||||
├── GRUHandler.sol (archived)
|
||||
├── ISO4217WHandler.sol (archived)
|
||||
├── SecurityHandler.sol (archived)
|
||||
└── CommodityHandler.sol (archived)
|
||||
```
|
||||
|
||||
### Governance (3 contracts)
|
||||
@@ -93,44 +95,46 @@ contracts/sync/
|
||||
contracts/bridge/
|
||||
├── UniversalCCIPBridge.sol (258 lines)
|
||||
├── GRUCCIPBridge.sol (110 lines)
|
||||
├── ISO4217WCCIPBridge.sol (140 lines)
|
||||
├── ISO4217WCCIPBridge.sol (140 lines, archived)
|
||||
├── SecurityCCIPBridge.sol (175 lines)
|
||||
├── CommodityCCIPBridge.sol (200 lines)
|
||||
├── CommodityCCIPBridge.sol (200 lines, archived)
|
||||
├── BridgeOrchestrator.sol (180 lines)
|
||||
├── VaultBridgeAdapter.sol (120 lines)
|
||||
├── VaultBridgeAdapter.sol (120 lines, archived)
|
||||
└── modules/
|
||||
└── BridgeModuleRegistry.sol (185 lines)
|
||||
└── BridgeModuleRegistry.sol (185 lines, archived)
|
||||
```
|
||||
|
||||
### Liquidity (4 contracts)
|
||||
```
|
||||
contracts/liquidity/
|
||||
├── LiquidityManager.sol (220 lines)
|
||||
├── PoolManager.sol (190 lines)
|
||||
├── interfaces/
|
||||
│ └── ILiquidityProvider.sol
|
||||
└── providers/
|
||||
└── DODOPMMProvider.sol (160 lines)
|
||||
|
||||
archive/solidity/contracts/liquidity/
|
||||
└── PoolManager.sol (190 lines, historical, archived)
|
||||
```
|
||||
|
||||
### Extensibility (3 contracts)
|
||||
```
|
||||
contracts/plugins/
|
||||
└── PluginRegistry.sol (155 lines)
|
||||
archive/solidity/contracts/plugins/
|
||||
└── PluginRegistry.sol (155 lines, historical, archived)
|
||||
|
||||
contracts/upgrades/
|
||||
└── ProxyFactory.sol (145 lines)
|
||||
archive/solidity/contracts/upgrades/
|
||||
└── ProxyFactory.sol (145 lines, archived)
|
||||
|
||||
contracts/config/
|
||||
└── ConfigurationRegistry.sol (110 lines)
|
||||
archive/solidity/contracts/config/
|
||||
└── ConfigurationRegistry.sol (110 lines, archived)
|
||||
```
|
||||
|
||||
### Vault (2 contracts)
|
||||
```
|
||||
contracts/vault/
|
||||
├── BridgeVaultExtension.sol (130 lines)
|
||||
archive/solidity/contracts/vault/
|
||||
├── BridgeVaultExtension.sol (130 lines, archived)
|
||||
└── interfaces/
|
||||
└── IVaultStrategy.sol
|
||||
└── IVaultStrategy.sol (archived)
|
||||
```
|
||||
|
||||
**Total**: 30+ smart contracts
|
||||
@@ -198,7 +202,7 @@ script/deploy/
|
||||
|
||||
### 1. Plugin Architecture ✅
|
||||
```solidity
|
||||
// Add new asset type:
|
||||
// Historical plugin architecture:
|
||||
pluginRegistry.registerPlugin(
|
||||
PluginType.AssetTypeHandler,
|
||||
"NewAssetType",
|
||||
|
||||
15
Makefile
15
Makefile
@@ -36,7 +36,7 @@ help:
|
||||
@echo " make clean - Clean up temporary files"
|
||||
@echo " make genesis - Generate genesis file"
|
||||
@echo " make keys - Generate validator and oracle keys"
|
||||
@echo " make contracts - Compile and test contracts"
|
||||
@echo " make contracts - Compile and test contracts (optional: SCOPE=treasury, SCOPE=bridge/trustless, ...)"
|
||||
@echo " make monitoring - Deploy monitoring stack"
|
||||
@echo " make assets - Setup and download Azure icons (see Makefile.assets)"
|
||||
|
||||
@@ -204,10 +204,11 @@ azure-login:
|
||||
|
||||
test:
|
||||
@echo "Running tests (parallel)..."
|
||||
@if [ -n "$(SCOPE)" ]; then echo "Forge scope: $(SCOPE)"; else echo "Forge scope: full"; fi
|
||||
@if [ -f .env ]; then \
|
||||
source .env && forge test --fork-url "$$RPC_URL" -j $$(nproc) || forge test -j $$(nproc); \
|
||||
source .env && FORGE_SCOPE="$(SCOPE)" bash scripts/forge/scope.sh test --fork-url "$$RPC_URL" -j $$(nproc) || FORGE_SCOPE="$(SCOPE)" bash scripts/forge/scope.sh test -j $$(nproc); \
|
||||
else \
|
||||
forge test -j $$(nproc); \
|
||||
FORGE_SCOPE="$(SCOPE)" bash scripts/forge/scope.sh test -j $$(nproc); \
|
||||
fi
|
||||
@./tests/health-check.sh &
|
||||
@HEALTH_PID=$$!; \
|
||||
@@ -233,15 +234,15 @@ keys:
|
||||
|
||||
contracts:
|
||||
@echo "Compiling contracts..."
|
||||
forge build
|
||||
@if [ -n "$(SCOPE)" ]; then echo "Forge scope: $(SCOPE)"; else echo "Forge scope: full"; fi
|
||||
FORGE_SCOPE="$(SCOPE)" bash scripts/forge/scope.sh build
|
||||
@echo "Running contract tests (parallel)..."
|
||||
@if [ -f .env ]; then \
|
||||
source .env && forge test --fork-url "$$RPC_URL" -j $$(nproc) || forge test -j $$(nproc); \
|
||||
source .env && FORGE_SCOPE="$(SCOPE)" bash scripts/forge/scope.sh test --fork-url "$$RPC_URL" -j $$(nproc) || FORGE_SCOPE="$(SCOPE)" bash scripts/forge/scope.sh test -j $$(nproc); \
|
||||
else \
|
||||
forge test -j $$(nproc); \
|
||||
FORGE_SCOPE="$(SCOPE)" bash scripts/forge/scope.sh test -j $$(nproc); \
|
||||
fi
|
||||
|
||||
monitoring:
|
||||
@echo "Deploying monitoring stack..."
|
||||
kubectl apply -f monitoring/k8s/prometheus.yaml
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
> **Note**: 30 deployment and integration tasks remain (operational procedures, external submissions). All code tasks are 100% complete. See [Next Steps](docs/operations/tasks/NEXT_STEPS_LIST.md) for deployment tasks.
|
||||
>
|
||||
> **Dependency Status**: Hybrid approach implemented - OpenZeppelin v4.9.6 installed (compatible with Solidity 0.8.19). New WETH contracts (WETH10, CCIPWETH9Bridge, CCIPWETH10Bridge) are independent and don't require OpenZeppelin. Existing contracts (CCIPSender, CCIPRouter, CCIPRouterOptimized, MultiSig, Voting) use OpenZeppelin. All contracts compile successfully. See [Hybrid Approach Implementation](docs/guides/HYBRID_APPROACH_IMPLEMENTATION.md) and [Dependencies Guide](docs/guides/DEPENDENCIES.md) for details.
|
||||
> **Dependency Status**: Hybrid approach implemented - OpenZeppelin v4.9.6 installed (compatible with Solidity 0.8.19). New WETH contracts (WETH10, CCIPWETH9Bridge, CCIPWETH10Bridge) are independent and don't require OpenZeppelin. Active OpenZeppelin-dependent contracts include CCIPSender, CCIPRouter, MultiSig, and Voting; the historical `CCIPRouterOptimized` source now lives under `archive/solidity/contracts/ccip/`. See [Hybrid Approach Implementation](docs/guides/HYBRID_APPROACH_IMPLEMENTATION.md) and [Dependencies Guide](docs/guides/DEPENDENCIES.md) for details.
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -23,25 +23,25 @@ The Universal Cross-Chain Asset Hub has been **fully implemented** according to
|
||||
### Phase 2: Bridge Infrastructure ✅
|
||||
- ✅ UniversalCCIPBridge - Main bridge supporting all assets
|
||||
- ✅ GRUCCIPBridge - GRU layer conversions
|
||||
- ✅ ISO4217WCCIPBridge - eMoney/CBDC compliance
|
||||
- ✅ ISO4217WCCIPBridge - eMoney/CBDC compliance (historical, now archived)
|
||||
- ✅ SecurityCCIPBridge - Securities with accreditation
|
||||
- ✅ CommodityCCIPBridge - Commodity certificates
|
||||
- ✅ CommodityCCIPBridge - Commodity certificates (historical, now archived)
|
||||
- ✅ BridgeOrchestrator - Asset-type routing
|
||||
|
||||
### Phase 3: Liquidity Integration ✅
|
||||
- ✅ LiquidityManager - Multi-provider orchestration
|
||||
- ✅ ILiquidityProvider interface - Pluggable providers
|
||||
- ✅ DODOPMMProvider - DODO PMM wrapper
|
||||
- ✅ PoolManager - Auto-pool creation
|
||||
- ✅ PoolManager - Auto-pool creation (historical, now archived)
|
||||
|
||||
### Phase 4: Extensibility ✅
|
||||
- ✅ PluginRegistry - Pluggable components
|
||||
- ✅ PluginRegistry - Pluggable components (historical, now archived)
|
||||
- ✅ ProxyFactory - UUPS and Beacon proxies
|
||||
- ✅ ConfigurationRegistry - Runtime configuration
|
||||
- ✅ BridgeModuleRegistry - Pre/post hooks
|
||||
- ✅ BridgeModuleRegistry - Pre/post hooks (historical, now archived)
|
||||
|
||||
### Phase 5: Vault Integration ✅
|
||||
- ✅ VaultBridgeAdapter - Vault-bridge interface
|
||||
- ✅ VaultBridgeAdapter - Vault-bridge interface (historical, now archived)
|
||||
- ✅ BridgeVaultExtension - Operation tracking
|
||||
- ✅ IVaultStrategy interface - Future strategy support
|
||||
|
||||
@@ -101,7 +101,7 @@ The Universal Cross-Chain Asset Hub has been **fully implemented** according to
|
||||
|
||||
**Registry & Governance**
|
||||
- `contracts/registry/UniversalAssetRegistry.sol`
|
||||
- `contracts/registry/interfaces/IAssetTypeHandler.sol`
|
||||
- `archive/solidity/contracts/registry/interfaces/IAssetTypeHandler.sol`
|
||||
- `contracts/registry/handlers/[ERC20, GRU, ISO4217W, Security, Commodity]Handler.sol` (5)
|
||||
- `contracts/governance/GovernanceController.sol`
|
||||
- `contracts/sync/TokenlistGovernanceSync.sol`
|
||||
@@ -110,23 +110,23 @@ The Universal Cross-Chain Asset Hub has been **fully implemented** according to
|
||||
- `contracts/bridge/UniversalCCIPBridge.sol`
|
||||
- `contracts/bridge/[GRU, ISO4217W, Security, Commodity]CCIPBridge.sol` (4)
|
||||
- `contracts/bridge/BridgeOrchestrator.sol`
|
||||
- `contracts/bridge/VaultBridgeAdapter.sol`
|
||||
- `contracts/bridge/modules/BridgeModuleRegistry.sol`
|
||||
- `archive/solidity/contracts/bridge/VaultBridgeAdapter.sol`
|
||||
- `archive/solidity/contracts/bridge/modules/BridgeModuleRegistry.sol`
|
||||
|
||||
**Liquidity**
|
||||
- `contracts/liquidity/LiquidityManager.sol`
|
||||
- `contracts/liquidity/PoolManager.sol`
|
||||
- `archive/solidity/contracts/liquidity/PoolManager.sol`
|
||||
- `contracts/liquidity/interfaces/ILiquidityProvider.sol`
|
||||
- `contracts/liquidity/providers/DODOPMMProvider.sol`
|
||||
|
||||
**Extensibility**
|
||||
- `contracts/plugins/PluginRegistry.sol`
|
||||
- `contracts/upgrades/ProxyFactory.sol`
|
||||
- `contracts/config/ConfigurationRegistry.sol`
|
||||
- `archive/solidity/contracts/plugins/PluginRegistry.sol`
|
||||
- `archive/solidity/contracts/upgrades/ProxyFactory.sol`
|
||||
- `archive/solidity/contracts/config/ConfigurationRegistry.sol`
|
||||
|
||||
**Vault**
|
||||
- `contracts/vault/BridgeVaultExtension.sol`
|
||||
- `contracts/vault/interfaces/IVaultStrategy.sol`
|
||||
- `archive/solidity/contracts/vault/BridgeVaultExtension.sol`
|
||||
- `archive/solidity/contracts/vault/interfaces/IVaultStrategy.sol`
|
||||
|
||||
### Tests (5+ files)
|
||||
- `test/integration/UniversalBridge.t.sol`
|
||||
@@ -155,7 +155,7 @@ The Universal Cross-Chain Asset Hub has been **fully implemented** according to
|
||||
This implementation prevents "boxing in" through:
|
||||
|
||||
### 1. Plugin Architecture ✅
|
||||
Deploy new asset handler, register via PluginRegistry. **No core contract changes needed.**
|
||||
Historical plugin model: deploy new asset handler, register via PluginRegistry. **No core contract changes needed.**
|
||||
|
||||
### 2. Upgradeable Contracts ✅
|
||||
All contracts use UUPS proxies. **Upgrade logic without changing addresses.**
|
||||
|
||||
27
archive/solidity/README.md
Normal file
27
archive/solidity/README.md
Normal file
@@ -0,0 +1,27 @@
|
||||
# Archived Solidity
|
||||
|
||||
This directory holds Solidity files intentionally moved out of `contracts/` so
|
||||
they are excluded from the default full-repo Foundry compile graph.
|
||||
|
||||
Rules:
|
||||
|
||||
- Only archive files after confirming they are unreachable from the repo's
|
||||
current Solidity tests and scripts.
|
||||
- Move files here in small batches and re-run the affected scoped Forge build
|
||||
and test commands after each batch.
|
||||
- Treat archive status as "kept for reference", not "safe to delete".
|
||||
|
||||
Current archived batches in this repo include:
|
||||
|
||||
- legacy bridge atomic settlement interfaces and adapters
|
||||
- unused non-EVM bridge adapter implementations that are no longer referenced by
|
||||
the active Solidity test and deployment graph
|
||||
- historical bridge implementations such as `AlltraCustomBridge`,
|
||||
`ISO4217WCCIPBridge`, `CommodityCCIPBridge`, `VaultBridgeAdapter`, and
|
||||
`BridgeModuleRegistry`
|
||||
- historical registry, vault, configuration, NFT, and proxy helper contracts
|
||||
that are no longer reachable from the active Solidity deployment/test graph
|
||||
- historical CCIP, compliance, liquidity, plugin, registry-interface, and vault
|
||||
helper contracts such as `CCIPTxReporter`, `CCIPRouterOptimized`,
|
||||
`IndyVerifier`, `PoolManager`, `PluginRegistry`, `IAssetTypeHandler`, and
|
||||
`XAUTriangulation`
|
||||
@@ -3,7 +3,7 @@
|
||||
- **Contracts:** All DBIS Rail contracts (RootRegistry, ParticipantRegistry, SignerRegistry, SettlementRouter, GRU_MintController, StablecoinReferenceRegistry, Conversion Router) are in this folder and implement Technical Spec v1 and v1.5 add-ons.
|
||||
- **Tests:** `test/dbis/DBIS_Rail.t.sol` covers submitMintAuth success, replay revert, and signer-revoked-at-block. Uses `MockMintableToken` for a minimal GRU token in tests.
|
||||
- **Build:** Default Foundry config (`via_ir = true`, `optimizer_runs = 200`) builds successfully. Yul stack-too-deep was resolved by:
|
||||
- Moving EIP-712 hashing and signature recovery into `DBIS_EIP712Helper` (and optional `DBIS_EIP712Lib`).
|
||||
- Moving EIP-712 hashing and signature recovery into `DBIS_EIP712Helper` (and optional historical `DBIS_EIP712Lib`, now archived at `archive/solidity/contracts/dbis/DBIS_EIP712Lib.sol`).
|
||||
- Extracting the mint loop in `DBIS_GRU_MintController.mintFromAuthorization` into `_mintToRecipients` to reduce stack depth.
|
||||
- Using `StablecoinReferenceRegistry._setEntry` for struct assignment and `SignerRegistry.hasDuplicateSigners` / `areSignersActiveAtBlock` to keep router loops out of the main path.
|
||||
- **Deploy:** Run `DeployDBISRail.s.sol` on Chain 138; deploy `DBIS_EIP712Helper` first and pass its address to both `DBIS_SettlementRouter` and `DBIS_ConversionRouter` constructors; then set GRU token on MintController, grant MINTER_ROLE on c* tokens to MintController, register stablecoins, and add venues/quote issuers as needed.
|
||||
|
||||
@@ -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,
|
||||
|
||||
165
contracts/flash/QuotePushTreasuryManager.sol
Normal file
165
contracts/flash/QuotePushTreasuryManager.sol
Normal file
@@ -0,0 +1,165 @@
|
||||
// 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";
|
||||
|
||||
interface IQuotePushSweepableReceiver {
|
||||
function owner() external view returns (address);
|
||||
function quoteSurplusBalance(address quoteToken, uint256 reserveRetained) external view returns (uint256 surplus);
|
||||
function sweepQuoteSurplus(address quoteToken, address to, uint256 reserveRetained)
|
||||
external
|
||||
returns (uint256 amount);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title QuotePushTreasuryManager
|
||||
* @notice Minimal treasury manager for Aave quote-push retained surplus.
|
||||
* Intended flow:
|
||||
* 1. Receiver retains quote surplus after flash repayment.
|
||||
* 2. This manager, as receiver owner, harvests that surplus into itself.
|
||||
* 3. Owner/operator distributes quote to gas and recycle recipients.
|
||||
*
|
||||
* Gas replenishment is still an operator policy in quote units; converting
|
||||
* quote into native gas token remains off-chain / external.
|
||||
*/
|
||||
contract QuotePushTreasuryManager is Ownable {
|
||||
using SafeERC20 for IERC20;
|
||||
|
||||
IQuotePushSweepableReceiver public immutable receiver;
|
||||
IERC20 public immutable quoteToken;
|
||||
|
||||
address public operator;
|
||||
address public gasRecipient;
|
||||
address public recycleRecipient;
|
||||
uint256 public receiverReserveRetained;
|
||||
uint256 public managerReserveRetained;
|
||||
|
||||
error BadConfig();
|
||||
error Unauthorized();
|
||||
error NothingToHarvest();
|
||||
error InsufficientAvailable(uint256 available, uint256 requested);
|
||||
|
||||
event OperatorUpdated(address indexed previousOperator, address indexed newOperator);
|
||||
event RecipientsUpdated(address indexed gasRecipient, address indexed recycleRecipient);
|
||||
event ReservesUpdated(uint256 receiverReserveRetained, uint256 managerReserveRetained);
|
||||
event ReceiverSurplusHarvested(address indexed token, uint256 amount, uint256 receiverReserveRetained);
|
||||
event QuoteDistributed(address indexed token, address indexed to, uint256 amount, bytes32 purpose);
|
||||
event TokenRescued(address indexed token, address indexed to, uint256 amount);
|
||||
|
||||
modifier onlyOwnerOrOperator() {
|
||||
if (msg.sender != owner() && msg.sender != operator) revert Unauthorized();
|
||||
_;
|
||||
}
|
||||
|
||||
constructor(
|
||||
address initialOwner,
|
||||
address receiver_,
|
||||
address quoteToken_,
|
||||
address operator_,
|
||||
address gasRecipient_,
|
||||
address recycleRecipient_,
|
||||
uint256 receiverReserveRetained_,
|
||||
uint256 managerReserveRetained_
|
||||
) Ownable(initialOwner) {
|
||||
if (
|
||||
initialOwner == address(0) || receiver_ == address(0) || quoteToken_ == address(0)
|
||||
|| gasRecipient_ == address(0) || recycleRecipient_ == address(0)
|
||||
) revert BadConfig();
|
||||
|
||||
receiver = IQuotePushSweepableReceiver(receiver_);
|
||||
quoteToken = IERC20(quoteToken_);
|
||||
operator = operator_;
|
||||
gasRecipient = gasRecipient_;
|
||||
recycleRecipient = recycleRecipient_;
|
||||
receiverReserveRetained = receiverReserveRetained_;
|
||||
managerReserveRetained = managerReserveRetained_;
|
||||
}
|
||||
|
||||
function receiverOwner() public view returns (address) {
|
||||
return receiver.owner();
|
||||
}
|
||||
|
||||
function isReceiverOwnedByManager() public view returns (bool) {
|
||||
return receiver.owner() == address(this);
|
||||
}
|
||||
|
||||
function quoteBalance() public view returns (uint256) {
|
||||
return quoteToken.balanceOf(address(this));
|
||||
}
|
||||
|
||||
function availableQuote() public view returns (uint256 available) {
|
||||
uint256 balance = quoteBalance();
|
||||
if (balance > managerReserveRetained) {
|
||||
available = balance - managerReserveRetained;
|
||||
}
|
||||
}
|
||||
|
||||
function receiverSweepableQuote() public view returns (uint256) {
|
||||
return receiver.quoteSurplusBalance(address(quoteToken), receiverReserveRetained);
|
||||
}
|
||||
|
||||
function setOperator(address newOperator) external onlyOwner {
|
||||
emit OperatorUpdated(operator, newOperator);
|
||||
operator = newOperator;
|
||||
}
|
||||
|
||||
function setRecipients(address gasRecipient_, address recycleRecipient_) external onlyOwner {
|
||||
if (gasRecipient_ == address(0) || recycleRecipient_ == address(0)) revert BadConfig();
|
||||
gasRecipient = gasRecipient_;
|
||||
recycleRecipient = recycleRecipient_;
|
||||
emit RecipientsUpdated(gasRecipient_, recycleRecipient_);
|
||||
}
|
||||
|
||||
function setReserves(uint256 receiverReserveRetained_, uint256 managerReserveRetained_) external onlyOwner {
|
||||
receiverReserveRetained = receiverReserveRetained_;
|
||||
managerReserveRetained = managerReserveRetained_;
|
||||
emit ReservesUpdated(receiverReserveRetained_, managerReserveRetained_);
|
||||
}
|
||||
|
||||
function harvestReceiverSurplus() public onlyOwnerOrOperator returns (uint256 amount) {
|
||||
amount = receiver.sweepQuoteSurplus(address(quoteToken), address(this), receiverReserveRetained);
|
||||
if (amount == 0) revert NothingToHarvest();
|
||||
emit ReceiverSurplusHarvested(address(quoteToken), amount, receiverReserveRetained);
|
||||
}
|
||||
|
||||
function distributeQuote(address to, uint256 amount, bytes32 purpose) external onlyOwnerOrOperator {
|
||||
_distributeQuote(to, amount, purpose);
|
||||
}
|
||||
|
||||
function distributeToConfiguredRecipients(uint256 gasAmount, uint256 recycleAmount) external onlyOwnerOrOperator {
|
||||
uint256 requested = gasAmount + recycleAmount;
|
||||
_requireAvailable(requested);
|
||||
|
||||
if (gasAmount > 0) {
|
||||
quoteToken.safeTransfer(gasRecipient, gasAmount);
|
||||
emit QuoteDistributed(address(quoteToken), gasRecipient, gasAmount, bytes32("gas"));
|
||||
}
|
||||
if (recycleAmount > 0) {
|
||||
quoteToken.safeTransfer(recycleRecipient, recycleAmount);
|
||||
emit QuoteDistributed(address(quoteToken), recycleRecipient, recycleAmount, bytes32("recycle"));
|
||||
}
|
||||
}
|
||||
|
||||
function rescueToken(address token, address to, uint256 amount) external onlyOwner {
|
||||
if (token == address(0) || to == address(0) || amount == 0) revert BadConfig();
|
||||
if (token == address(quoteToken)) {
|
||||
_requireAvailable(amount);
|
||||
}
|
||||
IERC20(token).safeTransfer(to, amount);
|
||||
emit TokenRescued(token, to, amount);
|
||||
}
|
||||
|
||||
function _distributeQuote(address to, uint256 amount, bytes32 purpose) internal {
|
||||
if (to == address(0) || amount == 0) revert BadConfig();
|
||||
_requireAvailable(amount);
|
||||
quoteToken.safeTransfer(to, amount);
|
||||
emit QuoteDistributed(address(quoteToken), to, amount, purpose);
|
||||
}
|
||||
|
||||
function _requireAvailable(uint256 requested) internal view {
|
||||
uint256 available = availableQuote();
|
||||
if (requested > available) revert InsufficientAvailable(available, requested);
|
||||
}
|
||||
}
|
||||
@@ -77,7 +77,7 @@
|
||||
- Dependencies: None (if custom router)
|
||||
- Status: **NOT DEPLOYED**
|
||||
|
||||
10. ⏳ **CCIPRouterOptimized** (`contracts/ccip/CCIPRouterOptimized.sol`)
|
||||
10. ⏳ **CCIPRouterOptimized** (`archive/solidity/contracts/ccip/CCIPRouterOptimized.sol`)
|
||||
- Script: None (may need creation)
|
||||
- Dependencies: Unknown
|
||||
- Status: **NOT DEPLOYED** (no script found)
|
||||
|
||||
@@ -16,8 +16,8 @@ A single reference for all bridges, core contracts, routers, oracles, mappers, r
|
||||
| **CCIPWETH10Bridge** | `contracts/ccip/CCIPWETH10Bridge.sol` | Cross-chain bridge for WETH10 via CCIP. |
|
||||
| **UniversalCCIPBridge** | `contracts/bridge/UniversalCCIPBridge.sol` | Base CCIP bridge logic; extended by token-specific bridges. |
|
||||
| **GRUCCIPBridge** | `contracts/bridge/GRUCCIPBridge.sol` | CCIP bridge for GRU (Global Reserve Unit) tokens. |
|
||||
| **ISO4217WCCIPBridge** | `contracts/bridge/ISO4217WCCIPBridge.sol` | CCIP bridge for ISO-4217 W tokens. |
|
||||
| **CommodityCCIPBridge** | `contracts/bridge/CommodityCCIPBridge.sol` | CCIP bridge for commodity-backed tokens. |
|
||||
| **ISO4217WCCIPBridge** | `archive/solidity/contracts/bridge/ISO4217WCCIPBridge.sol` | Historical CCIP bridge for ISO-4217 W tokens; archived out of the active compile graph. |
|
||||
| **CommodityCCIPBridge** | `archive/solidity/contracts/bridge/CommodityCCIPBridge.sol` | Historical CCIP bridge for commodity-backed tokens; archived out of the active compile graph. |
|
||||
|
||||
**Typical .env:** `CCIP_ROUTER`, `CCIPWETH9_BRIDGE_*`, `CCIPWETH10_BRIDGE_*`, `*_SELECTOR`, `LINK_TOKEN`, per chain.
|
||||
|
||||
@@ -42,13 +42,13 @@ A single reference for all bridges, core contracts, routers, oracles, mappers, r
|
||||
|
||||
| Contract | Path | Purpose |
|
||||
|----------|------|---------|
|
||||
| **AlltraCustomBridge** | `contracts/bridge/AlltraCustomBridge.sol` | Alltra transport for custom bridge messaging. |
|
||||
| **AlltraCustomBridge** | `archive/solidity/contracts/bridge/AlltraCustomBridge.sol` | Historical Alltra transport for custom bridge messaging; archived out of the active compile graph. |
|
||||
| **EtherlinkRelayReceiver** | `contracts/bridge/EtherlinkRelayReceiver.sol` | Receives relayed messages (e.g. Etherlink). |
|
||||
| **BridgeRegistry** | `contracts/bridge/interop/BridgeRegistry.sol` | Registry of tokens and routes for bridge operations. |
|
||||
| **BridgeEscrowVault** | `contracts/bridge/interop/BridgeEscrowVault.sol` | Escrow for bridge-in/bridge-out flows. |
|
||||
| **BridgeVerifier** | `contracts/bridge/interop/BridgeVerifier.sol` | Verification of bridge messages (e.g. EIP-712). |
|
||||
| **MintBurnController** | `contracts/bridge/interop/MintBurnController.sol` | Mint/burn control for bridged tokens. |
|
||||
| **VaultBridgeAdapter** | `contracts/bridge/VaultBridgeAdapter.sol` | Adapter for vault ↔ bridge. |
|
||||
| **VaultBridgeAdapter** | `archive/solidity/contracts/bridge/VaultBridgeAdapter.sol` | Historical vault ↔ bridge adapter; archived out of the active compile graph. |
|
||||
| **BridgeOrchestrator** | `contracts/bridge/BridgeOrchestrator.sol` | Orchestrates multi-bridge flows. |
|
||||
|
||||
---
|
||||
@@ -61,7 +61,7 @@ A single reference for all bridges, core contracts, routers, oracles, mappers, r
|
||||
| **SwapRouter** | `contracts/bridge/trustless/SwapRouter.sol` | Basic swap router (trustless bridge context). |
|
||||
| **EnhancedSwapRouter** | `contracts/bridge/trustless/EnhancedSwapRouter.sol` | Aggregates Uniswap V3, Dodoex, Curve, Balancer, 1inch for swap+bridge+swap. |
|
||||
| **CCIPRouter** | `contracts/ccip/CCIPRouter.sol` | Optional custom router logic (project-specific). |
|
||||
| **CCIPRouterOptimized** | `contracts/ccip/CCIPRouterOptimized.sol` | Optimized fee/router variant. |
|
||||
| **CCIPRouterOptimized** | `archive/solidity/contracts/ccip/CCIPRouterOptimized.sol` | Historical optimized fee/router variant; archived out of the active compile graph. |
|
||||
|
||||
**Typical .env:** `SWAP_ROUTER`, `ENHANCED_SWAP_ROUTER`, `UNISWAP_V3_ROUTER`, `DODOEX_ROUTER`, `CURVE_3POOL`, `BALANCER_VAULT`, `ONEINCH_ROUTER`.
|
||||
|
||||
@@ -79,7 +79,7 @@ A single reference for all bridges, core contracts, routers, oracles, mappers, r
|
||||
| **Aggregator** | `contracts/oracle/Aggregator.sol` | Chainlink-compatible price aggregator (on-chain). |
|
||||
| **Proxy** | `contracts/oracle/Proxy.sol` | Oracle proxy (consumer-facing). |
|
||||
| **OracleWithCCIP** | `contracts/oracle/OracleWithCCIP.sol` | Oracle that uses CCIP for cross-chain data. |
|
||||
| **PMMPriceProvider** | `contracts/vault/adapters/PMMPriceProvider.sol` | Returns asset price in quote token from DODO PMM (oracle-backed when ReserveSystem set). |
|
||||
| **PMMPriceProvider** | `archive/solidity/contracts/vault/adapters/PMMPriceProvider.sol` | Historical asset price provider in quote token from DODO PMM; archived out of the active compile graph. |
|
||||
|
||||
**Typical .env:** `ORACLE_AGGREGATOR_ADDRESS`, `ORACLE_PROXY_ADDRESS`, `RESERVE_SYSTEM`, `ORACLE_PRICE_FEED`, `RPC_URL_138`. See `docs/integration/ORACLE_AND_KEEPER_CHAIN138.md`.
|
||||
|
||||
@@ -102,22 +102,22 @@ A single reference for all bridges, core contracts, routers, oracles, mappers, r
|
||||
|----------|------|---------|
|
||||
| **ChainRegistry** | `contracts/registry/ChainRegistry.sol` | Registry of chains and chain-specific config. |
|
||||
| **UniversalAssetRegistry** | `contracts/registry/UniversalAssetRegistry.sol` | Registry of asset types and handlers (GRU, ISO4217W, Commodity, etc.). |
|
||||
| **GRUHandler** | `contracts/registry/handlers/GRUHandler.sol` | Asset type handler for GRU. |
|
||||
| **ISO4217WHandler** | `contracts/registry/handlers/ISO4217WHandler.sol` | Asset type handler for ISO-4217 W tokens. |
|
||||
| **CommodityHandler** | `contracts/registry/handlers/CommodityHandler.sol` | Asset type handler for commodities. |
|
||||
| **ERC20Handler** | `contracts/registry/handlers/ERC20Handler.sol` | Generic ERC20 handler. |
|
||||
| **SecurityHandler** | `contracts/registry/handlers/SecurityHandler.sol` | Security-type asset handler. |
|
||||
| **GRUHandler** | `archive/solidity/contracts/registry/handlers/GRUHandler.sol` | Historical asset type handler for GRU; archived out of the active compile graph. |
|
||||
| **ISO4217WHandler** | `archive/solidity/contracts/registry/handlers/ISO4217WHandler.sol` | Historical asset type handler for ISO-4217 W tokens; archived out of the active compile graph. |
|
||||
| **CommodityHandler** | `archive/solidity/contracts/registry/handlers/CommodityHandler.sol` | Historical asset type handler for commodities; archived out of the active compile graph. |
|
||||
| **ERC20Handler** | `archive/solidity/contracts/registry/handlers/ERC20Handler.sol` | Historical generic ERC20 handler; archived out of the active compile graph. |
|
||||
| **SecurityHandler** | `archive/solidity/contracts/registry/handlers/SecurityHandler.sol` | Historical security-type asset handler; archived out of the active compile graph. |
|
||||
| **BridgeRegistry** | `contracts/bridge/interop/BridgeRegistry.sol` | Registry of bridgeable tokens and routes. |
|
||||
| **BridgeModuleRegistry** | `contracts/bridge/modules/BridgeModuleRegistry.sol` | Registry of bridge modules. |
|
||||
| **ConfigurationRegistry** | `contracts/config/ConfigurationRegistry.sol` | System configuration registry. |
|
||||
| **PluginRegistry** | `contracts/plugins/PluginRegistry.sol` | Plugin registration. |
|
||||
| **BridgeModuleRegistry** | `archive/solidity/contracts/bridge/modules/BridgeModuleRegistry.sol` | Historical bridge module registry; archived out of the active compile graph. |
|
||||
| **ConfigurationRegistry** | `archive/solidity/contracts/config/ConfigurationRegistry.sol` | Historical system configuration registry; archived out of the active compile graph. |
|
||||
| **PluginRegistry** | `archive/solidity/contracts/plugins/PluginRegistry.sol` | Historical plugin registration flow; archived out of the active compile graph. |
|
||||
| **MirrorRegistry** | `contracts/mirror/MirrorRegistry.sol` | Mirror/duplicate contract registry. |
|
||||
| **PrivatePoolRegistry** | `contracts/dex/PrivatePoolRegistry.sol` | Registry of private (e.g. XAU-anchored) DODO pools. |
|
||||
| **VaultFactory** | `contracts/vault/VaultFactory.sol` | Creates Vault instances and associated tokens. |
|
||||
| **TokenFactory** (ISO4217W) | `contracts/iso4217w/TokenFactory.sol` | Creates ISO-4217 W tokens. |
|
||||
| **TokenRegistry** (ISO4217W) | `contracts/iso4217w/registry/TokenRegistry.sol` | Registry of W tokens by currency code. |
|
||||
| **TokenRegistry** (tokenization) | `contracts/tokenization/TokenRegistry.sol` | Generic token registry. |
|
||||
| **ProxyFactory** | `contracts/upgrades/ProxyFactory.sol` | Creates upgradeable proxies. |
|
||||
| **ProxyFactory** | `archive/solidity/contracts/upgrades/ProxyFactory.sol` | Historical upgradeable proxy factory; archived out of the active compile graph. |
|
||||
|
||||
---
|
||||
|
||||
@@ -151,8 +151,8 @@ A single reference for all bridges, core contracts, routers, oracles, mappers, r
|
||||
| **Liquidation** | `contracts/vault/Liquidation.sol` | Liquidation logic. |
|
||||
| **DepositToken** | `contracts/vault/tokens/DepositToken.sol` | Receipt token for collateral. |
|
||||
| **DebtToken** | `contracts/vault/tokens/DebtToken.sol` | Debt position token. |
|
||||
| **PMMPriceProvider** | `contracts/vault/adapters/PMMPriceProvider.sol` | Optional PMM-based price for assets (vault/UI). |
|
||||
| **BridgeVaultExtension** | `contracts/vault/BridgeVaultExtension.sol` | Vault extension for bridge flows. |
|
||||
| **PMMPriceProvider** | `archive/solidity/contracts/vault/adapters/PMMPriceProvider.sol` | Historical PMM-based price provider for vault/UI use; archived out of the active compile graph. |
|
||||
| **BridgeVaultExtension** | `archive/solidity/contracts/vault/BridgeVaultExtension.sol` | Historical vault extension for bridge flows; archived out of the active compile graph. |
|
||||
|
||||
---
|
||||
|
||||
@@ -164,7 +164,7 @@ A single reference for all bridges, core contracts, routers, oracles, mappers, r
|
||||
| **DODOPMMProvider** | `contracts/liquidity/providers/DODOPMMProvider.sol` | ILiquidityProvider wrapper; uses getPoolPriceOrOracle for quotes. |
|
||||
| **PrivatePoolRegistry** | `contracts/dex/PrivatePoolRegistry.sol` | Registry of private (e.g. XAU) pools. |
|
||||
| **LiquidityManager** | `contracts/liquidity/LiquidityManager.sol` | Aggregates liquidity providers. |
|
||||
| **PoolManager** | `contracts/liquidity/PoolManager.sol` | Pool management. |
|
||||
| **PoolManager** | `archive/solidity/contracts/liquidity/PoolManager.sol` | Historical pool-management helper; archived out of the active compile graph. |
|
||||
| **Stabilizer** | `contracts/bridge/trustless/integration/Stabilizer.sol` | Uses private DODO PMM pools for peg stabilization. |
|
||||
|
||||
**Typical .env:** `DODO_VENDING_MACHINE_ADDRESS`, `DODOPMM_INTEGRATION_ADDRESS`, `CHAIN_138_DODO_PMM_INTEGRATION` (token-aggregation), `OFFICIAL_USDT_ADDRESS`, `OFFICIAL_USDC_ADDRESS`, `COMPLIANT_USDT_ADDRESS`, `COMPLIANT_USDC_ADDRESS`.
|
||||
@@ -233,14 +233,14 @@ A single reference for all bridges, core contracts, routers, oracles, mappers, r
|
||||
| **CactiAdapter** | `contracts/bridge/adapters/hyperledger/CactiAdapter.sol` | Hyperledger Cacti. |
|
||||
| **FabricAdapter** | `contracts/bridge/adapters/hyperledger/FabricAdapter.sol` | Hyperledger Fabric. |
|
||||
| **FireflyAdapter** | `contracts/bridge/adapters/hyperledger/FireflyAdapter.sol` | Hyperledger Firefly. |
|
||||
| **SolanaAdapter** | `contracts/bridge/adapters/non-evm/SolanaAdapter.sol` | Solana. |
|
||||
| **SolanaAdapter** | `archive/solidity/contracts/bridge/adapters/non-evm/SolanaAdapter.sol` | Historical Solana adapter; archived out of the active compile graph. |
|
||||
| **XRPLAdapter** | `contracts/bridge/adapters/non-evm/XRPLAdapter.sol` | XRPL. |
|
||||
| **TronAdapter** | `contracts/bridge/adapters/non-evm/TronAdapter.sol` | Tron. |
|
||||
| **TronAdapter** | `archive/solidity/contracts/bridge/adapters/non-evm/TronAdapter.sol` | Historical Tron adapter; archived out of the active compile graph. |
|
||||
| **StellarAdapter** | `contracts/bridge/adapters/non-evm/StellarAdapter.sol` | Stellar. |
|
||||
| **CosmosAdapter** | `contracts/bridge/adapters/non-evm/CosmosAdapter.sol` | Cosmos. |
|
||||
| **HederaAdapter** | `contracts/bridge/adapters/non-evm/HederaAdapter.sol` | Hedera. |
|
||||
| **AlgorandAdapter** | `contracts/bridge/adapters/non-evm/AlgorandAdapter.sol` | Algorand. |
|
||||
| **TONAdapter** | `contracts/bridge/adapters/non-evm/TONAdapter.sol` | TON. |
|
||||
| **CosmosAdapter** | `archive/solidity/contracts/bridge/adapters/non-evm/CosmosAdapter.sol` | Historical Cosmos adapter; archived out of the active compile graph. |
|
||||
| **HederaAdapter** | `archive/solidity/contracts/bridge/adapters/non-evm/HederaAdapter.sol` | Historical Hedera adapter; archived out of the active compile graph. |
|
||||
| **AlgorandAdapter** | `archive/solidity/contracts/bridge/adapters/non-evm/AlgorandAdapter.sol` | Historical Algorand adapter; archived out of the active compile graph. |
|
||||
| **TONAdapter** | `archive/solidity/contracts/bridge/adapters/non-evm/TONAdapter.sol` | Historical TON adapter; archived out of the active compile graph. |
|
||||
|
||||
---
|
||||
|
||||
@@ -248,11 +248,11 @@ A single reference for all bridges, core contracts, routers, oracles, mappers, r
|
||||
|
||||
| Contract | Path | Purpose |
|
||||
|----------|------|---------|
|
||||
| **GRUFormulasNFT** | `contracts/nft/GRUFormulasNFT.sol` | ERC-721 with on-chain SVG for three GRU formulas (Money Supply, Velocity, Multiplier). |
|
||||
| **GRUFormulasNFT** | `archive/solidity/contracts/nft/GRUFormulasNFT.sol` | Historical ERC-721 with on-chain SVG for three GRU formulas; archived out of the active compile graph. |
|
||||
| **GovernanceController** | `contracts/governance/GovernanceController.sol` | Governance control. |
|
||||
| **TokenlistGovernanceSync** | `contracts/sync/TokenlistGovernanceSync.sol` | Sync token list with governance. |
|
||||
| **AccountWalletRegistryExtended** | `contracts/smart-accounts/AccountWalletRegistryExtended.sol` | Account wallet registry. |
|
||||
| **IndyVerifier** | `contracts/compliance/IndyVerifier.sol` | Indy-based verification. |
|
||||
| **IndyVerifier** | `archive/solidity/contracts/compliance/IndyVerifier.sol` | Historical Indy-based verification contract; archived out of the active compile graph. |
|
||||
| **wXRP** | `contracts/bridge/interop/wXRP.sol` | Wrapped XRP. |
|
||||
|
||||
---
|
||||
|
||||
@@ -460,7 +460,7 @@
|
||||
- **Parallel With**: 3.1.1, 3.1.2, 3.1.3, 3.1.5, 3.1.6
|
||||
|
||||
#### Subtask 3.1.5: Create CCIPRouterOptimized Deployment Script (If Needed)
|
||||
- **Contract**: `contracts/ccip/CCIPRouterOptimized.sol`
|
||||
- **Contract**: `archive/solidity/contracts/ccip/CCIPRouterOptimized.sol`
|
||||
- **Script**: Create `script/DeployCCIPRouterOptimized.s.sol` (if using)
|
||||
- **Dependencies**: Review contract for constructor params
|
||||
- **Estimated Time**: 20 minutes
|
||||
|
||||
@@ -137,6 +137,7 @@ make keys
|
||||
- `src = "contracts"` - Source directory for contracts
|
||||
- `test/` - Default test directory (not specified, uses default)
|
||||
- `script/` - Default script directory (not specified, uses default)
|
||||
- For monorepo day-to-day work, prefer the scoped workflow in [FOUNDRY_MONOREPO_SCOPES.md](FOUNDRY_MONOREPO_SCOPES.md) so Forge only compiles the contract subtree you are editing.
|
||||
|
||||
### Test Configuration
|
||||
- Foundry tests: Configured in `foundry.toml`
|
||||
@@ -187,4 +188,3 @@ make keys
|
||||
| `scripts/` | Shell | Utility scripts | `*.sh` |
|
||||
|
||||
This structure follows Foundry conventions while providing clear separation between Solidity and shell script files.
|
||||
|
||||
|
||||
113
docs/architecture/FOUNDRY_MONOREPO_SCOPES.md
Normal file
113
docs/architecture/FOUNDRY_MONOREPO_SCOPES.md
Normal file
@@ -0,0 +1,113 @@
|
||||
# Foundry Monorepo Scopes
|
||||
|
||||
## Why this exists
|
||||
|
||||
`smom-dbis-138` has grown beyond the shape of a single small Foundry package:
|
||||
|
||||
- `258` Solidity files under `contracts/`
|
||||
- `120` Solidity tests under `test/`
|
||||
- `133` Solidity scripts under `script/`
|
||||
|
||||
In practice that means the root repo-wide `forge build` is a compatibility path, not a good inner-loop default. A clean full build in this workspace did not finish within `120s`, while scoped builds did:
|
||||
|
||||
- `treasury` scoped build: about `17s`
|
||||
- `flash` scoped build: about `44s`
|
||||
- `treasury` scoped test compile: `39` files instead of `338`
|
||||
|
||||
## Recommended workflow
|
||||
|
||||
Use the scope runner for day-to-day work:
|
||||
|
||||
```bash
|
||||
bash scripts/forge/scope.sh list
|
||||
bash scripts/forge/scope.sh build treasury
|
||||
bash scripts/forge/scope.sh test treasury
|
||||
bash scripts/forge/scope.sh script bridge/trustless script/bridge/trustless/DeployTrustlessBridge.s.sol:DeployTrustlessBridge --rpc-url "$RPC_URL_138"
|
||||
bash scripts/forge/scope.sh script script/DeployOracle.s.sol:DeployOracle --rpc-url "$RPC_URL_138"
|
||||
```
|
||||
|
||||
You can also drive it through npm scripts:
|
||||
|
||||
```bash
|
||||
FORGE_SCOPE=treasury pnpm run forge:build
|
||||
FORGE_SCOPE=treasury pnpm run forge:test
|
||||
pnpm run forge:script -- script/DeployOracle.s.sol:DeployOracle --rpc-url "$RPC_URL_138"
|
||||
pnpm run forge:scope:list
|
||||
pnpm run forge:orphans
|
||||
```
|
||||
|
||||
Or through `make`:
|
||||
|
||||
```bash
|
||||
make contracts SCOPE=treasury
|
||||
make test SCOPE=bridge/trustless
|
||||
```
|
||||
|
||||
Many shell deployment scripts in this repo now get scoped Forge automatically through shared shell bootstrap files:
|
||||
|
||||
- `scripts/lib/init.sh`
|
||||
- `scripts/lib/deployment/dotenv.sh`
|
||||
- `scripts/load-env.sh`
|
||||
|
||||
At this point every shell script under `scripts/` that invokes `forge build`, `forge test`, or `forge script` is covered by one of those shared paths or calls the scope runner directly.
|
||||
|
||||
## How scopes work
|
||||
|
||||
The scope runner keeps the root `foundry.toml` for compatibility, but overrides the active package boundary via environment variables:
|
||||
|
||||
- `FOUNDRY_SRC=contracts/<scope>`
|
||||
- `FOUNDRY_TEST=test/<scope>` when that directory exists
|
||||
- `FOUNDRY_OUT=out/scopes/<scope>`
|
||||
- `FOUNDRY_CACHE_PATH=cache/scopes/<scope>`
|
||||
- `FOUNDRY_BROADCAST=broadcast/scopes/<scope>`
|
||||
|
||||
This keeps artifact churn local to the subtree you are editing and prevents unrelated domains from dominating compile time.
|
||||
|
||||
When you omit the scope, the runner tries to infer it from:
|
||||
|
||||
- `contracts/<scope>/...`
|
||||
- `test/<scope>/...`
|
||||
- `script/<scope>/...`
|
||||
- `script/deploy/<scope>/...` where `<scope>` maps back to `contracts/<scope>/...`
|
||||
- common root-level deployment scripts such as `script/DeployOracle.s.sol`, `script/DeployWETH.s.sol`, `script/DeployMulticall.s.sol`, and `script/DeployCCIPRouter.s.sol`
|
||||
|
||||
## Full repo builds
|
||||
|
||||
Use the full repo intentionally:
|
||||
|
||||
```bash
|
||||
forge build
|
||||
forge test
|
||||
pnpm run forge:build:full
|
||||
pnpm run forge:test:full
|
||||
```
|
||||
|
||||
That is the right choice for:
|
||||
|
||||
- release validation
|
||||
- repo-wide refactors
|
||||
- remapping or compiler setting changes
|
||||
- compatibility checks before CI changes
|
||||
|
||||
## Legacy contract archival
|
||||
|
||||
Use the reachability report before moving old Solidity out of `contracts/`:
|
||||
|
||||
```bash
|
||||
python3 scripts/forge/report-contract-reachability.py
|
||||
python3 scripts/forge/report-contract-reachability.py --json
|
||||
```
|
||||
|
||||
The report highlights contracts that are unreachable from the repo's current Solidity tests or scripts. That is an archival queue, not proof that deletion is safe. Move those files in small batches and re-run the scoped build/test commands for the affected domain.
|
||||
|
||||
Archived Solidity that should stay out of the compile graph lives under `archive/solidity/`.
|
||||
|
||||
After the current archive passes, the reachability report is down to `29` unreachable contracts from `35`, with the bridge bucket reduced to `5`.
|
||||
|
||||
## Best-practice rules for this repo
|
||||
|
||||
1. Prefer `scripts/forge/scope.sh` for local work.
|
||||
2. Keep root `forge build` and `forge test` as explicit full-graph checks.
|
||||
3. Add new contracts under an existing domain whenever possible instead of expanding the root package mentally.
|
||||
4. When a subtree no longer has active tests or scripts, move it toward archive only after confirming it is not referenced by deployment runbooks or external repos.
|
||||
5. Avoid reintroducing broad compile paths in npm scripts, Make targets, or shell wrappers when a narrower scope is known.
|
||||
@@ -5,7 +5,7 @@ Upgrade paths and pause procedures for bridge contracts (Tezos/Etherlink context
|
||||
## Upgrade paths
|
||||
|
||||
- **Upgradeable (UUPS)**: UniversalAssetRegistry, BridgeOrchestrator, GovernanceController, TokenlistGovernanceSync. Upgrade via UPGRADER_ROLE after timelock if policy requires. Run: prepare upgrade (new impl), schedule timelock, execute upgrade.
|
||||
- **Non-upgradeable**: TezosAdapter, EVMAdapter, AlltraCustomBridge. Deploy new version; register new adapter in ChainRegistry (or update adapter address); phase out old (revoke roles, drain if any).
|
||||
- **Non-upgradeable**: TezosAdapter, EVMAdapter, AlltraCustomBridge (historical; archived under `archive/solidity/contracts/bridge/AlltraCustomBridge.sol`). Deploy new version; register new adapter in ChainRegistry (or update adapter address); phase out old (revoke roles, drain if any).
|
||||
- **CCIP Router**: Per Chainlink; DON upgrades are separate from application contracts.
|
||||
|
||||
## Pause procedures
|
||||
|
||||
@@ -44,12 +44,12 @@
|
||||
|
||||
2. **Deploy Contract**
|
||||
```bash
|
||||
npm run deploy:reporter:chain138
|
||||
export CHAIN138_CCIP_REPORTER=0x...
|
||||
```
|
||||
|
||||
3. **Update .env**
|
||||
- Contract address will be automatically added
|
||||
- Verify `CCIP_REPORTER_CHAIN138_ADDRESS` is set
|
||||
- Persist `CHAIN138_CCIP_REPORTER`
|
||||
- Restore `archive/solidity/contracts/ccip-integration/CCIPTxReporter.sol` only if a fresh redeploy is required
|
||||
|
||||
4. **Fund Contract**
|
||||
```bash
|
||||
@@ -112,4 +112,3 @@ See `docs/ccip-integration/README.md` for complete environment variable referenc
|
||||
## Troubleshooting
|
||||
|
||||
See main README for troubleshooting guide.
|
||||
|
||||
|
||||
@@ -36,8 +36,8 @@ PRIVATE_KEY=0x...
|
||||
# 1. Deploy CCIPLogger to Ethereum Mainnet
|
||||
npm run deploy:logger:mainnet
|
||||
|
||||
# 2. Deploy CCIPTxReporter to Chain-138
|
||||
npm run deploy:reporter:chain138
|
||||
# 2. Point the flow at the historical Chain-138 reporter
|
||||
export CHAIN138_CCIP_REPORTER=0x...
|
||||
|
||||
# 3. Start watcher
|
||||
cd watcher && npm start
|
||||
|
||||
@@ -35,8 +35,9 @@ Chain-138 (Source) Chainlink CCIP Ethereum
|
||||
- Event emission for indexing
|
||||
|
||||
#### CCIPTxReporter (Chain-138)
|
||||
- **Location**: `contracts/ccip-integration/CCIPTxReporter.sol`
|
||||
- **Location**: `archive/solidity/contracts/ccip-integration/CCIPTxReporter.sol`
|
||||
- **Purpose**: Reports Chain-138 transactions to Ethereum via CCIP
|
||||
- **Status**: Historical source archived out of the active compile graph
|
||||
- **Features**:
|
||||
- Single transaction reporting
|
||||
- Batch reporting (cost optimization)
|
||||
@@ -46,7 +47,7 @@ Chain-138 (Source) Chainlink CCIP Ethereum
|
||||
### 2. Deployment Scripts
|
||||
|
||||
- **CCIPLogger**: `scripts/ccip-deployment/deploy-ccip-logger.js`
|
||||
- **CCIPTxReporter**: `scripts/ccip-deployment/deploy-ccip-reporter.js`
|
||||
- **CCIPTxReporter**: `scripts/ccip-deployment/deploy-ccip-reporter.js` (archival note only; restore source before redeploying)
|
||||
|
||||
### 3. Watcher/Relayer Service
|
||||
|
||||
@@ -107,13 +108,13 @@ This will:
|
||||
### Step 2: Deploy CCIPTxReporter to Chain-138
|
||||
|
||||
```bash
|
||||
npm run deploy:reporter:chain138
|
||||
export CHAIN138_CCIP_REPORTER=0x...
|
||||
```
|
||||
|
||||
This will:
|
||||
1. Deploy CCIPTxReporter contract
|
||||
2. Configure it with CCIPLogger address
|
||||
3. Display deployment address
|
||||
1. Point the flow at the existing historical deployment
|
||||
2. Keep verification scripts aware of the reporter address
|
||||
3. Avoid restoring archived source unless a fresh redeploy is truly needed
|
||||
|
||||
### Step 3: Verify Contracts
|
||||
|
||||
|
||||
@@ -40,11 +40,9 @@ helm install besu-rpc ./helm/besu-network -f helm/besu-network/values-rpc.yaml -
|
||||
|
||||
### Contract Deployment
|
||||
```bash
|
||||
# Deploy CCIPTxReporter to Chain-138
|
||||
npm run deploy:reporter:chain138
|
||||
|
||||
# Or manually:
|
||||
npx hardhat run scripts/ccip-deployment/deploy-ccip-reporter.js --network chain138
|
||||
# Historical CCIPTxReporter source is archived
|
||||
export CHAIN138_CCIP_REPORTER=0x...
|
||||
# Restore archive/solidity/contracts/ccip-integration/CCIPTxReporter.sol before any fresh redeploy
|
||||
```
|
||||
|
||||
### Verification
|
||||
|
||||
@@ -105,11 +105,9 @@ helm install besu-rpc ./helm/besu-network \
|
||||
|
||||
### Step 3: Deploy Contracts
|
||||
```bash
|
||||
# Deploy CCIPTxReporter to Chain-138
|
||||
npm run deploy:reporter:chain138
|
||||
|
||||
# Or manually:
|
||||
npx hardhat run scripts/ccip-deployment/deploy-ccip-reporter.js --network chain138
|
||||
# Historical CCIPTxReporter source is archived
|
||||
export CHAIN138_CCIP_REPORTER=0x...
|
||||
# Restore archive/solidity/contracts/ccip-integration/CCIPTxReporter.sol before any fresh redeploy
|
||||
```
|
||||
|
||||
### Step 4: Verify Deployment
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
- **Reason**: Function is `external`, requires `this.` prefix for internal calls
|
||||
|
||||
#### **verifyCredentialProof Call**
|
||||
- **Fixed**: `contracts/compliance/IndyVerifier.sol`
|
||||
- **Fixed**: `archive/solidity/contracts/compliance/IndyVerifier.sol`
|
||||
- **Changed**: `verifyCredentialProof(...)` → `this.verifyCredentialProof(...)`
|
||||
|
||||
### **4. Payable Function Issues**
|
||||
@@ -62,6 +62,7 @@
|
||||
- **Fixed**: GRUCCIPBridge, ISO4217WCCIPBridge, CommodityCCIPBridge
|
||||
- **Changed**: `bridge(op)` → `this.bridge(op)`
|
||||
- **Reason**: `bridge()` is `external`, requires `this.` for internal calls
|
||||
- **Current status**: ISO4217WCCIPBridge and CommodityCCIPBridge are retained only as archived historical implementations under `archive/solidity/`
|
||||
|
||||
### **7. Test Files**
|
||||
|
||||
|
||||
@@ -81,8 +81,8 @@
|
||||
# Deploy CCIPLogger
|
||||
npm run deploy:logger:mainnet
|
||||
|
||||
# Deploy CCIPTxReporter (on Chain-138)
|
||||
npm run deploy:reporter:chain138
|
||||
# Reuse the historical CCIPTxReporter deployment (on Chain-138)
|
||||
export CHAIN138_CCIP_REPORTER=0x...
|
||||
```
|
||||
|
||||
### WETH Bridges
|
||||
|
||||
@@ -112,8 +112,8 @@ This document tracks the status of smart contract deployments to Ethereum Mainne
|
||||
# Deploy CCIPLogger to Ethereum Mainnet
|
||||
npm run deploy:logger:mainnet
|
||||
|
||||
# Deploy CCIPTxReporter to Chain-138
|
||||
npm run deploy:reporter:chain138
|
||||
# Reuse the historical CCIPTxReporter deployment on Chain-138
|
||||
export CHAIN138_CCIP_REPORTER=0x...
|
||||
```
|
||||
|
||||
#### Option B: Deploy WETH Bridges
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
|
||||
This guide shows how to extend the Universal Bridge to support a new asset type without modifying core contracts.
|
||||
|
||||
> Note: This plugin-handler flow is historical reference material. The original `IAssetTypeHandler` and `PluginRegistry` sources were archived under `archive/solidity/contracts/registry/interfaces/` and `archive/solidity/contracts/plugins/` to keep them out of the active Forge compile graph.
|
||||
|
||||
---
|
||||
|
||||
## Prerequisites
|
||||
@@ -28,7 +30,7 @@ This guide shows how to extend the Universal Bridge to support a new asset type
|
||||
Implement `IAssetTypeHandler` interface:
|
||||
|
||||
```solidity
|
||||
// contracts/registry/handlers/MyAssetHandler.sol
|
||||
// Historical reference: archive/solidity/contracts/registry/handlers/MyAssetHandler.sol
|
||||
import "../interfaces/IAssetTypeHandler.sol";
|
||||
|
||||
contract MyAssetHandler is IAssetTypeHandler {
|
||||
@@ -64,7 +66,7 @@ forge create contracts/registry/handlers/MyAssetHandler.sol:MyAssetHandler \
|
||||
--private-key $PRIVATE_KEY
|
||||
```
|
||||
|
||||
### Step 3: Register with PluginRegistry
|
||||
### Step 3: Historical PluginRegistry Registration
|
||||
|
||||
```solidity
|
||||
// Register handler as plugin
|
||||
|
||||
@@ -54,7 +54,7 @@ This document provides a comprehensive inventory of all contracts in the project
|
||||
- Status: ✅ Production-ready
|
||||
- Dependencies: None
|
||||
|
||||
- **IAggregator.sol** (`contracts/interfaces/IAggregator.sol`)
|
||||
- **IAggregator.sol** (`contracts/oracle/IAggregator.sol`)
|
||||
- Status: ✅ Production-ready
|
||||
- Dependencies: None
|
||||
|
||||
@@ -91,8 +91,8 @@ This document provides a comprehensive inventory of all contracts in the project
|
||||
- Refactoring: Can be refactored to use minimal IERC20 interface
|
||||
- Tests: `test/ccip/CCIPIntegration.t.sol`
|
||||
|
||||
- **CCIPRouterOptimized.sol** (`contracts/ccip/CCIPRouterOptimized.sol`)
|
||||
- Status: ⚠️ Requires OpenZeppelin
|
||||
- **CCIPRouterOptimized.sol** (`archive/solidity/contracts/ccip/CCIPRouterOptimized.sol`)
|
||||
- Status: Historical archived contract
|
||||
- Dependencies: `SafeERC20`, `IERC20` from OpenZeppelin
|
||||
- Usage: SafeERC20 for fee token handling
|
||||
- Refactoring: Can be refactored to use minimal IERC20 interface
|
||||
@@ -122,7 +122,7 @@ This document provides a comprehensive inventory of all contracts in the project
|
||||
|----------|-----------|--------|---------|-------------------|
|
||||
| CCIPSender | ✅ | ✅ | ❌ | Low (similar to CCIPWETH9Bridge) |
|
||||
| CCIPRouter | ✅ | ✅ | ❌ | Low (similar to CCIPWETH9Bridge) |
|
||||
| CCIPRouterOptimized | ✅ | ✅ | ❌ | Low (similar to CCIPWETH9Bridge) |
|
||||
| CCIPRouterOptimized | Archived | Archived | Archived | Historical reference only |
|
||||
| MultiSig | ❌ | ❌ | ✅ | Medium (custom admin pattern) |
|
||||
| Voting | ❌ | ❌ | ✅ | Medium (custom admin pattern) |
|
||||
|
||||
@@ -160,7 +160,7 @@ This document provides a comprehensive inventory of all contracts in the project
|
||||
### ⚠️ Contracts Requiring OpenZeppelin
|
||||
- CCIPSender.sol
|
||||
- CCIPRouter.sol
|
||||
- CCIPRouterOptimized.sol
|
||||
- CCIPRouterOptimized.sol (historical, archived)
|
||||
- MultiSig.sol
|
||||
- Voting.sol
|
||||
|
||||
@@ -233,7 +233,7 @@ forge test
|
||||
### Phase 2: Refactor Contracts (Long-term)
|
||||
1. Refactor CCIPSender.sol → Use minimal IERC20 interface
|
||||
2. Refactor CCIPRouter.sol → Use minimal IERC20 interface
|
||||
3. Refactor CCIPRouterOptimized.sol → Use minimal IERC20 interface
|
||||
3. Historical reference: CCIPRouterOptimized.sol was archived instead of keeping it in the active compile graph
|
||||
4. Refactor MultiSig.sol → Use custom admin pattern
|
||||
5. Refactor Voting.sol → Use custom admin pattern
|
||||
|
||||
@@ -274,4 +274,3 @@ forge test
|
||||
- [OpenZeppelin Dependency Assessment](./OPENZEPPELIN_DEPENDENCY_ASSESSMENT.md)
|
||||
- [OpenZeppelin Tasks Checklist](./OPENZEPPELIN_TASKS_CHECKLIST.md)
|
||||
- [WETH CCIP Deployment Guide](./WETH_CCIP_DEPLOYMENT.md)
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ This document outlines tasks to assess and resolve OpenZeppelin dependencies in
|
||||
- [ ] List contracts using OpenZeppelin:
|
||||
- [ ] `contracts/ccip/CCIPSender.sol` - Uses `SafeERC20`, `IERC20`
|
||||
- [ ] `contracts/ccip/CCIPRouter.sol` - Uses `SafeERC20`, `IERC20`
|
||||
- [ ] `contracts/ccip/CCIPRouterOptimized.sol` - Uses `SafeERC20`, `IERC20`
|
||||
- [ ] `archive/solidity/contracts/ccip/CCIPRouterOptimized.sol` - Uses `SafeERC20`, `IERC20`
|
||||
- [ ] `contracts/governance/MultiSig.sol` - Uses `Ownable`
|
||||
- [ ] `contracts/governance/Voting.sol` - Uses `Ownable`
|
||||
- [ ] Document which OpenZeppelin contracts are used:
|
||||
@@ -65,7 +65,7 @@ This document outlines tasks to assess and resolve OpenZeppelin dependencies in
|
||||
- [ ] Test compilation of existing CCIP contracts:
|
||||
- [ ] `contracts/ccip/CCIPSender.sol`
|
||||
- [ ] `contracts/ccip/CCIPRouter.sol`
|
||||
- [ ] `contracts/ccip/CCIPRouterOptimized.sol`
|
||||
- [ ] `archive/solidity/contracts/ccip/CCIPRouterOptimized.sol`
|
||||
- [ ] Test compilation of governance contracts:
|
||||
- [ ] `contracts/governance/MultiSig.sol`
|
||||
- [ ] `contracts/governance/Voting.sol`
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
- [x] Found 5 contracts using OpenZeppelin:
|
||||
- `contracts/ccip/CCIPSender.sol`
|
||||
- `contracts/ccip/CCIPRouter.sol`
|
||||
- `contracts/ccip/CCIPRouterOptimized.sol`
|
||||
- `archive/solidity/contracts/ccip/CCIPRouterOptimized.sol`
|
||||
- `contracts/governance/MultiSig.sol`
|
||||
- `contracts/governance/Voting.sol`
|
||||
- [x] OpenZeppelin imports identified:
|
||||
@@ -179,7 +179,7 @@ forge test
|
||||
### Contracts with OpenZeppelin Dependencies
|
||||
1. `contracts/ccip/CCIPSender.sol` - Needs SafeERC20, IERC20
|
||||
2. `contracts/ccip/CCIPRouter.sol` - Needs SafeERC20, IERC20
|
||||
3. `contracts/ccip/CCIPRouterOptimized.sol` - Needs SafeERC20, IERC20
|
||||
3. `archive/solidity/contracts/ccip/CCIPRouterOptimized.sol` - Needs SafeERC20, IERC20
|
||||
4. `contracts/governance/MultiSig.sol` - Needs Ownable
|
||||
5. `contracts/governance/Voting.sol` - Needs Ownable
|
||||
|
||||
|
||||
@@ -316,7 +316,7 @@ See also: [PRICE_FEED_SETUP.md](PRICE_FEED_SETUP.md) for ReserveSystem/OraclePri
|
||||
|
||||
### PMM price for vault / reporting
|
||||
|
||||
**PMMPriceProvider** (`contracts/vault/adapters/PMMPriceProvider.sol`) exposes `getPrice(asset, quoteToken)` using DODOPMMIntegration’s `getPoolPriceOrOracle`. Use it for vault collateral valuation (e.g. cUSDT/cUSDC in USD terms) or off-chain reporting when the asset is a PMM pair token. Deploy with the DODOPMMIntegration address; see [Vault IMPLEMENTATION_SUMMARY](../vault/IMPLEMENTATION_SUMMARY.md#gru-smart-vault-and-pmm-integration).
|
||||
**PMMPriceProvider** (`archive/solidity/contracts/vault/adapters/PMMPriceProvider.sol`) exposes `getPrice(asset, quoteToken)` using DODOPMMIntegration’s `getPoolPriceOrOracle`. It is retained as a historical reference implementation for vault collateral valuation and off-chain reporting patterns.
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# GRU Formulas NFT
|
||||
|
||||
**Contract**: `contracts/nft/GRUFormulasNFT.sol`
|
||||
**Contract**: `archive/solidity/contracts/nft/GRUFormulasNFT.sol`
|
||||
**Standard**: ERC-721
|
||||
|
||||
---
|
||||
@@ -35,7 +35,7 @@ The GRU Formulas NFT mints up to three token types, each depicting a GRU-related
|
||||
Deploy with an admin address (receives `DEFAULT_ADMIN_ROLE` and `MINTER_ROLE`). Grant `MINTER_ROLE` to any additional minters as needed.
|
||||
|
||||
```bash
|
||||
forge create contracts/nft/GRUFormulasNFT.sol:GRUFormulasNFT --constructor-args <ADMIN_ADDRESS> --rpc-url $RPC_URL --private-key $PRIVATE_KEY
|
||||
forge create archive/solidity/contracts/nft/GRUFormulasNFT.sol:GRUFormulasNFT --constructor-args <ADMIN_ADDRESS> --rpc-url $RPC_URL --private-key $PRIVATE_KEY
|
||||
```
|
||||
|
||||
## References
|
||||
|
||||
@@ -65,7 +65,7 @@ All code, infrastructure, testing, documentation, and enhancement tasks are comp
|
||||
|
||||
### Contracts
|
||||
- `contracts/governance/Voting.sol`
|
||||
- `contracts/ccip/CCIPRouterOptimized.sol`
|
||||
- `archive/solidity/contracts/ccip/CCIPRouterOptimized.sol`
|
||||
|
||||
### Testing
|
||||
- `test/e2e/ContractDeployment.t.sol`
|
||||
|
||||
@@ -37,7 +37,7 @@ All remaining tasks have been completed:
|
||||
- Files: `monitoring/prometheus/alerts/region.yml`
|
||||
|
||||
6. ✅ **PERF-001 through PERF-008**: Performance optimizations
|
||||
- Files: `contracts/ccip/CCIPRouterOptimized.sol`
|
||||
- Files: `archive/solidity/contracts/ccip/CCIPRouterOptimized.sol`
|
||||
- Files: `services/oracle-publisher/oracle_publisher_optimized.py`
|
||||
|
||||
7. ✅ **GOV-007**: On-chain voting
|
||||
|
||||
@@ -678,7 +678,7 @@ See [Project Review](docs/PROJECT_REVIEW.md), [Recommendations](docs/RECOMMENDAT
|
||||
- Status: ✅ Completed - Optimized router with batching and caching created
|
||||
- Priority: 🟡 Medium
|
||||
- Effort: 8-16 hours
|
||||
- Files: `contracts/ccip/CCIPRouterOptimized.sol`
|
||||
- Files: `archive/solidity/contracts/ccip/CCIPRouterOptimized.sol`
|
||||
- Dependencies: CCIP-001
|
||||
- Notes: Optimized message processing with batching and fee caching
|
||||
|
||||
@@ -686,7 +686,7 @@ See [Project Review](docs/PROJECT_REVIEW.md), [Recommendations](docs/RECOMMENDAT
|
||||
- Status: ✅ Completed - Message batching implemented
|
||||
- Priority: 🟡 Medium
|
||||
- Effort: 8-16 hours
|
||||
- Files: `contracts/ccip/CCIPRouterOptimized.sol`
|
||||
- Files: `archive/solidity/contracts/ccip/CCIPRouterOptimized.sol`
|
||||
- Dependencies: CCIP-001
|
||||
- Notes: Batch multiple messages with configurable batch size and window
|
||||
|
||||
@@ -694,7 +694,7 @@ See [Project Review](docs/PROJECT_REVIEW.md), [Recommendations](docs/RECOMMENDAT
|
||||
- Status: ✅ Completed - Fee caching implemented
|
||||
- Priority: 🟡 Medium
|
||||
- Effort: 4-8 hours
|
||||
- Files: `contracts/ccip/CCIPRouterOptimized.sol`
|
||||
- Files: `archive/solidity/contracts/ccip/CCIPRouterOptimized.sol`
|
||||
- Dependencies: CCIP-005
|
||||
- Notes: Fee calculations cached with configurable expiry
|
||||
|
||||
@@ -702,7 +702,7 @@ See [Project Review](docs/PROJECT_REVIEW.md), [Recommendations](docs/RECOMMENDAT
|
||||
- Status: ✅ Completed - Caching implemented in optimized router
|
||||
- Priority: 🟡 Medium
|
||||
- Effort: 4-8 hours
|
||||
- Files: `contracts/ccip/CCIPRouterOptimized.sol`
|
||||
- Files: `archive/solidity/contracts/ccip/CCIPRouterOptimized.sol`
|
||||
- Dependencies: CCIP-001
|
||||
- Notes: Fee caching with TTL for frequently accessed data
|
||||
|
||||
|
||||
@@ -54,9 +54,9 @@ The tokenization system for central bank/IFI settlements has been successfully i
|
||||
|
||||
### Deployment & Testing
|
||||
- `scripts/deployment/deploy-tokenization.sh` - Deployment script
|
||||
- `scripts/tokenization/DeployTokenizedEUR.s.sol` - TokenizedEUR deployment
|
||||
- `scripts/tokenization/DeployTokenRegistry.s.sol` - TokenRegistry deployment
|
||||
- `scripts/tokenization/RegisterToken.s.sol` - Token registration
|
||||
- `script/tokenization/DeployTokenizedEUR.s.sol` - TokenizedEUR deployment
|
||||
- `script/tokenization/DeployTokenRegistry.s.sol` - TokenRegistry deployment
|
||||
- `script/tokenization/RegisterToken.s.sol` - Token registration
|
||||
- `test/tokenization/TokenizationIntegration.t.sol` - Integration tests
|
||||
|
||||
### Documentation
|
||||
|
||||
@@ -89,7 +89,7 @@ CurrencyA → XAU → CurrencyB
|
||||
|
||||
### Implementation
|
||||
|
||||
The `XAUTriangulation` library enforces this requirement:
|
||||
The historical `XAUTriangulation` library, archived at `archive/solidity/contracts/vault/libraries/XAUTriangulation.sol`, documents this requirement:
|
||||
- All conversions use `triangulate()` function
|
||||
- Direct currency-to-currency conversions are NOT permitted
|
||||
- XAU is the universal unit of account
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
- ✅ Currency type enumeration (ISO4217_FIAT, NON_ISO_SYNTHETIC, etc.)
|
||||
|
||||
**Files**:
|
||||
- `contracts/vault/libraries/CurrencyValidation.sol`
|
||||
- `archive/solidity/contracts/vault/libraries/CurrencyValidation.sol`
|
||||
|
||||
### 2. Non-ISO Currency Classification ✅
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
- ✅ `getCurrencyType()` returns explicit classification
|
||||
|
||||
**Files**:
|
||||
- `contracts/vault/libraries/CurrencyValidation.sol`
|
||||
- `archive/solidity/contracts/vault/libraries/CurrencyValidation.sol`
|
||||
- `contracts/vault/libraries/GRUConstants.sol`
|
||||
|
||||
### 3. GRU as Non-Legal Tender ✅
|
||||
@@ -46,7 +46,7 @@
|
||||
|
||||
**Files**:
|
||||
- `contracts/vault/libraries/GRUConstants.sol`
|
||||
- `contracts/vault/libraries/CurrencyValidation.sol`
|
||||
- `archive/solidity/contracts/vault/libraries/CurrencyValidation.sol`
|
||||
- `docs/vault/COMPLIANCE_REQUIREMENTS.md`
|
||||
|
||||
### 4. GRU Conversion Ratios ✅
|
||||
@@ -70,14 +70,14 @@
|
||||
**Requirement**: ALL currency conversions MUST go through XAU
|
||||
|
||||
**Implementation**:
|
||||
- ✅ `XAUTriangulation.sol` library enforces triangulation
|
||||
- ✅ Historical `XAUTriangulation.sol` library enforces triangulation
|
||||
- ✅ `triangulate()` function: CurrencyA → XAU → CurrencyB
|
||||
- ✅ All conversions documented as requiring XAU intermediation
|
||||
- ✅ Ledger contract documents XAU normalization
|
||||
- ✅ XAU Oracle provides ETH/XAU pricing
|
||||
|
||||
**Files**:
|
||||
- `contracts/vault/libraries/XAUTriangulation.sol`
|
||||
- `archive/solidity/contracts/vault/libraries/XAUTriangulation.sol`
|
||||
- `contracts/vault/Ledger.sol` (XAU normalization comments)
|
||||
- `contracts/vault/XAUOracle.sol`
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
- ✅ Money Multiplier: `m = (1 + c) / (r + c)` - `calculateMoneyMultiplierWithCurrency()`
|
||||
|
||||
**Files**:
|
||||
- `contracts/vault/libraries/MonetaryFormulas.sol`
|
||||
- `archive/solidity/contracts/vault/libraries/MonetaryFormulas.sol`
|
||||
|
||||
### 7. Documentation Compliance ✅
|
||||
|
||||
@@ -129,7 +129,7 @@
|
||||
| Non-ISO Classification | ✅ | CurrencyValidation.sol + GRUConstants.sol |
|
||||
| GRU Non-Legal Tender | ✅ | GRUConstants.sol + Documentation |
|
||||
| GRU Conversion Ratios | ✅ | GRUConstants.sol (exact enforcement) |
|
||||
| XAU Triangulation | ✅ | XAUTriangulation.sol + Ledger.sol |
|
||||
| XAU Triangulation | ✅ | archive/solidity/contracts/vault/libraries/XAUTriangulation.sol + Ledger.sol |
|
||||
| Monetary Formulas | ✅ | MonetaryFormulas.sol (exact implementation) |
|
||||
| Documentation | ✅ | COMPLIANCE_REQUIREMENTS.md |
|
||||
|
||||
|
||||
@@ -231,7 +231,7 @@ All interfaces have been created:
|
||||
- Money Multiplier: m = 1 / r and m = (1 + c) / (r + c)
|
||||
- Exact formula implementations without modification
|
||||
|
||||
**XAUTriangulation.sol**:
|
||||
**XAUTriangulation.sol** (historical, archived):
|
||||
- XAU triangulation for all currency conversions
|
||||
- CurrencyA → XAU → CurrencyB enforcement
|
||||
- XAU conversion utilities
|
||||
@@ -259,7 +259,7 @@ contracts/vault/
|
||||
│ ├── CurrencyValidation.sol ✅ ISO 4217 compliance
|
||||
│ ├── GRUConstants.sol ✅ GRU relationships
|
||||
│ ├── MonetaryFormulas.sol ✅ Mandatory formulas
|
||||
│ └── XAUTriangulation.sol ✅ XAU triangulation
|
||||
│ └── XAUTriangulation.sol ✅ XAU triangulation (historical, archived)
|
||||
├── errors/
|
||||
│ └── VaultErrors.sol
|
||||
├── Ledger.sol
|
||||
@@ -322,9 +322,9 @@ See `docs/vault/COMPLIANCE_REQUIREMENTS.md` for complete compliance documentatio
|
||||
|
||||
### GRU Smart Vault and PMM Integration
|
||||
|
||||
- **PMM price for vault valuation**: When collateral or debt is a token that has a PMM pool (e.g. cUSDT, cUSDC), price can be obtained from **PMMPriceProvider** (`contracts/vault/adapters/PMMPriceProvider.sol`). It wraps DODOPMMIntegration and exposes `getPrice(asset, quoteToken)` using `getPoolPriceOrOracle` (oracle-backed when ReserveSystem is set on DODOPMMIntegration). The Ledger’s primary valuation remains XAU via XAUOracle; PMMPriceProvider is for optional use by keepers, UIs, or a future Ledger extension that supports a secondary price source per asset.
|
||||
- **PMM price for vault valuation**: When collateral or debt is a token that has a PMM pool (e.g. cUSDT, cUSDC), price can be obtained from the historical **PMMPriceProvider** reference implementation (`archive/solidity/contracts/vault/adapters/PMMPriceProvider.sol`). It wraps DODOPMMIntegration and exposes `getPrice(asset, quoteToken)` using `getPoolPriceOrOracle` (oracle-backed when ReserveSystem is set on DODOPMMIntegration). The Ledger’s primary valuation remains XAU via XAUOracle; PMMPriceProvider is retained as a reference pattern for optional use by keepers, UIs, or a future Ledger extension that supports a secondary price source per asset.
|
||||
- **Vault as LP / PMM liquidity**: A vault (or its regulated entity) can add liquidity to PMM pools by calling **DODOPMMIntegration.addLiquidity(pool, baseAmount, quoteAmount)**. The vault (or entity) must hold base and quote tokens and approve the integration contract. Required role on DODOPMMIntegration: none for addLiquidity (anyone can add); pool creation requires **POOL_MANAGER_ROLE**. LP positions are not currently accepted as collateral in the Ledger; that would require a future extension (e.g. LP token as approved asset and a valuation path for LP shares).
|
||||
- **GRUHandler / registry**: GRU assets used in vaults should be validated via **GRUHandler** (`contracts/registry/handlers/GRUHandler.sol`). Register any new PMM-related or GRU asset types in **ChainRegistry** / **UniversalAssetRegistry** as applicable.
|
||||
- **GRUHandler / registry**: GRU assets used in vaults should be validated via the historical **GRUHandler** reference implementation (`archive/solidity/contracts/registry/handlers/GRUHandler.sol`). Register any new PMM-related or GRU asset types in **ChainRegistry** / **UniversalAssetRegistry** as applicable.
|
||||
|
||||
See also: `docs/integration/DODO_PMM_INTEGRATION.md`, `docs/integration/ORACLE_AND_KEEPER_CHAIN138.md`.
|
||||
|
||||
@@ -334,4 +334,4 @@ See also: `docs/integration/DODO_PMM_INTEGRATION.md`, `docs/integration/ORACLE_A
|
||||
- All contracts follow OpenZeppelin security best practices
|
||||
- The system enforces strict access controls and compliance checks
|
||||
- XAU normalization ensures consistent valuation across all operations
|
||||
- **MANDATORY COMPLIANCE**: All currency codes, GRU relationships, and monetary formulas are enforced
|
||||
- **MANDATORY COMPLIANCE**: All currency codes, GRU relationships, and monetary formulas are enforced
|
||||
|
||||
@@ -93,7 +93,7 @@ contract AaveQuotePushFlashReceiverMainnetForkTest is Test {
|
||||
string memory rpcUrl = vm.envString("ETHEREUM_MAINNET_RPC");
|
||||
vm.createSelectFork(rpcUrl);
|
||||
|
||||
receiver = new AaveQuotePushFlashReceiver(AAVE_POOL_MAINNET);
|
||||
receiver = new AaveQuotePushFlashReceiver(AAVE_POOL_MAINNET, address(this));
|
||||
unwinder = new AaveForkMockExternalUnwinder(IERC20(CWUSDC), IERC20(USDC), 130, 100);
|
||||
deal(USDC, address(unwinder), 50_000_000_000);
|
||||
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
# This file configures Foundry for the project
|
||||
|
||||
[profile.default]
|
||||
# Full historical repo config. For day-to-day monorepo work, prefer
|
||||
# `bash scripts/forge/scope.sh ...` so Forge only sees the contract subtree you
|
||||
# are actively editing.
|
||||
src = "contracts"
|
||||
out = "out"
|
||||
libs = ["lib"]
|
||||
@@ -9,6 +12,7 @@ solc = "0.8.20"
|
||||
optimizer = true
|
||||
optimizer_runs = 200
|
||||
via_ir = true
|
||||
auto_detect_remappings = false
|
||||
# Fork tests execute live mainnet bytecode; Cancun matches post-Dencun execution (MCOPY, etc.).
|
||||
evm_version = "cancun"
|
||||
fs_permissions = [
|
||||
|
||||
21
package.json
21
package.json
@@ -8,17 +8,22 @@
|
||||
"test:ci": "pnpm run test:contracts:ci && pnpm run test:services:ci",
|
||||
"test:contracts:ci": "pnpm run test:contracts:transport && pnpm run test:contracts:ccip-smoke",
|
||||
"test:contracts:transport": "bash ../scripts/verify/check-cstar-v2-transport-stack.sh",
|
||||
"test:contracts:ccip-smoke": "npx hardhat test --no-compile test/ccip-integration/CCIPIntegration.test.js",
|
||||
"test:contracts:ccip-smoke": "node -e \"console.log('CCIPTxReporter Hardhat smoke is archived; no active reporter smoke test runs in CI.')\"",
|
||||
"test:services:ci": "pnpm run test:services:token-aggregation && pnpm run test:services:emoney-api",
|
||||
"test:services:token-aggregation": "pnpm --dir services/token-aggregation run test:ci",
|
||||
"test:services:emoney-api": "pnpm --dir test/emoney/api run test:ci",
|
||||
"test:hardhat:full": "hardhat test",
|
||||
"test:forge:full": "forge test",
|
||||
"forge:build": "forge build",
|
||||
"forge:test": "forge test",
|
||||
"forge:test:vault": "forge test --match-path 'test/vault/Ledger.t.sol'",
|
||||
"forge:test:iso": "forge test --match-path 'test/iso4217w/*.t.sol'",
|
||||
"forge:test:quick": "forge test --match-contract LedgerTest",
|
||||
"test:forge:full": "bash scripts/forge/scope.sh test full",
|
||||
"forge:scope:list": "bash scripts/forge/scope.sh list",
|
||||
"forge:orphans": "python3 scripts/forge/report-contract-reachability.py",
|
||||
"forge:build": "bash scripts/forge/scope.sh build",
|
||||
"forge:build:full": "bash scripts/forge/scope.sh build full",
|
||||
"forge:script": "bash scripts/forge/scope.sh script",
|
||||
"forge:test": "bash scripts/forge/scope.sh test",
|
||||
"forge:test:full": "bash scripts/forge/scope.sh test full",
|
||||
"forge:test:vault": "FORGE_SCOPE=vault bash scripts/forge/scope.sh test --match-path 'test/vault/Ledger.t.sol'",
|
||||
"forge:test:iso": "FORGE_SCOPE=iso4217w bash scripts/forge/scope.sh test --match-path 'test/iso4217w/*.t.sol'",
|
||||
"forge:test:quick": "FORGE_SCOPE=vault bash scripts/forge/scope.sh test --match-contract LedgerTest",
|
||||
"dodo-pools:create": "bash scripts/create-all-dodo-pools-from-token-api.sh",
|
||||
"dodo-pools:dry-run": "DRY_RUN=true bash scripts/create-all-dodo-pools-from-token-api.sh",
|
||||
"prereqs": "bash scripts/deployment/ensure-prerequisites.sh",
|
||||
@@ -27,7 +32,7 @@
|
||||
"deploy:logger:polygon": "hardhat run scripts/ccip-deployment/deploy-ccip-logger-multichain.js --network polygon",
|
||||
"deploy:logger:gnosis": "hardhat run scripts/ccip-deployment/deploy-ccip-logger-multichain.js --network gnosis",
|
||||
"deploy:logger:cronos": "hardhat run scripts/ccip-deployment/deploy-ccip-logger-multichain.js --network cronos",
|
||||
"deploy:reporter:chain138": "hardhat run scripts/ccip-deployment/deploy-ccip-reporter.js --network chain138",
|
||||
"deploy:reporter:chain138": "node scripts/ccip-deployment/deploy-ccip-reporter.js",
|
||||
"verify:logger": "hardhat verify --network mainnet",
|
||||
"verify:reporter": "hardhat verify --network chain138"
|
||||
},
|
||||
|
||||
@@ -11,6 +11,7 @@ import {AaveQuotePushFlashReceiver} from "../../contracts/flash/AaveQuotePushFla
|
||||
* Env:
|
||||
* PRIVATE_KEY required
|
||||
* AAVE_POOL_ADDRESS optional; defaults to Aave V3 mainnet Pool
|
||||
* QUOTE_PUSH_RECEIVER_OWNER optional; defaults to deployer derived from PRIVATE_KEY
|
||||
*
|
||||
* Usage:
|
||||
* forge script script/deploy/DeployAaveQuotePushFlashReceiver.s.sol:DeployAaveQuotePushFlashReceiver \
|
||||
@@ -23,12 +24,14 @@ contract DeployAaveQuotePushFlashReceiver is Script {
|
||||
uint256 pk = vm.envUint("PRIVATE_KEY");
|
||||
address pool = vm.envOr("AAVE_POOL_ADDRESS", DEFAULT_AAVE_POOL_MAINNET);
|
||||
address deployer = vm.addr(pk);
|
||||
address owner = vm.envOr("QUOTE_PUSH_RECEIVER_OWNER", deployer);
|
||||
|
||||
console.log("Deployer:", deployer);
|
||||
console.log("Aave Pool:", pool);
|
||||
console.log("Receiver owner:", owner);
|
||||
|
||||
vm.startBroadcast(pk);
|
||||
AaveQuotePushFlashReceiver receiver = new AaveQuotePushFlashReceiver(pool);
|
||||
AaveQuotePushFlashReceiver receiver = new AaveQuotePushFlashReceiver(pool, owner);
|
||||
vm.stopBroadcast();
|
||||
|
||||
console.log("AaveQuotePushFlashReceiver:", address(receiver));
|
||||
|
||||
72
script/deploy/DeployQuotePushTreasuryManager.s.sol
Normal file
72
script/deploy/DeployQuotePushTreasuryManager.s.sol
Normal file
@@ -0,0 +1,72 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
import {Script, console} from "forge-std/Script.sol";
|
||||
import {AaveQuotePushFlashReceiver} from "../../contracts/flash/AaveQuotePushFlashReceiver.sol";
|
||||
import {QuotePushTreasuryManager} from "../../contracts/flash/QuotePushTreasuryManager.sol";
|
||||
|
||||
/**
|
||||
* @title DeployQuotePushTreasuryManager
|
||||
* @notice Deploy a treasury manager for quote-push retained surplus and optionally
|
||||
* hand receiver ownership to it in the same broadcast.
|
||||
*
|
||||
* Env:
|
||||
* PRIVATE_KEY required
|
||||
* AAVE_QUOTE_PUSH_RECEIVER_MAINNET required
|
||||
* QUOTE_PUSH_SURPLUS_TOKEN_MAINNET optional; defaults to USDC mainnet
|
||||
* QUOTE_PUSH_TREASURY_OWNER optional; defaults to deployer
|
||||
* QUOTE_PUSH_TREASURY_OPERATOR optional; defaults to owner
|
||||
* QUOTE_PUSH_TREASURY_GAS_RECIPIENT optional; defaults to owner
|
||||
* QUOTE_PUSH_TREASURY_RECYCLE_RECIPIENT optional; defaults to owner
|
||||
* QUOTE_PUSH_RECEIVER_RESERVE_RAW optional; defaults to 0
|
||||
* QUOTE_PUSH_TREASURY_RESERVE_RAW optional; defaults to 0
|
||||
* QUOTE_PUSH_TREASURY_TAKE_RECEIVER_OWNERSHIP optional; 1 to transfer receiver ownership to manager
|
||||
*/
|
||||
contract DeployQuotePushTreasuryManager is Script {
|
||||
address internal constant DEFAULT_USDC_MAINNET = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;
|
||||
|
||||
function run() external {
|
||||
uint256 pk = vm.envUint("PRIVATE_KEY");
|
||||
address receiver = vm.envAddress("AAVE_QUOTE_PUSH_RECEIVER_MAINNET");
|
||||
address quoteToken = vm.envOr("QUOTE_PUSH_SURPLUS_TOKEN_MAINNET", DEFAULT_USDC_MAINNET);
|
||||
address deployer = vm.addr(pk);
|
||||
address owner = vm.envOr("QUOTE_PUSH_TREASURY_OWNER", deployer);
|
||||
address operator = vm.envOr("QUOTE_PUSH_TREASURY_OPERATOR", owner);
|
||||
address gasRecipient = vm.envOr("QUOTE_PUSH_TREASURY_GAS_RECIPIENT", owner);
|
||||
address recycleRecipient = vm.envOr("QUOTE_PUSH_TREASURY_RECYCLE_RECIPIENT", owner);
|
||||
uint256 receiverReserve = vm.envOr("QUOTE_PUSH_RECEIVER_RESERVE_RAW", uint256(0));
|
||||
uint256 managerReserve = vm.envOr("QUOTE_PUSH_TREASURY_RESERVE_RAW", uint256(0));
|
||||
bool takeReceiverOwnership = vm.envOr("QUOTE_PUSH_TREASURY_TAKE_RECEIVER_OWNERSHIP", uint256(0)) == 1;
|
||||
|
||||
console.log("Deployer:", deployer);
|
||||
console.log("Receiver:", receiver);
|
||||
console.log("Quote token:", quoteToken);
|
||||
console.log("Manager owner:", owner);
|
||||
console.log("Manager operator:", operator);
|
||||
console.log("Gas recipient:", gasRecipient);
|
||||
console.log("Recycle recipient:", recycleRecipient);
|
||||
console.log("Receiver reserve:", receiverReserve);
|
||||
console.log("Manager reserve:", managerReserve);
|
||||
console.log("Take receiver ownership:", takeReceiverOwnership);
|
||||
|
||||
vm.startBroadcast(pk);
|
||||
QuotePushTreasuryManager manager = new QuotePushTreasuryManager(
|
||||
owner,
|
||||
receiver,
|
||||
quoteToken,
|
||||
operator,
|
||||
gasRecipient,
|
||||
recycleRecipient,
|
||||
receiverReserve,
|
||||
managerReserve
|
||||
);
|
||||
|
||||
if (takeReceiverOwnership) {
|
||||
AaveQuotePushFlashReceiver(receiver).transferOwnership(address(manager));
|
||||
console.log("Receiver ownership transferred to manager");
|
||||
}
|
||||
vm.stopBroadcast();
|
||||
|
||||
console.log("QuotePushTreasuryManager:", address(manager));
|
||||
}
|
||||
}
|
||||
50
script/flash/ManageQuotePushTreasuryManager.s.sol
Normal file
50
script/flash/ManageQuotePushTreasuryManager.s.sol
Normal file
@@ -0,0 +1,50 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
import {Script, console} from "forge-std/Script.sol";
|
||||
import {QuotePushTreasuryManager} from "../../contracts/flash/QuotePushTreasuryManager.sol";
|
||||
|
||||
/**
|
||||
* @title ManageQuotePushTreasuryManager
|
||||
* @notice Harvest receiver surplus into the treasury manager and/or distribute
|
||||
* quote to the configured gas and recycle recipients.
|
||||
*
|
||||
* Env:
|
||||
* PRIVATE_KEY required
|
||||
* QUOTE_PUSH_TREASURY_MANAGER_MAINNET required
|
||||
* QUOTE_PUSH_TREASURY_HARVEST optional; default 1
|
||||
* QUOTE_PUSH_TREASURY_GAS_DISTRIBUTION_RAW optional; default 0
|
||||
* QUOTE_PUSH_TREASURY_RECYCLE_DISTRIBUTION_RAW optional; default 0
|
||||
*/
|
||||
contract ManageQuotePushTreasuryManager is Script {
|
||||
function run() external {
|
||||
uint256 pk = vm.envUint("PRIVATE_KEY");
|
||||
address managerAddr = vm.envAddress("QUOTE_PUSH_TREASURY_MANAGER_MAINNET");
|
||||
bool harvest = vm.envOr("QUOTE_PUSH_TREASURY_HARVEST", uint256(1)) == 1;
|
||||
uint256 gasAmount = vm.envOr("QUOTE_PUSH_TREASURY_GAS_DISTRIBUTION_RAW", uint256(0));
|
||||
uint256 recycleAmount = vm.envOr("QUOTE_PUSH_TREASURY_RECYCLE_DISTRIBUTION_RAW", uint256(0));
|
||||
|
||||
QuotePushTreasuryManager manager = QuotePushTreasuryManager(managerAddr);
|
||||
|
||||
console.log("manager", managerAddr);
|
||||
console.log("harvest", harvest);
|
||||
console.log("gasAmount", gasAmount);
|
||||
console.log("recycleAmount", recycleAmount);
|
||||
console.log("quoteBalanceBefore", manager.quoteBalance());
|
||||
console.log("availableBefore", manager.availableQuote());
|
||||
console.log("receiverSweepableBefore", manager.receiverSweepableQuote());
|
||||
|
||||
vm.startBroadcast(pk);
|
||||
if (harvest) {
|
||||
uint256 harvested = manager.harvestReceiverSurplus();
|
||||
console.log("harvested", harvested);
|
||||
}
|
||||
if (gasAmount > 0 || recycleAmount > 0) {
|
||||
manager.distributeToConfiguredRecipients(gasAmount, recycleAmount);
|
||||
}
|
||||
vm.stopBroadcast();
|
||||
|
||||
console.log("quoteBalanceAfter", manager.quoteBalance());
|
||||
console.log("availableAfter", manager.availableQuote());
|
||||
}
|
||||
}
|
||||
173
script/flash/RunManagedMainnetAaveCwusdcUsdcQuotePushCycle.s.sol
Normal file
173
script/flash/RunManagedMainnetAaveCwusdcUsdcQuotePushCycle.s.sol
Normal file
@@ -0,0 +1,173 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
import {Script, console} from "forge-std/Script.sol";
|
||||
import {AaveQuotePushFlashReceiver} from "../../contracts/flash/AaveQuotePushFlashReceiver.sol";
|
||||
import {QuotePushTreasuryManager} from "../../contracts/flash/QuotePushTreasuryManager.sol";
|
||||
|
||||
interface IDODOPMMPoolQuoteManaged {
|
||||
function querySellQuote(address trader, uint256 payQuoteAmount) external view returns (uint256 receiveBaseAmount, uint256 mtFee);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title RunManagedMainnetAaveCwusdcUsdcQuotePushCycle
|
||||
* @notice Simulate or broadcast a full manager-backed cycle:
|
||||
* flash quote-push -> harvest retained quote into treasury manager -> split to configured recipients.
|
||||
*
|
||||
* Env:
|
||||
* Same flash envs as RunMainnetAaveCwusdcUsdcQuotePushOnce
|
||||
* QUOTE_PUSH_TREASURY_MANAGER_MAINNET required
|
||||
* QUOTE_PUSH_TREASURY_HARVEST optional; default 1
|
||||
* QUOTE_PUSH_TREASURY_GAS_HOLDBACK_TARGET_RAW optional; default 0
|
||||
*
|
||||
* Notes:
|
||||
* - Gas holdback target is a quote-denominated cap. The script computes:
|
||||
* gasAmount = min(manager.availableQuote(), gasHoldbackTargetRaw)
|
||||
* recycleAmount = manager.availableQuote() - gasAmount
|
||||
* - This is primarily used by the keeper dry-run so flash and recycle happen in the
|
||||
* same simulated environment and post-flash surplus is visible to the manager.
|
||||
*/
|
||||
contract RunManagedMainnetAaveCwusdcUsdcQuotePushCycle is Script {
|
||||
address internal constant DEFAULT_POOL = 0x69776fc607e9edA8042e320e7e43f54d06c68f0E;
|
||||
address internal constant DEFAULT_CWUSDC = 0x2de5F116bFcE3d0f922d9C8351e0c5Fc24b9284a;
|
||||
address internal constant DEFAULT_USDC = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;
|
||||
|
||||
function run() external {
|
||||
uint256 pk = vm.envUint("PRIVATE_KEY");
|
||||
address receiver = vm.envAddress("AAVE_QUOTE_PUSH_RECEIVER_MAINNET");
|
||||
address managerAddr = vm.envAddress("QUOTE_PUSH_TREASURY_MANAGER_MAINNET");
|
||||
address pool = vm.envOr("POOL_CWUSDC_USDC_MAINNET", DEFAULT_POOL);
|
||||
address integration = vm.envAddress("DODO_PMM_INTEGRATION_MAINNET");
|
||||
address baseToken = vm.envOr("CWUSDC_MAINNET", DEFAULT_CWUSDC);
|
||||
address usdc = vm.envOr("USDC_MAINNET", DEFAULT_USDC);
|
||||
address unwinder = vm.envAddress("QUOTE_PUSH_EXTERNAL_UNWINDER_MAINNET");
|
||||
uint256 amount = vm.envUint("FLASH_QUOTE_AMOUNT_RAW");
|
||||
bool harvest = vm.envOr("QUOTE_PUSH_TREASURY_HARVEST", uint256(1)) == 1;
|
||||
uint256 gasHoldbackTargetRaw = vm.envOr("QUOTE_PUSH_TREASURY_GAS_HOLDBACK_TARGET_RAW", uint256(0));
|
||||
|
||||
QuotePushTreasuryManager manager = QuotePushTreasuryManager(managerAddr);
|
||||
AaveQuotePushFlashReceiver.QuotePushParams memory p =
|
||||
_loadQuotePushParams(receiver, pool, integration, baseToken, unwinder, amount);
|
||||
|
||||
console.log("receiver", receiver);
|
||||
console.log("manager", managerAddr);
|
||||
console.log("pool", pool);
|
||||
console.log("amount", amount);
|
||||
console.log("managerAvailableBefore", manager.availableQuote());
|
||||
console.log("receiverSweepableBefore", manager.receiverSweepableQuote());
|
||||
console.log("gasHoldbackTargetRaw", gasHoldbackTargetRaw);
|
||||
|
||||
vm.startBroadcast(pk);
|
||||
AaveQuotePushFlashReceiver(receiver).flashQuotePush(usdc, amount, p);
|
||||
|
||||
uint256 harvested = 0;
|
||||
if (harvest) {
|
||||
uint256 receiverSweepableAfterFlash = manager.receiverSweepableQuote();
|
||||
if (receiverSweepableAfterFlash > 0) {
|
||||
harvested = manager.harvestReceiverSurplus();
|
||||
}
|
||||
console.log("receiverSweepableAfterFlash", receiverSweepableAfterFlash);
|
||||
}
|
||||
|
||||
uint256 available = manager.availableQuote();
|
||||
uint256 gasAmount = _min(available, gasHoldbackTargetRaw);
|
||||
uint256 recycleAmount = available - gasAmount;
|
||||
|
||||
if (gasAmount > 0 || recycleAmount > 0) {
|
||||
manager.distributeToConfiguredRecipients(gasAmount, recycleAmount);
|
||||
}
|
||||
vm.stopBroadcast();
|
||||
|
||||
console.log("harvested", harvested);
|
||||
console.log("gasDistributionRaw", gasAmount);
|
||||
console.log("recycleDistributionRaw", recycleAmount);
|
||||
console.log("managerQuoteAfter", manager.quoteBalance());
|
||||
console.log("managerAvailableAfter", manager.availableQuote());
|
||||
console.log("receiverSweepableAfter", manager.receiverSweepableQuote());
|
||||
}
|
||||
|
||||
function _loadQuotePushParams(
|
||||
address receiver,
|
||||
address pool,
|
||||
address integration,
|
||||
address baseToken,
|
||||
address unwinder,
|
||||
uint256 amount
|
||||
) internal view returns (AaveQuotePushFlashReceiver.QuotePushParams memory p) {
|
||||
uint256 minPmmNum = vm.envOr("MIN_OUT_PMM_NUM", uint256(985));
|
||||
uint256 minPmmDen = vm.envOr("MIN_OUT_PMM_DEN", uint256(1000));
|
||||
|
||||
uint256 minOutPmm = vm.envOr("MIN_OUT_PMM", uint256(0));
|
||||
if (minOutPmm == 0) {
|
||||
(uint256 baseOut,) = IDODOPMMPoolQuoteManaged(pool).querySellQuote(receiver, amount);
|
||||
minOutPmm = (baseOut * minPmmNum) / minPmmDen;
|
||||
}
|
||||
|
||||
uint256 premiumBps = vm.envOr("AAVE_FLASH_PREMIUM_BPS", uint256(5));
|
||||
uint256 buf = vm.envOr("MIN_OUT_UNWIND_BUFFER_RAW", uint256(5000));
|
||||
uint256 minOutUnwind = vm.envOr("MIN_OUT_UNWIND", uint256(0));
|
||||
if (minOutUnwind == 0) {
|
||||
uint256 premium = (amount * premiumBps) / 10000;
|
||||
minOutUnwind = amount + premium + buf;
|
||||
}
|
||||
|
||||
uint256 unwindMode = vm.envOr("UNWIND_MODE", uint256(0));
|
||||
bytes memory unwindData;
|
||||
if (unwindMode == 0) {
|
||||
uint24 fee = uint24(vm.envUint("UNWIND_V3_FEE_U24"));
|
||||
unwindData = abi.encode(fee);
|
||||
} else if (unwindMode == 1) {
|
||||
address dodoPool = vm.envAddress("UNWIND_DODO_POOL");
|
||||
unwindData = abi.encode(dodoPool);
|
||||
} else if (unwindMode == 2) {
|
||||
string memory pathHex = vm.envString("UNWIND_V3_PATH_HEX");
|
||||
bytes memory path = vm.parseBytes(pathHex);
|
||||
unwindData = abi.encode(path);
|
||||
} else if (unwindMode == 4) {
|
||||
address poolA = vm.envAddress("UNWIND_TWO_HOP_POOL_A");
|
||||
address poolB = vm.envAddress("UNWIND_TWO_HOP_POOL_B");
|
||||
address midToken = vm.envAddress("UNWIND_TWO_HOP_MID_TOKEN");
|
||||
uint256 minMidOut = vm.envOr("UNWIND_MIN_MID_OUT_RAW", uint256(1));
|
||||
unwindData = abi.encode(poolA, poolB, midToken, minMidOut);
|
||||
} else if (unwindMode == 5) {
|
||||
address dodoPool = vm.envAddress("UNWIND_DODO_POOL");
|
||||
address intermediateToken = vm.envAddress("UNWIND_INTERMEDIATE_TOKEN");
|
||||
uint256 minIntermediateOut = vm.envOr("UNWIND_MIN_INTERMEDIATE_OUT_RAW", uint256(1));
|
||||
string memory pathHex = vm.envString("UNWIND_V3_PATH_HEX");
|
||||
bytes memory path = vm.parseBytes(pathHex);
|
||||
unwindData = abi.encode(dodoPool, intermediateToken, minIntermediateOut, path);
|
||||
} else {
|
||||
revert("UNWIND_MODE must be 0, 1, 2, 4, or 5");
|
||||
}
|
||||
|
||||
p = AaveQuotePushFlashReceiver.QuotePushParams({
|
||||
integration: integration,
|
||||
pmmPool: pool,
|
||||
baseToken: baseToken,
|
||||
externalUnwinder: unwinder,
|
||||
minOutPmm: minOutPmm,
|
||||
minOutUnwind: minOutUnwind,
|
||||
unwindData: unwindData,
|
||||
atomicBridge: AaveQuotePushFlashReceiver.AtomicBridgeParams({
|
||||
coordinator: address(0),
|
||||
sourceChain: 0,
|
||||
destinationChain: 0,
|
||||
destinationAsset: address(0),
|
||||
bridgeAmount: 0,
|
||||
minDestinationAmount: 0,
|
||||
destinationRecipient: address(0),
|
||||
destinationDeadline: 0,
|
||||
routeId: bytes32(0),
|
||||
settlementMode: bytes32(0),
|
||||
submitCommitment: false
|
||||
})
|
||||
});
|
||||
|
||||
console.log("minOutPmm", minOutPmm);
|
||||
console.log("minOutUnwind", minOutUnwind);
|
||||
}
|
||||
|
||||
function _min(uint256 a, uint256 b) internal pure returns (uint256) {
|
||||
return a < b ? a : b;
|
||||
}
|
||||
}
|
||||
47
script/flash/SweepAaveQuotePushFlashReceiverSurplus.s.sol
Normal file
47
script/flash/SweepAaveQuotePushFlashReceiverSurplus.s.sol
Normal file
@@ -0,0 +1,47 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
import {Script, console} from "forge-std/Script.sol";
|
||||
import {AaveQuotePushFlashReceiver} from "../../contracts/flash/AaveQuotePushFlashReceiver.sol";
|
||||
|
||||
/**
|
||||
* @title SweepAaveQuotePushFlashReceiverSurplus
|
||||
* @notice Owner-operated surplus recovery for a deployed AaveQuotePushFlashReceiver.
|
||||
*
|
||||
* Env:
|
||||
* PRIVATE_KEY required (must be receiver owner)
|
||||
* AAVE_QUOTE_PUSH_RECEIVER_MAINNET required
|
||||
* QUOTE_PUSH_SURPLUS_TOKEN_MAINNET optional; defaults to USDC mainnet
|
||||
* QUOTE_PUSH_SURPLUS_RECIPIENT optional; defaults to deployer derived from PRIVATE_KEY
|
||||
* QUOTE_PUSH_SURPLUS_RESERVE_RAW optional; keep this much on receiver when sweeping surplus mode
|
||||
* QUOTE_PUSH_SURPLUS_EXACT_AMOUNT_RAW optional; if > 0, sweep this exact amount via sweepToken()
|
||||
*/
|
||||
contract SweepAaveQuotePushFlashReceiverSurplus is Script {
|
||||
address internal constant DEFAULT_USDC_MAINNET = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;
|
||||
|
||||
function run() external {
|
||||
uint256 pk = vm.envUint("PRIVATE_KEY");
|
||||
address receiver = vm.envAddress("AAVE_QUOTE_PUSH_RECEIVER_MAINNET");
|
||||
address token = vm.envOr("QUOTE_PUSH_SURPLUS_TOKEN_MAINNET", DEFAULT_USDC_MAINNET);
|
||||
address deployer = vm.addr(pk);
|
||||
address recipient = vm.envOr("QUOTE_PUSH_SURPLUS_RECIPIENT", deployer);
|
||||
uint256 reserveRetained = vm.envOr("QUOTE_PUSH_SURPLUS_RESERVE_RAW", uint256(0));
|
||||
uint256 exactAmount = vm.envOr("QUOTE_PUSH_SURPLUS_EXACT_AMOUNT_RAW", uint256(0));
|
||||
|
||||
console.log("receiver", receiver);
|
||||
console.log("token", token);
|
||||
console.log("recipient", recipient);
|
||||
console.log("reserveRetained", reserveRetained);
|
||||
console.log("exactAmount", exactAmount);
|
||||
|
||||
vm.startBroadcast(pk);
|
||||
if (exactAmount > 0) {
|
||||
AaveQuotePushFlashReceiver(receiver).sweepToken(token, recipient, exactAmount);
|
||||
console.log("sweptExact", exactAmount);
|
||||
} else {
|
||||
uint256 swept = AaveQuotePushFlashReceiver(receiver).sweepQuoteSurplus(token, recipient, reserveRetained);
|
||||
console.log("sweptSurplus", swept);
|
||||
}
|
||||
vm.stopBroadcast();
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@
|
||||
set -e
|
||||
|
||||
cd "$(dirname "$0")/../.."
|
||||
source scripts/lib/forge-scope.sh
|
||||
|
||||
echo "=== Deployment Preparation Check ==="
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
set -e
|
||||
|
||||
cd "$(dirname "$0")/../.."
|
||||
FORGE_SCOPE="${FORGE_SCOPE:-full}"
|
||||
|
||||
echo "=== 🚀 Running All Automated Tasks ==="
|
||||
echo ""
|
||||
@@ -41,10 +42,10 @@ run_parallel_task "validate-scripts" "./scripts/automation/validate-all-scripts.
|
||||
run_parallel_task "scope-review" "./scripts/automation/scope-review.sh"
|
||||
|
||||
# Task 3: Compile Foundry contracts
|
||||
run_parallel_task "compile-foundry" "forge build --force 2>&1 | grep -v 'ccip-integration' || true"
|
||||
run_parallel_task "compile-foundry" "bash scripts/forge/scope.sh build \"$FORGE_SCOPE\" --force 2>&1 | grep -v 'ccip-integration' || true"
|
||||
|
||||
# Task 4: Run Foundry tests
|
||||
run_parallel_task "test-foundry" "forge test --no-match-path 'test/ccip-integration/*' 2>&1 || true"
|
||||
run_parallel_task "test-foundry" "bash scripts/forge/scope.sh test \"$FORGE_SCOPE\" --no-match-path 'test/ccip-integration/*' 2>&1 || true"
|
||||
|
||||
# Task 5: Check environment configuration
|
||||
run_parallel_task "check-env" "./scripts/deployment/verify-env.sh 2>&1 || echo 'Env check skipped'"
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
set -e
|
||||
|
||||
cd "$(dirname "$0")/../.."
|
||||
FORGE_SCOPE="${FORGE_SCOPE:-full}"
|
||||
|
||||
echo "=== 🧪 Running Tests in Parallel ==="
|
||||
|
||||
@@ -12,7 +13,7 @@ mkdir -p test-results
|
||||
|
||||
# Run Foundry tests (excluding CCIP integration)
|
||||
echo "Running Foundry tests..."
|
||||
forge test --no-match-path 'test/ccip-integration/*' --json > test-results/foundry.json 2>&1 &
|
||||
bash scripts/forge/scope.sh test "$FORGE_SCOPE" --no-match-path 'test/ccip-integration/*' --json > test-results/foundry.json 2>&1 &
|
||||
FORGE_PID=$!
|
||||
|
||||
# Run Hardhat tests (if any)
|
||||
|
||||
@@ -80,6 +80,7 @@ echo "Deployed Contracts:"
|
||||
echo " CCIPLogger: $CCIP_LOGGER_ADDRESS"
|
||||
echo "Next Steps:"
|
||||
echo " 1. Verify contract on Etherscan"
|
||||
echo " 2. Deploy CCIPTxReporter to Chain-138"
|
||||
echo " 2. Set CHAIN138_CCIP_REPORTER for the historical Chain-138 sender if that flow is still active"
|
||||
echo " Archived source: archive/solidity/contracts/ccip-integration/CCIPTxReporter.sol"
|
||||
echo " 3. Configure watcher/relayer service"
|
||||
echo " 4. Start monitoring"
|
||||
|
||||
@@ -1,66 +1,7 @@
|
||||
const { ethers } = require("hardhat");
|
||||
require("dotenv").config();
|
||||
const archivedSource = "archive/solidity/contracts/ccip-integration/CCIPTxReporter.sol";
|
||||
|
||||
/**
|
||||
* Deploy CCIPTxReporter to Chain-138
|
||||
* This contract reports Chain-138 transactions to Ethereum Mainnet via CCIP
|
||||
*/
|
||||
async function main() {
|
||||
const [deployer] = await ethers.getSigners();
|
||||
console.log("Deploying CCIPTxReporter with account:", deployer.address);
|
||||
console.log("Account balance:", (await ethers.provider.getBalance(deployer.address)).toString());
|
||||
|
||||
// Get configuration from environment
|
||||
const routerAddress = process.env.CCIP_CHAIN138_ROUTER || process.env.CCIP_ROUTER || ethers.ZeroAddress;
|
||||
const destChainSelector = process.env.ETH_MAINNET_SELECTOR || "0x500147"; // Ethereum Mainnet selector (update with actual value from CCIP Directory)
|
||||
const destReceiver = process.env.CCIP_LOGGER_ETH_ADDRESS || ethers.ZeroAddress;
|
||||
|
||||
if (routerAddress === ethers.ZeroAddress) {
|
||||
throw new Error("CCIP_ROUTER or CCIP_CHAIN138_ROUTER must be set in .env");
|
||||
}
|
||||
if (destReceiver === ethers.ZeroAddress) {
|
||||
throw new Error("CCIP_LOGGER_ETH_ADDRESS must be set in .env (deploy CCIPLogger first)");
|
||||
}
|
||||
|
||||
console.log("\nConfiguration:");
|
||||
console.log(" Router (Chain-138):", routerAddress);
|
||||
console.log(" Destination Chain Selector (Ethereum):", destChainSelector);
|
||||
console.log(" Destination Receiver (CCIPLogger):", destReceiver);
|
||||
|
||||
// Deploy CCIPTxReporter
|
||||
const CCIPTxReporter = await ethers.getContractFactory("CCIPTxReporter");
|
||||
console.log("\nDeploying CCIPTxReporter...");
|
||||
|
||||
const selectorU64 = typeof destChainSelector === "string" && destChainSelector.startsWith("0x")
|
||||
? BigInt(destChainSelector)
|
||||
: BigInt(destChainSelector);
|
||||
const reporter = await CCIPTxReporter.deploy(
|
||||
routerAddress,
|
||||
selectorU64,
|
||||
destReceiver
|
||||
);
|
||||
|
||||
await reporter.waitForDeployment();
|
||||
const reporterAddress = await reporter.getAddress();
|
||||
|
||||
console.log("\n✅ CCIPTxReporter deployed to:", reporterAddress);
|
||||
console.log("\nDeployment details:");
|
||||
console.log(" Router:", await reporter.router());
|
||||
console.log(" Destination Chain Selector:", await reporter.destChainSelector());
|
||||
console.log(" Destination Receiver:", await reporter.destReceiver());
|
||||
console.log(" Owner:", await reporter.owner());
|
||||
|
||||
console.log("\n📝 Next steps:");
|
||||
console.log(" 1. Verify contract on Chain-138 explorer (if available)");
|
||||
console.log(" 2. Update .env with CCIP_REPORTER_CHAIN138_ADDRESS=" + reporterAddress);
|
||||
console.log(" 3. Fund the contract with ETH for CCIP fees");
|
||||
console.log(" 4. Start the watcher/relayer service");
|
||||
console.log(" 5. Test with a sample transaction report");
|
||||
}
|
||||
|
||||
main()
|
||||
.then(() => process.exit(0))
|
||||
.catch((error) => {
|
||||
console.error(error);
|
||||
process.exit(1);
|
||||
});
|
||||
console.error("CCIPTxReporter has been archived out of the active compile graph.");
|
||||
console.error(`Historical source: ${archivedSource}`);
|
||||
console.error("If you need a fresh deployment, restore that source into contracts/ first.");
|
||||
console.error("If you only need the existing deployment, set CHAIN138_CCIP_REPORTER in .env.");
|
||||
process.exit(1);
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
set -e
|
||||
|
||||
cd /home/intlc/projects/proxmox/smom-dbis-138
|
||||
source scripts/lib/forge-scope.sh
|
||||
|
||||
echo "╔══════════════════════════════════════════════════════════════╗"
|
||||
echo "║ TokenFactory138 Compilation and Error Check ║"
|
||||
@@ -126,4 +127,3 @@ else
|
||||
echo " 3. Ensure all dependencies are compiled"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
|
||||
# Colors
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
@@ -17,12 +20,8 @@ echo -e "${BLUE}╚════════════════════
|
||||
echo ""
|
||||
|
||||
# Load environment
|
||||
cd /home/intlc/projects/proxmox/smom-dbis-138
|
||||
if [ -f .env ]; then
|
||||
set -a
|
||||
source .env
|
||||
set +a
|
||||
fi
|
||||
cd "$PROJECT_ROOT"
|
||||
source "$PROJECT_ROOT/scripts/load-env.sh" >/dev/null 2>&1 || true
|
||||
|
||||
# Check prerequisites
|
||||
if [ -z "$PRIVATE_KEY" ]; then
|
||||
@@ -198,4 +197,3 @@ echo " 1. Verify contracts on explorer: https://explorer.d-bis.org"
|
||||
echo " 2. Review test results above"
|
||||
echo " 3. Set up monitoring and alerting"
|
||||
echo " 4. Configure multisig governance (production)"
|
||||
|
||||
|
||||
@@ -5,16 +5,19 @@
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
cd "$PROJECT_ROOT"
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Load environment variables
|
||||
if [ -f .env ]; then
|
||||
export $(cat .env | grep -v '^#' | xargs)
|
||||
else
|
||||
source "$PROJECT_ROOT/scripts/load-env.sh" >/dev/null 2>&1 || true
|
||||
|
||||
if [ ! -f .env ]; then
|
||||
echo -e "${RED}Error: .env file not found${NC}"
|
||||
exit 1
|
||||
fi
|
||||
@@ -120,4 +123,3 @@ echo " CompliantUSDT: $COMPLIANT_USDT"
|
||||
echo " CompliantUSDC: $COMPLIANT_USDC"
|
||||
echo ""
|
||||
echo "Addresses have been saved to .env file"
|
||||
|
||||
|
||||
@@ -5,16 +5,19 @@
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
cd "$PROJECT_ROOT"
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Load environment variables
|
||||
if [ -f .env ]; then
|
||||
export $(cat .env | grep -v '^#' | xargs)
|
||||
else
|
||||
source "$PROJECT_ROOT/scripts/load-env.sh" >/dev/null 2>&1 || true
|
||||
|
||||
if [ ! -f .env ]; then
|
||||
echo -e "${RED}Error: .env file not found${NC}"
|
||||
exit 1
|
||||
fi
|
||||
@@ -109,4 +112,3 @@ echo " TokenRegistry: $TOKEN_REGISTRY"
|
||||
echo " FeeCollector: $FEE_COLLECTOR"
|
||||
echo ""
|
||||
echo "Addresses have been saved to .env file"
|
||||
|
||||
|
||||
@@ -5,6 +5,10 @@
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
cd "$PROJECT_ROOT"
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
@@ -24,12 +28,7 @@ if [ -z "$PRIVATE_KEY" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Load .env if exists
|
||||
if [ -f .env ]; then
|
||||
set -a
|
||||
source .env
|
||||
set +a
|
||||
fi
|
||||
source "$PROJECT_ROOT/scripts/load-env.sh" >/dev/null 2>&1 || true
|
||||
|
||||
# Set defaults
|
||||
RPC_URL=${RPC_URL:-${RPC_URL_138:-"http://192.168.11.250:8545"}}
|
||||
@@ -325,4 +324,3 @@ echo " 4. Test end-to-end functionality"
|
||||
echo ""
|
||||
echo -e "${GREEN}All addresses saved to .env file${NC}"
|
||||
echo ""
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ set -e
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
cd "$PROJECT_ROOT"
|
||||
source "$PROJECT_ROOT/scripts/lib/forge-scope.sh"
|
||||
|
||||
# Load environment variables
|
||||
source "$PROJECT_ROOT/../explorer-monorepo/.env" 2>/dev/null || true
|
||||
@@ -139,4 +140,3 @@ else
|
||||
echo "Receipt: $RECEIPT"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
@@ -4,9 +4,11 @@
|
||||
# Optional: CUSTODIAN_ADDRESS, RESERVE_MANAGER_ADDRESS, RESERVE_TRANSMITTER_1, RESERVE_TRANSMITTER_2
|
||||
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
cd "$PROJECT_ROOT"
|
||||
|
||||
source .env 2>/dev/null || true
|
||||
source "$PROJECT_ROOT/scripts/load-env.sh" >/dev/null 2>&1 || true
|
||||
|
||||
: "${PRIVATE_KEY:?PRIVATE_KEY required}"
|
||||
: "${RPC_URL:?RPC_URL required (e.g. http://192.168.11.250:8545)}"
|
||||
|
||||
@@ -9,9 +9,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
||||
|
||||
# Load environment variables
|
||||
if [ -f "$PROJECT_ROOT/.env" ]; then
|
||||
source "$PROJECT_ROOT/.env"
|
||||
fi
|
||||
source "$PROJECT_ROOT/scripts/load-env.sh" >/dev/null 2>&1 || true
|
||||
|
||||
# Configuration
|
||||
RPC_URL_MAINNET="${RPC_URL_MAINNET:-https://eth.llamarpc.com}"
|
||||
@@ -107,4 +105,3 @@ else
|
||||
echo "⚠️ Could not extract deployed addresses from logs"
|
||||
echo " Please check deployment logs manually"
|
||||
fi
|
||||
|
||||
|
||||
@@ -4,9 +4,11 @@
|
||||
# Optional: TREASURY_ADDRESS
|
||||
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
cd "$PROJECT_ROOT"
|
||||
|
||||
source .env 2>/dev/null || true
|
||||
source "$PROJECT_ROOT/scripts/load-env.sh" >/dev/null 2>&1 || true
|
||||
|
||||
: "${PRIVATE_KEY:?PRIVATE_KEY required}"
|
||||
: "${RPC_URL:?RPC_URL required (e.g. http://192.168.11.250:8545)}"
|
||||
|
||||
@@ -3,7 +3,11 @@
|
||||
|
||||
set -e
|
||||
|
||||
cd "$(dirname "$0")/../.."
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
||||
cd "$PROJECT_ROOT"
|
||||
source "$SCRIPT_DIR/../lib/init.sh"
|
||||
source "$PROJECT_ROOT/scripts/load-env.sh" >/dev/null 2>&1 || true
|
||||
|
||||
echo "=== Compiling and Testing Mainnet Contracts ==="
|
||||
|
||||
|
||||
@@ -3,7 +3,11 @@
|
||||
|
||||
set -e
|
||||
|
||||
cd "$(dirname "$0")/../.."
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
||||
cd "$PROJECT_ROOT"
|
||||
source "$SCRIPT_DIR/../lib/init.sh"
|
||||
source "$PROJECT_ROOT/scripts/load-env.sh" >/dev/null 2>&1 || true
|
||||
|
||||
# Color codes
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user