-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathIFlyoverDiscovery.sol
More file actions
64 lines (54 loc) · 2.96 KB
/
IFlyoverDiscovery.sol
File metadata and controls
64 lines (54 loc) · 2.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;
import {Flyover} from "../libraries/Flyover.sol";
interface IFlyoverDiscovery {
event Register(uint indexed id, address indexed from, uint256 indexed amount);
event ProviderUpdate(address indexed from, string name, string apiBaseUrl);
event ProviderStatusSet(uint indexed id, bool indexed status);
error NotAuthorized(address from);
error NotEOA(address from);
error InvalidProviderData(string name, string apiBaseUrl);
error InvalidProviderType(Flyover.ProviderType providerType);
error AlreadyRegistered(address from);
error InsufficientCollateral(uint amount);
/// @notice Registers the caller as a Liquidity Provider
/// @dev Reverts if caller is not an EOA, already resigned, provides invalid data, invalid type, or lacks collateral
/// @param name Human-readable LP name
/// @param apiBaseUrl Base URL of the LP public API
/// @param status Initial status flag (enabled/disabled)
/// @param providerType The service type(s) the LP offers
/// @return id The newly assigned LP identifier
function register(
string calldata name,
string calldata apiBaseUrl,
bool status,
Flyover.ProviderType providerType
) external payable returns (uint);
/// @notice Updates the caller LP metadata
/// @dev Reverts if the caller is not registered or provides invalid fields
/// @param name New LP name
/// @param apiBaseUrl New LP API base URL
function updateProvider(string calldata name, string calldata apiBaseUrl) external;
/// @notice Updates a provider status flag
/// @dev Callable by the LP itself or the contract owner
/// @param providerId The provider identifier
/// @param status The new status value
function setProviderStatus(uint providerId, bool status) external;
/// @notice Lists LPs that should be visible to users
/// @dev A provider is listed if it has sufficient collateral for at least one side and `status` is true
/// @return providersToReturn Array of LP records to display
function getProviders() external view returns (Flyover.LiquidityProvider[] memory);
/// @notice Returns a single LP by address
/// @param providerAddress The LP address
/// @return provider LP record, reverts if not found
function getProvider(address providerAddress) external view returns (Flyover.LiquidityProvider memory);
/// @notice Checks if an LP can operate for a specific type of operation
/// @dev Ignores the first argument as compatibility stub with legacy signature
/// @param providerType The type of provider
/// @param addr The LP address
/// @return isOp True if registered and peg-in collateral >= min
function isOperational(Flyover.ProviderType providerType, address addr) external view returns (bool);
/// @notice Returns the last assigned provider id
/// @return lastId Last provider id
function getProvidersId() external view returns (uint);
}