Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
DataContract
Compiler Version
v0.4.24+commit.e67f0147
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity)
/** *Submitted for verification at Etherscan.io on 2018-08-10 */ pragma solidity ^0.4.20; contract owned { address public owner; address public tokenContract; constructor() public{ owner = msg.sender; } modifier onlyOwner { require(msg.sender == owner); _; } modifier onlyOwnerAndtokenContract { require(msg.sender == owner || msg.sender == tokenContract); _; } function transferOwnership(address newOwner) onlyOwner public { if (newOwner != address(0)) { owner = newOwner; } } function transfertokenContract(address newOwner) onlyOwner public { if (newOwner != address(0)) { tokenContract = newOwner; } } } contract DataContract is owned { struct Good { bytes32 preset; uint price; uint decision; uint time; } mapping (bytes32 => Good) public goods; function setGood(bytes32 _preset, uint _price,uint _decision) onlyOwnerAndtokenContract external { goods[_preset] = Good({preset: _preset, price: _price, decision:_decision, time: now}); } function getGoodPreset(bytes32 _preset) view public returns (bytes32) { return goods[_preset].preset; } function getGoodDecision(bytes32 _preset) view public returns (uint) { return goods[_preset].decision; } function getGoodPrice(bytes32 _preset) view public returns (uint) { return goods[_preset].price; } } contract Token is owned { DataContract DC; constructor(address _dataContractAddr) public{ DC = DataContract(_dataContractAddr); } event Decision(uint decision,bytes32 preset); function postGood(bytes32 _preset, uint _price) onlyOwner public { require(DC.getGoodPreset(_preset) == ""); uint _decision = uint(keccak256(keccak256(blockhash(block.number),_preset),now))%(_price); DC.setGood(_preset, _price, _decision); Decision(_decision, _preset); } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"constant":true,"inputs":[],"name":"tokenContract","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_preset","type":"bytes32"}],"name":"getGoodPreset","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"goods","outputs":[{"name":"preset","type":"bytes32"},{"name":"price","type":"uint256"},{"name":"decision","type":"uint256"},{"name":"time","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_preset","type":"bytes32"}],"name":"getGoodPrice","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transfertokenContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_preset","type":"bytes32"}],"name":"getGoodDecision","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_preset","type":"bytes32"},{"name":"_price","type":"uint256"},{"name":"_decision","type":"uint256"}],"name":"setGood","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405260008054600160a060020a031916331790556103b0806100256000396000f3006080604052600436106100985763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166355a373d6811461009d5780636ccde640146100ce5780638da5cb5b146100f857806399ce919c1461010d578063bcd61c6a1461014b578063e7f0a86514610163578063ec3a6d6414610186578063f2fde38b1461019e578063fffa9d0c146101bf575b600080fd5b3480156100a957600080fd5b506100b26101dd565b60408051600160a060020a039092168252519081900360200190f35b3480156100da57600080fd5b506100e66004356101ec565b60408051918252519081900360200190f35b34801561010457600080fd5b506100b26101fe565b34801561011957600080fd5b5061012560043561020d565b604080519485526020850193909352838301919091526060830152519081900360800190f35b34801561015757600080fd5b506100e6600435610236565b34801561016f57600080fd5b50610184600160a060020a036004351661024b565b005b34801561019257600080fd5b506100e660043561029d565b3480156101aa57600080fd5b50610184600160a060020a03600435166102b3565b3480156101cb57600080fd5b50610184600435602435604435610306565b600154600160a060020a031681565b60009081526002602052604090205490565b600054600160a060020a031681565b600260208190526000918252604090912080546001820154928201546003909201549092919084565b60009081526002602052604090206001015490565b600054600160a060020a0316331461026257600080fd5b600160a060020a0381161561029a576001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b50565b6000908152600260208190526040909120015490565b600054600160a060020a031633146102ca57600080fd5b600160a060020a0381161561029a5760008054600160a060020a03831673ffffffffffffffffffffffffffffffffffffffff1990911617905550565b600054600160a060020a03163314806103295750600154600160a060020a031633145b151561033457600080fd5b6040805160808101825284815260208082019485528183019384524260608301908152600096875260029182905292909520905181559251600184015590519282019290925590516003909101555600a165627a7a72305820395e6d3d923c5bfbf213d362a85dd923f10c3364c929caa4d5a581830e07ae600029
Deployed Bytecode
0x6080604052600436106100985763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166355a373d6811461009d5780636ccde640146100ce5780638da5cb5b146100f857806399ce919c1461010d578063bcd61c6a1461014b578063e7f0a86514610163578063ec3a6d6414610186578063f2fde38b1461019e578063fffa9d0c146101bf575b600080fd5b3480156100a957600080fd5b506100b26101dd565b60408051600160a060020a039092168252519081900360200190f35b3480156100da57600080fd5b506100e66004356101ec565b60408051918252519081900360200190f35b34801561010457600080fd5b506100b26101fe565b34801561011957600080fd5b5061012560043561020d565b604080519485526020850193909352838301919091526060830152519081900360800190f35b34801561015757600080fd5b506100e6600435610236565b34801561016f57600080fd5b50610184600160a060020a036004351661024b565b005b34801561019257600080fd5b506100e660043561029d565b3480156101aa57600080fd5b50610184600160a060020a03600435166102b3565b3480156101cb57600080fd5b50610184600435602435604435610306565b600154600160a060020a031681565b60009081526002602052604090205490565b600054600160a060020a031681565b600260208190526000918252604090912080546001820154928201546003909201549092919084565b60009081526002602052604090206001015490565b600054600160a060020a0316331461026257600080fd5b600160a060020a0381161561029a576001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b50565b6000908152600260208190526040909120015490565b600054600160a060020a031633146102ca57600080fd5b600160a060020a0381161561029a5760008054600160a060020a03831673ffffffffffffffffffffffffffffffffffffffff1990911617905550565b600054600160a060020a03163314806103295750600154600160a060020a031633145b151561033457600080fd5b6040805160808101825284815260208082019485528183019384524260608301908152600096875260029182905292909520905181559251600184015590519282019290925590516003909101555600a165627a7a72305820395e6d3d923c5bfbf213d362a85dd923f10c3364c929caa4d5a581830e07ae600029
Swarm Source
bzzr://395e6d3d923c5bfbf213d362a85dd923f10c3364c929caa4d5a581830e07ae60
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 35 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.