Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 10 from a total of 10 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Withdraw Token | 4358704 | 2536 days ago | IN | 0 ETH | 0.00058186 | ||||
Withdraw Ether | 4307927 | 2553 days ago | IN | 0 ETH | 0.00066481 | ||||
Set Token To Eth... | 4307923 | 2553 days ago | IN | 0 ETH | 0.00028547 | ||||
Transfer | 4301444 | 2555 days ago | IN | 3,000 ETH | 0.00044207 | ||||
Transfer | 4301383 | 2555 days ago | IN | 1,500 ETH | 0.00044207 | ||||
Owned | 4291093 | 2558 days ago | IN | 0 ETH | 0.00017303 | ||||
Owned | 4280444 | 2561 days ago | IN | 0 ETH | 0.00008651 | ||||
Withdraw Ether | 4280434 | 2561 days ago | IN | 0 ETH | 0.00015777 | ||||
Transfer | 4268181 | 2565 days ago | IN | 0.001 ETH | 0.00002105 | ||||
0x60606040 | 4268155 | 2565 days ago | IN | 0 ETH | 0.00214501 |
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
4307927 | 2553 days ago | 3,784.89720522 ETH | ||||
4307890 | 2553 days ago | 5.77206494 ETH | ||||
4307877 | 2553 days ago | 10.68322981 ETH | ||||
4307838 | 2553 days ago | 0.25093167 ETH | ||||
4307837 | 2553 days ago | 1.67701863 ETH | ||||
4307830 | 2553 days ago | 11.62623792 ETH | ||||
4307824 | 2553 days ago | 1.16124223 ETH | ||||
4307822 | 2553 days ago | 10.85052198 ETH | ||||
4307821 | 2553 days ago | 0.14491593 ETH | ||||
4307817 | 2553 days ago | 0.67446648 ETH | ||||
4307812 | 2553 days ago | 0.44189306 ETH | ||||
4307812 | 2553 days ago | 99.87577639 ETH | ||||
4307808 | 2553 days ago | 0.28078973 ETH | ||||
4307772 | 2553 days ago | 38.137965 ETH | ||||
4307753 | 2553 days ago | 1.76717515 ETH | ||||
4307738 | 2553 days ago | 5.59098973 ETH | ||||
4307729 | 2553 days ago | 8.51913043 ETH | ||||
4307721 | 2553 days ago | 1.24223602 ETH | ||||
4307703 | 2553 days ago | 2 ETH | ||||
4307672 | 2553 days ago | 4.96529192 ETH | ||||
4307621 | 2553 days ago | 1.49068322 ETH | ||||
4307597 | 2553 days ago | 12.91362983 ETH | ||||
4307575 | 2553 days ago | 38 ETH | ||||
4307541 | 2553 days ago | 1.98161639 ETH | ||||
4307523 | 2553 days ago | 0.20016734 ETH |
Loading...
Loading
Contract Name:
Exchange
Compiler Version
v0.4.11+commit.68ef5810
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity)
/** *Submitted for verification at Etherscan.io on 2017-09-15 */ pragma solidity ^0.4.11; contract Owned { address public owner; function Owned() { owner = msg.sender; } modifier onlyOwner() { require(msg.sender == owner); _; } function setOwner(address _newOwner) onlyOwner { owner = _newOwner; } } /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal constant returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal constant returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } function sub(uint256 a, uint256 b) internal constant returns (uint256) { assert(b <= a); return a - b; } function add(uint256 a, uint256 b) internal constant returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } function toUINT112(uint256 a) internal constant returns(uint112) { assert(uint112(a) == a); return uint112(a); } function toUINT120(uint256 a) internal constant returns(uint120) { assert(uint120(a) == a); return uint120(a); } function toUINT128(uint256 a) internal constant returns(uint128) { assert(uint128(a) == a); return uint128(a); } } // Abstract contract for the full ERC 20 Token standard // https://github.com/ethereum/EIPs/issues/20 contract Token { /* This is a slight change to the ERC20 base standard. function totalSupply() constant returns (uint256 supply); is replaced with: uint256 public totalSupply; This automatically creates a getter function for the totalSupply. This is moved to the base contract since public getter functions are not currently recognised as an implementation of the matching abstract function by the compiler. */ /// total amount of tokens //uint256 public totalSupply; function totalSupply() constant returns (uint256 supply); /// @param _owner The address from which the balance will be retrieved /// @return The balance function balanceOf(address _owner) constant returns (uint256 balance); /// @notice send `_value` token to `_to` from `msg.sender` /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transfer(address _to, uint256 _value) returns (bool success); /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transferFrom(address _from, address _to, uint256 _value) returns (bool success); /// @notice `msg.sender` approves `_addr` to spend `_value` tokens /// @param _spender The address of the account able to transfer the tokens /// @param _value The amount of wei to be approved for transfer /// @return Whether the approval was successful or not function approve(address _spender, uint256 _value) returns (bool success); /// @param _owner The address of the account owning tokens /// @param _spender The address of the account able to transfer the tokens /// @return Amount of remaining tokens allowed to spent function allowance(address _owner, address _spender) constant returns (uint256 remaining); event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); } contract Exchange is Owned { event onExchangeTokenToEther(address who, uint256 tokenAmount, uint256 etherAmount); using SafeMath for uint256; Token public token = Token(0xD850942eF8811f2A866692A623011bDE52a462C1); // 1 ether = ? tokens uint256 public rate = 4025; // quota of token for every account that can be exchanged to ether uint256 public tokenQuota = 402500 ether; // quota of ether for every account that can be exchanged to token // uint256 public etherQuota = 100 ether; bool public tokenToEtherAllowed = true; // bool public etherToTokenAllowed = false; // uint256 public totalReturnedCredit; //returned ven // struct QuotaUsed { // uint128 tokens; // uint128 ethers; // } mapping(address => uint256) accountQuotaUsed; function Exchange() { } function () payable { } function withdrawEther(address _address,uint256 _amount) onlyOwner { require(_address != 0); _address.transfer(_amount); } function withdrawToken(address _address, uint256 _amount) onlyOwner { require(_address != 0); token.transfer(_address, _amount); } function quotaUsed(address _account) constant returns(uint256 ) { return accountQuotaUsed[_account]; } //tested function setRate(uint256 _rate) onlyOwner { rate = _rate; } //tested function setTokenQuota(uint256 _quota) onlyOwner { tokenQuota = _quota; } // function setEtherQuota(uint256 _quota) onlyOwner { // etherQuota = _quota; // } //tested function setTokenToEtherAllowed(bool _allowed) onlyOwner { tokenToEtherAllowed = _allowed; } // function setEtherToTokenAllowed(bool _allowed) onlyOwner { // etherToTokenAllowed = _allowed; // } function receiveApproval(address _from, uint256 _value, address /*_tokenContract*/, bytes /*_extraData*/) { exchangeTokenToEther(_from, _value); } function exchangeTokenToEther(address _from, uint256 _tokenAmount) internal { require(tokenToEtherAllowed); require(msg.sender == address(token)); require(!isContract(_from)); uint256 quota = tokenQuota.sub(accountQuotaUsed[_from]); if (_tokenAmount > quota) _tokenAmount = quota; uint256 balance = token.balanceOf(_from); if (_tokenAmount > balance) _tokenAmount = balance; require(_tokenAmount>0); //require the token should be above 0 //require(_tokenAmount > 0.01 ether); require(token.transferFrom(_from, this, _tokenAmount)); accountQuotaUsed[_from] = _tokenAmount.add(accountQuotaUsed[_from]); uint256 etherAmount = _tokenAmount / rate; require(etherAmount > 0); _from.transfer(etherAmount); // totalReturnedCredit+=_tokenAmount; onExchangeTokenToEther(_from, _tokenAmount, etherAmount); } //exchange EtherToToken放到fallback函数中 //TokenToEther // function exchangeEtherToToken() payable { // require(etherToTokenAllowed); // require(!isContract(msg.sender)); // // uint256 quota = etherQuota.sub(accountQuotaUsed[msg.sender].ethers); // uint256 etherAmount = msg.value; // require(etherAmount >= 0.01 ether && etherAmount <= quota); // // uint256 tokenAmount = etherAmount * rate; // accountQuotaUsed[msg.sender].ethers = etherAmount.add(accountQuotaUsed[msg.sender].ethers).toUINT128(); // require(token.transfer(msg.sender, tokenAmount)); // onExchangeEtherToToken(msg.sender, tokenAmount, etherAmount); // } function isContract(address _addr) constant internal returns(bool) { uint size; if (_addr == 0) return false; assembly { size := extcodesize(_addr) } return size > 0; } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"constant":false,"inputs":[{"name":"_newOwner","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"tokenQuota","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"rate","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"tokenToEtherAllowed","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_rate","type":"uint256"}],"name":"setRate","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_allowed","type":"bool"}],"name":"setTokenToEtherAllowed","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_account","type":"address"}],"name":"quotaUsed","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_address","type":"address"},{"name":"_amount","type":"uint256"}],"name":"withdrawEther","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_value","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"bytes"}],"name":"receiveApproval","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_address","type":"address"},{"name":"_amount","type":"uint256"}],"name":"withdrawToken","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"token","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_quota","type":"uint256"}],"name":"setTokenQuota","outputs":[],"payable":false,"type":"function"},{"inputs":[],"payable":false,"type":"constructor"},{"payable":true,"type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"who","type":"address"},{"indexed":false,"name":"tokenAmount","type":"uint256"},{"indexed":false,"name":"etherAmount","type":"uint256"}],"name":"onExchangeTokenToEther","type":"event"}]
Contract Creation Code
606060405260018054600160a060020a03191673d850942ef8811f2a866692a623011bde52a462c1178155610fb960025569553b9197b79a869000006003556004805460ff19169091179055341561005357fe5b5b5b60008054600160a060020a03191633600160a060020a03161790555b5b5b61083b806100826000396000f300606060405236156100c25763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166313af403581146100cb578063168cd7ae146100e95780632c4e722e1461010b5780632d0e66361461012d57806334fcf43714610151578063378ebf9314610166578063496e41d21461017d578063522f6815146101ab5780638da5cb5b146101cc5780638f4ffcb1146101f85780639e281a9814610266578063fc0c546a14610287578063fe6fef44146102b3575b6100c95b5b565b005b34156100d357fe5b6100c9600160a060020a03600435166102c8565b005b34156100f157fe5b6100f9610311565b60408051918252519081900360200190f35b341561011357fe5b6100f9610317565b60408051918252519081900360200190f35b341561013557fe5b61013d61031d565b604080519115158252519081900360200190f35b341561015957fe5b6100c9600435610326565b005b341561016e57fe5b6100c9600435151561034c565b005b341561018557fe5b6100f9600160a060020a036004351661037b565b60408051918252519081900360200190f35b34156101b357fe5b6100c9600160a060020a036004351660243561039a565b005b34156101d457fe5b6101dc6103ff565b60408051600160a060020a039092168252519081900360200190f35b341561020057fe5b604080516020600460643581810135601f81018490048402850184019095528484526100c9948235600160a060020a039081169560248035966044359093169594608494929391019190819084018382808284375094965061040e95505050505050565b005b341561026e57fe5b6100c9600160a060020a036004351660243561041f565b005b341561028f57fe5b6101dc6104dd565b60408051600160a060020a039092168252519081900360200190f35b34156102bb57fe5b6100c96004356104ec565b005b60005433600160a060020a039081169116146102e45760006000fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b50565b60035481565b60025481565b60045460ff1681565b60005433600160a060020a039081169116146103425760006000fd5b60028190555b5b50565b60005433600160a060020a039081169116146103685760006000fd5b6004805460ff19168215151790555b5b50565b600160a060020a0381166000908152600560205260409020545b919050565b60005433600160a060020a039081169116146103b65760006000fd5b600160a060020a03821615156103cc5760006000fd5b604051600160a060020a0383169082156108fc029083906000818181858888f1935050505015156103f957fe5b5b5b5050565b600054600160a060020a031681565b6104188484610512565b5b50505050565b60005433600160a060020a0390811691161461043b5760006000fd5b600160a060020a03821615156104515760006000fd5b600154604080516000602091820181905282517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a038781166004830152602482018790529351939094169363a9059cbb936044808301949391928390030190829087803b15156104c657fe5b6102c65a03f115156104d457fe5b5050505b5b5050565b600154600160a060020a031681565b60005433600160a060020a039081169116146105085760006000fd5b60038190555b5b50565b6004546000908190819060ff16151561052b5760006000fd5b60015433600160a060020a039081169116146105475760006000fd5b610550856107b1565b1561055b5760006000fd5b600160a060020a0385166000908152600560205260409020546003546105869163ffffffff6107de16565b925082841115610594578293505b600154604080516000602091820181905282517f70a08231000000000000000000000000000000000000000000000000000000008152600160a060020a038a81166004830152935193909416936370a08231936024808301949391928390030190829087803b151561060257fe5b6102c65a03f1151561061057fe5b50506040515192505081841115610625578193505b600084116106335760006000fd5b600154604080516000602091820181905282517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a038a811660048301523081166024830152604482018a9052935193909416936323b872dd936064808301949391928390030190829087803b15156106b057fe5b6102c65a03f115156106be57fe5b505060405151151590506106d25760006000fd5b600160a060020a0385166000908152600560205260409020546106fc90859063ffffffff6107f516565b600160a060020a0386166000908152600560205260409020556002548481151561072257fe5b049050600081116107335760006000fd5b604051600160a060020a0386169082156108fc029083906000818181858888f19350505050151561076057fe5b60408051600160a060020a03871681526020810186905280820183905290517f870911ff929322178d4a23d2962b1b0b6c857473a1e38dfb4aed29384ecb5ff39181900360600190a15b5050505050565b600080600160a060020a03831615156107cd57600091506107d8565b823b90506000811191505b50919050565b6000828211156107ea57fe5b508082035b92915050565b60008282018381101561080457fe5b8091505b50929150505600a165627a7a72305820b514f875e446108157ba3a6e3b03dfa0d9b7acc43accb0e61776b11b8bb64dcd0029
Deployed Bytecode
0x606060405236156100c25763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166313af403581146100cb578063168cd7ae146100e95780632c4e722e1461010b5780632d0e66361461012d57806334fcf43714610151578063378ebf9314610166578063496e41d21461017d578063522f6815146101ab5780638da5cb5b146101cc5780638f4ffcb1146101f85780639e281a9814610266578063fc0c546a14610287578063fe6fef44146102b3575b6100c95b5b565b005b34156100d357fe5b6100c9600160a060020a03600435166102c8565b005b34156100f157fe5b6100f9610311565b60408051918252519081900360200190f35b341561011357fe5b6100f9610317565b60408051918252519081900360200190f35b341561013557fe5b61013d61031d565b604080519115158252519081900360200190f35b341561015957fe5b6100c9600435610326565b005b341561016e57fe5b6100c9600435151561034c565b005b341561018557fe5b6100f9600160a060020a036004351661037b565b60408051918252519081900360200190f35b34156101b357fe5b6100c9600160a060020a036004351660243561039a565b005b34156101d457fe5b6101dc6103ff565b60408051600160a060020a039092168252519081900360200190f35b341561020057fe5b604080516020600460643581810135601f81018490048402850184019095528484526100c9948235600160a060020a039081169560248035966044359093169594608494929391019190819084018382808284375094965061040e95505050505050565b005b341561026e57fe5b6100c9600160a060020a036004351660243561041f565b005b341561028f57fe5b6101dc6104dd565b60408051600160a060020a039092168252519081900360200190f35b34156102bb57fe5b6100c96004356104ec565b005b60005433600160a060020a039081169116146102e45760006000fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b50565b60035481565b60025481565b60045460ff1681565b60005433600160a060020a039081169116146103425760006000fd5b60028190555b5b50565b60005433600160a060020a039081169116146103685760006000fd5b6004805460ff19168215151790555b5b50565b600160a060020a0381166000908152600560205260409020545b919050565b60005433600160a060020a039081169116146103b65760006000fd5b600160a060020a03821615156103cc5760006000fd5b604051600160a060020a0383169082156108fc029083906000818181858888f1935050505015156103f957fe5b5b5b5050565b600054600160a060020a031681565b6104188484610512565b5b50505050565b60005433600160a060020a0390811691161461043b5760006000fd5b600160a060020a03821615156104515760006000fd5b600154604080516000602091820181905282517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a038781166004830152602482018790529351939094169363a9059cbb936044808301949391928390030190829087803b15156104c657fe5b6102c65a03f115156104d457fe5b5050505b5b5050565b600154600160a060020a031681565b60005433600160a060020a039081169116146105085760006000fd5b60038190555b5b50565b6004546000908190819060ff16151561052b5760006000fd5b60015433600160a060020a039081169116146105475760006000fd5b610550856107b1565b1561055b5760006000fd5b600160a060020a0385166000908152600560205260409020546003546105869163ffffffff6107de16565b925082841115610594578293505b600154604080516000602091820181905282517f70a08231000000000000000000000000000000000000000000000000000000008152600160a060020a038a81166004830152935193909416936370a08231936024808301949391928390030190829087803b151561060257fe5b6102c65a03f1151561061057fe5b50506040515192505081841115610625578193505b600084116106335760006000fd5b600154604080516000602091820181905282517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a038a811660048301523081166024830152604482018a9052935193909416936323b872dd936064808301949391928390030190829087803b15156106b057fe5b6102c65a03f115156106be57fe5b505060405151151590506106d25760006000fd5b600160a060020a0385166000908152600560205260409020546106fc90859063ffffffff6107f516565b600160a060020a0386166000908152600560205260409020556002548481151561072257fe5b049050600081116107335760006000fd5b604051600160a060020a0386169082156108fc029083906000818181858888f19350505050151561076057fe5b60408051600160a060020a03871681526020810186905280820183905290517f870911ff929322178d4a23d2962b1b0b6c857473a1e38dfb4aed29384ecb5ff39181900360600190a15b5050505050565b600080600160a060020a03831615156107cd57600091506107d8565b823b90506000811191505b50919050565b6000828211156107ea57fe5b508082035b92915050565b60008282018381101561080457fe5b8091505b50929150505600a165627a7a72305820b514f875e446108157ba3a6e3b03dfa0d9b7acc43accb0e61776b11b8bb64dcd0029
Swarm Source
bzzr://b514f875e446108157ba3a6e3b03dfa0d9b7acc43accb0e61776b11b8bb64dcd
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 27 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
[ 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.