Contract Address Details

0x71dB1A52b9E684AC73b3041a67AE9d39A6515591

Contract Name
Web3Place
Creator
0xc52752–0c43b6 at 0x20e2e4–d0fff0
Balance
0 EWT ( )
Tokens
Fetching tokens...
Transactions
295 Transactions
Transfers
0 Transfers
Gas Used
80,055,284
Last Balance Update
33640053
Contract name:
Web3Place




Optimization enabled
false
Compiler version
v0.8.16+commit.07a7930e




EVM Version
default




Verified at
2022-10-03T20:54:08.963719Z

Contract source code

// SPDX-License-Identifier: GPL-3.0
// File: @openzeppelin/contracts/utils/Context.sol
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.16;
/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

// File: @openzeppelin/contracts/access/Ownable.sol
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.16;
/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

// File: ewtplace.sol
pragma solidity ^0.8.16;
contract Web3Place is Ownable {
    uint256 public pixelPrice = 2500000000000000;

    struct Pixel {
        address owner;
        uint8 colour;
    }  

    Pixel[100][100] public pixels;

    event PixelColourChanged(uint x, uint y, uint8 color);
    event PixelOwnerChanged(uint x, uint y, address owner);


    function changePixelPrice(uint _newPixelPrice) public onlyOwner {
        pixelPrice = _newPixelPrice;
    }

    function buyPixel(uint x, uint y) public payable{
        Pixel storage pixel = pixels[x][y];
        require(msg.value >= pixelPrice);

        pixel.owner = msg.sender;

        emit PixelOwnerChanged(x, y, pixel.owner);
    }

    function buyPixels(uint[] memory xcoords, uint[] memory ycoords) public payable{
        require(msg.value >= (xcoords.length)*pixelPrice);
        for (uint256 i = 0; i < xcoords.length; i++) {
            uint xcoord = xcoords[i];
            uint ycoord = ycoords[i]; 
            Pixel storage pixel = pixels[xcoord][ycoord];
            pixel.owner = msg.sender;
            emit PixelOwnerChanged(xcoord, ycoord, pixel.owner);
        }
    }

    function withdraw() public payable onlyOwner {
        require(payable(msg.sender).send(address(this).balance));
    }
}
        

Contract ABI

[{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"PixelColourChanged","inputs":[{"type":"uint256","name":"x","internalType":"uint256","indexed":false},{"type":"uint256","name":"y","internalType":"uint256","indexed":false},{"type":"uint8","name":"color","internalType":"uint8","indexed":false}],"anonymous":false},{"type":"event","name":"PixelOwnerChanged","inputs":[{"type":"uint256","name":"x","internalType":"uint256","indexed":false},{"type":"uint256","name":"y","internalType":"uint256","indexed":false},{"type":"address","name":"owner","internalType":"address","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"payable","outputs":[],"name":"buyPixel","inputs":[{"type":"uint256","name":"x","internalType":"uint256"},{"type":"uint256","name":"y","internalType":"uint256"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"buyPixels","inputs":[{"type":"uint256[]","name":"xcoords","internalType":"uint256[]"},{"type":"uint256[]","name":"ycoords","internalType":"uint256[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"changePixelPrice","inputs":[{"type":"uint256","name":"_newPixelPrice","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"pixelPrice","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"owner","internalType":"address"},{"type":"uint8","name":"colour","internalType":"uint8"}],"name":"pixels","inputs":[{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"withdraw","inputs":[]}]
            

Deployed ByteCode

0x6080604052600436106100865760003560e01c806369d640fd1161005957806369d640fd146100f6578063715018a6146101345780638da5cb5b1461014b578063f2fde38b14610176578063ffb871731461019f57610086565b8063240ab5ae1461008b5780632fb049bc146100a757806335e5b75a146100c35780633ccfd60b146100ec575b600080fd5b6100a560048036038101906100a091906109c6565b6101ca565b005b6100c160048036038101906100bc9190610a3e565b61031b565b005b3480156100cf57600080fd5b506100ea60048036038101906100e59190610a7e565b610400565b005b6100f4610486565b005b34801561010257600080fd5b5061011d60048036038101906101189190610a3e565b610542565b60405161012b929190610b08565b60405180910390f35b34801561014057600080fd5b506101496105a9565b005b34801561015757600080fd5b50610160610631565b60405161016d9190610b31565b60405180910390f35b34801561018257600080fd5b5061019d60048036038101906101989190610b78565b61065a565b005b3480156101ab57600080fd5b506101b4610751565b6040516101c19190610bb4565b60405180910390f35b60015482516101d99190610bfe565b3410156101e557600080fd5b60005b825181101561031657600083828151811061020657610205610c58565b5b60200260200101519050600083838151811061022557610224610c58565b5b6020026020010151905060006002836064811061024557610244610c58565b5b60640201826064811061025b5761025a610c58565b5b019050338160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f5db26a9daa96f54ad1b38c1cb9712a30c8dde4f707c0f0f1313ecf94cc237aca83838360000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040516102f893929190610c87565b60405180910390a1505050808061030e90610cbe565b9150506101e8565b505050565b60006002836064811061033157610330610c58565b5b60640201826064811061034757610346610c58565b5b01905060015434101561035957600080fd5b338160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f5db26a9daa96f54ad1b38c1cb9712a30c8dde4f707c0f0f1313ecf94cc237aca83838360000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040516103f393929190610c87565b60405180910390a1505050565b610408610757565b73ffffffffffffffffffffffffffffffffffffffff16610426610631565b73ffffffffffffffffffffffffffffffffffffffff161461047c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161047390610d63565b60405180910390fd5b8060018190555050565b61048e610757565b73ffffffffffffffffffffffffffffffffffffffff166104ac610631565b73ffffffffffffffffffffffffffffffffffffffff1614610502576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104f990610d63565b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f1935050505061054057600080fd5b565b6002826064811061055257600080fd5b60640201816064811061056457600080fd5b01600091509150508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060000160149054906101000a900460ff16905082565b6105b1610757565b73ffffffffffffffffffffffffffffffffffffffff166105cf610631565b73ffffffffffffffffffffffffffffffffffffffff1614610625576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161061c90610d63565b60405180910390fd5b61062f600061075f565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610662610757565b73ffffffffffffffffffffffffffffffffffffffff16610680610631565b73ffffffffffffffffffffffffffffffffffffffff16146106d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106cd90610d63565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610745576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161073c90610df5565b60405180910390fd5b61074e8161075f565b50565b60015481565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6108858261083c565b810181811067ffffffffffffffff821117156108a4576108a361084d565b5b80604052505050565b60006108b7610823565b90506108c3828261087c565b919050565b600067ffffffffffffffff8211156108e3576108e261084d565b5b602082029050602081019050919050565b600080fd5b6000819050919050565b61090c816108f9565b811461091757600080fd5b50565b60008135905061092981610903565b92915050565b600061094261093d846108c8565b6108ad565b90508083825260208201905060208402830185811115610965576109646108f4565b5b835b8181101561098e578061097a888261091a565b845260208401935050602081019050610967565b5050509392505050565b600082601f8301126109ad576109ac610837565b5b81356109bd84826020860161092f565b91505092915050565b600080604083850312156109dd576109dc61082d565b5b600083013567ffffffffffffffff8111156109fb576109fa610832565b5b610a0785828601610998565b925050602083013567ffffffffffffffff811115610a2857610a27610832565b5b610a3485828601610998565b9150509250929050565b60008060408385031215610a5557610a5461082d565b5b6000610a638582860161091a565b9250506020610a748582860161091a565b9150509250929050565b600060208284031215610a9457610a9361082d565b5b6000610aa28482850161091a565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610ad682610aab565b9050919050565b610ae681610acb565b82525050565b600060ff82169050919050565b610b0281610aec565b82525050565b6000604082019050610b1d6000830185610add565b610b2a6020830184610af9565b9392505050565b6000602082019050610b466000830184610add565b92915050565b610b5581610acb565b8114610b6057600080fd5b50565b600081359050610b7281610b4c565b92915050565b600060208284031215610b8e57610b8d61082d565b5b6000610b9c84828501610b63565b91505092915050565b610bae816108f9565b82525050565b6000602082019050610bc96000830184610ba5565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610c09826108f9565b9150610c14836108f9565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615610c4d57610c4c610bcf565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000606082019050610c9c6000830186610ba5565b610ca96020830185610ba5565b610cb66040830184610add565b949350505050565b6000610cc9826108f9565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610cfb57610cfa610bcf565b5b600182019050919050565b600082825260208201905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000610d4d602083610d06565b9150610d5882610d17565b602082019050919050565b60006020820190508181036000830152610d7c81610d40565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000610ddf602683610d06565b9150610dea82610d83565b604082019050919050565b60006020820190508181036000830152610e0e81610dd2565b905091905056fea2646970667358221220a2553a5dc1b1c5bcddb0ea76e4c75f99146ad9610d44fd46ffe89084231366e264736f6c63430008100033