账户
0xc2...16d2
0xC2...16d2

0xC2...16d2

$500
此合同的源代码已经过验证!
合同元数据
编译器
0.8.7+commit.e28d00a7
语言
Solidity
合同源代码
文件 1 的 5:BidProxy.sol
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;

import "./Pausable.sol";
import "./IKittyCore.sol";
import "./ISaleClockAuction.sol";

contract BidProxy is Pausable {

    IKittyCore private immutable kitties;
    ISaleClockAuction private immutable saleAuction;

    address private constant WALLET1 = 0x37932f3ECA864632156CcbA7E2814b51A374caEc;
    address private constant WALLET2 = 0x989A2ad9aCaa8C4e50B2fC6B650d6e1809b9195b;

    constructor(address _kitties, address _saleAuction) {
        kitties = IKittyCore(_kitties);
        saleAuction = ISaleClockAuction(_saleAuction);
    }

    function _warmUpDapperWallet(address wallet) private view {
        // query dapper wallet first, so it is added into a list of warm addresses
        // various techniques can be used to warm up the address
        // query balance, extcodehash, extcodesize
        // it seems solidity compiler compiles them out since the result is not used
        // however it keeps extcodecopy, therefore use extcodecopy to warmup the address
        assembly { // solhint-disable-line no-inline-assembly
            extcodecopy(wallet, 0, 0, 0)
        }
    }

    receive() external payable whenNotPaused {
        if (msg.value > 0) {
            // accept the change from the sale auction contract
            require(msg.sender == address(saleAuction));
        }
    }

    function _bid(uint256 _kittyId) private {
        uint256 balanceBefore = address(this).balance - msg.value;

        // buy the kitty on behalf of the caller
        saleAuction.bid{value: msg.value}(_kittyId);

        // transfer the kitty back to the caller
        kitties.transfer(msg.sender, _kittyId);

        // make sure that the caller received their kitty
        require(kitties.ownerOf(_kittyId) == msg.sender);

        uint256 balanceAfter = address(this).balance;
        uint256 change = balanceAfter - balanceBefore;
        // send any change back to the caller
        if (change > 0) {
            payable(msg.sender).transfer(change);
        }
    }

    function bid(uint256 _kittyId) external payable whenNotPaused {
        _warmUpDapperWallet(WALLET1);
        _warmUpDapperWallet(WALLET2);
        _bid(_kittyId);
    }

    function bidWithSpecificWarmups(uint256 _kittyId, address[] calldata _accountsToWarmUp) external payable whenNotPaused {
        uint256 len = _accountsToWarmUp.length;
        for (uint256 i = 0; i < len; i += 1) {
            _warmUpDapperWallet(_accountsToWarmUp[i]);
        }
        _bid(_kittyId);
    }

    /// @dev Transfers a kitty owned by this contract to the specified address.
    ///  Used to rescue lost kitties. (There is no "proper" flow where this contract
    ///  should be the owner of any Kitty. This function exists for us to reassign
    ///  the ownership of Kitties that users may have accidentally sent to our address.)
    /// @param _kittyId - ID of kitty
    /// @param _recipient - Address to send the cat to
    function rescueLostKitty(uint256 _kittyId, address _recipient) external onlyOwner whenNotPaused {
        kitties.transfer(_recipient, _kittyId);
    }

    /// @dev can be used to make arbitrary calls in context of this contract
    ///  This contract is not supposed to hold user assets
    ///  This function acts like an escape hatch that allows owner to perform all sorts of rescue operations
    ///  Rescue kitty (there is a separate function for this common use case)
    ///  Rescue ETH, WETH sent to this contract, etc
    function call(address payable _to, uint256 _value, bytes calldata _data) external onlyOwner whenNotPaused payable returns (bytes memory) {
        require(_to != address(0));
        (bool _success, bytes memory _result) = _to.call{value: _value}(_data); // solhint-disable-line avoid-low-level-calls
        require(_success);
        return _result;
    }
}
合同源代码
文件 2 的 5:IKittyCore.sol
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;

interface IKittyCore {
    function ownerOf(uint256 _tokenId) external view returns (address owner);
    function transfer(address _to, uint256 _tokenId) external;
}
合同源代码
文件 3 的 5:ISaleClockAuction.sol
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;

interface ISaleClockAuction {
    function bid(uint256 _tokenId) external payable;
    function getAuction(uint256 _tokenId) external view returns (address seller, uint256 startingPrice, uint256 endingPrice, uint256 duration, uint256 startedAt);
    function getCurrentPrice(uint256 _tokenId) external view returns (uint256);
}
合同源代码
文件 4 的 5:Ownable.sol
pragma solidity ^0.8.0;

/**
 * @title Ownable
 * @dev The Ownable contract has an owner address, and provides basic authorization control
 * functions, this simplifies the implementation of "user permissions".
 */
contract Ownable {
    address public owner;

    /**
     * @dev The Ownable constructor sets the original `owner` of the contract to the sender
     * account.
     */
    constructor() {
        owner = msg.sender;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(msg.sender == owner);
        _;
    }

    /**
     * @dev Allows the current owner to transfer control of the contract to a newOwner.
     * @param newOwner The address to transfer ownership to.
     */
    function transferOwnership(address newOwner) external onlyOwner {
        require(newOwner != address(0));
        owner = newOwner;
    }
}
合同源代码
文件 5 的 5:Pausable.sol
pragma solidity ^0.8.0;

import "./Ownable.sol";

/**
 * @title Pausable
 * @dev Base contract which allows children to implement an emergency stop mechanism.
 */
contract Pausable is Ownable {
    event Pause();
    event Unpause();

    bool public paused = false;

    /**
     * @dev modifier to allow actions only when the contract IS paused
     */
    modifier whenNotPaused() {
        require(!paused);
        _;
    }

    /**
     * @dev modifier to allow actions only when the contract IS NOT paused
     */
    modifier whenPaused {
        require(paused);
        _;
    }

    /**
     * @dev called by the owner to pause, triggers stopped state
     */
    function pause() external onlyOwner whenNotPaused returns (bool) {
        paused = true;
        emit Pause();
        return true;
    }

    /**
     * @dev called by the owner to unpause, returns to normal state
     */
    function unpause() external onlyOwner whenPaused returns (bool) {
        paused = false;
        emit Unpause();
        return true;
    }
}
设置
{
  "compilationTarget": {
    "BidProxy.sol": "BidProxy"
  },
  "evmVersion": "london",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs"
  },
  "optimizer": {
    "enabled": false,
    "runs": 200
  },
  "remappings": []
}
ABI
[{"inputs":[{"internalType":"address","name":"_kitties","type":"address"},{"internalType":"address","name":"_saleAuction","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"inputs":[{"internalType":"uint256","name":"_kittyId","type":"uint256"}],"name":"bid","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_kittyId","type":"uint256"},{"internalType":"address[]","name":"_accountsToWarmUp","type":"address[]"}],"name":"bidWithSpecificWarmups","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address payable","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"call","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_kittyId","type":"uint256"},{"internalType":"address","name":"_recipient","type":"address"}],"name":"rescueLostKitty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]