Verified contractPartialUnlicense
BidProxy
Address0xc2dcf507c2abbce41e37307aa88552ee192716d2
- Balance
0 ETH
- Transactions
1,070
- Compiler
solc 0.8.7
- Same code
Only this contract
Details
- Compiler
- solc 0.8.7+commit.e28d00a7
- Language
- solidity
- Optimization
- No
- EVM version
- london
- License
- Unlicense
- Match
- Partialcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 14,177,065
- Creation transaction
- 0xac8ca02aaa…e53e6675d6
5 files
- BidProxy.solmain3.97 KB
- IKittyCore.sol235 B
- ISaleClockAuction.sol398 B
- Ownable.sol950 B
- Pausable.sol1.09 KB
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;
}
}
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;
}
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);
}
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;
}
}
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;
}
}
Compiler settingsShow
{
"metadata": {
"bytecodeHash": "ipfs"
},
"libraries": {},
"optimizer": {
"runs": 200,
"enabled": false
},
"evmVersion": "london",
"remappings": []
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.