Core Interfaces
IFXSwap
The main swap interface for stablecoin exchanges. Theswap() function executes a token swap, taking the input token address, output token address, input amount, minimum acceptable output, and deadline timestamp. It returns the actual output amount received. The getQuote() function provides swap quotes, returning expected output amount, price impact in basis points, the DEX route, and estimated gas.
ICrossChainSwap
Interface for cross-chain stablecoin swaps. ThecrossChainSwap() function executes a cross-chain swap and returns a bridge message identifier for tracking. The estimateFees() function returns the native token fee and bridge protocol fee.
Bridge Interfaces
ICCTP
Circle CCTP integration for USDC transfers. ThesendUSDC() function sends USDC to another chain via CCTP, returning a message nonce for tracking. The receiveUSDC() function receives USDC from another chain using the CCTP message and Circle attestation.
ILayerZeroOFT
LayerZero OFT interface for TEDP transfers. Thesend() function transfers tokens to another chain, requiring the destination endpoint ID, recipient address (as bytes32), amount in local decimals, and LayerZero messaging options. The quoteSend() function returns the native token fee for the transfer.
Admin Interfaces
IDiamondCut
Interface for upgrading diamond facets. ThediamondCut() function adds, replaces, or removes facet functions. Each FacetCut specifies a facet address, the action (Add, Replace, or Remove), and the function selectors affected.
IAdmin
Protocol administration interface. Functions includepause() to stop all operations, unpause() to resume, setProtocolFee() to update fees in basis points (max 100 = 1%), and addSupportedToken()/removeSupportedToken() to manage supported tokens.
Events
Swap events notify when swaps execute. TheSwap event includes sender, input/output tokens, amounts, and the DEX used. The CrossChainSwapInitiated event includes the message ID, sender, chain IDs, tokens, and input amount. The CrossChainSwapCompleted event confirms completion with the message ID, recipient, output token, and amount.
Admin events include Paused and Unpaused (with admin address) and FeeUpdated (with old and new fee values).
Error Codes
TED Protocol uses custom errors for gas-efficient error handling:- InsufficientOutput — Output amount less than minimum specified
- DeadlineExpired — Transaction deadline has passed
- UnsupportedToken — Token not supported by the protocol
- UnsupportedChain — Chain ID not supported
- ProtocolPaused — Protocol operations are paused
- InsufficientFee — Native token fee provided is too low
- InvalidRoute — Swap route is invalid
- ZeroAmount — Amount cannot be zero
- ZeroAddress — Address cannot be zero