feat: Take reactor address as input to UniswapXFiller
- Put reactor zero address check in separate line for more easy debugging. - Also includes other small cosmetic changes.
This commit is contained in:
@@ -3,7 +3,6 @@ pragma solidity ^0.8.26;
|
||||
|
||||
/// @dev external struct including a generic encoded order and swapper signature
|
||||
/// The order bytes will be parsed and mapped to a ResolvedOrder in the concrete reactor contract
|
||||
|
||||
struct SignedOrder {
|
||||
bytes order;
|
||||
bytes sig;
|
||||
@@ -41,8 +40,8 @@ struct OutputToken {
|
||||
uint256 amount;
|
||||
address recipient;
|
||||
}
|
||||
/// @dev generic concrete order that specifies exact tokens which need to be sent and received
|
||||
|
||||
/// @dev generic concrete order that specifies exact tokens which need to be sent and received
|
||||
struct ResolvedOrder {
|
||||
OrderInfo info;
|
||||
InputToken input;
|
||||
|
||||
@@ -16,8 +16,7 @@ contract UniswapXFiller is AccessControl, IReactorCallback {
|
||||
using SafeERC20 for IERC20;
|
||||
|
||||
// UniswapX V2DutchOrder Reactor
|
||||
IReactor public constant USXEDAReactor =
|
||||
IReactor(0x00000011F84B9aa48e5f8aA8B9897600006289Be);
|
||||
IReactor public immutable USXEDAReactor;
|
||||
address public immutable tychoRouter;
|
||||
|
||||
// keccak256("NAME_OF_ROLE") : save gas on deployment
|
||||
@@ -30,12 +29,14 @@ contract UniswapXFiller is AccessControl, IReactorCallback {
|
||||
address indexed token, uint256 amount, address indexed receiver
|
||||
);
|
||||
|
||||
constructor(address _tychoRouter) {
|
||||
constructor(address _tychoRouter, address _reactor) {
|
||||
if (_tychoRouter == address(0)) revert UniswapXFiller__AddressZero();
|
||||
if (_reactor == address(0)) revert UniswapXFiller__AddressZero();
|
||||
|
||||
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
|
||||
_grantRole(REACTOR_ROLE, address(USXEDAReactor));
|
||||
tychoRouter = _tychoRouter;
|
||||
USXEDAReactor = IReactor(_reactor);
|
||||
}
|
||||
|
||||
function execute(SignedOrder calldata order, bytes calldata callbackData)
|
||||
@@ -65,7 +66,7 @@ contract UniswapXFiller is AccessControl, IReactorCallback {
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Allows withdrawing any ERC20 funds if funds get stuck in case of a bug.
|
||||
* @dev Allows withdrawing any ERC20 funds.
|
||||
*/
|
||||
function withdraw(IERC20[] memory tokens, address receiver)
|
||||
external
|
||||
@@ -84,8 +85,7 @@ contract UniswapXFiller is AccessControl, IReactorCallback {
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Allows withdrawing any NATIVE funds if funds get stuck in case of a bug.
|
||||
* The contract should never hold any NATIVE tokens for security reasons.
|
||||
* @dev Allows withdrawing any NATIVE funds.
|
||||
*/
|
||||
function withdrawNative(address receiver)
|
||||
external
|
||||
|
||||
Reference in New Issue
Block a user