Contract Overview
More Info
My Name Tag:
Not Available, login to update
[ Download CSV Export ]
Latest 25 internal transaction
[ Download CSV Export ]
Contract Name:
EnclavesDEXProxy
Compiler Version
v0.4.21+commit.dfe3193c
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity)
/** *Submitted for verification at Etherscan.io on 2018-04-16 */ pragma solidity ^0.4.18; // File: contracts/EtherDeltaI.sol contract EtherDeltaI { uint public feeMake; //percentage times (1 ether) uint public feeTake; //percentage times (1 ether) mapping (address => mapping (address => uint)) public tokens; //mapping of token addresses to mapping of account balances (token=0 means Ether) mapping (address => mapping (bytes32 => bool)) public orders; //mapping of user accounts to mapping of order hashes to booleans (true = submitted by user, equivalent to offchain signature) mapping (address => mapping (bytes32 => uint)) public orderFills; //mapping of user accounts to mapping of order hashes to uints (amount of order that has been filled) function deposit() payable; function withdraw(uint amount); function depositToken(address token, uint amount); function withdrawToken(address token, uint amount); function balanceOf(address token, address user) constant returns (uint); function order(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce); function trade(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user, uint8 v, bytes32 r, bytes32 s, uint amount); function testTrade(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user, uint8 v, bytes32 r, bytes32 s, uint amount, address sender) constant returns(bool); function availableVolume(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user, uint8 v, bytes32 r, bytes32 s) constant returns(uint); function amountFilled(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user, uint8 v, bytes32 r, bytes32 s) constant returns(uint); function cancelOrder(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, uint8 v, bytes32 r, bytes32 s); } // File: contracts/KindMath.sol /** * @title KindMath * @dev Math operations with safety checks that fail */ library KindMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; require(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal pure 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 pure returns (uint256) { require(b <= a); return a - b; } function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a); return c; } } // File: contracts/KeyValueStorage.sol contract KeyValueStorage { mapping(address => mapping(bytes32 => uint256)) _uintStorage; mapping(address => mapping(bytes32 => address)) _addressStorage; mapping(address => mapping(bytes32 => bool)) _boolStorage; mapping(address => mapping(bytes32 => bytes32)) _bytes32Storage; /**** Get Methods ***********/ function getAddress(bytes32 key) public view returns (address) { return _addressStorage[msg.sender][key]; } function getUint(bytes32 key) public view returns (uint) { return _uintStorage[msg.sender][key]; } function getBool(bytes32 key) public view returns (bool) { return _boolStorage[msg.sender][key]; } function getBytes32(bytes32 key) public view returns (bytes32) { return _bytes32Storage[msg.sender][key]; } /**** Set Methods ***********/ function setAddress(bytes32 key, address value) public { _addressStorage[msg.sender][key] = value; } function setUint(bytes32 key, uint value) public { _uintStorage[msg.sender][key] = value; } function setBool(bytes32 key, bool value) public { _boolStorage[msg.sender][key] = value; } function setBytes32(bytes32 key, bytes32 value) public { _bytes32Storage[msg.sender][key] = value; } /**** Delete Methods ***********/ function deleteAddress(bytes32 key) public { delete _addressStorage[msg.sender][key]; } function deleteUint(bytes32 key) public { delete _uintStorage[msg.sender][key]; } function deleteBool(bytes32 key) public { delete _boolStorage[msg.sender][key]; } function deleteBytes32(bytes32 key) public { delete _bytes32Storage[msg.sender][key]; } } // File: contracts/StorageStateful.sol contract StorageStateful { KeyValueStorage public keyValueStorage; } // File: contracts/StorageConsumer.sol contract StorageConsumer is StorageStateful { function StorageConsumer(address _storageAddress) public { require(_storageAddress != address(0)); keyValueStorage = KeyValueStorage(_storageAddress); } } // File: contracts/TokenI.sol contract Token { /// @return total amount of tokens function totalSupply() public returns (uint256); /// @param _owner The address from which the balance will be retrieved /// @return The balance function balanceOf(address _owner) public returns (uint256); /// @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) public returns (bool); /// @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) public returns (bool); /// @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) public returns (bool); /// @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) public returns (uint256); event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); uint256 public decimals; string public name; } // File: contracts/EnclavesDEXProxy.sol contract EnclavesDEXProxy is StorageConsumer { using KindMath for uint256; address public admin; //the admin address address public feeAccount; //the account that will receive fees struct EtherDeltaInfo { uint256 feeMake; uint256 feeTake; } EtherDeltaInfo public etherDeltaInfo; uint256 public feeTake; //percentage times 1 ether uint256 public feeAmountThreshold; //gasPrice amount under which no fees are charged address public etherDelta; bool public useEIP712 = true; bytes32 public tradeABIHash; bytes32 public withdrawABIHash; bool freezeTrading; bool depositTokenLock; mapping (address => mapping (uint256 => bool)) nonceCheck; mapping (address => mapping (address => uint256)) public tokens; //mapping of token addresses to mapping of account balances (token=0 means Ether) mapping (address => mapping (bytes32 => bool)) public orders; //mapping of user accounts to mapping of order hashes to booleans (true = submitted by user, equivalent to offchain signature) mapping (address => mapping (bytes32 => uint256)) public orderFills; //mapping of user accounts to mapping of order hashes to uints (amount of order that has been filled) address internal implementation; address public proposedImplementation; uint256 public proposedTimestamp; event Upgraded(address _implementation); event UpgradedProposed(address _proposedImplementation, uint256 _proposedTimestamp); modifier onlyAdmin { require(msg.sender == admin); _; } function EnclavesDEXProxy(address _storageAddress, address _implementation, address _admin, address _feeAccount, uint256 _feeTake, uint256 _feeAmountThreshold, address _etherDelta, bytes32 _tradeABIHash, bytes32 _withdrawABIHash) public StorageConsumer(_storageAddress) { require(_implementation != address(0)); implementation = _implementation; admin = _admin; feeAccount = _feeAccount; feeTake = _feeTake; feeAmountThreshold = _feeAmountThreshold; etherDelta = _etherDelta; tradeABIHash = _tradeABIHash; withdrawABIHash = _withdrawABIHash; etherDeltaInfo.feeMake = EtherDeltaI(etherDelta).feeMake(); etherDeltaInfo.feeTake = EtherDeltaI(etherDelta).feeTake(); } function getImplementation() public view returns(address) { return implementation; } function proposeUpgrade(address _proposedImplementation) public onlyAdmin { require(implementation != _proposedImplementation); require(_proposedImplementation != address(0)); proposedImplementation = _proposedImplementation; proposedTimestamp = now + 2 weeks; UpgradedProposed(proposedImplementation, now); } function upgrade() public onlyAdmin { require(proposedImplementation != address(0)); require(proposedTimestamp < now); implementation = proposedImplementation; Upgraded(implementation); } function () payable public { bytes memory data = msg.data; address impl = getImplementation(); assembly { let result := delegatecall(gas, impl, add(data, 0x20), mload(data), 0, 0) let size := returndatasize let ptr := mload(0x40) returndatacopy(ptr, 0, size) switch result case 0 { revert(ptr, size) } default { return(ptr, size) } } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"bytes32"}],"name":"orderFills","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"etherDeltaInfo","outputs":[{"name":"feeMake","type":"uint256"},{"name":"feeTake","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"proposedTimestamp","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"}],"name":"tokens","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"feeAmountThreshold","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"useEIP712","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"keyValueStorage","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"feeAccount","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"tradeABIHash","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getImplementation","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"proposedImplementation","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"bytes32"}],"name":"orders","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"feeTake","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_proposedImplementation","type":"address"}],"name":"proposeUpgrade","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"upgrade","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"etherDelta","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"admin","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"withdrawABIHash","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_storageAddress","type":"address"},{"name":"_implementation","type":"address"},{"name":"_admin","type":"address"},{"name":"_feeAccount","type":"address"},{"name":"_feeTake","type":"uint256"},{"name":"_feeAmountThreshold","type":"uint256"},{"name":"_etherDelta","type":"address"},{"name":"_tradeABIHash","type":"bytes32"},{"name":"_withdrawABIHash","type":"bytes32"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_implementation","type":"address"}],"name":"Upgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_proposedImplementation","type":"address"},{"indexed":false,"name":"_proposedTimestamp","type":"uint256"}],"name":"UpgradedProposed","type":"event"}]
Contract Creation Code
60606040526007805460a060020a60ff02191674010000000000000000000000000000000000000000179055341561003657600080fd5b6040516101208061081c8339810160405280805191906020018051919060200180519190602001805191906020018051919060200180519190602001805191906020018051919060200180519150899050600160a060020a038116151561009c57600080fd5b60008054600160a060020a031916600160a060020a03928316179055881615156100c557600080fd5b600f8054600160a060020a0319908116600160a060020a038b8116919091179092556001805482168a841617905560028054821689841617905560058790556006869055600780549091168583161790819055600884905560098390551663577863946040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561016f57600080fd5b5af1151561017c57600080fd5b505050604051805160035550600754600160a060020a031663c281309e6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15156101e057600080fd5b5af115156101ed57600080fd5b50505060405180516004555050505050505050505061060b806102116000396000f3006060604052600436106100fb5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166319774d4381146101675780631bff47861461019b5780633cf52ffb146101c6578063508493bc146101d957806355ce76e6146101fe5780635bd948b1146102115780635d4d061e1461023857806365e17c9d146102675780638e1e2add1461027a578063aaf10f421461028d578063bb057c5e146102a0578063bb5f4629146102b3578063c281309e146102d5578063c915fc93146102e8578063d55ec69714610309578063d67a10e31461031c578063f851a4401461032f578063fe26f16f14610342575b6101036105cd565b600080368080601f01602080910402602001604051908101604052818152929190602084018383808284378201915050505050509150610141610355565b9050600080835160208501845af43d604051816000823e828015610163578282f35b8282fd5b341561017257600080fd5b610189600160a060020a0360043516602435610364565b60405190815260200160405180910390f35b34156101a657600080fd5b6101ae610381565b60405191825260208201526040908101905180910390f35b34156101d157600080fd5b61018961038a565b34156101e457600080fd5b610189600160a060020a0360043581169060243516610390565b341561020957600080fd5b6101896103ad565b341561021c57600080fd5b6102246103b3565b604051901515815260200160405180910390f35b341561024357600080fd5b61024b6103d4565b604051600160a060020a03909116815260200160405180910390f35b341561027257600080fd5b61024b6103e3565b341561028557600080fd5b6101896103f2565b341561029857600080fd5b61024b610355565b34156102ab57600080fd5b61024b6103f8565b34156102be57600080fd5b610224600160a060020a0360043516602435610407565b34156102e057600080fd5b610189610427565b34156102f357600080fd5b610307600160a060020a036004351661042d565b005b341561031457600080fd5b6103076104fa565b341561032757600080fd5b61024b6105a9565b341561033a57600080fd5b61024b6105b8565b341561034d57600080fd5b6101896105c7565b600f54600160a060020a031690565b600e60209081526000928352604080842090915290825290205481565b60035460045482565b60115481565b600c60209081526000928352604080842090915290825290205481565b60065481565b60075474010000000000000000000000000000000000000000900460ff1681565b600054600160a060020a031681565b600254600160a060020a031681565b60085481565b601054600160a060020a031681565b600d60209081526000928352604080842090915290825290205460ff1681565b60055481565b60015433600160a060020a0390811691161461044857600080fd5b600f54600160a060020a038281169116141561046357600080fd5b600160a060020a038116151561047857600080fd5b6010805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038381169190911791829055426212750081016011557fec67bbd1e1c0c74039cb44e4ee8278b388155a131c81387e07f800c16f776e839290911690604051600160a060020a03909216825260208201526040908101905180910390a150565b60015433600160a060020a0390811691161461051557600080fd5b601054600160a060020a0316151561052c57600080fd5b60115442901061053b57600080fd5b601054600f805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392831617908190557fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b9116604051600160a060020a03909116815260200160405180910390a1565b600754600160a060020a031681565b600154600160a060020a031681565b60095481565b602060405190810160405260008152905600a165627a7a72305820748c3fd36452cba2982dabc925ed50191b752dc57a2492bded2e68ee07306ed20029000000000000000000000000129caf12c70fe9633fe24b15497adafc913c842c000000000000000000000000ed06d46ffb309128c4458a270c99c824dc127f5d000000000000000000000000e03793e63776cf69fe42414ed03bb924d4d9157e000000000000000000000000e03793e63776cf69fe42414ed03bb924d4d9157e00000000000000000000000000000000000000000000000000071afd498d0000000000000000000000000000000000000000000000000000016345785d8a00000000000000000000000000008d12a197cb00d4747a1fe03395095ce2a5cc681957d54158692b43b05f55462695c3dc04b0217afddfda3f27a07ec31ee46b9c20369521fb20e3cff93d515dad43dc9f9f23dfdbb8d0ca564c480634d401bf9aa1
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000129caf12c70fe9633fe24b15497adafc913c842c000000000000000000000000ed06d46ffb309128c4458a270c99c824dc127f5d000000000000000000000000e03793e63776cf69fe42414ed03bb924d4d9157e000000000000000000000000e03793e63776cf69fe42414ed03bb924d4d9157e00000000000000000000000000000000000000000000000000071afd498d0000000000000000000000000000000000000000000000000000016345785d8a00000000000000000000000000008d12a197cb00d4747a1fe03395095ce2a5cc681957d54158692b43b05f55462695c3dc04b0217afddfda3f27a07ec31ee46b9c20369521fb20e3cff93d515dad43dc9f9f23dfdbb8d0ca564c480634d401bf9aa1
-----Decoded View---------------
Arg [0] : _storageAddress (address): 0x129caf12c70fe9633fe24b15497adafc913c842c
Arg [1] : _implementation (address): 0xed06d46ffb309128c4458a270c99c824dc127f5d
Arg [2] : _admin (address): 0xe03793e63776cf69fe42414ed03bb924d4d9157e
Arg [3] : _feeAccount (address): 0xe03793e63776cf69fe42414ed03bb924d4d9157e
Arg [4] : _feeTake (uint256): 2000000000000000
Arg [5] : _feeAmountThreshold (uint256): 100000000000000000
Arg [6] : _etherDelta (address): 0x8d12a197cb00d4747a1fe03395095ce2a5cc6819
Arg [7] : _tradeABIHash (bytes32): 0x57d54158692b43b05f55462695c3dc04b0217afddfda3f27a07ec31ee46b9c20
Arg [8] : _withdrawABIHash (bytes32): 0x369521fb20e3cff93d515dad43dc9f9f23dfdbb8d0ca564c480634d401bf9aa1
-----Encoded View---------------
9 Constructor Arguments found :
Arg [0] : 000000000000000000000000129caf12c70fe9633fe24b15497adafc913c842c
Arg [1] : 000000000000000000000000ed06d46ffb309128c4458a270c99c824dc127f5d
Arg [2] : 000000000000000000000000e03793e63776cf69fe42414ed03bb924d4d9157e
Arg [3] : 000000000000000000000000e03793e63776cf69fe42414ed03bb924d4d9157e
Arg [4] : 00000000000000000000000000000000000000000000000000071afd498d0000
Arg [5] : 000000000000000000000000000000000000000000000000016345785d8a0000
Arg [6] : 0000000000000000000000008d12a197cb00d4747a1fe03395095ce2a5cc6819
Arg [7] : 57d54158692b43b05f55462695c3dc04b0217afddfda3f27a07ec31ee46b9c20
Arg [8] : 369521fb20e3cff93d515dad43dc9f9f23dfdbb8d0ca564c480634d401bf9aa1
Swarm Source
bzzr://748c3fd36452cba2982dabc925ed50191b752dc57a2492bded2e68ee07306ed2
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.