ETH Price: $2,143.45 (+5.24%)

Contract

0xaE1C7AAF0650E9be8499d91Abd4718f9F22D6FC2
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

More Info

Private Name Tags

ContractCreator

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

1 Internal Transaction found.

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Method Block
From
To
0x60c0601f235041862025-10-04 11:42:23170 days ago1759578143  Contract Creation0 ETH
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x0D304B21...4e1b000EE
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
MiladyPool

Compiler Version
v0.8.30+commit.73712a01

Optimization Enabled:
Yes with 9999999 runs

Other Settings:
prague EvmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 1 : MiladyRescue.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.30;

/// @notice Minimalist and gas efficient standard ERC6909 implementation.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC6909.sol)
abstract contract ERC6909 {
    event OperatorSet(address indexed owner, address indexed operator, bool approved);
    event Approval(
        address indexed owner, address indexed spender, uint256 indexed id, uint256 amount
    );
    event Transfer(
        address caller, address indexed from, address indexed to, uint256 indexed id, uint256 amount
    );

    mapping(address => mapping(address => bool)) public isOperator;
    mapping(address => mapping(uint256 => uint256)) public balanceOf;
    mapping(address => mapping(address => mapping(uint256 => uint256))) public allowance;

    function transfer(address receiver, uint256 id, uint256 amount) public virtual returns (bool) {
        balanceOf[msg.sender][id] -= amount;
        balanceOf[receiver][id] += amount;
        emit Transfer(msg.sender, msg.sender, receiver, id, amount);
        return true;
    }

    function transferFrom(address sender, address receiver, uint256 id, uint256 amount)
        public
        virtual
        returns (bool)
    {
        if (msg.sender != sender && !isOperator[sender][msg.sender]) {
            uint256 allowed = allowance[sender][msg.sender][id];
            if (allowed != type(uint256).max) allowance[sender][msg.sender][id] = allowed - amount;
        }
        balanceOf[sender][id] -= amount;
        balanceOf[receiver][id] += amount;
        emit Transfer(msg.sender, sender, receiver, id, amount);
        return true;
    }

    function approve(address spender, uint256 id, uint256 amount) public virtual returns (bool) {
        allowance[msg.sender][spender][id] = amount;
        emit Approval(msg.sender, spender, id, amount);
        return true;
    }

    function setOperator(address operator, bool approved) public virtual returns (bool) {
        isOperator[msg.sender][operator] = approved;
        emit OperatorSet(msg.sender, operator, approved);
        return true;
    }

    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
        return interfaceId == 0x01ffc9a7 || interfaceId == 0x0f632fb3;
    }

    function _mint(address receiver, uint256 id, uint256 amount) internal virtual {
        balanceOf[receiver][id] += amount;
        emit Transfer(msg.sender, address(0), receiver, id, amount);
    }

    function _burn(address sender, uint256 id, uint256 amount) internal virtual {
        balanceOf[sender][id] -= amount;
        emit Transfer(msg.sender, sender, address(0), id, amount);
    }
}

/// @notice Swap ETH to Miladys on NFTXV2. Pool together to relist & exchange.
/// @dev Inspired by TokenWorks NFT strategies - this goes the mini-DAO route.
contract MiladyRescue is ERC6909 {
    address constant POOL = 0x15A8E38942F9e353BEc8812763fb3C104c89eCf4;
    address constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
    address constant VAULT = 0x227c7DF69D3ed1ae7574A1a7685fDEd90292EB48;

    constructor() payable {
        IERC20(WSTETH).approve(ZSTETH, type(uint256).max);
        emit OwnershipTransferred(address(0), owner = tx.origin);
    }

    address[] _pools;
    address[] _raids;

    // ERC6909 ID METADATA

    mapping(uint256 id => uint256) public totalSupply;

    function name(uint256 id) public pure returns (string memory) {
        return string(abi.encodePacked("MR-", _toString(id)));
    }

    function symbol(uint256) public pure returns (string memory) {
        return "MR";
    }

    function getPools() public view returns (address[] memory pools) {
        return _pools;
    }

    function getRaids() public view returns (address[] memory raids) {
        return _raids;
    }

    function _toString(uint256 value) internal pure returns (string memory result) {
        assembly ("memory-safe") {
            result := add(mload(0x40), 0x80)
            mstore(0x40, add(result, 0x20))
            mstore(result, 0)
            let end := result
            let w := not(0)
            for { let temp := value } 1 {} {
                result := add(result, w)
                mstore8(result, add(48, mod(temp, 10)))
                temp := div(temp, 10)
                if iszero(temp) { break }
            }
            let n := sub(end, result)
            result := sub(result, 0x20)
            mstore(result, n)
        }
    }

    // CREATE2 ADDRESS GETTERS

    function getPoolFromMilady(uint256 milady) public view returns (address pool) {
        pool = _computeAddress(
            bytes32(milady),
            keccak256(abi.encodePacked(type(MiladyPool).creationCode, abi.encode(milady)))
        );
    }

    function getRaidFromMilady(uint256 milady) public view returns (address raid) {
        raid = _computeAddress(
            bytes32(milady),
            keccak256(abi.encodePacked(type(MiladyRaid).creationCode, abi.encode(milady)))
        );
    }

    function getCallerFromCall(address target, uint256 value, bytes calldata data)
        public
        view
        returns (address caller)
    {
        bytes32 callHash = keccak256(abi.encode(target, value, data));
        caller = _computeAddress(
            bytes32(callHash),
            keccak256(abi.encodePacked(type(Caller).creationCode, abi.encode(callHash)))
        );
    }

    function _computeAddress(bytes32 salt, bytes32 bytecodeHash)
        internal
        view
        returns (address computed)
    {
        assembly ("memory-safe") {
            let ptr := mload(0x40)
            mstore(add(ptr, 0x40), bytecodeHash)
            mstore(add(ptr, 0x20), salt)
            mstore(ptr, address())
            let start := add(ptr, 0x0b)
            mstore8(start, 0xff)
            computed := and(keccak256(start, 0x55), 0xffffffffffffffffffffffffffffffffffffffff)
        }
    }

    // SWAP ETH FOR MILADY NFTXV2 SHARES

    error Slippage();

    /// @dev Fetch the SushiSwap ETH price of NFTX-vaulted Miladys.
    function getPrice() public view returns (uint256) {
        (uint112 r0, uint112 r1,) = IUniswapV2(POOL).getReserves();
        return (uint256(r1) * 1e18) / uint256(r0);
    }

    /// @dev Execute exact-in ETH->MILADY swap via SushiSwap -> mint MR shares.
    function swap(address to, uint256 minOut) public payable {
        assembly ("memory-safe") {
            pop(call(gas(), WETH, callvalue(), codesize(), 0x00, codesize(), 0x00))
            mstore(0x14, POOL)
            mstore(0x34, callvalue())
            mstore(0x00, 0xa9059cbb000000000000000000000000)
            pop(call(gas(), WETH, 0, 0x10, 0x44, codesize(), 0x00))
            mstore(0x34, 0)
        }
        unchecked {
            (uint112 r0, uint112 r1,) = IUniswapV2(POOL).getReserves();
            uint256 amountInWithFee = msg.value * 997;
            uint256 numerator = amountInWithFee * r0;
            uint256 denominator = uint256(r1) * 1000 + amountInWithFee;
            uint256 amount0Out = numerator / denominator;
            require(amount0Out >= minOut, Slippage());
            IUniswapV2(POOL).swap(amount0Out, 0, address(this), "");
            _mint(to, uint160(address(this)), amount0Out);
            totalSupply[uint160(address(this))] += amount0Out;
        }
    }

    /// @dev Execute exact-out ETH->MILADY swap via SushiSwap -> mint MR shares.
    function swapExact(address to, uint256 outShares, uint256 maxIn)
        public
        payable
        nonReentrant
        returns (uint256 amountIn)
    {
        (uint112 r0, uint112 r1,) = IUniswapV2(POOL).getReserves();
        require(outShares > 0 && outShares < r0, Slippage());

        unchecked {
            uint256 n = uint256(r1) * outShares * 1000;
            uint256 d = (uint256(r0) - outShares) * 997;
            amountIn = (n + d - 1) / d;
        }

        require(amountIn <= maxIn && amountIn <= msg.value, Slippage());
        assembly ("memory-safe") {
            pop(call(gas(), WETH, amountIn, codesize(), 0x00, codesize(), 0x00))
            mstore(0x14, POOL)
            mstore(0x34, amountIn)
            mstore(0x00, 0xa9059cbb000000000000000000000000)
            pop(call(gas(), WETH, 0, 0x10, 0x44, codesize(), 0x00))
            mstore(0x34, 0)
        }
        IUniswapV2(POOL).swap(outShares, 0, address(this), "");

        _mint(to, uint160(address(this)), outShares);
        totalSupply[uint160(address(this))] += outShares;

        uint256 refund = msg.value - amountIn;
        if (refund != 0) safeTransferETH(msg.sender, refund);
    }

    // DEPOSIT MILADY NFTXV2 SHARES FOR MR

    /// @dev Deposit NFTX shares for MR shares.
    function deposit(address to, uint256 amount) public payable {
        IERC20(VAULT).transferFrom(msg.sender, address(this), amount);
        _mint(to, uint160(address(this)), amount);
        totalSupply[uint160(address(this))] += amount;
    }

    // WITHDRAW MILADY NFTXV2 SHARES FROM MR

    /// @dev Burn MR shares deposit for NFTX shares.
    function withdraw(address to, uint256 amount) public payable {
        _burn(msg.sender, uint160(address(this)), amount);
        totalSupply[uint160(address(this))] -= amount;
        IERC20(VAULT).transfer(to, amount);
    }

    // POOL TOGETHER MR SHARES FOR TARGETED MILADY RESCUES

    error AlreadyRedeemed();

    event JoinPool(address indexed holder, address indexed pool, uint256 indexed shares);
    event ExitPool(address indexed holder, address indexed pool, uint256 indexed shares);

    /// @dev Initialize a new MR share pool to redeem a Milady via NFTX shares.
    function initPool(uint256 milady, uint256 shares) public payable returns (address pool) {
        pool = address(new MiladyPool{salt: bytes32(milady)}(milady));
        _burn(msg.sender, uint160(address(this)), shares);
        _mint(pool, uint160(address(this)), shares);
        _mint(msg.sender, uint160(pool), shares);
        totalSupply[uint160(pool)] += shares;
        _pools.push(pool);
        emit JoinPool(msg.sender, pool, shares);
    }

    /// @dev Join a MR share pool to redeem a Milady via NFTX shares.
    function joinPool(address pool, uint256 shares) public payable {
        require(!MiladyPool(payable(pool)).redeemed(), AlreadyRedeemed());
        _burn(msg.sender, uint160(address(this)), shares);
        _mint(pool, uint160(address(this)), shares);
        _mint(msg.sender, uint160(pool), shares);
        totalSupply[uint160(pool)] += shares;
        emit JoinPool(msg.sender, pool, shares);
    }

    /// @dev Exit a MR share pool to redeem a Milady via NFTX shares.
    function exitPool(address pool, uint256 shares) public payable {
        require(!MiladyPool(payable(pool)).redeemed(), AlreadyRedeemed());
        _burn(msg.sender, uint160(pool), shares);
        totalSupply[uint160(pool)] -= shares;
        _burn(pool, uint160(address(this)), shares);
        _mint(msg.sender, uint160(address(this)), shares);
        emit ExitPool(msg.sender, pool, shares);
    }

    // POOL TOGETHER ETH FOR TARGETED MILADY RAIDS

    error RaidSold();

    event JoinRaid(address indexed holder, address indexed raid, uint256 indexed shares);

    /// @dev Initialize a new raid to bid for a Milady with pooled ETH.
    function initRaid(uint256 milady) public payable nonReentrant returns (address raid) {
        raid = address(new MiladyRaid{salt: bytes32(milady)}(milady));
        _mint(msg.sender, uint160(raid), msg.value);
        totalSupply[uint160(raid)] += msg.value;
        _raids.push(raid);
        safeTransferETH(raid, msg.value);
        emit JoinRaid(msg.sender, raid, msg.value);
    }

    /// @dev Join a raid to bid for a Milady with pooled ETH.
    function joinRaid(address raid) public payable nonReentrant {
        require(!MiladyRaid(payable(raid)).listingSold(), RaidSold());
        require(!MiladyRaid(payable(raid)).redeemed(), AlreadyRedeemed());
        _mint(msg.sender, uint160(raid), msg.value);
        totalSupply[uint160(raid)] += msg.value;
        safeTransferETH(raid, msg.value);
        emit JoinRaid(msg.sender, raid, msg.value);
    }

    // POOL & RAID REDEMPTION PAYOUTS

    /// @dev Exit a share pool to redeem fair share of ETH/leftover NFTX shares.
    /// In case of raid, this will be used to exit and/or claim any ETH amounts.
    function payout(address source, uint256 shares) public payable nonReentrant {
        require(shares != 0, Slippage());
        uint256 supply = totalSupply[uint160(source)];
        _burn(msg.sender, uint160(source), shares);
        totalSupply[uint160(source)] -= shares;
        uint256 ethOwed = mulDiv(source.balance, shares, supply);
        uint256 tknOwed = mulDiv(IERC20(VAULT).balanceOf(source), shares, supply);
        MiladyPool(payable(source)).payout(msg.sender, ethOwed, tknOwed);
    }

    // CALL PROPOSAL CASTING HELPERS - MINI-DAOS

    event CallerCreated(address indexed caller);
    event CallCast(
        address indexed holder, address indexed caller, address indexed pool, uint256 shares
    );
    event CallUncast(
        address indexed holder, address indexed caller, address indexed pool, uint256 shares
    );

    /// @dev Create a call proposal contract that can be shared among pools.
    function createCall(address target, uint256 value, bytes calldata data)
        public
        payable
        returns (bytes32 callHash, address caller)
    {
        callHash = keccak256(abi.encode(target, value, data));
        caller = address(new Caller{salt: callHash}(callHash));
        emit CallerCreated(caller);
    }

    /// @dev Cast holder shares to a call proposal contract that can be shared among pools.
    function castToCall(address caller, address pool, uint256 shares) public payable {
        _burn(msg.sender, uint160(pool), shares);
        _mint(caller, uint160(pool), shares);
        uint256 receiptId = uint256(keccak256(abi.encode(caller, pool)));
        _mint(msg.sender, receiptId, shares);
        totalSupply[receiptId] += shares;
        emit CallCast(msg.sender, caller, pool, shares);
    }

    /// @dev Uncast pool shares from a call proposal contract that can be shared among pools.
    function uncastFromCall(address caller, address pool, uint256 shares) public payable {
        uint256 receiptId = uint256(keccak256(abi.encode(caller, pool)));
        _burn(msg.sender, receiptId, shares);
        totalSupply[receiptId] -= shares;
        _burn(caller, uint160(pool), shares);
        _mint(msg.sender, uint160(pool), shares);
        emit CallUncast(msg.sender, caller, pool, shares);
    }

    /// @dev Claim post-call shares returned after call contract has executed for pool.
    function claimPostCall(address caller, address pool, uint256 shares) public payable {
        uint256 receiptId = uint256(keccak256(abi.encode(caller, pool)));
        _burn(msg.sender, receiptId, shares);
        totalSupply[receiptId] -= shares;
        _burn(address(this), uint160(pool), shares);
        _mint(msg.sender, uint160(pool), shares);
    }

    error NotMajority();

    /// @dev Execute authorized call through the selected source pool that will forward.
    function execute(address pool, address target, uint256 value, bytes calldata data)
        public
        payable
        nonReentrant
        returns (bytes memory retData)
    {
        // check that sufficient majority tally is escrowed with Caller:
        address computedCaller = getCallerFromCall(target, value, data);
        uint256 tally = balanceOf[computedCaller][uint160(pool)];
        require(tally > (totalSupply[uint160(pool)] / 2), NotMajority());
        retData = MiladyPool(payable(pool)).execute(target, value, data);
        // return tally amount so no replay of call:
        _burn(computedCaller, uint160(pool), tally);
        _mint(address(this), uint160(pool), tally);
    }

    // Soledge reentrancy guard:
    // (https://github.com/Vectorized/soledge/blob/main/src/utils/ReentrancyGuard.sol)

    error Reentrancy();

    uint256 constant REENTRANCY_GUARD_SLOT = 0x929eee149b4bd21268;

    modifier nonReentrant() {
        assembly ("memory-safe") {
            if tload(REENTRANCY_GUARD_SLOT) {
                mstore(0x00, 0xab143c06) // `Reentrancy()`
                revert(0x1c, 0x04)
            }
            tstore(REENTRANCY_GUARD_SLOT, address())
        }
        _;
        assembly ("memory-safe") {
            tstore(REENTRANCY_GUARD_SLOT, 0)
        }
    }

    // MULTICALL BATCHER

    /// @dev Execute a sequence of calls to this contract to batch interactions.
    function multicall(bytes[] calldata data) public payable returns (bytes[] memory) {
        assembly ("memory-safe") {
            mstore(0x00, 0x20)
            mstore(0x20, data.length)
            if iszero(data.length) { return(0x00, 0x40) }
            let results := 0x40
            let end := shl(5, data.length)
            calldatacopy(0x40, data.offset, end)
            let resultsOffset := end
            end := add(results, end)
            for {} 1 {} {
                let o := add(data.offset, mload(results))
                let m := add(resultsOffset, 0x40)
                calldatacopy(m, add(o, 0x20), calldataload(o))
                if iszero(delegatecall(gas(), address(), m, calldataload(o), codesize(), 0x00)) {
                    returndatacopy(0x00, 0x00, returndatasize())
                    revert(0x00, returndatasize())
                }
                mstore(results, resultsOffset)
                results := add(results, 0x20)
                mstore(m, returndatasize())
                returndatacopy(add(m, 0x20), 0x00, returndatasize())
                resultsOffset :=
                    and(add(add(resultsOffset, returndatasize()), 0x3f), 0xffffffffffffffe0)
                if iszero(lt(results, end)) { break }
            }
            return(0x00, add(resultsOffset, 0x40))
        }
    }

    // MR PROTOCOL HELPERS - ETH GOVERNED BY ALL SHAREHOLDERS VIA ERC173

    event OwnershipTransferred(address indexed from, address indexed to);

    receive() external payable {
        (bool ok,) = CULT_BURNER.call{value: msg.value / 3}(""); // CULT 10
        ok = ok; // Silence the compiler so it doesn't annoy me anymore yea
        stakeProtocolETH(); // 20 bps reserved to protocol for MR supremacy
    }

    error Unauthorized();

    address public owner;

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

    function transferOwnership(address _owner) public payable onlyOwner {
        emit OwnershipTransferred(msg.sender, owner = _owner);
    }

    address constant WSTETH = 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0;
    address constant ZSTETH = 0x000000000088649055D9D23362B819A5cfF11f02;
    address constant CULT_BURNER = 0xA44531D7A1Ea66A9b7CdCDDF9a001B51eaE61BEB;

    /// @dev Public staking function into Lido wstETH for ETH inside this contract.
    function stakeProtocolETH() public payable {
        assembly ("memory-safe") {
            pop(call(gas(), WSTETH, selfbalance(), codesize(), 0x00, codesize(), 0x00))
        }
    }

    /// @dev Governed exact-in swap to redeem yield from Lido staking.
    function swapExactWSTETHtoETH(address to, uint256 amount, uint256 minOut)
        public
        payable
        onlyOwner
        nonReentrant
    {
        MiladyRescue(payable(ZSTETH)).swapExactWSTETHtoETH(to, amount, minOut);
    }

    /// @dev Governed exact-out swap to redeem yield from Lido staking.
    function swapWSTETHtoExactETH(address to, uint256 exactOut, uint256 maxIn)
        public
        payable
        onlyOwner
        nonReentrant
    {
        MiladyRescue(payable(ZSTETH)).swapWSTETHtoExactETH(to, exactOut, maxIn);
    }
}

/// @notice Special Milady NFT pooling executable vault contract.
contract MiladyPool {
    error WrongETH();
    error NotListed();
    error CallFailed();
    error Unauthorized();
    error NotYetRedeemed();
    error AlreadyRedeemed();

    bool public redeemed;
    bool public listingSold;
    uint256 public ethPrice;

    uint16 constant FEE_BPS = 30;

    event Listed(uint256 indexed ethPrice);

    uint256 public immutable milady;
    address public immutable creator = msg.sender;

    address constant VAULT = 0x227c7DF69D3ed1ae7574A1a7685fDEd90292EB48;
    address constant MILADY = 0x5Af0D9827E0c53E4799BB226655A1de152A425a5;

    constructor(uint256 _milady) payable {
        milady = _milady;
    }

    /// @dev Authorized calls may be cast through the creator contract.
    /// This arbitrary call method is locked against rugging Milady NFT.
    function execute(address target, uint256 value, bytes calldata data)
        public
        payable
        returns (bytes memory retData)
    {
        require(redeemed, NotYetRedeemed());
        require(msg.sender == creator, Unauthorized());
        require(target == address(this), Unauthorized());
        (bool ok, bytes memory _retData) = target.call{value: value}(data);
        require(ok, CallFailed());
        return _retData;
    }

    /// @dev Simple listing method that is called by this contract via execute().
    function list(uint256 _ethPrice) public payable {
        require(msg.sender == address(this), Unauthorized());
        emit Listed(ethPrice = _ethPrice);
    }

    /// @dev Buy the current Milady listing with ETH.
    function buyListing() public payable {
        require(msg.sender != address(this), Unauthorized());
        uint256 _ethPrice = ethPrice;
        require(_ethPrice != 0, NotListed());
        require(msg.value == _ethPrice, WrongETH());
        IERC721(MILADY).transferFrom(address(this), msg.sender, milady);
        listingSold = true;
    }

    /// @dev Public can redeem targeted rescue Milady NFT.
    function redeemNFT() public payable {
        require(!redeemed, AlreadyRedeemed());
        redeemed = true;
        uint256 balance = MiladyRescue(payable(creator)).balanceOf(address(this), uint160(creator));
        MiladyRescue(payable(creator)).withdraw(address(this), balance);
        uint256[] memory specificIds = new uint256[](1);
        specificIds[0] = milady;
        IVault(VAULT).redeem(1, specificIds);
    }

    /// @dev Holders can redeem out their fair share of ETH following vault share redemption.
    function payout(address holder, uint256 ethAmount, uint256 vaultAmount) public payable {
        require(redeemed, NotYetRedeemed());
        require(msg.sender == creator, Unauthorized());
        if (ethAmount != 0) {
            uint256 fee = (ethAmount * FEE_BPS) / 10_000;
            uint256 net = ethAmount - fee;
            if (fee != 0) safeTransferETH(creator, fee);
            if (net != 0) safeTransferETH(holder, net);
        }
        if (vaultAmount != 0) IERC20(VAULT).transfer(holder, vaultAmount);
    }

    /// @dev Extended safe ERC721 transfer support.
    function onERC721Received(address, address, uint256, bytes calldata)
        public
        pure
        returns (bytes4)
    {
        return this.onERC721Received.selector;
    }

    receive() external payable {} // fallback ETH receipts
}

/// @notice Special Milady NFT pooling executable raid contract.
contract MiladyRaid {
    error NoYoink();
    error WrongETH();
    error NotListed();
    error CallFailed();
    error Unauthorized();

    bool public redeemed;
    bool public listingSold;
    uint256 public ethPrice;

    uint16 constant FEE_BPS = 30;

    event Listed(uint256 indexed ethPrice);

    uint256 public immutable milady;
    address public immutable creator = msg.sender;

    address constant MILADY = 0x5Af0D9827E0c53E4799BB226655A1de152A425a5;

    constructor(uint256 _milady) payable {
        milady = _milady;
    }

    /// @dev Authorized calls may be cast through the creator contract.
    /// This arbitrary call method is locked against rugging Milady NFT.
    /// And can essentially only be used to bid Milady or set ETH listing.
    function execute(address target, uint256 value, bytes calldata data)
        public
        payable
        returns (bytes memory retData)
    {
        require(target != MILADY, NoYoink());
        require(msg.sender == creator, Unauthorized());
        // If holding, only allow self-calls (e.g., list()) and no ETH out:
        if (redeemed) {
            require(target == address(this), Unauthorized());
            require(value == 0, NoYoink());
        }
        (bool ok, bytes memory _retData) = target.call{value: value}(data);
        require(ok, CallFailed());
        require(redeemed = IERC721(MILADY).ownerOf(milady) == address(this));
        return _retData;
    }

    /// @dev Simple listing method that is called by this contract via execute().
    function list(uint256 _ethPrice) public payable {
        require(msg.sender == address(this), Unauthorized());
        emit Listed(ethPrice = _ethPrice);
    }

    /// @dev Buy the current Milady listing with ETH.
    function buyListing() public payable {
        require(msg.sender != address(this), Unauthorized());
        uint256 _ethPrice = ethPrice;
        require(_ethPrice != 0, NotListed());
        require(msg.value == _ethPrice, WrongETH());
        IERC721(MILADY).transferFrom(address(this), msg.sender, milady);
        listingSold = true;
    }

    /// @dev Holders can redeem out their fair share of ETH following vault share redemption.
    function payout(address holder, uint256 ethAmount, uint256) public payable {
        require(msg.sender == creator, Unauthorized());
        uint256 fee = (ethAmount * FEE_BPS) / 10_000;
        uint256 net = ethAmount - fee;
        if (fee != 0) safeTransferETH(creator, fee);
        if (net != 0) safeTransferETH(holder, net);
    }

    /// @dev Extended safe ERC721 transfer support.
    function onERC721Received(address, address, uint256, bytes calldata)
        public
        pure
        returns (bytes4)
    {
        return this.onERC721Received.selector;
    }

    receive() external payable {} // fallback ETH receipts
}

/// @notice Special calldata tally ERC6909 balance recorder.
contract Caller {
    bytes32 public immutable callHash;
    address public immutable creator = msg.sender;

    constructor(bytes32 _callHash) payable {
        callHash = _callHash;
    }
}

/// @dev Minimal NFTXV2 vault interface.
interface IVault {
    function redeem(uint256 amount, uint256[] calldata specificIds)
        external
        returns (uint256[] memory redeemedIds);
}

/// @dev Minimal ERC20 token interface.
interface IERC20 {
    function balanceOf(address holder) external view returns (uint256);
    function approve(address to, uint256 amount) external returns (bool);
    function transfer(address to, uint256 amount) external returns (bool);
    function transferFrom(address from, address to, uint256 amount) external returns (bool);
}

/// @dev Minimal ERC721 token interface.
interface IERC721 {
    function ownerOf(uint256 tokenId) external view returns (address);
    function transferFrom(address from, address to, uint256 tokenId) external;
}

/// @dev Minimal Uniswap V2 interface.
interface IUniswapV2 {
    function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data)
        external;
    function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32);
}

error MulDivFailed();

/// @dev Solady mulDiv free function.
function mulDiv(uint256 x, uint256 y, uint256 d) pure returns (uint256 z) {
    assembly ("memory-safe") {
        z := mul(x, y)
        // Equivalent to `require(d != 0 && (y == 0 || x <= type(uint256).max / y))`.
        if iszero(mul(or(iszero(x), eq(div(z, x), y)), d)) {
            mstore(0x00, 0xad251c27) // `MulDivFailed()`.
            revert(0x1c, 0x04)
        }
        z := div(z, d)
    }
}

error ETHTransferFailed();

/// @dev Solady safe transfer ETH free function.
function safeTransferETH(address to, uint256 amount) {
    assembly ("memory-safe") {
        if iszero(call(gas(), to, amount, codesize(), 0x00, codesize(), 0x00)) {
            mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`.
            revert(0x1c, 0x04)
        }
    }
}

Settings
{
  "remappings": [
    "@solady/=lib/solady/",
    "@soledge/=lib/soledge/",
    "@forge/=lib/forge-std/src/",
    "forge-std/=lib/forge-std/src/",
    "solady/=lib/solady/src/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 9999999
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "prague",
  "viaIR": true
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"uint256","name":"_milady","type":"uint256"}],"stateMutability":"payable","type":"constructor"},{"inputs":[],"name":"AlreadyRedeemed","type":"error"},{"inputs":[],"name":"CallFailed","type":"error"},{"inputs":[],"name":"NotListed","type":"error"},{"inputs":[],"name":"NotYetRedeemed","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"inputs":[],"name":"WrongETH","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"ethPrice","type":"uint256"}],"name":"Listed","type":"event"},{"inputs":[],"name":"buyListing","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"creator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ethPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"execute","outputs":[{"internalType":"bytes","name":"retData","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_ethPrice","type":"uint256"}],"name":"list","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"listingSold","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"milady","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"holder","type":"address"},{"internalType":"uint256","name":"ethAmount","type":"uint256"},{"internalType":"uint256","name":"vaultAmount","type":"uint256"}],"name":"payout","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"redeemNFT","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"redeemed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

0x60c0601f610ee438819003918201601f19168301916001600160401b038311848410176100895780849260209460405283398101031261008557513360a052608052604051610e46908161009e8239608051818181610381015281816107fd0152610ac3015260a051818181610192015281816103eb015281816106f70152610cee0152f35b5f80fd5b634e487b7160e01b5f52604160045260245ffdfe608080604052600436101561001c575b50361561001a575f80fd5b005b5f905f3560e01c90816302d05d3f14610ca657508063150b7a0214610c195780632c31d8f714610bd75780636636466014610a3457806377262d381461068357806380c9419e146105fb578063adf58c15146103a4578063b2aff2b61461034b578063b61d27f61461011b578063e231bff0146100db5763ff186b2e0361000f57346100d857807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100d8576020600154604051908152f35b80fd5b50346100d857807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100d85760ff60209154166040519015158152f35b5060607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100d85761014e610d12565b9060443567ffffffffffffffff81116103475761016f903690600401610d58565b929060ff8354161561031f5773ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001633036102f7573073ffffffffffffffffffffffffffffffffffffffff8316036102f757829184839281604051928392833781018481520391602435905af13d156102ef573d9067ffffffffffffffff82116102c2576040519161023d60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8401160184610d86565b82523d83602084013e5b1561029a576040907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f6020845195869482865280519283918282890152018787015e85828601015201168101030190f35b6004827f3204506f000000000000000000000000000000000000000000000000000000008152fd5b6024837f4e487b710000000000000000000000000000000000000000000000000000000081526041600452fd5b606090610247565b6004837f82b42900000000000000000000000000000000000000000000000000000000008152fd5b6004837f44a974e5000000000000000000000000000000000000000000000000000000008152fd5b5080fd5b50346100d857807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100d85760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b5060607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100d8576103d7610d12565b602435906044359160ff845416156105d3577f00000000000000000000000000000000000000000000000000000000000000009073ffffffffffffffffffffffffffffffffffffffff821633036105ab57801580156104f9575b5050508161043d578280f35b6040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff91909116600482015260248101919091526020816044818573227c7df69d3ed1ae7574a1a7685fded90292eb485af180156104ee576104b657808280f35b6020813d6020116104e6575b816104cf60209383610d86565b810103126103475751801515036100d8575f808280f35b3d91506104c2565b6040513d84823e3d90fd5b601e820290828204601e14171561057e5761271090049081810392818411610551578280610541575b505003610531575b8080610431565b61053b9082610df4565b5f61052a565b61054a91610df4565b5f82610522565b6024877f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b6024867f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b6004857f82b42900000000000000000000000000000000000000000000000000000000008152fd5b6004847f44a974e5000000000000000000000000000000000000000000000000000000008152fd5b5060207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100d85760043530330361065b57806001557ff3ecdc9ffda52c5ad69793c567cb456f83bba2d14f196542e0be80c919a8bda38280a280f35b6004827f82b42900000000000000000000000000000000000000000000000000000000008152fd5b50807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100d857805460ff8116610a0c577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00600191161781558073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016604051907efdd58e000000000000000000000000000000000000000000000000000000008252306004830152806024830152602082604481845afa918215610a015783926109cd575b50803b156109c9576040517ff3fef3a3000000000000000000000000000000000000000000000000000000008152306004820152602481019290925282908290604490829084905af180156104ee576109b4575b505060408051906107c58183610d86565b60018252602082017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0820136823782511561098757917f0000000000000000000000000000000000000000000000000000000000000000835283825180947fc4a0db9600000000000000000000000000000000000000000000000000000000825260448201936001600484015285602484015251809452606482019093835b81811061096b5750508192935003818373227c7df69d3ed1ae7574a1a7685fded90292eb485af1801561096157610899578280f35b3d8084843e6108a88184610d86565b82019160208184031261092c5780519067ffffffffffffffff821161095d570182601f8201121561092c5780519167ffffffffffffffff831161093057602080918460051b946108fd83870192519283610d86565b8152019282010192831161092c57602001905b82821061091c57508280f35b8151815260209182019101610910565b8380fd5b6024857f4e487b710000000000000000000000000000000000000000000000000000000081526041600452fd5b8480fd5b81513d85823e3d90fd5b8551835260209586019589955088945090920191600101610864565b6024847f4e487b710000000000000000000000000000000000000000000000000000000081526032600452fd5b816109be91610d86565b6100d857805f6107b4565b5050fd5b9091506020813d6020116109f9575b816109e960209383610d86565b810103126109c95751905f610760565b3d91506109dc565b6040513d85823e3d90fd5b6004827f1b4e0c3c000000000000000000000000000000000000000000000000000000008152fd5b505f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610b5b57303314610baf576001548015610b87573403610b5f57735af0d9827e0c53e4799bb226655a1de152a425a53b15610b5b576040517f23b872dd0000000000000000000000000000000000000000000000000000000081523060048201523360248201527f000000000000000000000000000000000000000000000000000000000000000060448201525f8160648183735af0d9827e0c53e4799bb226655a1de152a425a55af18015610b5057610b3d575b506101007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff82541617815580f35b610b4991505f90610d86565b5f5f610b0f565b6040513d5f823e3d90fd5b5f80fd5b7f10480164000000000000000000000000000000000000000000000000000000005f5260045ffd5b7f665c1c57000000000000000000000000000000000000000000000000000000005f5260045ffd5b7f82b42900000000000000000000000000000000000000000000000000000000005f5260045ffd5b34610b5b575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610b5b57602060ff5f5460081c166040519015158152f35b34610b5b5760807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610b5b57610c50610d12565b50610c59610d35565b5060643567ffffffffffffffff8111610b5b57610c7a903690600401610d58565b505060206040517f150b7a02000000000000000000000000000000000000000000000000000000008152f35b34610b5b575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610b5b5760209073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b6004359073ffffffffffffffffffffffffffffffffffffffff82168203610b5b57565b6024359073ffffffffffffffffffffffffffffffffffffffff82168203610b5b57565b9181601f84011215610b5b5782359167ffffffffffffffff8311610b5b5760208381860195010111610b5b57565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff821117610dc757604052565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f80809338935af115610e0357565b63b12d13eb5f526004601cfdfea2646970667358221220ef113b3749d019b93d3aebe2582a2c20e7cfbc42d0c24bfd453d75dde31add6964736f6c634300081e003300000000000000000000000000000000000000000000000000000000000003c4

Deployed Bytecode

0x608080604052600436101561001c575b50361561001a575f80fd5b005b5f905f3560e01c90816302d05d3f14610ca657508063150b7a0214610c195780632c31d8f714610bd75780636636466014610a3457806377262d381461068357806380c9419e146105fb578063adf58c15146103a4578063b2aff2b61461034b578063b61d27f61461011b578063e231bff0146100db5763ff186b2e0361000f57346100d857807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100d8576020600154604051908152f35b80fd5b50346100d857807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100d85760ff60209154166040519015158152f35b5060607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100d85761014e610d12565b9060443567ffffffffffffffff81116103475761016f903690600401610d58565b929060ff8354161561031f5773ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000088fa5efa50ff6d5cfad19551cd3b361633036102f7573073ffffffffffffffffffffffffffffffffffffffff8316036102f757829184839281604051928392833781018481520391602435905af13d156102ef573d9067ffffffffffffffff82116102c2576040519161023d60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8401160184610d86565b82523d83602084013e5b1561029a576040907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f6020845195869482865280519283918282890152018787015e85828601015201168101030190f35b6004827f3204506f000000000000000000000000000000000000000000000000000000008152fd5b6024837f4e487b710000000000000000000000000000000000000000000000000000000081526041600452fd5b606090610247565b6004837f82b42900000000000000000000000000000000000000000000000000000000008152fd5b6004837f44a974e5000000000000000000000000000000000000000000000000000000008152fd5b5080fd5b50346100d857807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100d85760206040517f00000000000000000000000000000000000000000000000000000000000003c48152f35b5060607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100d8576103d7610d12565b602435906044359160ff845416156105d3577f000000000000000000000000000000000088fa5efa50ff6d5cfad19551cd3b369073ffffffffffffffffffffffffffffffffffffffff821633036105ab57801580156104f9575b5050508161043d578280f35b6040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff91909116600482015260248101919091526020816044818573227c7df69d3ed1ae7574a1a7685fded90292eb485af180156104ee576104b657808280f35b6020813d6020116104e6575b816104cf60209383610d86565b810103126103475751801515036100d8575f808280f35b3d91506104c2565b6040513d84823e3d90fd5b601e820290828204601e14171561057e5761271090049081810392818411610551578280610541575b505003610531575b8080610431565b61053b9082610df4565b5f61052a565b61054a91610df4565b5f82610522565b6024877f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b6024867f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b6004857f82b42900000000000000000000000000000000000000000000000000000000008152fd5b6004847f44a974e5000000000000000000000000000000000000000000000000000000008152fd5b5060207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100d85760043530330361065b57806001557ff3ecdc9ffda52c5ad69793c567cb456f83bba2d14f196542e0be80c919a8bda38280a280f35b6004827f82b42900000000000000000000000000000000000000000000000000000000008152fd5b50807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100d857805460ff8116610a0c577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00600191161781558073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000088fa5efa50ff6d5cfad19551cd3b3616604051907efdd58e000000000000000000000000000000000000000000000000000000008252306004830152806024830152602082604481845afa918215610a015783926109cd575b50803b156109c9576040517ff3fef3a3000000000000000000000000000000000000000000000000000000008152306004820152602481019290925282908290604490829084905af180156104ee576109b4575b505060408051906107c58183610d86565b60018252602082017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0820136823782511561098757917f00000000000000000000000000000000000000000000000000000000000003c4835283825180947fc4a0db9600000000000000000000000000000000000000000000000000000000825260448201936001600484015285602484015251809452606482019093835b81811061096b5750508192935003818373227c7df69d3ed1ae7574a1a7685fded90292eb485af1801561096157610899578280f35b3d8084843e6108a88184610d86565b82019160208184031261092c5780519067ffffffffffffffff821161095d570182601f8201121561092c5780519167ffffffffffffffff831161093057602080918460051b946108fd83870192519283610d86565b8152019282010192831161092c57602001905b82821061091c57508280f35b8151815260209182019101610910565b8380fd5b6024857f4e487b710000000000000000000000000000000000000000000000000000000081526041600452fd5b8480fd5b81513d85823e3d90fd5b8551835260209586019589955088945090920191600101610864565b6024847f4e487b710000000000000000000000000000000000000000000000000000000081526032600452fd5b816109be91610d86565b6100d857805f6107b4565b5050fd5b9091506020813d6020116109f9575b816109e960209383610d86565b810103126109c95751905f610760565b3d91506109dc565b6040513d85823e3d90fd5b6004827f1b4e0c3c000000000000000000000000000000000000000000000000000000008152fd5b505f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610b5b57303314610baf576001548015610b87573403610b5f57735af0d9827e0c53e4799bb226655a1de152a425a53b15610b5b576040517f23b872dd0000000000000000000000000000000000000000000000000000000081523060048201523360248201527f00000000000000000000000000000000000000000000000000000000000003c460448201525f8160648183735af0d9827e0c53e4799bb226655a1de152a425a55af18015610b5057610b3d575b506101007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff82541617815580f35b610b4991505f90610d86565b5f5f610b0f565b6040513d5f823e3d90fd5b5f80fd5b7f10480164000000000000000000000000000000000000000000000000000000005f5260045ffd5b7f665c1c57000000000000000000000000000000000000000000000000000000005f5260045ffd5b7f82b42900000000000000000000000000000000000000000000000000000000005f5260045ffd5b34610b5b575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610b5b57602060ff5f5460081c166040519015158152f35b34610b5b5760807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610b5b57610c50610d12565b50610c59610d35565b5060643567ffffffffffffffff8111610b5b57610c7a903690600401610d58565b505060206040517f150b7a02000000000000000000000000000000000000000000000000000000008152f35b34610b5b575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610b5b5760209073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000088fa5efa50ff6d5cfad19551cd3b36168152f35b6004359073ffffffffffffffffffffffffffffffffffffffff82168203610b5b57565b6024359073ffffffffffffffffffffffffffffffffffffffff82168203610b5b57565b9181601f84011215610b5b5782359167ffffffffffffffff8311610b5b5760208381860195010111610b5b57565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff821117610dc757604052565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f80809338935af115610e0357565b63b12d13eb5f526004601cfdfea2646970667358221220ef113b3749d019b93d3aebe2582a2c20e7cfbc42d0c24bfd453d75dde31add6964736f6c634300081e0033

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.