Skip to content
Verified contractPartialMIT

JITSettlerTreasury

Address0xbeff157f7d8cce278cc33d2d31d7a34a6d3c326d
Balance

0 ETH

 

Transactions

1

 

Compiler

solc 0.8.30

 

Same code

1 more contract

 

Details

Compiler
solc 0.8.30+commit.73712a01
Language
solidity
Optimization
Yes, 1,000 runs
EVM version
osaka
Via IR
yes
License
MIT
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
26,290,354
Creation transaction
0x99eace033c…dc29a2f160

src/JITSettlerTreasury.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import { SafeERC20Min } from "./libraries/SafeERC20Min.sol";

/// @title JITSettlerTreasury (RFC 2026-10-15)
/// @notice Where `JITSettler` sends each swap's `postingChargeOut` (the posted price of the
///         order's own update tx, in `tokenOut`) plus `feeOut` (0 in v1). `JITSettler` holds this
///         address as an immutable and never calls it; it only receives ERC-20 transfers.
///
///         The one mutable party. Owned by a hotkey (an EOA) in v1, which sweeps the balances.
///         Rotating the hotkey, or handing the treasury to a Safe once fees are on, is
///         `transferOwnership`; the settler is untouched.
contract JITSettlerTreasury {
    using SafeERC20Min for address;

    address public owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
    event Withdrawn(address indexed token, address indexed to, uint256 amount);

    modifier onlyOwner() {
        require(msg.sender == owner, "not owner");
        _;
    }

    constructor(address owner_) {
        require(owner_ != address(0));
        owner = owner_;
        emit OwnershipTransferred(address(0), owner_);
    }

    receive() external payable { }

    function transferOwnership(address newOwner) external onlyOwner {
        require(newOwner != address(0));
        emit OwnershipTransferred(owner, newOwner);
        owner = newOwner;
    }

    /// @notice Sends `amount` of `token` to `to`; `token == address(0)` sends ETH.
    function withdraw(address token, address to, uint256 amount) external onlyOwner {
        if (token == address(0)) {
            (bool ok,) = to.call{ value: amount }("");
            require(ok, "eth transfer");
        } else {
            token.safeTransfer(to, amount);
        }
        emit Withdrawn(token, to, amount);
    }
}

src/libraries/SafeERC20Min.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

/// @notice Minimal ERC20 surface for `SafeERC20Min`: empty returndata is success (USDT), a
///         returned word is the bool it claims.
interface IERC20Min {
    function balanceOf(address) external view returns (uint256);
    function transferFrom(address, address, uint256) external returns (bool);
    function transfer(address, uint256) external returns (bool);
}

library SafeERC20Min {
    function safeTransferFrom(address token, address from, address to, uint256 amount) internal {
        _call(token, abi.encodeWithSelector(IERC20Min.transferFrom.selector, from, to, amount));
    }

    function safeTransfer(address token, address to, uint256 amount) internal {
        _call(token, abi.encodeWithSelector(IERC20Min.transfer.selector, to, amount));
    }

    function balanceOf(address token, address who) internal view returns (uint256) {
        return IERC20Min(token).balanceOf(who);
    }

    function _call(address token, bytes memory data) private {
        (bool ok, bytes memory ret) = token.call(data);
        require(ok && (ret.length == 0 || abi.decode(ret, (bool))), "erc20 call failed");
    }
}
Compiler settingsShow
{
  "viaIR": true,
  "metadata": {
    "appendCBOR": false,
    "bytecodeHash": "none",
    "useLiteralContent": false
  },
  "libraries": {},
  "optimizer": {
    "runs": 1000,
    "enabled": true
  },
  "evmVersion": "osaka",
  "remappings": [
    "forge-std/=lib/forge-std/src/",
    "priority-update-registry/=vendor/priority-update-registry/src/",
    "solady/=lib/priority-update-registry/lib/solady/src/",
    "@openzeppelin/=lib/priority-update-registry/lib/openzeppelin-contracts/",
    "erc4626-tests/=lib/priority-update-registry/lib/openzeppelin-contracts/lib/erc4626-tests/",
    "halmos-cheatcodes/=lib/priority-update-registry/lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
    "openzeppelin-contracts/=lib/priority-update-registry/lib/openzeppelin-contracts/"
  ]
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.