Consolidate webapp structure by merging nested components into the main repository
This commit is contained in:
34
contracts/interfaces/IAdapter.sol
Normal file
34
contracts/interfaces/IAdapter.sol
Normal file
@@ -0,0 +1,34 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
/**
|
||||
* @title IAdapter
|
||||
* @notice Interface for protocol adapters
|
||||
*/
|
||||
interface IAdapter {
|
||||
/**
|
||||
* @notice Execute a step using this adapter
|
||||
* @param data Encoded step parameters
|
||||
* @return success Whether execution succeeded
|
||||
* @return returnData Return data from execution
|
||||
*/
|
||||
function executeStep(bytes calldata data) external returns (bool success, bytes memory returnData);
|
||||
|
||||
/**
|
||||
* @notice Prepare step (2PC prepare phase)
|
||||
* @param data Encoded step parameters
|
||||
* @return prepared Whether preparation succeeded
|
||||
*/
|
||||
function prepareStep(bytes calldata data) external returns (bool prepared);
|
||||
|
||||
/**
|
||||
* @notice Get adapter name
|
||||
*/
|
||||
function name() external view returns (string memory);
|
||||
|
||||
/**
|
||||
* @notice Get adapter type (DEFI or FIAT_DTL)
|
||||
*/
|
||||
function adapterType() external view returns (uint8);
|
||||
}
|
||||
|
||||
19
contracts/interfaces/IAdapterRegistry.sol
Normal file
19
contracts/interfaces/IAdapterRegistry.sol
Normal file
@@ -0,0 +1,19 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
interface IAdapterRegistry {
|
||||
enum AdapterType {
|
||||
DEFI,
|
||||
FIAT_DTL
|
||||
}
|
||||
|
||||
struct AdapterInfo {
|
||||
string name;
|
||||
AdapterType adapterType;
|
||||
uint256 registeredAt;
|
||||
bool whitelisted;
|
||||
}
|
||||
|
||||
function isWhitelisted(address adapter) external view returns (bool);
|
||||
}
|
||||
|
||||
54
contracts/interfaces/IComboHandler.sol
Normal file
54
contracts/interfaces/IComboHandler.sol
Normal file
@@ -0,0 +1,54 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
interface IComboHandler {
|
||||
enum StepType {
|
||||
BORROW,
|
||||
SWAP,
|
||||
REPAY,
|
||||
PAY,
|
||||
DEPOSIT,
|
||||
WITHDRAW,
|
||||
BRIDGE
|
||||
}
|
||||
|
||||
enum ExecutionStatus {
|
||||
PENDING,
|
||||
IN_PROGRESS,
|
||||
COMPLETE,
|
||||
FAILED,
|
||||
ABORTED
|
||||
}
|
||||
|
||||
struct Step {
|
||||
StepType stepType;
|
||||
bytes data; // Encoded step-specific parameters
|
||||
address target; // Target contract address (adapter or protocol)
|
||||
uint256 value; // ETH value to send (if applicable)
|
||||
}
|
||||
|
||||
struct StepReceipt {
|
||||
uint256 stepIndex;
|
||||
bool success;
|
||||
bytes returnData;
|
||||
uint256 gasUsed;
|
||||
}
|
||||
|
||||
function executeCombo(
|
||||
bytes32 planId,
|
||||
Step[] calldata steps,
|
||||
bytes calldata signature
|
||||
) external returns (bool success, StepReceipt[] memory receipts);
|
||||
|
||||
function prepare(
|
||||
bytes32 planId,
|
||||
Step[] calldata steps
|
||||
) external returns (bool prepared);
|
||||
|
||||
function commit(bytes32 planId) external returns (bool committed);
|
||||
|
||||
function abort(bytes32 planId) external;
|
||||
|
||||
function getExecutionStatus(bytes32 planId) external view returns (ExecutionStatus status);
|
||||
}
|
||||
|
||||
31
contracts/interfaces/INotaryRegistry.sol
Normal file
31
contracts/interfaces/INotaryRegistry.sol
Normal file
@@ -0,0 +1,31 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
import "./IComboHandler.sol";
|
||||
|
||||
interface INotaryRegistry {
|
||||
struct PlanRecord {
|
||||
bytes32 planHash;
|
||||
address creator;
|
||||
uint256 registeredAt;
|
||||
uint256 finalizedAt;
|
||||
bool success;
|
||||
bytes32 receiptHash;
|
||||
}
|
||||
|
||||
struct CodehashRecord {
|
||||
address contractAddress;
|
||||
bytes32 codehash;
|
||||
string version;
|
||||
uint256 registeredAt;
|
||||
}
|
||||
|
||||
function registerPlan(
|
||||
bytes32 planId,
|
||||
IComboHandler.Step[] calldata steps,
|
||||
address creator
|
||||
) external;
|
||||
|
||||
function finalizePlan(bytes32 planId, bool success) external;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user