// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;
import {Ownable, Ownable2Step} from '@openzeppelin/contracts/access/Ownable2Step.sol';
import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import {SafeERC20} from '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';
import {Address} from '@openzeppelin/contracts/utils/Address.sol';
import {ECDSA} from '@openzeppelin/contracts/utils/cryptography/ECDSA.sol';
import {MessageHashUtils} from '@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol';
import {TypeCasts} from 'contracts/common/TypeCasts.sol';
import {IEverclear} from 'interfaces/common/IEverclear.sol';
import {IPermit2} from 'interfaces/common/IPermit2.sol';
import {IEverclearSpoke} from 'interfaces/intent/IEverclearSpoke.sol';
import {IEverclearSpokeV3} from 'interfaces/intent/IEverclearSpokeV3.sol';
import {IFeeAdapter} from 'interfaces/intent/IFeeAdapter.sol';
contract FeeAdapter is IFeeAdapter, Ownable2Step {
////////////////////
//// Libraries /////
////////////////////
using SafeERC20 for IERC20;
using TypeCasts for address;
using TypeCasts for bytes32;
////////////////////
///// Storage //////
////////////////////
/// @inheritdoc IFeeAdapter
IEverclearSpokeV3 public immutable spoke;
// @inheritdoc IFeeAdapter
address public immutable xerc20Module;
/// @inheritdoc IFeeAdapter
address public feeRecipient;
/// @inheritdoc IFeeAdapter
address public feeSigner;
/// @inheritdoc IFeeAdapter
IPermit2 public constant PERMIT2 = IPermit2(0x000000000022D473030F116dDEE9F6B43aC78BA3);
////////////////////
/// Constructor ////
////////////////////
constructor(
address _spoke,
address _feeRecipient,
address _feeSigner,
address _xerc20Module,
address _owner
) Ownable(_owner) {
spoke = IEverclearSpokeV3(_spoke);
xerc20Module = _xerc20Module;
_updateFeeRecipient(_feeRecipient);
_updateFeeSigner(_feeSigner);
}
////////////////////
////// Admin ///////
////////////////////
/// @inheritdoc IFeeAdapter
function updateFeeRecipient(
address _feeRecipient
) external onlyOwner {
_updateFeeRecipient(_feeRecipient);
}
/// @inheritdoc IFeeAdapter
function updateFeeSigner(
address _feeSigner
) external onlyOwner {
_updateFeeSigner(_feeSigner);
}
/// @inheritdoc IFeeAdapter
function returnUnsupportedIntent(address _asset, uint256 _amount, address _recipient) external onlyOwner {
spoke.withdraw(_asset, _amount);
_pushTokens(_recipient, _asset, _amount);
}
////////////////////
///// External /////
////////////////////
/// @inheritdoc IFeeAdapter
function newIntent(
uint32[] memory _destinations,
bytes32 _receiver,
address _inputAsset,
bytes32 _outputAsset,
uint256 _amount,
uint24 _maxFee,
uint48 _ttl,
bytes calldata _data,
IFeeAdapter.FeeParams calldata _feeParams
) external payable returns (bytes32 _intentId, IEverclear.Intent memory _intent) {
// Transfer from caller
_pullTokens(msg.sender, _inputAsset, _amount + _feeParams.fee);
// Create intent
(_intentId, _intent) =
_newIntent(_destinations, _receiver, _inputAsset, _outputAsset, _amount, _maxFee, _ttl, _data, _feeParams);
}
/// @inheritdoc IFeeAdapter
function newIntent(
uint32[] memory _destinations,
address _receiver,
address _inputAsset,
address _outputAsset,
uint256 _amount,
uint24 _maxFee,
uint48 _ttl,
bytes calldata _data,
IFeeAdapter.FeeParams calldata _feeParams
) external payable returns (bytes32 _intentId, IEverclear.Intent memory _intent) {
// Transfer from caller
_pullTokens(msg.sender, _inputAsset, _amount + _feeParams.fee);
// Create intent
(_intentId, _intent) =
_newIntent(_destinations, _receiver, _inputAsset, _outputAsset, _amount, _maxFee, _ttl, _data, _feeParams);
}
/// @inheritdoc IFeeAdapter
function newIntent(
uint32[] memory _destinations,
address _receiver,
address _inputAsset,
address _outputAsset,
uint256 _amount,
uint24 _maxFee,
uint48 _ttl,
bytes calldata _data,
IEverclearSpoke.Permit2Params calldata _permit2Params,
IFeeAdapter.FeeParams calldata _feeParams
) external payable returns (bytes32 _intentId, IEverclear.Intent memory _intent) {
// Transfer from caller using permit2
_pullWithPermit2(_inputAsset, _amount + _feeParams.fee, _permit2Params);
// Call internal helper to create intent
(_intentId, _intent) =
_newIntent(_destinations, _receiver, _inputAsset, _outputAsset, _amount, _maxFee, _ttl, _data, _feeParams);
}
/// @inheritdoc IFeeAdapter
function newOrderSplitEvenly(
uint32 _numIntents,
uint256 _fee,
uint256 _deadline,
bytes calldata _sig,
OrderParameters memory _params
) external payable returns (bytes32 _orderId, bytes32[] memory _intentIds) {
// Transfer once from the user
_pullTokens(msg.sender, _params.inputAsset, _params.amount + _fee);
// Send fees to recipient
_handleFees(_fee, msg.value, _params.inputAsset, _deadline, _sig);
// Approve the spoke contract if needed
_approveSpokeIfNeeded(_params.inputAsset, _params.amount);
// Create `_numIntents` intents with the same params and `_amount` divided
// equally across all created intents.
uint256 _toSend = _params.amount / _numIntents;
// Initialising array length
_intentIds = new bytes32[](_numIntents);
for (uint256 i; i < _numIntents - 1; i++) {
// Create new intent
(bytes32 _intentId,) = spoke.newIntent(
_params.destinations,
_params.receiver,
_params.inputAsset,
_params.outputAsset,
_toSend,
_params.maxFee,
_params.ttl,
_params.data
);
_intentIds[i] = _intentId;
}
// Create a final intent here with the remainder of balance
_toSend = _toSend * (_numIntents - 1);
(bytes32 _intentId,) = spoke.newIntent(
_params.destinations,
_params.receiver,
_params.inputAsset,
_params.outputAsset,
_params.amount - _toSend, // handles remainder gracefully
_params.maxFee,
_params.ttl,
_params.data
);
// Add to array
_intentIds[_numIntents - 1] = _intentId;
// Calculate order id
_orderId = keccak256(abi.encode(_intentIds));
// Emit order information event
emit OrderCreated(_orderId, msg.sender.toBytes32(), _intentIds, _fee, msg.value);
}
/// @inheritdoc IFeeAdapter
function newOrder(
uint256 _fee,
uint256 _deadline,
bytes calldata _sig,
OrderParameters[] memory _params
) external payable returns (bytes32 _orderId, bytes32[] memory _intentIds) {
uint256 _numIntents = _params.length;
{
// Get the asset
address _asset = _params[0].inputAsset;
// Get the sum of the order amounts
uint256 _orderSum;
for (uint256 i; i < _numIntents; i++) {
_orderSum += _params[i].amount;
if (_params[i].inputAsset != _asset) {
revert MultipleOrderAssets();
}
}
// Transfer once from the user
_pullTokens(msg.sender, _asset, _orderSum + _fee);
// Approve the spoke contract if needed
_approveSpokeIfNeeded(_asset, _orderSum);
// Send fees to recipient
_handleFees(_fee, msg.value, _asset, _deadline, _sig);
}
// Initialising array length
_intentIds = new bytes32[](_numIntents);
for (uint256 i; i < _numIntents; i++) {
// Create new intent
(bytes32 _intentId,) = spoke.newIntent(
_params[i].destinations,
_params[i].receiver,
_params[i].inputAsset,
_params[i].outputAsset,
_params[i].amount,
_params[i].maxFee,
_params[i].ttl,
_params[i].data
);
_intentIds[i] = _intentId;
}
// Calculate order id
_orderId = keccak256(abi.encode(_intentIds));
// Emit order event
emit OrderCreated(_orderId, msg.sender.toBytes32(), _intentIds, _fee, msg.value);
}
////////////////////
///// Internal /////
////////////////////
/**
* @notice Internal function to create a new intent
* @param _destinations Array of destination chain IDs
* @param _receiver Address of the receiver on the destination chain
* @param _inputAsset Address of the input asset
* @param _outputAsset Address of the output asset
* @param _amount Amount of input asset to transfer
* @param _maxFee Maximum fee in basis points that can be charged
* @param _ttl Time-to-live for the intent
* @param _data Additional data for the intent
* @param _feeParams Fee parameters including fee amount, deadline, and signature
* @return _intentId The ID of the created intent
* @return _intent The created intent object
*/
function _newIntent(
uint32[] memory _destinations,
bytes32 _receiver,
address _inputAsset,
bytes32 _outputAsset,
uint256 _amount,
uint24 _maxFee,
uint48 _ttl,
bytes calldata _data,
IFeeAdapter.FeeParams calldata _feeParams
) internal returns (bytes32 _intentId, IEverclear.Intent memory _intent) {
// Send fees to recipient
_handleFees(_feeParams.fee, msg.value, _inputAsset, _feeParams.deadline, _feeParams.sig);
// Approve the spoke contract if needed
_approveSpokeIfNeeded(_inputAsset, _amount);
// Create new intent
(_intentId, _intent) =
spoke.newIntent(_destinations, _receiver, _inputAsset, _outputAsset, _amount, _maxFee, _ttl, _data);
// Emit event
emit IntentWithFeesAdded(_intentId, msg.sender.toBytes32(), _feeParams.fee, msg.value);
return (_intentId, _intent);
}
/**
* @notice Internal function to create a new intent
* @param _destinations Array of destination chain IDs
* @param _receiver Address of the receiver on the destination chain
* @param _inputAsset Address of the input asset
* @param _outputAsset Address of the output asset
* @param _amount Amount of input asset to transfer
* @param _maxFee Maximum fee in basis points that can be charged
* @param _ttl Time-to-live for the intent
* @param _data Additional data for the intent
* @param _feeParams Fee parameters including fee amount, deadline, and signature
* @return _intentId The ID of the created intent
* @return _intent The created intent object
*/
function _newIntent(
uint32[] memory _destinations,
address _receiver,
address _inputAsset,
address _outputAsset,
uint256 _amount,
uint24 _maxFee,
uint48 _ttl,
bytes calldata _data,
IFeeAdapter.FeeParams calldata _feeParams
) internal returns (bytes32 _intentId, IEverclear.Intent memory _intent) {
// Send fees to recipient
_handleFees(_feeParams.fee, msg.value, _inputAsset, _feeParams.deadline, _feeParams.sig);
// Approve the spoke contract if needed
_approveSpokeIfNeeded(_inputAsset, _amount);
// Create new intent
(_intentId, _intent) =
spoke.newIntent(_destinations, _receiver, _inputAsset, _outputAsset, _amount, _maxFee, _ttl, _data);
// Emit event
emit IntentWithFeesAdded(_intentId, msg.sender.toBytes32(), _feeParams.fee, msg.value);
return (_intentId, _intent);
}
/**
* @notice Updates the fee recipient
* @param _feeRecipient New recipient
*/
function _updateFeeRecipient(
address _feeRecipient
) internal {
emit FeeRecipientUpdated(_feeRecipient, feeRecipient);
feeRecipient = _feeRecipient;
}
/**
* @notice Updates the fee signer
* @param _feeSigner New signer
*/
function _updateFeeSigner(
address _feeSigner
) internal {
emit FeeSignerUpdated(_feeSigner, feeSigner);
feeSigner = _feeSigner;
}
/**
* @notice Verifies a signature
* @param _data The data of the message
* @param _signature The signature of the message
*/
function _verifySignature(bytes memory _data, bytes calldata _signature) internal view {
bytes32 _hash = keccak256(_data);
address _recoveredSigner = ECDSA.recover(MessageHashUtils.toEthSignedMessageHash(_hash), _signature);
if (_recoveredSigner != feeSigner) {
revert FeeAdapter_InvalidSignature();
}
}
/**
* @notice Sends fees to recipient
* @param _tokenFee Amount in transacting asset to send to recipient
* @param _nativeFee Amount in native asset to send to recipient
*/
function _handleFees(
uint256 _tokenFee,
uint256 _nativeFee,
address _inputAsset,
uint256 _deadline,
bytes calldata _sig
) internal {
// Verify the signature on the fee
_verifySignature(abi.encode(_tokenFee, _nativeFee, _inputAsset, _deadline), _sig);
// Verify the ttl is valid
if (block.timestamp > _deadline) {
revert FeeAdapter_InvalidDeadline();
}
// Handle token fees if exist
if (_tokenFee > 0) {
_pushTokens(feeRecipient, _inputAsset, _tokenFee);
}
// Handle native tokens
if (_nativeFee > 0) {
Address.sendValue(payable(feeRecipient), _nativeFee);
}
}
/**
* @notice Approves the maximum uint value to the gateway.
* @dev Approving the max reduces gas for following intents.
* @param _asset Asset to approve to spoke.
* @param _minimum Minimum required approval budget.
*/
function _approveSpokeIfNeeded(address _asset, uint256 _minimum) internal {
// Checking if the strategy is default or not
address spender;
IEverclear.Strategy _strategy = spoke.strategies(_asset);
if (_strategy == IEverclear.Strategy.DEFAULT) spender = address(spoke);
else spender = xerc20Module;
// Approve the spoke contract if needed
IERC20 _token = IERC20(_asset);
uint256 _current = _token.allowance(address(this), spender);
if (_current >= _minimum) {
return;
}
// Approve to 0
if (_current != 0) {
_token.safeDecreaseAllowance(spender, _current);
}
// Approve to max
_token.safeIncreaseAllowance(spender, type(uint256).max);
}
/**
* @notice Transfers tokens from the caller to this contract using Permit2
* @dev Uses the Permit2 contract to transfer tokens with a signature
* @param _asset The token to transfer
* @param _amount The amount to transfer
* @param _permit2Params The permit2 parameters including nonce, deadline, and signature
*/
function _pullWithPermit2(
address _asset,
uint256 _amount,
IEverclearSpoke.Permit2Params calldata _permit2Params
) internal {
// Transfer from caller using permit2
PERMIT2.permitTransferFrom(
IPermit2.PermitTransferFrom({
permitted: IPermit2.TokenPermissions({token: IERC20(_asset), amount: _amount}),
nonce: _permit2Params.nonce,
deadline: _permit2Params.deadline
}),
IPermit2.SignatureTransferDetails({to: address(this), requestedAmount: _amount}),
msg.sender,
_permit2Params.signature
);
}
/**
* @notice Pull tokens from the sender to the contract
* @param _sender The address of the sender
* @param _asset The address of the asset
* @param _amount The amount of the asset
*/
function _pullTokens(address _sender, address _asset, uint256 _amount) internal {
IERC20(_asset).safeTransferFrom(_sender, address(this), _amount);
}
/**
* @notice Push tokens from the contract to the recipient
* @param _recipient The address of the recipient
* @param _asset The address of the asset
* @param _amount The amount of the asset
*/
function _pushTokens(address _recipient, address _asset, uint256 _amount) internal {
IERC20(_asset).safeTransfer(_recipient, _amount);
}
}
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;
/**
* @title ICallExecutor
* @notice Interface for the CallExecutor contract, executes calls to external contracts
*/
interface ICallExecutor {
/**
* @notice Safely call a target contract, use when you _really_ really _really_ don't trust the called
* contract. This prevents the called contract from causing reversion of the caller in as many ways as we can.
* @param _target The address to call
* @param _gas The amount of gas to forward to the remote contract
* @param _value The value in wei to send to the remote contract
* @param _maxCopy The maximum number of bytes of returndata to copy to memory
* @param _calldata The data to send to the remote contract
* @return _success Whether the call was successful
* @return _returnData Returndata as `.call()`. Returndata is capped to `_maxCopy` bytes.
*/
function excessivelySafeCall(
address _target,
uint256 _gas,
uint256 _value,
uint16 _maxCopy,
bytes memory _calldata
) external returns (bool _success, bytes memory _returnData);
}
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;
/**
* @title IEverclear
* @notice Common interface for EverclearHub and EverclearSpoke
*/
interface IEverclear {
/*//////////////////////////////////////////////////////////////
ENUMS
//////////////////////////////////////////////////////////////*/
/**
* @notice Enum representing statuses of an intent
*/
enum IntentStatus {
NONE, // 0
ADDED, // 1
DEPOSIT_PROCESSED, // 2
FILLED, // 3
ADDED_AND_FILLED, // 4
INVOICED, // 5
SETTLED, // 6
SETTLED_AND_MANUALLY_EXECUTED, // 7
UNSUPPORTED, // 8
UNSUPPORTED_RETURNED // 9
}
/**
* @notice Enum representing asset strategies
*/
enum Strategy {
DEFAULT,
XERC20
}
/*///////////////////////////////////////////////////////////////
STRUCTS
//////////////////////////////////////////////////////////////*/
/**
* @notice The structure of an intent
* @param initiator The address of the intent initiator
* @param receiver The address of the intent receiver
* @param inputAsset The address of the intent asset on origin
* @param outputAsset The address of the intent asset on destination
* @param maxFee The maximum fee that can be taken by solvers
* @param origin The origin chain of the intent
* @param destinations The possible destination chains of the intent
* @param nonce The nonce of the intent
* @param timestamp The timestamp of the intent
* @param ttl The time to live of the intent
* @param amount The amount of the intent asset normalized to 18 decimals
* @param data The data of the intent
*/
struct Intent {
bytes32 initiator;
bytes32 receiver;
bytes32 inputAsset;
bytes32 outputAsset;
uint24 maxFee;
uint32 origin;
uint64 nonce;
uint48 timestamp;
uint48 ttl;
uint256 amount;
uint32[] destinations;
bytes data;
}
/**
* @notice The structure of a fill message
* @param intentId The ID of the intent
* @param solver The address of the intent solver in bytes32 format
* @param initiator The address of the intent initiator
* @param fee The total fee of the expressed in dbps, represents the solver fee plus the sum of protocol fees for the token
* @param executionTimestamp The execution timestamp of the intent
*/
struct FillMessage {
bytes32 intentId;
bytes32 solver;
bytes32 initiator;
uint24 fee;
uint48 executionTimestamp;
}
/**
* @notice The structure of a settlement
* @param intentId The ID of the intent
* @param amount The amount of the asset
* @param asset The address of the asset
* @param recipient The address of the recipient
* @param updateVirtualBalance If set to true, the settlement will not be transferred to the recipient in spoke domain and the virtual balance will be increased
*/
struct Settlement {
bytes32 intentId;
uint256 amount;
bytes32 asset;
bytes32 recipient;
bool updateVirtualBalance;
}
}
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;
import {IEverclear} from 'interfaces/common/IEverclear.sol';
import {ISettlementModule} from 'interfaces/common/ISettlementModule.sol';
import {ISpokeStorage} from './ISpokeStorage.sol';
/**
* @title IEverclearSpoke
* @notice Interface for the EverclearSpoke contract
*/
interface IEverclearSpoke is ISpokeStorage {
/*///////////////////////////////////////////////////////////////
STRUCTS
//////////////////////////////////////////////////////////////*/
/**
* @notice Parameters needed to execute a permit2
* @param nonce The nonce of the permit
* @param deadline The deadline of the permit
* @param signature The signature of the permit
*/
struct Permit2Params {
uint256 nonce;
uint256 deadline;
bytes signature;
}
/*///////////////////////////////////////////////////////////////
EVENTS
//////////////////////////////////////////////////////////////*/
/**
* @notice emitted when a new intent is added on origin
* @param _intentId The ID of the intent
* @param _queueIdx The index of the intent in the IntentQueue
* @param _intent The intent object
*/
event IntentAdded(bytes32 indexed _intentId, uint256 _queueIdx, Intent _intent);
/**
* @notice emitted when an intent is filled on destination
* @param _intentId The ID of the intent
* @param _solver The address of the intent solver
* @param _totalFeeDBPS The total amount of fee deducted from the transferred amount
* @param _queueIdx The index of the FillMessage in the FillQueue
* @param _intent The full intent object
*/
event IntentFilled(
bytes32 indexed _intentId, address indexed _solver, uint256 _totalFeeDBPS, uint256 _queueIdx, Intent _intent
);
/**
* @notice emitted when solver (or anyone) deposits an asset in the EverclearSpoke
* @param _depositant The address of the depositant
* @param _asset The address of the deposited asset
* @param _amount The amount of the deposited asset
*/
event Deposited(address indexed _depositant, address indexed _asset, uint256 _amount);
/**
* @notice emitted when solver (or anyone) withdraws an asset from the EverclearSpoke
* @param _withdrawer The address of the withdrawer
* @param _asset The address of the withdrawn asset
* @param _amount The amount of the withdrawn asset
*/
event Withdrawn(address indexed _withdrawer, address indexed _asset, uint256 _amount);
/**
* @notice Emitted when the intent queue is processed
* @param _messageId The ID of the message
* @param _firstIdx The first index of the queue to be processed
* @param _lastIdx The last index of the queue to be processed
* @param _quote The quote amount
*/
event IntentQueueProcessed(bytes32 indexed _messageId, uint256 _firstIdx, uint256 _lastIdx, uint256 _quote);
/**
* @notice Emitted when the fill queue is processed
* @param _messageId The ID of the message
* @param _firstIdx The first index of the queue to be processed
* @param _lastIdx The last index of the queue to be processed
* @param _quote The quote amount
*/
event FillQueueProcessed(bytes32 indexed _messageId, uint256 _firstIdx, uint256 _lastIdx, uint256 _quote);
/**
* @notice Emitted when an external call is executed
* @param _intentId The ID of the intent
* @param _returnData The return data of the call
*/
event ExternalCalldataExecuted(bytes32 indexed _intentId, bytes _returnData);
/**
* @notice Emitted when feeAdapter is updated
* @param _newFeeAdapter The new fee adapter
*/
event FeeAdapterUpdated(address _newFeeAdapter);
/*///////////////////////////////////////////////////////////////
ERRORS
//////////////////////////////////////////////////////////////*/
/**
* @notice Thrown when the intent is already filled
* @param _intentId The id of the intent which is being tried to fill
*/
error EverclearSpoke_FillIntent_InvalidStatus(bytes32 _intentId);
/**
* @notice Thrown when trying to fill an expired intent
* @param _intentId The id of the intent which is being tried to fill
*/
error EverclearSpoke_FillIntent_IntentExpired(bytes32 _intentId);
/**
* @notice Thrown when calling newIntent with invalid intent parameters
*/
error EverclearSpoke_NewIntent_InvalidIntent();
/**
* @notice Thrown when the maxFee is exceeded
* @param _fee The fee chosen by the user
* @param _maxFee The maximum possible fee
*/
error EverclearSpoke_NewIntent_MaxFeeExceeded(uint256 _fee, uint24 _maxFee);
/**
* @notice Thrown when the intent amount is zero
*/
error EverclearSpoke_NewIntent_ZeroAmount();
/**
* @notice Thrown when the solver doesnt have sufficient funds to fill an intent
* @param _requested The amount of tokens needed to fill the intent
* @param _available The amount of tokens the solver has deposited in the `EverclearSpoke`
*/
error EverclearSpoke_FillIntent_InsufficientFunds(uint256 _requested, uint256 _available);
/**
* @notice Thrown when the fee exceeds the maximum fee
* @param _fee The fee chosen by the solver
* @param _maxFee The actual fee the intent solver set for his intent
*/
error EverclearSpoke_FillIntent_MaxFeeExceeded(uint256 _fee, uint24 _maxFee);
/**
* @notice Thrown when the intent calldata exceeds the limit
*/
error EverclearSpoke_NewIntent_CalldataExceedsLimit();
/**
* @notice Thrown when a signature signer does not match the expected address
*/
error EverclearSpoke_InvalidSignature();
/**
* @notice Thrown when the domain does not match the expected domain
*/
error EverclearSpoke_ProcessFillViaRelayer_WrongDomain();
/**
* @notice Thrown when the relayer address does not match the msg.sender
*/
error EverclearSpoke_ProcessFillViaRelayer_NotRelayer();
/**
* @notice Thrown when the TTL of the message has expired
*/
error EverclearSpoke_ProcessFillViaRelayer_TTLExpired();
/**
* @notice Thrown when processing the intent queue and the intent is not found in the position specified in the parameter
* @param _intentId The id of the intent being processed
* @param _position The position specified by the queue processor
*/
error EverclearSpoke_ProcessIntentQueue_NotFound(bytes32 _intentId, uint256 _position);
/**
* @notice Thrown when trying to execute the calldata of an intent with invalid status
* @param _intentId The id of the intent whose calldata is trying to be executed
*/
error EverclearSpoke_ExecuteIntentCalldata_InvalidStatus(bytes32 _intentId);
/**
* @notice Thrown when the external call failed on executeIntentCalldata
*/
error EverclearSpoke_ExecuteIntentCalldata_ExternalCallFailed();
/*///////////////////////////////////////////////////////////////
LOGIC
//////////////////////////////////////////////////////////////*/
/**
* @notice Pauses the contract
* @dev only the lighthouse and watchtower can pause the contract
*/
function pause() external;
/**
* @notice Unpauses the contract
* @dev only the lighthouse and watchtower can unpause the contract
*/
function unpause() external;
/**
* @notice Sets a minting / burning strategy for an asset
* @param _asset The asset address
* @param _strategy The strategy id (see `enum Strategy`)
*/
function setStrategyForAsset(address _asset, IEverclear.Strategy _strategy) external;
/**
* @notice Sets a module for a strategy
* @param _strategy The strategy id (see `enum Strategy`)
* @param _module The module contract
*/
function setModuleForStrategy(IEverclear.Strategy _strategy, ISettlementModule _module) external;
/**
* @notice Updates the security module
* @param _newSecurityModule The address of the new security module
*/
function updateSecurityModule(
address _newSecurityModule
) external;
/**
* @notice Initialize the EverclearSpoke contract
* @param _init The spoke initialization parameters
*/
function initialize(
SpokeInitializationParams calldata _init
) external;
/**
* @notice Creates a new intent
* @param _destinations The possible destination chains of the intent
* @param _receiver The destinantion address of the intent
* @param _inputAsset The asset address on origin
* @param _outputAsset The asset address on destination
* @param _amount The amount of the asset
* @param _maxFee The maximum fee that can be taken by solvers
* @param _ttl The time to live of the intent
* @param _data The data of the intent
* @return _intentId The ID of the intent
* @return _intent The intent object
*/
function newIntent(
uint32[] memory _destinations,
address _receiver,
address _inputAsset,
address _outputAsset,
uint256 _amount,
uint24 _maxFee,
uint48 _ttl,
bytes calldata _data
) external returns (bytes32 _intentId, Intent calldata _intent);
/**
* @notice Creates a new intent with permit2
* @param _destinations The possible destination chains of the intent
* @param _receiver The destinantion address of the intent
* @param _inputAsset The asset address on origin
* @param _outputAsset The asset address on destination
* @param _amount The amount of the asset
* @param _maxFee The maximum fee that can be taken by solvers
* @param _ttl The time to live of the intent
* @param _data The data of the intent
* @param _permit2Params The parameters needed to execute a permit2
* @return _intentId The ID of the intent
* @return _intent The intent object
*/
function newIntent(
uint32[] memory _destinations,
address _receiver,
address _inputAsset,
address _outputAsset,
uint256 _amount,
uint24 _maxFee,
uint48 _ttl,
bytes calldata _data,
Permit2Params calldata _permit2Params
) external returns (bytes32 _intentId, Intent calldata _intent);
/**
* @notice fills an intent
* @param _intent The intent structure
* @param _fee The total fee, expressed in dbps, represents the solver fee plus the sum of protocol fees for the token
* @return _fillMessage The enqueued fill message
*/
function fillIntent(Intent calldata _intent, uint24 _fee) external returns (FillMessage calldata _fillMessage);
/**
* @notice Allows a relayer to fill an intent for a solver
* @param _solver The address of the solver
* @param _intent The intent structure
* @param _nonce The nonce of the signature
* @param _fee The total fee, expressed in dbps, represents the solver fee plus the sum of protocol fees for the token
* @param _signature The solver signature
* @return _fillMessage The enqueued fill message
*/
function fillIntentForSolver(
address _solver,
Intent calldata _intent,
uint256 _nonce,
uint24 _fee,
bytes calldata _signature
) external returns (FillMessage memory _fillMessage);
/**
* @notice Process the intent queue messages to send a batched message to the transport layer
* @param _intents The intents to process, must respect the intent queue order
*/
function processIntentQueue(
Intent[] calldata _intents
) external payable;
/**
* @notice Process the fill queue messages to send a batched message to the transport layer
* @param _amount The amount of messages to process and batch
*/
function processFillQueue(
uint32 _amount
) external payable;
/**
* @notice Process the intent queue messages to send a batched message to the transport layer (via relayer)
* @param _domain The domain of the message
* @param _intents The intents to process, must respect the intent queue order
* @param _relayer The address of the relayer
* @param _ttl The time to live of the message
* @param _nonce The nonce of the signature
* @param _bufferDBPS The buffer in DBPS to add to the fee
* @param _signature The signature of the data
*/
function processIntentQueueViaRelayer(
uint32 _domain,
Intent[] calldata _intents,
address _relayer,
uint256 _ttl,
uint256 _nonce,
uint256 _bufferDBPS,
bytes calldata _signature
) external;
/**
* @notice Process the fill queue messages to send a batched message to the transport layer (via relayer)
* @param _domain The domain of the message
* @param _amount The amount of messages to process and batch
* @param _relayer The address of the relayer
* @param _ttl The time to live of the message
* @param _nonce The nonce of the signature
* @param _bufferDBPS The buffer in DBPS to add to the fee
* @param _signature The signature of the data
*/
function processFillQueueViaRelayer(
uint32 _domain,
uint32 _amount,
address _relayer,
uint256 _ttl,
uint256 _nonce,
uint256 _bufferDBPS,
bytes calldata _signature
) external;
/**
* @notice deposits an asset into the EverclearSpoke
* @dev should be only called by solvers but it is permissionless, the funds will be used by the solvers to execute intents
* @param _asset The address of the asset
* @param _amount The amount of the asset
*/
function deposit(address _asset, uint256 _amount) external;
/**
* @notice withdraws an asset from the EverclearSpoke
* @dev can be called by solvers or users
* @param _asset The address of the asset
* @param _amount The amount of the asset
*/
function withdraw(address _asset, uint256 _amount) external;
/**
* @notice Updates the gateway
* @param _newGateway The address of the new gateway
*/
function updateGateway(
address _newGateway
) external;
/**
* @notice Updates the message receiver
* @param _newMessageReceiver The address of the new message receiver
*/
function updateMessageReceiver(
address _newMessageReceiver
) external;
/**
* @notice Updates the max gas limit used for outgoing messages
* @param _newGasLimit The new gas limit
*/
function updateMessageGasLimit(
uint256 _newGasLimit
) external;
/**
* @notice Executes the calldata of an intent
* @param _intent The intent object
*/
function executeIntentCalldata(
Intent calldata _intent
) external;
}
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;
import {IEverclear} from 'interfaces/common/IEverclear.sol';
import {ISettlementModule} from 'interfaces/common/ISettlementModule.sol';
import {ISpokeStorage} from './ISpokeStorage.sol';
/**
* @title IEverclearSpoke
* @notice Interface for the EverclearSpoke contract
*/
interface IEverclearSpokeV3 is ISpokeStorage {
/*///////////////////////////////////////////////////////////////
STRUCTS
//////////////////////////////////////////////////////////////*/
/**
* @notice Parameters needed to execute a permit2
* @param nonce The nonce of the permit
* @param deadline The deadline of the permit
* @param signature The signature of the permit
*/
struct Permit2Params {
uint256 nonce;
uint256 deadline;
bytes signature;
}
/*///////////////////////////////////////////////////////////////
EVENTS
//////////////////////////////////////////////////////////////*/
/**
* @notice emitted when a new intent is added on origin
* @param _intentId The ID of the intent
* @param _queueIdx The index of the intent in the IntentQueue
* @param _intent The intent object
*/
event IntentAdded(bytes32 indexed _intentId, uint256 _queueIdx, Intent _intent);
/**
* @notice emitted when an intent is filled on destination
* @param _intentId The ID of the intent
* @param _solver The address of the intent solver
* @param _totalFeeDBPS The total amount of fee deducted from the transferred amount
* @param _queueIdx The index of the FillMessage in the FillQueue
* @param _intent The full intent object
*/
event IntentFilled(
bytes32 indexed _intentId, address indexed _solver, uint256 _totalFeeDBPS, uint256 _queueIdx, Intent _intent
);
/**
* @notice emitted when solver (or anyone) deposits an asset in the EverclearSpoke
* @param _depositant The address of the depositant
* @param _asset The address of the deposited asset
* @param _amount The amount of the deposited asset
*/
event Deposited(address indexed _depositant, address indexed _asset, uint256 _amount);
/**
* @notice emitted when solver (or anyone) withdraws an asset from the EverclearSpoke
* @param _withdrawer The address of the withdrawer
* @param _asset The address of the withdrawn asset
* @param _amount The amount of the withdrawn asset
*/
event Withdrawn(address indexed _withdrawer, address indexed _asset, uint256 _amount);
/**
* @notice Emitted when the intent queue is processed
* @param _messageId The ID of the message
* @param _firstIdx The first index of the queue to be processed
* @param _lastIdx The last index of the queue to be processed
* @param _quote The quote amount
*/
event IntentQueueProcessed(bytes32 indexed _messageId, uint256 _firstIdx, uint256 _lastIdx, uint256 _quote);
/**
* @notice Emitted when the fill queue is processed
* @param _messageId The ID of the message
* @param _firstIdx The first index of the queue to be processed
* @param _lastIdx The last index of the queue to be processed
* @param _quote The quote amount
*/
event FillQueueProcessed(bytes32 indexed _messageId, uint256 _firstIdx, uint256 _lastIdx, uint256 _quote);
/**
* @notice Emitted when an external call is executed
* @param _intentId The ID of the intent
* @param _returnData The return data of the call
*/
event ExternalCalldataExecuted(bytes32 indexed _intentId, bytes _returnData);
/*///////////////////////////////////////////////////////////////
ERRORS
//////////////////////////////////////////////////////////////*/
/**
* @notice Thrown when the intent is already filled
* @param _intentId The id of the intent which is being tried to fill
*/
error EverclearSpoke_FillIntent_InvalidStatus(bytes32 _intentId);
/**
* @notice Thrown when trying to fill an expired intent
* @param _intentId The id of the intent which is being tried to fill
*/
error EverclearSpoke_FillIntent_IntentExpired(bytes32 _intentId);
/**
* @notice Thrown when calling newIntent with invalid intent parameters
*/
error EverclearSpoke_NewIntent_InvalidIntent();
/**
* @notice Thrown when the maxFee is exceeded
* @param _fee The fee chosen by the user
* @param _maxFee The maximum possible fee
*/
error EverclearSpoke_NewIntent_MaxFeeExceeded(uint256 _fee, uint24 _maxFee);
/**
* @notice Thrown when the intent amount is zero
*/
error EverclearSpoke_NewIntent_ZeroAmount();
/**
* @notice Thrown when the solver doesnt have sufficient funds to fill an intent
* @param _requested The amount of tokens needed to fill the intent
* @param _available The amount of tokens the solver has deposited in the `EverclearSpoke`
*/
error EverclearSpoke_FillIntent_InsufficientFunds(uint256 _requested, uint256 _available);
/**
* @notice Thrown when the fee exceeds the maximum fee
* @param _fee The fee chosen by the solver
* @param _maxFee The actual fee the intent solver set for his intent
*/
error EverclearSpoke_FillIntent_MaxFeeExceeded(uint256 _fee, uint24 _maxFee);
/**
* @notice Thrown when the intent calldata exceeds the limit
*/
error EverclearSpoke_NewIntent_CalldataExceedsLimit();
/**
* @notice Thrown when a signature signer does not match the expected address
*/
error EverclearSpoke_InvalidSignature();
/**
* @notice Thrown when the domain does not match the expected domain
*/
error EverclearSpoke_ProcessFillViaRelayer_WrongDomain();
/**
* @notice Thrown when the relayer address does not match the msg.sender
*/
error EverclearSpoke_ProcessFillViaRelayer_NotRelayer();
/**
* @notice Thrown when the TTL of the message has expired
*/
error EverclearSpoke_ProcessFillViaRelayer_TTLExpired();
/**
* @notice Thrown when processing the intent queue and the intent is not found in the position specified in the parameter
* @param _intentId The id of the intent being processed
* @param _position The position specified by the queue processor
*/
error EverclearSpoke_ProcessIntentQueue_NotFound(bytes32 _intentId, uint256 _position);
/**
* @notice Thrown when trying to execute the calldata of an intent with invalid status
* @param _intentId The id of the intent whose calldata is trying to be executed
*/
error EverclearSpoke_ExecuteIntentCalldata_InvalidStatus(bytes32 _intentId);
/**
* @notice Thrown when the external call failed on executeIntentCalldata
*/
error EverclearSpoke_ExecuteIntentCalldata_ExternalCallFailed();
/*///////////////////////////////////////////////////////////////
LOGIC
//////////////////////////////////////////////////////////////*/
/**
* @notice Pauses the contract
* @dev only the lighthouse and watchtower can pause the contract
*/
function pause() external;
/**
* @notice Unpauses the contract
* @dev only the lighthouse and watchtower can unpause the contract
*/
function unpause() external;
/**
* @notice Sets a minting / burning strategy for an asset
* @param _asset The asset address
* @param _strategy The strategy id (see `enum Strategy`)
*/
function setStrategyForAsset(address _asset, IEverclear.Strategy _strategy) external;
/**
* @notice Sets a module for a strategy
* @param _strategy The strategy id (see `enum Strategy`)
* @param _module The module contract
*/
function setModuleForStrategy(IEverclear.Strategy _strategy, ISettlementModule _module) external;
/**
* @notice Updates the security module
* @param _newSecurityModule The address of the new security module
*/
function updateSecurityModule(
address _newSecurityModule
) external;
/**
* @notice Initialize the EverclearSpoke contract
* @param _init The spoke initialization parameters
*/
function initialize(
SpokeInitializationParams calldata _init
) external;
/**
* @notice Creates a new intent
* @param _destinations The possible destination chains of the intent
* @param _receiver The destinantion address of the intent
* @param _inputAsset The asset address on origin
* @param _outputAsset The asset address on destination
* @param _amount The amount of the asset
* @param _maxFee The maximum fee that can be taken by solvers
* @param _ttl The time to live of the intent
* @param _data The data of the intent
* @return _intentId The ID of the intent
* @return _intent The intent object
*/
function newIntent(
uint32[] memory _destinations,
bytes32 _receiver,
address _inputAsset,
bytes32 _outputAsset,
uint256 _amount,
uint24 _maxFee,
uint48 _ttl,
bytes calldata _data
) external returns (bytes32 _intentId, Intent calldata _intent);
/**
* @notice Creates a new intent
* @param _destinations The possible destination chains of the intent
* @param _receiver The destinantion address of the intent
* @param _inputAsset The asset address on origin
* @param _outputAsset The asset address on destination
* @param _amount The amount of the asset
* @param _maxFee The maximum fee that can be taken by solvers
* @param _ttl The time to live of the intent
* @param _data The data of the intent
* @return _intentId The ID of the intent
* @return _intent The intent object
*/
function newIntent(
uint32[] memory _destinations,
address _receiver,
address _inputAsset,
address _outputAsset,
uint256 _amount,
uint24 _maxFee,
uint48 _ttl,
bytes calldata _data
) external returns (bytes32 _intentId, Intent calldata _intent);
/**
* @notice Creates a new intent with permit2
* @param _destinations The possible destination chains of the intent
* @param _receiver The destinantion address of the intent
* @param _inputAsset The asset address on origin
* @param _outputAsset The asset address on destination
* @param _amount The amount of the asset
* @param _maxFee The maximum fee that can be taken by solvers
* @param _ttl The time to live of the intent
* @param _data The data of the intent
* @param _permit2Params The parameters needed to execute a permit2
* @return _intentId The ID of the intent
* @return _intent The intent object
*/
function newIntent(
uint32[] memory _destinations,
address _receiver,
address _inputAsset,
address _outputAsset,
uint256 _amount,
uint24 _maxFee,
uint48 _ttl,
bytes calldata _data,
Permit2Params calldata _permit2Params
) external returns (bytes32 _intentId, Intent calldata _intent);
/**
* @notice fills an intent
* @param _intent The intent structure
* @param _fee The total fee, expressed in dbps, represents the solver fee plus the sum of protocol fees for the token
* @return _fillMessage The enqueued fill message
*/
function fillIntent(Intent calldata _intent, uint24 _fee) external returns (FillMessage calldata _fillMessage);
/**
* @notice Allows a relayer to fill an intent for a solver
* @param _solver The address of the solver
* @param _intent The intent structure
* @param _nonce The nonce of the signature
* @param _fee The total fee, expressed in dbps, represents the solver fee plus the sum of protocol fees for the token
* @param _signature The solver signature
* @return _fillMessage The enqueued fill message
*/
function fillIntentForSolver(
address _solver,
Intent calldata _intent,
uint256 _nonce,
uint24 _fee,
bytes calldata _signature
) external returns (FillMessage memory _fillMessage);
/**
* @notice Process the intent queue messages to send a batched message to the transport layer
* @param _intents The intents to process, must respect the intent queue order
*/
function processIntentQueue(
Intent[] calldata _intents
) external payable;
/**
* @notice Process the fill queue messages to send a batched message to the transport layer
* @param _amount The amount of messages to process and batch
*/
function processFillQueue(
uint32 _amount
) external payable;
/**
* @notice Process the intent queue messages to send a batched message to the transport layer (via relayer)
* @param _domain The domain of the message
* @param _intents The intents to process, must respect the intent queue order
* @param _relayer The address of the relayer
* @param _ttl The time to live of the message
* @param _nonce The nonce of the signature
* @param _bufferDBPS The buffer in DBPS to add to the fee
* @param _signature The signature of the data
*/
function processIntentQueueViaRelayer(
uint32 _domain,
Intent[] calldata _intents,
address _relayer,
uint256 _ttl,
uint256 _nonce,
uint256 _bufferDBPS,
bytes calldata _signature
) external;
/**
* @notice Process the fill queue messages to send a batched message to the transport layer (via relayer)
* @param _domain The domain of the message
* @param _amount The amount of messages to process and batch
* @param _relayer The address of the relayer
* @param _ttl The time to live of the message
* @param _nonce The nonce of the signature
* @param _bufferDBPS The buffer in DBPS to add to the fee
* @param _signature The signature of the data
*/
function processFillQueueViaRelayer(
uint32 _domain,
uint32 _amount,
address _relayer,
uint256 _ttl,
uint256 _nonce,
uint256 _bufferDBPS,
bytes calldata _signature
) external;
/**
* @notice deposits an asset into the EverclearSpoke
* @dev should be only called by solvers but it is permissionless, the funds will be used by the solvers to execute intents
* @param _asset The address of the asset
* @param _amount The amount of the asset
*/
function deposit(address _asset, uint256 _amount) external;
/**
* @notice withdraws an asset from the EverclearSpoke
* @dev can be called by solvers or users
* @param _asset The address of the asset
* @param _amount The amount of the asset
*/
function withdraw(address _asset, uint256 _amount) external;
/**
* @notice Updates the gateway
* @param _newGateway The address of the new gateway
*/
function updateGateway(
address _newGateway
) external;
/**
* @notice Updates the message receiver
* @param _newMessageReceiver The address of the new message receiver
*/
function updateMessageReceiver(
address _newMessageReceiver
) external;
/**
* @notice Updates the max gas limit used for outgoing messages
* @param _newGasLimit The new gas limit
*/
function updateMessageGasLimit(
uint256 _newGasLimit
) external;
/**
* @notice Executes the calldata of an intent
* @param _intent The intent object
*/
function executeIntentCalldata(
Intent calldata _intent
) external;
}
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;
import {IEverclear} from '../common/IEverclear.sol';
import {IEverclearSpoke} from './IEverclearSpoke.sol';
import {IEverclearSpokeV3} from './IEverclearSpokeV3.sol';
import {IPermit2} from 'interfaces/common/IPermit2.sol';
interface IFeeAdapter {
struct OrderParameters {
uint32[] destinations;
address receiver;
address inputAsset;
address outputAsset;
uint256 amount;
uint24 maxFee;
uint48 ttl;
bytes data;
}
struct FeeParams {
uint256 fee;
uint256 deadline;
bytes sig;
}
/**
* @notice Emitted when a new intent is created with fees
* @param _intentId The ID of the created intent
* @param _initiator The address of the user who initiated the intent
* @param _tokenFee The amount of token fees paid
* @param _nativeFee The amount of native token fees paid
*/
event IntentWithFeesAdded(
bytes32 indexed _intentId, bytes32 indexed _initiator, uint256 _tokenFee, uint256 _nativeFee
);
/**
* @notice Emitted when a new order containing multiple intents is created
* @param _orderId The unique identifier for the created order
* @param _initiator The address of the user who initiated the order
* @param _intentIds Array of intent IDs that make up this order
* @param _tokenFee The amount of token fees paid for the order
* @param _nativeFee The amount of native token fees paid for the order
*/
event OrderCreated(
bytes32 indexed _orderId, bytes32 indexed _initiator, bytes32[] _intentIds, uint256 _tokenFee, uint256 _nativeFee
);
/**
* @notice Emitted when the fee recipient is updated
* @param _updated The new fee recipient address
* @param _previous The previous fee recipient address
*/
event FeeRecipientUpdated(address indexed _updated, address indexed _previous);
/**
* @notice Emitted when the fee signer is updated
* @param _updated The new fee signer address
* @param _previous The previous fee signer address
*/
event FeeSignerUpdated(address indexed _updated, address indexed _previous);
/**
* @notice Thrown when there are multiple assets included in a single order request.
*/
error MultipleOrderAssets();
/**
* @notice Thrown when the signature is invalid on fees
*/
error FeeAdapter_InvalidSignature();
/**
* @notice Thrown when the deadline has elapsed
*/
error FeeAdapter_InvalidDeadline();
/**
* @notice Returns the spoke contract address
* @return The EverclearSpoke contract interface
*/
function spoke() external view returns (IEverclearSpokeV3);
/**
* @notice returns the permit2 contract
* @return _permit2 The Permit2 singleton address
*/
function PERMIT2() external view returns (IPermit2 _permit2);
/**
* @notice Returns the current fee recipient address
* @return The address that receives fees
*/
function feeRecipient() external view returns (address);
/**
* @notice Returns the current fee signer address
* @return The address whos signature is verified
*/
function feeSigner() external view returns (address);
/**
* @notice Creates a new intent with fees
* @param _destinations Array of destination domains, preference ordered
* @param _receiver Address of the receiver on the destination chain
* @param _inputAsset Address of the input asset
* @param _outputAsset Address of the output asset
* @param _amount Amount of input asset to use for the intent
* @param _maxFee Maximum fee percentage allowed for the intent
* @param _ttl Time-to-live for the intent in seconds
* @param _data Additional data for the intent
* @param _feeParams Fee parameters including fee amount, deadline, and signature
* @return _intentId The ID of the created intent
* @return _intent The created intent object
*/
function newIntent(
uint32[] memory _destinations,
bytes32 _receiver,
address _inputAsset,
bytes32 _outputAsset,
uint256 _amount,
uint24 _maxFee,
uint48 _ttl,
bytes calldata _data,
FeeParams calldata _feeParams
) external payable returns (bytes32, IEverclear.Intent memory);
/**
* @notice Creates a new intent with fees
* @param _destinations Array of destination domains, preference ordered
* @param _receiver Address of the receiver on the destination chain
* @param _inputAsset Address of the input asset
* @param _outputAsset Address of the output asset
* @param _amount Amount of input asset to use for the intent
* @param _maxFee Maximum fee percentage allowed for the intent
* @param _ttl Time-to-live for the intent in seconds
* @param _data Additional data for the intent
* @param _feeParams Fee parameters including fee amount, deadline, and signature
* @return _intentId The ID of the created intent
* @return _intent The created intent object
*/
function newIntent(
uint32[] memory _destinations,
address _receiver,
address _inputAsset,
address _outputAsset,
uint256 _amount,
uint24 _maxFee,
uint48 _ttl,
bytes calldata _data,
FeeParams calldata _feeParams
) external payable returns (bytes32, IEverclear.Intent memory);
/**
* @notice Creates a new intent with fees using Permit2
* @dev Users will permit the adapter, which will then approve the spoke and call newIntent
* @param _destinations Array of destination domains, preference ordered
* @param _receiver Address of the receiver on the destination chain
* @param _inputAsset Address of the input asset
* @param _outputAsset Address of the output asset
* @param _amount Amount of input asset to use for the intent
* @param _maxFee Maximum fee percentage allowed for the intent
* @param _ttl Time-to-live for the intent in seconds
* @param _data Additional data for the intent
* @param _permit2Params Signed Permit2 payload, with adapter as spender
* @param _feeParams Token fee amount to be sent to the fee recipient
* @return _intentId The ID of the created intent
* @return _intent The created intent object
*/
function newIntent(
uint32[] memory _destinations,
address _receiver,
address _inputAsset,
address _outputAsset,
uint256 _amount,
uint24 _maxFee,
uint48 _ttl,
bytes calldata _data,
IEverclearSpoke.Permit2Params calldata _permit2Params,
FeeParams calldata _feeParams
) external payable returns (bytes32, IEverclear.Intent memory);
/**
* @notice Creates multiple intents with the same parameters, splitting the amount evenly
* @dev Creates _numIntents intents with identical parameters but divides _amount equally among them
* @param _numIntents Number of intents to create
* @param _fee Token fee amount to be sent to the fee recipient
* @param _params Order parameters including destinations, receiver, assets, amount, maxFee, ttl, and data
* @return _orderId The ID of the created order (hash of all intent IDs)
* @return _intentIds Array of all created intent IDs
*/
function newOrderSplitEvenly(
uint32 _numIntents,
uint256 _fee,
uint256 _deadline,
bytes calldata _sig,
OrderParameters memory _params
) external payable returns (bytes32, bytes32[] memory);
/**
* @notice Creates multiple intents with the supplied parameters
* @param _fee Token fee amount to be sent to the fee recipient
* @param _params Order parameters including destinations, receiver, assets, amount, maxFee, ttl, and data
* @return _orderId The ID of the created order (hash of all intent IDs)
* @return _intentIds Array of all created intent IDs
*/
function newOrder(
uint256 _fee,
uint256 _deadline,
bytes calldata _sig,
OrderParameters[] memory _params
) external payable returns (bytes32, bytes32[] memory);
/**
* @notice Updates the fee recipient address
* @dev Can only be called by the owner of the contract
* @param _feeRecipient The new address that will receive fees
*/
function updateFeeRecipient(
address _feeRecipient
) external;
/**
* @notice Updates the fee signer address
* @dev Can only be called by the owner of the contract
* @param _feeSigner The new address that will sign for fees
*/
function updateFeeSigner(
address _feeSigner
) external;
/**
* @notice Send virtual balance to the original recipient
* @param _asset Address of the asset to return
* @param _amount Amount of the asset to return
* @param _recipient Address of the recipient
*/
function returnUnsupportedIntent(address _asset, uint256 _amount, address _recipient) external;
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import {IMailbox} from '@hyperlane/interfaces/IMailbox.sol';
import {IMessageReceiver} from 'interfaces/common/IMessageReceiver.sol';
interface IGateway {
/*///////////////////////////////////////////////////////////////
EVENTS
//////////////////////////////////////////////////////////////*/
/**
* @notice Emitted when the mailbox is updated
* @param _oldMailbox The old mailbox address
* @param _newMailbox The new mailbox address
*/
event MailboxUpdated(address _oldMailbox, address _newMailbox);
/**
* @notice Emitted when the security module is updated
* @param _oldSecurityModule The old security module address
* @param _newSecurityModule The new security module address
*/
event SecurityModuleUpdated(address _oldSecurityModule, address _newSecurityModule);
/*///////////////////////////////////////////////////////////////
ERRORS
//////////////////////////////////////////////////////////////*/
/**
* @notice Thrown when the message origin is invalid
*/
error Gateway_Handle_InvalidOriginDomain();
/**
* @notice Thrown when the sender is not the appropriate remote Gateway
*/
error Gateway_Handle_InvalidSender();
/**
* @notice Thrown when the caller is not the local mailbox
*/
error Gateway_Handle_NotCalledByMailbox();
/**
* @notice Thrown when the GasTank does not have enough native asset to cover the fee
*/
error Gateway_SendMessage_InsufficientBalance();
/**
* @notice Thrown when the message dispatcher is not the local receiver
*/
error Gateway_SendMessage_UnauthorizedCaller();
/**
* @notice Thrown when the call returning the unused fee fails
*/
error Gateway_SendMessage_UnsuccessfulRebate();
/**
* @notice Thrown when an address equals the address zero
*/
error Gateway_ZeroAddress();
/*///////////////////////////////////////////////////////////////
LOGIC
//////////////////////////////////////////////////////////////*/
/**
* @notice Send a message to the transport layer using the gas tank
* @param _chainId The id of the destination chain
* @param _message The message to send
* @param _fee The fee to send the message
* @param _gasLimit The gas limit to use on destination
* @return _messageId The id message of the transport layer
* @return _feeSpent The fee spent to send the message
* @dev only called by the spoke contract
*/
function sendMessage(
uint32 _chainId,
bytes memory _message,
uint256 _fee,
uint256 _gasLimit
) external returns (bytes32 _messageId, uint256 _feeSpent);
/**
* @notice Send a message to the transport layer
* @param _chainId The id of the destination chain
* @param _message The message to send
* @param _gasLimit The gas limit to use on destination
* @return _messageId The id message of the transport layer
* @return _feeSpent The fee spent to send the message
* @dev only called by the spoke contract
*/
function sendMessage(
uint32 _chainId,
bytes memory _message,
uint256 _gasLimit
) external payable returns (bytes32 _messageId, uint256 _feeSpent);
/**
* @notice Updates the mailbox
* @param _mailbox The new mailbox address
* @dev only called by the `receiver`
*/
function updateMailbox(
address _mailbox
) external;
/**
* @notice Updates the gateway security module
* @param _securityModule The address of the new security module
* @dev only called by the `receiver`
*/
function updateSecurityModule(
address _securityModule
) external;
/*///////////////////////////////////////////////////////////////
VIEWS
//////////////////////////////////////////////////////////////*/
/**
* @notice Returns the transport layer message routing smart contract
* @dev this is independent of the transport layer used, adopting mailbox name because its descriptive enough
* using address instead of specific interface to be independent from HL or any other TL
* @return _mailbox The mailbox contract
*/
function mailbox() external view returns (IMailbox _mailbox);
/**
* @notice Returns the message receiver for this Gateway (EverclearHub / EverclearSpoke)
* @return _receiver The message receiver
*/
function receiver() external view returns (IMessageReceiver _receiver);
/**
* @notice Quotes cost of sending a message to the transport layer
* @param _chainId The id of the destination chain
* @param _message The message to send
* @param _gasLimit The gas limit for delivering the message
* @return _fee The fee to send the message
*/
function quoteMessage(uint32 _chainId, bytes memory _message, uint256 _gasLimit) external view returns (uint256 _fee);
}
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;
/**
* @title IMessageReceiver
* @notice Interface for the transport layer communication with the message receiver
*/
interface IMessageReceiver {
/*///////////////////////////////////////////////////////////////
LOGIC
//////////////////////////////////////////////////////////////*/
/**
* @notice Receive a message from the transport layer
* @param _message The message to receive encoded as bytes
* @dev This function should be called by the the gateway contract
*/
function receiveMessage(
bytes calldata _message
) external;
}
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;
import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';
/**
* @title IPermit2
* @notice Interface for permit2
*/
interface IPermit2 {
/*///////////////////////////////////////////////////////////////
STRUCTS
//////////////////////////////////////////////////////////////*/
/**
* @notice Struct for token and amount in a permit message
* @param token The token to transfer
* @param amount The amount to transfer
*/
struct TokenPermissions {
IERC20 token;
uint256 amount;
}
/**
* @notice Struct for the permit2 message
* @param permitted The permitted token and amount
* @param nonce The unique identifier for this permit
* @param deadline The expiration for this permit
*/
struct PermitTransferFrom {
TokenPermissions permitted;
uint256 nonce;
uint256 deadline;
}
/**
* @notice Struct for the transfer details for permitTransferFrom()
* @param to The recipient of the tokens
* @param requestedAmount The amount to transfer
*/
struct SignatureTransferDetails {
address to;
uint256 requestedAmount;
}
/*///////////////////////////////////////////////////////////////
LOGIC
//////////////////////////////////////////////////////////////*/
/**
* @notice Consume a permit2 message and transfer tokens
* @param permit The permit message
* @param transferDetails The transfer details
* @param owner The owner of the tokens
* @param signature The signature of the permit
*/
function permitTransferFrom(
PermitTransferFrom calldata permit,
SignatureTransferDetails calldata transferDetails,
address owner,
bytes calldata signature
) external;
}
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;
/**
* @title ISettlementModule
* @notice Interface for the base settlement module
*/
interface ISettlementModule {
/*///////////////////////////////////////////////////////////////
LOGIC
//////////////////////////////////////////////////////////////*/
/**
* @notice Handle a mint action for a specific strategy
* @param _asset The address of the asset to mint
* @param _recipient The recipient of the minted assets
* @param _fallbackRecipient The fallback recipient of the minted assets (in case of failure)
* @param _amount The amount to mint
* @param _data Extra data needed by some modules
* @return _success The outcome of the minting strategy
* @dev In case of failure, the parent module will handle the operation accordingly
*/
function handleMintStrategy(
address _asset,
address _recipient,
address _fallbackRecipient,
uint256 _amount,
bytes calldata _data
) external returns (bool _success);
/**
* @notice Handle a burn action for a specific strategy
* @param _asset The address of the asset to burn
* @param _user The user whose assets are being burned
* @param _amount The amount to burn
* @param _data Extra data needed by some modules
* @dev In case of failure, the `newIntent` flow will revert
*/
function handleBurnStrategy(address _asset, address _user, uint256 _amount, bytes calldata _data) external;
}
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;
import {IGateway} from 'interfaces/common/IGateway.sol';
/**
* @title ISpokeGateway
* @notice Interface for the SpokeGateway contract, sends and receives messages to and from the transport layer
*/
interface ISpokeGateway is IGateway {
/*///////////////////////////////////////////////////////////////
LOGIC
//////////////////////////////////////////////////////////////*/
/**
* @notice Initialize Gateway variables
* @param _owner The address of the owner
* @param _mailbox The address of the local mailbox
* @param _receiver The address of the local message receiver (EverclearSpoke)
* @param _interchainSecurityModule The address of the chosen interchain security module
* @param _everclearId The id of the Everclear domain
* @param _hubGateway The bytes32 representation of the Hub gateway
* @dev Only called once on initialization
*/
function initialize(
address _owner,
address _mailbox,
address _receiver,
address _interchainSecurityModule,
uint32 _everclearId,
bytes32 _hubGateway
) external;
/*///////////////////////////////////////////////////////////////
VIEWS
//////////////////////////////////////////////////////////////*/
/**
* @notice Returns the Everclear hub chain id
* @return _hubChainId The Everclear chain id
*/
function EVERCLEAR_ID() external view returns (uint32 _hubChainId);
/**
* @notice Returns the `HubGateway` gateway address
* @return _hubGateway The `HubGateway` address
*/
function EVERCLEAR_GATEWAY() external view returns (bytes32 _hubGateway);
}
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;
import {IEverclear} from 'interfaces/common/IEverclear.sol';
import {IPermit2} from 'interfaces/common/IPermit2.sol';
import {ISettlementModule} from 'interfaces/common/ISettlementModule.sol';
import {ICallExecutor} from 'interfaces/intent/ICallExecutor.sol';
import {ISpokeGateway} from 'interfaces/intent/ISpokeGateway.sol';
/**
* @title ISpokeStorage
* @notice Interface for the SpokeStorage contract
*/
interface ISpokeStorage is IEverclear {
/*///////////////////////////////////////////////////////////////
STRUCTS
//////////////////////////////////////////////////////////////*/
/**
* @notice Parameters needed to initiliaze `EverclearSpoke`
* @param gateway The local `SpokeGateway`
* @param callExecutor The local `CallExecutor`
* @param messageReceiver The address for the `SpokeMessageReceiver` module
* @param lighthouse The address for the Lighthouse agent
* @param watchtower The address for the Watchtower agent
* @param hubDomain The chain id for the Everclear domain
* @param owner The initial owner of the contract
*/
struct SpokeInitializationParams {
ISpokeGateway gateway;
ICallExecutor callExecutor;
address messageReceiver;
address lighthouse;
address watchtower;
uint32 hubDomain;
address owner;
}
/*///////////////////////////////////////////////////////////////
EVENTS
//////////////////////////////////////////////////////////////*/
/**
* @notice emitted when the Gateway address is updated
* @param _oldGateway The address of the old gateway
* @param _newGateway The address of the new gateway
*/
event GatewayUpdated(address _oldGateway, address _newGateway);
/**
* @notice emitted when the Lighthouse address is updated
* @param _oldLightHouse The address of the old lighthouse
* @param _newLightHouse The address of the new lighthouse
*/
event LighthouseUpdated(address _oldLightHouse, address _newLightHouse);
/**
* @notice emitted when the Watchtower address is updated
* @param _oldWatchtower The address of the old watchtower
* @param _newWatchtower The address of the new watchtower
*/
event WatchtowerUpdated(address _oldWatchtower, address _newWatchtower);
/**
* @notice emitted when the MessageReceiver address is updated
* @param _oldMessageReceiver The address of the old message receiver
* @param _newMessageReceiver The address of the new message receiver
*/
event MessageReceiverUpdated(address _oldMessageReceiver, address _newMessageReceiver);
/**
* @notice emitted when messageGasLimit is updated
* @param _oldGasLimit The old gas limit
* @param _newGasLimit The new gas limit
*/
event MessageGasLimitUpdated(uint256 _oldGasLimit, uint256 _newGasLimit);
/**
* @notice emitted when the protocol is paused (domain-level)
*/
event Paused();
/**
* @notice emitted when the protocol is paused (domain-level)
*/
event Unpaused();
/**
* @notice emitted when a strategy is set for an asset
* @param _asset The address of the asset being configured
* @param _strategy The id for the strategy (see `enum Strategy`)
*/
event StrategySetForAsset(address _asset, IEverclear.Strategy _strategy);
/**
* @notice emitted when the module is set for a strategy
* @param _strategy The id for the strategy (see `enum Strategy`)
* @param _module The settlement module
*/
event ModuleSetForStrategy(IEverclear.Strategy _strategy, ISettlementModule _module);
/**
* @notice emitted when the EverclearSpoke processes a settlement
* @param _intentId The ID of the intent
* @param _account The address of the account
* @param _asset The address of the asset
* @param _amount The amount of the asset
*/
event Settled(bytes32 indexed _intentId, address _account, address _asset, uint256 _amount);
/**
* @notice emitted when `_handleSettlement` fails to transfer tokens to a user (eg. blacklisted recipient)
* @param _asset The address of the asset
* @param _recipient The address of the recipient
* @param _amount The amount of the asset
*/
event AssetTransferFailed(address indexed _asset, address indexed _recipient, uint256 _amount);
/**
* @notice emitted when `_handleSettlement` fails to mint the non-default stategy asset
* @param _asset The address of the asset
* @param _recipient The address of the recipient
* @param _amount The amount of the asset
* @param _strategy The strategy used for the asset
*/
event AssetMintFailed(address indexed _asset, address indexed _recipient, uint256 _amount, Strategy _strategy);
/*///////////////////////////////////////////////////////////////
ERRORS
//////////////////////////////////////////////////////////////*/
/**
* @notice Thrown when the spoke is receiving a message from an address that is not the authorized gateway, admin or owner
*/
error EverclearSpoke_Unauthorized();
/**
* @notice Thrown when a message is not a valid message type
*/
error EverclearSpoke_InvalidMessageType();
/**
* @notice Thrown when the destination is wrong
*/
error EverclearSpoke_WrongDestination();
/**
* @notice Thrown when a variable update is invalid
*/
error EverclearSpoke_InvalidVarUpdate();
/**
* @notice Thrown when calling to a processQueue method with a zero amount
*/
error EverclearSpoke_ProcessQueue_ZeroAmount();
/**
* @notice Thrown when calling to a processQueue method with an invalid amount
* @param _first The index of the first element of the queue
* @param _last The index of the last element of the queue
* @param _amount The amount of items being tried to process
*/
error EverclearSpoke_ProcessQueue_InvalidAmount(uint256 _first, uint256 _last, uint256 _amount);
/**
* @notice Thrown when calling a function with the zero address
*/
error EverclearSpoke_ZeroAddress();
/**
* @notice Thrown when a function is called when the spoke is paused
*/
error EverclearSpoke_Paused();
/**
* @notice Thrown when the caller is not authorized to pause the spoke
*/
error EverclearSpoke_Pause_NotAuthorized();
/*///////////////////////////////////////////////////////////////
VIEWS
//////////////////////////////////////////////////////////////*/
/**
* @notice returns the typehash for `fillIntentForSolver`
* @return _typeHash The `fillIntentForSolver` type hash
*/
function FILL_INTENT_FOR_SOLVER_TYPEHASH() external view returns (bytes32 _typeHash);
/**
* @notice returns the typehash for `processIntentQueueViaRelayer`
* @return _typeHash The `processIntentQueueViaRelayer` type hash
*/
function PROCESS_INTENT_QUEUE_VIA_RELAYER_TYPEHASH() external view returns (bytes32 _typeHash);
/**
* @notice returns the typehash for `processFillQueueViaRelayer`
* @return _typeHash The `processFillQueueViaRelayer` type hash
*/
function PROCESS_FILL_QUEUE_VIA_RELAYER_TYPEHASH() external view returns (bytes32 _typeHash);
/**
* @notice returns the permit2 contract
* @return _permit2 The Permit2 singleton address
*/
function PERMIT2() external view returns (IPermit2 _permit2);
/**
* @notice returns the domain id for the Everclear rollup
* @return _domain The id of the Everclear domain
*/
function EVERCLEAR() external view returns (uint32 _domain);
/**
* @notice returns the current domain
* @return _domain The id of the current domain
*/
function DOMAIN() external view returns (uint32 _domain);
/**
* @notice returns the lighthouse address
* @return _lighthouse The address of the Lighthouse agent
*/
function lighthouse() external view returns (address _lighthouse);
/**
* @notice returns the watchtower address
* @return _watchtower The address of the Watchtower agent
*/
function watchtower() external view returns (address _watchtower);
/**
* @notice returns the message receiver address
* @return _messageReceiver The address of the `SpokeMessageReceiver`
*/
function messageReceiver() external view returns (address _messageReceiver);
/**
* @notice returns the gateway
* @return _gateway The local `SpokeGateway`
*/
function gateway() external view returns (ISpokeGateway _gateway);
/**
* @notice returns the call executor
* @return _callExecutor The local `CallExecutor`
*/
function callExecutor() external view returns (ICallExecutor _callExecutor);
/**
* @notice returns the paused status of the spoke
* @return _paused The boolean indicating if the contract is paused
*/
function paused() external view returns (bool _paused);
/**
* @notice returns the current intent nonce
* @return _nonce The current nonce
*/
function nonce() external view returns (uint64 _nonce);
/**
* @notice returns the gas limit used for outgoing messages
* @return _messageGasLimit the max gas limit
*/
function messageGasLimit() external view returns (uint256 _messageGasLimit);
/**
* @notice returns the balance of an asset for a user
* @param _asset The address of the asset
* @param _user The address of the user
* @return _amount The amount of assets locked in the contract
*/
function balances(bytes32 _asset, bytes32 _user) external view returns (uint256 _amount);
/**
* @notice returns the status of an intent
* @param _intentId The ID of the intent
* @return _status The status of the intent
*/
function status(
bytes32 _intentId
) external view returns (IntentStatus _status);
/**
* @notice returns the configured strategy id for an asset
* @param _asset The address of the asset
* @return _strategy The strategy for the asset
*/
function strategies(
address _asset
) external view returns (IEverclear.Strategy _strategy);
/**
* @notice returns the module address for a strategy
* @param _strategy The strategy id
* @return _module The strategy module
*/
function modules(
IEverclear.Strategy _strategy
) external view returns (ISettlementModule _module);
}
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity 0.8.25;
/**
* @title TypeCasts
* @notice Library for type casts
*/
library TypeCasts {
// alignment preserving cast
/**
* @notice Cast an address to a bytes32
* @param _addr The address to cast
*/
function toBytes32(
address _addr
) internal pure returns (bytes32) {
return bytes32(uint256(uint160(_addr)));
}
// alignment preserving cast
/**
* @notice Cast a bytes32 to an address
* @param _buf The bytes32 to cast
*/
function toAddress(
bytes32 _buf
) internal pure returns (address) {
return address(uint160(uint256(_buf)));
}
}
{
"compilationTarget": {
"src/contracts/intent/FeeAdapter.sol": "FeeAdapter"
},
"evmVersion": "cancun",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 10000
},
"remappings": [
":@eth-optimism/=../../node_modules/@eth-optimism/",
":@hyperlane-xyz/=../../node_modules/@hyperlane-xyz/",
":@hyperlane/=../../node_modules/@hyperlane-xyz/core/contracts/",
":@layerzerolabs/=../../node_modules/@layerzerolabs/",
":@openzeppelin/=../../node_modules/@openzeppelin/",
":@upgrades/=lib/openzeppelin-foundry-upgrades/src/",
":contracts/=src/contracts/",
":ds-test/=../../node_modules/ds-test/src/",
":erc4626-tests/=lib/xerc20/lib/openzeppelin-contracts/lib/erc4626-tests/",
":forge-gas-snapshot/=lib/xerc20/lib/permit2/lib/forge-gas-snapshot/src/",
":forge-std/=../../node_modules/forge-std/src/",
":fx-portal/=../../node_modules/fx-portal/",
":interfaces/=src/interfaces/",
":isolmate/=../../node_modules/isolmate/src/",
":openzeppelin-contracts/=lib/xerc20/lib/openzeppelin-contracts/",
":openzeppelin-foundry-upgrades/=lib/openzeppelin-foundry-upgrades/src/",
":openzeppelin/=lib/xerc20/lib/openzeppelin-contracts/contracts/",
":permit2/=lib/xerc20/lib/permit2/",
":prb-test/=lib/xerc20/lib/prb-test/src/",
":prb/test/=lib/xerc20/lib/prb-test/src/",
":solidity-stringutils/=lib/openzeppelin-foundry-upgrades/lib/solidity-stringutils/",
":solmate/=lib/xerc20/lib/permit2/lib/solmate/",
":utils/=script/utils/",
":xerc20/=lib/xerc20/solidity/contracts/"
]
}
[{"inputs":[{"internalType":"address","name":"_spoke","type":"address"},{"internalType":"address","name":"_feeRecipient","type":"address"},{"internalType":"address","name":"_feeSigner","type":"address"},{"internalType":"address","name":"_xerc20Module","type":"address"},{"internalType":"address","name":"_owner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"ECDSAInvalidSignature","type":"error"},{"inputs":[{"internalType":"uint256","name":"length","type":"uint256"}],"name":"ECDSAInvalidSignatureLength","type":"error"},{"inputs":[{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"ECDSAInvalidSignatureS","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"FeeAdapter_InvalidDeadline","type":"error"},{"inputs":[],"name":"FeeAdapter_InvalidSignature","type":"error"},{"inputs":[],"name":"MultipleOrderAssets","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"currentAllowance","type":"uint256"},{"internalType":"uint256","name":"requestedDecrease","type":"uint256"}],"name":"SafeERC20FailedDecreaseAllowance","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_updated","type":"address"},{"indexed":true,"internalType":"address","name":"_previous","type":"address"}],"name":"FeeRecipientUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_updated","type":"address"},{"indexed":true,"internalType":"address","name":"_previous","type":"address"}],"name":"FeeSignerUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"_intentId","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"_initiator","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"_tokenFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_nativeFee","type":"uint256"}],"name":"IntentWithFeesAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"_orderId","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"_initiator","type":"bytes32"},{"indexed":false,"internalType":"bytes32[]","name":"_intentIds","type":"bytes32[]"},{"indexed":false,"internalType":"uint256","name":"_tokenFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_nativeFee","type":"uint256"}],"name":"OrderCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"PERMIT2","outputs":[{"internalType":"contract IPermit2","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"feeRecipient","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeSigner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32[]","name":"_destinations","type":"uint32[]"},{"internalType":"bytes32","name":"_receiver","type":"bytes32"},{"internalType":"address","name":"_inputAsset","type":"address"},{"internalType":"bytes32","name":"_outputAsset","type":"bytes32"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint24","name":"_maxFee","type":"uint24"},{"internalType":"uint48","name":"_ttl","type":"uint48"},{"internalType":"bytes","name":"_data","type":"bytes"},{"components":[{"internalType":"uint256","name":"fee","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"bytes","name":"sig","type":"bytes"}],"internalType":"struct IFeeAdapter.FeeParams","name":"_feeParams","type":"tuple"}],"name":"newIntent","outputs":[{"internalType":"bytes32","name":"_intentId","type":"bytes32"},{"components":[{"internalType":"bytes32","name":"initiator","type":"bytes32"},{"internalType":"bytes32","name":"receiver","type":"bytes32"},{"internalType":"bytes32","name":"inputAsset","type":"bytes32"},{"internalType":"bytes32","name":"outputAsset","type":"bytes32"},{"internalType":"uint24","name":"maxFee","type":"uint24"},{"internalType":"uint32","name":"origin","type":"uint32"},{"internalType":"uint64","name":"nonce","type":"uint64"},{"internalType":"uint48","name":"timestamp","type":"uint48"},{"internalType":"uint48","name":"ttl","type":"uint48"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint32[]","name":"destinations","type":"uint32[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct IEverclear.Intent","name":"_intent","type":"tuple"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint32[]","name":"_destinations","type":"uint32[]"},{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"address","name":"_inputAsset","type":"address"},{"internalType":"address","name":"_outputAsset","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint24","name":"_maxFee","type":"uint24"},{"internalType":"uint48","name":"_ttl","type":"uint48"},{"internalType":"bytes","name":"_data","type":"bytes"},{"components":[{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct IEverclearSpoke.Permit2Params","name":"_permit2Params","type":"tuple"},{"components":[{"internalType":"uint256","name":"fee","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"bytes","name":"sig","type":"bytes"}],"internalType":"struct IFeeAdapter.FeeParams","name":"_feeParams","type":"tuple"}],"name":"newIntent","outputs":[{"internalType":"bytes32","name":"_intentId","type":"bytes32"},{"components":[{"internalType":"bytes32","name":"initiator","type":"bytes32"},{"internalType":"bytes32","name":"receiver","type":"bytes32"},{"internalType":"bytes32","name":"inputAsset","type":"bytes32"},{"internalType":"bytes32","name":"outputAsset","type":"bytes32"},{"internalType":"uint24","name":"maxFee","type":"uint24"},{"internalType":"uint32","name":"origin","type":"uint32"},{"internalType":"uint64","name":"nonce","type":"uint64"},{"internalType":"uint48","name":"timestamp","type":"uint48"},{"internalType":"uint48","name":"ttl","type":"uint48"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint32[]","name":"destinations","type":"uint32[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct IEverclear.Intent","name":"_intent","type":"tuple"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint32[]","name":"_destinations","type":"uint32[]"},{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"address","name":"_inputAsset","type":"address"},{"internalType":"address","name":"_outputAsset","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint24","name":"_maxFee","type":"uint24"},{"internalType":"uint48","name":"_ttl","type":"uint48"},{"internalType":"bytes","name":"_data","type":"bytes"},{"components":[{"internalType":"uint256","name":"fee","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"bytes","name":"sig","type":"bytes"}],"internalType":"struct IFeeAdapter.FeeParams","name":"_feeParams","type":"tuple"}],"name":"newIntent","outputs":[{"internalType":"bytes32","name":"_intentId","type":"bytes32"},{"components":[{"internalType":"bytes32","name":"initiator","type":"bytes32"},{"internalType":"bytes32","name":"receiver","type":"bytes32"},{"internalType":"bytes32","name":"inputAsset","type":"bytes32"},{"internalType":"bytes32","name":"outputAsset","type":"bytes32"},{"internalType":"uint24","name":"maxFee","type":"uint24"},{"internalType":"uint32","name":"origin","type":"uint32"},{"internalType":"uint64","name":"nonce","type":"uint64"},{"internalType":"uint48","name":"timestamp","type":"uint48"},{"internalType":"uint48","name":"ttl","type":"uint48"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint32[]","name":"destinations","type":"uint32[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct IEverclear.Intent","name":"_intent","type":"tuple"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fee","type":"uint256"},{"internalType":"uint256","name":"_deadline","type":"uint256"},{"internalType":"bytes","name":"_sig","type":"bytes"},{"components":[{"internalType":"uint32[]","name":"destinations","type":"uint32[]"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"address","name":"inputAsset","type":"address"},{"internalType":"address","name":"outputAsset","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint24","name":"maxFee","type":"uint24"},{"internalType":"uint48","name":"ttl","type":"uint48"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct IFeeAdapter.OrderParameters[]","name":"_params","type":"tuple[]"}],"name":"newOrder","outputs":[{"internalType":"bytes32","name":"_orderId","type":"bytes32"},{"internalType":"bytes32[]","name":"_intentIds","type":"bytes32[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_numIntents","type":"uint32"},{"internalType":"uint256","name":"_fee","type":"uint256"},{"internalType":"uint256","name":"_deadline","type":"uint256"},{"internalType":"bytes","name":"_sig","type":"bytes"},{"components":[{"internalType":"uint32[]","name":"destinations","type":"uint32[]"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"address","name":"inputAsset","type":"address"},{"internalType":"address","name":"outputAsset","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint24","name":"maxFee","type":"uint24"},{"internalType":"uint48","name":"ttl","type":"uint48"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct IFeeAdapter.OrderParameters","name":"_params","type":"tuple"}],"name":"newOrderSplitEvenly","outputs":[{"internalType":"bytes32","name":"_orderId","type":"bytes32"},{"internalType":"bytes32[]","name":"_intentIds","type":"bytes32[]"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_recipient","type":"address"}],"name":"returnUnsupportedIntent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"spoke","outputs":[{"internalType":"contract IEverclearSpokeV3","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_feeRecipient","type":"address"}],"name":"updateFeeRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_feeSigner","type":"address"}],"name":"updateFeeSigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"xerc20Module","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]