Contract Overview
Balance:
0 Ether
EtherValue:
$0.00
More Info
My Name Tag:
Not Available, login to update
Txn Hash |
Method
|
Block
|
From
|
To
|
Value | ||||
---|---|---|---|---|---|---|---|---|---|
0xfe16e7c2374a10c3e93805ca6473996476f4d9fe79e754b3f9a11ab22dfafd7b | 0x60806040 | 5697133 | 1542 days 10 hrs ago | 0xa7c73b829488156f8b15f26622519cc76be76505 | IN | Create: HundredEtherWall | 0 Ether | 0.01701563 |
[ Download CSV Export ]
Contract Name:
HundredEtherWall
Compiler Version
v0.4.25-nightly.2018.5.28+commit.c223b03
Optimization Enabled:
No with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity)
/** *Submitted for verification at Etherscan.io on 2018-05-29 */ pragma solidity ^0.4.18; //this is the smart contract for the Hundred Ether Wall //please take note that the contract contains a constructor That //declares the contract owner, only the contract owner can withdraw funds //if you want to see the methods being called on //take a look at the HomePage.js component contract HundredEtherWall { address public contractOwner; //a modifier can be used on methods to inherit the require modifier onlyContractOwner { require(msg.sender == contractOwner); _; } uint public constant pixelPrice = 80000000000000; uint public constant pixelsPerCell = 625; address receiver; //event for buying an ad event Buy ( uint indexed idx, address owner, uint x, uint y, uint width, uint height ); //event for updating an ad event Update ( uint indexed idx, string link, string ipfsHash, string title ); //event for setting an add off or on sale event SetSale ( uint indexed idx, bool forSale, uint marketPrice ); //event for setting an add off or on sale event MarketBuy ( uint indexed idx, address owner, bool forSale, uint marketPrice ); //event for setting an add off or on active event SetActive ( uint indexed idx, bool active ); //Contents on an ad struct Ad { address owner; uint width; uint height; uint x; uint y; string title; string link; string ipfsHash; bool forSale; bool active; uint marketPrice; } //the actual array of the ads Ad[] public ads; //2d array of booleans to set true whenever an ad is bought //this is used in the buy() method to check if the spot is availible or not bool[40][50] public grid; //the constructor constructor() public { contractOwner = msg.sender; } //payable function to trigger the purchase function buy(uint _x, uint _y, uint _width, uint _height, string _title, string _link, string _ipfsHash) public payable returns (uint idx) { //calculate the price of the ad uint price = _width * _height * pixelPrice; //set restrictions require(price > 0); require(msg.value >= price); require(_width % 25 == 0); require(_height % 25 == 0); //fill 2d array with true fo the purchased blocks //if the block is already true (means its already bought) // -> revert() for(uint i = 0; i < _width / 25; i++) { for(uint j = 0; j < _height / 25; j++) { if (grid[_x / 25 + i][_y / 25 + j]) { revert(); } grid[_x / 25 + i][_y / 25 + j] = true; } } //store the ad, return the index Ad memory ad = Ad(msg.sender, _x, _y, _width, _height, _title, _link, _ipfsHash, false, true, price); idx = ads.push(ad) - 1; //trigger transaction with the buy event emit Buy(idx, msg.sender, _x, _y, _width, _height); return idx; } //function for updating an ad function update(uint _idx, string _title, string _link, string _ipfsHash) public { //get add with index from parameter Ad storage ad = ads[_idx]; require(msg.sender == ad.owner || msg.sender == contractOwner); //set parameters to repalce the old content ad.link = _link; ad.ipfsHash = _ipfsHash; ad.title = _title; //trigger transaction without cost emit Update(_idx, ad.link, ad.ipfsHash, ad.title); } //function for setting an ad for sale function setSale(uint _idx, bool _sale, uint _marketPrice) public { //get add with index from parameter Ad storage ad = ads[_idx]; require(msg.sender == ad.owner); ad.forSale = _sale; ad.marketPrice = _marketPrice; emit SetSale(_idx, ad.forSale, ad.marketPrice); } //method for buying an ad on the market. Has to change owner only //set the forSale bool false again function marketBuy(uint _idx) public payable { //get add with index from parameter Ad storage ad = ads[_idx]; //set restrictions require(msg.sender != ad.owner); require(msg.value > 0); require(msg.value >= ad.marketPrice); require(ad.forSale == true); receiver = ad.owner; ad.owner = msg.sender; ad.forSale = false; //set the ad back to its original price uint price = ad.width * ad.height * pixelPrice; receiver.transfer(msg.value); emit MarketBuy(_idx, ad.owner, ad.forSale, price); } //function for setting an ad active or inactive function setActive(uint _idx, bool _active) public onlyContractOwner { //get add with index from parameter Ad storage ad = ads[_idx]; ad.active = _active; emit SetActive(_idx, ad.active); } //returns the total length of ads, used for looping over the ads in the homepage.js //note: this does only return an integer function getAds() public constant returns (uint) { return ads.length; } //transfers the full funds to the contract owner //contractOwner === deployer of the contract function withdraw() public onlyContractOwner { contractOwner.transfer(address(this).balance); } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"constant":true,"inputs":[],"name":"getAds","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"ads","outputs":[{"name":"owner","type":"address"},{"name":"width","type":"uint256"},{"name":"height","type":"uint256"},{"name":"x","type":"uint256"},{"name":"y","type":"uint256"},{"name":"title","type":"string"},{"name":"link","type":"string"},{"name":"ipfsHash","type":"string"},{"name":"forSale","type":"bool"},{"name":"active","type":"bool"},{"name":"marketPrice","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"pixelsPerCell","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"name":"grid","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"withdraw","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_x","type":"uint256"},{"name":"_y","type":"uint256"},{"name":"_width","type":"uint256"},{"name":"_height","type":"uint256"},{"name":"_title","type":"string"},{"name":"_link","type":"string"},{"name":"_ipfsHash","type":"string"}],"name":"buy","outputs":[{"name":"idx","type":"uint256"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"_idx","type":"uint256"},{"name":"_title","type":"string"},{"name":"_link","type":"string"},{"name":"_ipfsHash","type":"string"}],"name":"update","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_idx","type":"uint256"},{"name":"_sale","type":"bool"},{"name":"_marketPrice","type":"uint256"}],"name":"setSale","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_idx","type":"uint256"}],"name":"marketBuy","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"contractOwner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_idx","type":"uint256"},{"name":"_active","type":"bool"}],"name":"setActive","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"pixelPrice","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"idx","type":"uint256"},{"indexed":false,"name":"owner","type":"address"},{"indexed":false,"name":"x","type":"uint256"},{"indexed":false,"name":"y","type":"uint256"},{"indexed":false,"name":"width","type":"uint256"},{"indexed":false,"name":"height","type":"uint256"}],"name":"Buy","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"idx","type":"uint256"},{"indexed":false,"name":"link","type":"string"},{"indexed":false,"name":"ipfsHash","type":"string"},{"indexed":false,"name":"title","type":"string"}],"name":"Update","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"idx","type":"uint256"},{"indexed":false,"name":"forSale","type":"bool"},{"indexed":false,"name":"marketPrice","type":"uint256"}],"name":"SetSale","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"idx","type":"uint256"},{"indexed":false,"name":"owner","type":"address"},{"indexed":false,"name":"forSale","type":"bool"},{"indexed":false,"name":"marketPrice","type":"uint256"}],"name":"MarketBuy","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"idx","type":"uint256"},{"indexed":false,"name":"active","type":"bool"}],"name":"SetActive","type":"event"}]
Contract Creation Code
608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611797806100606000396000f3006080604052600436106100ba576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630955ae99146100bf57806311a7a4c0146100ea57806313f4b42c146102d4578063146008e3146102ff5780633ccfd60b1461034e5780633efea4d1146103655780636522bff11461048957806387b01dc9146105885780638fb84bb0146105cb578063ce606ee0146105eb578063e60a955d14610642578063ffb871731461067b575b600080fd5b3480156100cb57600080fd5b506100d46106a6565b6040518082815260200191505060405180910390f35b3480156100f657600080fd5b50610115600480360381019080803590602001909291905050506106b3565b604051808c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018b81526020018a8152602001898152602001888152602001806020018060200180602001871515151581526020018615151515815260200185815260200184810384528a818151815260200191508051906020019080838360005b838110156101c15780820151818401526020810190506101a6565b50505050905090810190601f1680156101ee5780820380516001836020036101000a031916815260200191505b50848103835289818151815260200191508051906020019080838360005b8381101561022757808201518184015260208101905061020c565b50505050905090810190601f1680156102545780820380516001836020036101000a031916815260200191505b50848103825288818151815260200191508051906020019080838360005b8381101561028d578082015181840152602081019050610272565b50505050905090810190601f1680156102ba5780820380516001836020036101000a031916815260200191505b509e50505050505050505050505050505060405180910390f35b3480156102e057600080fd5b506102e961091e565b6040518082815260200191505060405180910390f35b34801561030b57600080fd5b506103346004803603810190808035906020019092919080359060200190929190505050610924565b604051808215151515815260200191505060405180910390f35b34801561035a57600080fd5b50610363610961565b005b61047360048036038101908080359060200190929190803590602001909291908035906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610a3d565b6040518082815260200191505060405180910390f35b34801561049557600080fd5b5061058660048036038101908080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610dfa565b005b34801561059457600080fd5b506105c960048036038101908080359060200190929190803515159060200190929190803590602001909291905050506110f9565b005b6105e9600480360381019080803590602001909291905050506111fc565b005b3480156105f757600080fd5b506106006114b8565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561064e57600080fd5b50610679600480360381019080803590602001909291908035151590602001909291905050506114dd565b005b34801561068757600080fd5b506106906115c7565b6040518082815260200191505060405180910390f35b6000600280549050905090565b6002818154811015156106c257fe5b90600052602060002090600a02016000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690806001015490806002015490806003015490806004015490806005018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107ac5780601f10610781576101008083540402835291602001916107ac565b820191906000526020600020905b81548152906001019060200180831161078f57829003601f168201915b505050505090806006018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561084a5780601f1061081f5761010080835404028352916020019161084a565b820191906000526020600020905b81548152906001019060200180831161082d57829003601f168201915b505050505090806007018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108e85780601f106108bd576101008083540402835291602001916108e8565b820191906000526020600020905b8154815290600101906020018083116108cb57829003601f168201915b5050505050908060080160009054906101000a900460ff16908060080160019054906101000a900460ff1690806009015490508b565b61027181565b60038260328110151561093357fe5b600202018160288110151561094457fe5b60209182820401919006915091509054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156109bc57600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f19350505050158015610a3a573d6000803e3d6000fd5b50565b600080600080610a4b6115d1565b6548c273950000898b02029350600084111515610a6757600080fd5b833410151515610a7657600080fd5b600060198b811515610a8457fe5b06141515610a9157600080fd5b600060198a811515610a9f57fe5b06141515610aac57600080fd5b600092505b60198a811515610abd57fe5b04831015610bb157600091505b601989811515610ad657fe5b04821015610ba45760038360198e811515610aed57fe5b0401603281101515610afb57fe5b600202018260198d811515610b0c57fe5b0401602881101515610b1a57fe5b602091828204019190069054906101000a900460ff1615610b3a57600080fd5b600160038460198f811515610b4b57fe5b0401603281101515610b5957fe5b600202018360198e811515610b6a57fe5b0401602881101515610b7857fe5b602091828204019190066101000a81548160ff0219169083151502179055508180600101925050610aca565b8280600101935050610ab1565b610160604051908101604052803373ffffffffffffffffffffffffffffffffffffffff1681526020018d81526020018c81526020018b81526020018a815260200189815260200188815260200187815260200160001515815260200160011515815260200185815250905060016002829080600181540180825580915050906001820390600052602060002090600a02016000909192909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151816001015560408201518160020155606082015181600301556080820151816004015560a0820151816005019080519060200190610cd7929190611646565b5060c0820151816006019080519060200190610cf4929190611646565b5060e0820151816007019080519060200190610d11929190611646565b506101008201518160080160006101000a81548160ff0219169083151502179055506101208201518160080160016101000a81548160ff02191690831515021790555061014082015181600901555050039450847fc743092e1c1087d90fef606d97a56863ec6bbfd9e9cfbdddfe075a31094d70c1338e8e8e8e604051808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020018381526020018281526020019550505050505060405180910390a284945050505050979650505050505050565b6000600285815481101515610e0b57fe5b90600052602060002090600a020190508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610ec557506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515610ed057600080fd5b82816006019080519060200190610ee89291906116c6565b5081816007019080519060200190610f019291906116c6565b5083816005019080519060200190610f1a9291906116c6565b50847feb49f7181cc0da7406125224373eee9a7e5b640fd401f42801b825006aac841b82600601836007018460050160405180806020018060200180602001848103845287818154600181600116156101000203166002900481526020019150805460018160011615610100020316600290048015610fda5780601f10610faf57610100808354040283529160200191610fda565b820191906000526020600020905b815481529060010190602001808311610fbd57829003601f168201915b505084810383528681815460018160011615610100020316600290048152602001915080546001816001161561010002031660029004801561105d5780601f106110325761010080835404028352916020019161105d565b820191906000526020600020905b81548152906001019060200180831161104057829003601f168201915b50508481038252858181546001816001161561010002031660029004815260200191508054600181600116156101000203166002900480156110e05780601f106110b5576101008083540402835291602001916110e0565b820191906000526020600020905b8154815290600101906020018083116110c357829003601f168201915b5050965050505050505060405180910390a25050505050565b600060028481548110151561110a57fe5b90600052602060002090600a020190508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561117857600080fd5b828160080160006101000a81548160ff021916908315150217905550818160090181905550837f1716312071f207b07366243a09850282d385f2cffe8ee1f6f68f7d1feec53d958260080160009054906101000a900460ff16836009015460405180831515151581526020018281526020019250505060405180910390a250505050565b60008060028381548110151561120e57fe5b90600052602060002090600a020191508160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415151561127d57600080fd5b60003411151561128c57600080fd5b8160090154341015151561129f57600080fd5b600115158260080160009054906101000a900460ff1615151415156112c357600080fd5b8160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550338260000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008260080160006101000a81548160ff0219169083151502179055506548c2739500008260020154836001015402029050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f19350505050158015611405573d6000803e3d6000fd5b50827f95c733f2e801c4588b34397b3ceb3c76a9122d347cea7bbba037f1a74121e6a98360000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168460080160009054906101000a900460ff1684604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183151515158152602001828152602001935050505060405180910390a2505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561153a57600080fd5b60028381548110151561154957fe5b90600052602060002090600a02019050818160080160016101000a81548160ff021916908315150217905550827fb43464c32a3cc15ea31c3e13db7db00e57c742ba81008d107550cc22b2f53d308260080160019054906101000a900460ff16604051808215151515815260200191505060405180910390a2505050565b6548c27395000081565b61016060405190810160405280600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081526020016000815260200160008152602001606081526020016060815260200160608152602001600015158152602001600015158152602001600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061168757805160ff19168380011785556116b5565b828001600101855582156116b5579182015b828111156116b4578251825591602001919060010190611699565b5b5090506116c29190611746565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061170757805160ff1916838001178555611735565b82800160010185558215611735579182015b82811115611734578251825591602001919060010190611719565b5b5090506117429190611746565b5090565b61176891905b8082111561176457600081600090555060010161174c565b5090565b905600a165627a7a7230582040e76380ab7b7334d8e7a373e0c3e8f668982631460d515217de730406ad47ed0029
Swarm Source
bzzr://40e76380ab7b7334d8e7a373e0c3e8f668982631460d515217de730406ad47ed
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.
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.