Address Contract Partially Verified
Address
0x3c020e014069df790d4f4e63fd297BA4e1c8e51F
Balance
30.0782 ETH ($58338.17)
Nonce
1
Code Size
6700 bytes
Creator
0x8bC3bc20...5e89 at tx 0x6cd6b84c...567338
Last Active
Indexed Transactions
295 (10,732,999 → 24,319,953)
Gas Used (indexed)
900,114
Contract Bytecode
6700 bytes
0x606060405236156101515763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630a19b14a81146101675780630b927666146101b357806319774d43146101e4578063278b8c0e146102155780632e1a7d4d14610253578063338b5dea1461026857806346be96c314610289578063508493bc146102e157806354d03b5c14610315578063577863941461032a5780635e1d7ae41461034c57806365e17c9d146103615780636c86888b1461038d57806371ffcb16146103f6578063731c2f81146104145780638823a9c0146104365780638f2839701461044b5780639e281a9814610469578063bb5f46291461048a578063c281309e146104bd578063d0e30db0146104df578063e8f6bc2e146104e9578063f341294214610507578063f7888aec14610533578063f851a44014610567578063fb6e155f14610593575b341561015957fe5b6101655b60006000fd5b565b005b341561016f57fe5b610165600160a060020a0360043581169060243590604435811690606435906084359060a4359060c4351660ff60e435166101043561012435610144356105eb565b005b34156101bb57fe5b610165600160a060020a03600435811690602435906044351660643560843560a4356108b1565b005b34156101ec57fe5b610203600160a060020a03600435166024356109c2565b60408051918252519081900360200190f35b341561021d57fe5b610165600160a060020a03600435811690602435906044351660643560843560a43560ff60c4351660e435610104356109df565b005b341561025b57fe5b610165600435610bf0565b005b341561027057fe5b610165600160a060020a0360043516602435610d10565b005b341561029157fe5b610203600160a060020a0360043581169060243590604435811690606435906084359060a4359060c4351660ff60e435166101043561012435610e67565b60408051918252519081900360200190f35b34156102e957fe5b610203600160a060020a0360043581169060243516610f54565b60408051918252519081900360200190f35b341561031d57fe5b610165600435610f71565b005b341561033257fe5b610203610fa6565b60408051918252519081900360200190f35b341561035457fe5b610165600435610fac565b005b341561036957fe5b610371610fed565b60408051600160a060020a039092168252519081900360200190f35b341561039557fe5b6103e2600160a060020a0360043581169060243590604435811690606435906084359060a4359060c43581169060ff60e43516906101043590610124359061014435906101643516610ffc565b604080519115158252519081900360200190f35b34156103fe57fe5b610165600160a060020a0360043516611067565b005b341561041c57fe5b6102036110af565b60408051918252519081900360200190f35b341561043e57fe5b6101656004356110b5565b005b341561045357fe5b610165600160a060020a03600435166110f6565b005b341561047157fe5b610165600160a060020a036004351660243561113e565b005b341561049257fe5b6103e2600160a060020a03600435166024356112e0565b604080519115158252519081900360200190f35b34156104c557fe5b610203611300565b60408051918252519081900360200190f35b610165611306565b005b34156104f157fe5b610165600160a060020a03600435166113a8565b005b341561050f57fe5b6103716113f0565b60408051600160a060020a039092168252519081900360200190f35b341561053b57fe5b610203600160a060020a03600435811690602435166113ff565b60408051918252519081900360200190f35b341561056f57fe5b61037161142c565b60408051600160a060020a039092168252519081900360200190f35b341561059b57fe5b610203600160a060020a0360043581169060243590604435811690606435906084359060a4359060c4351660ff60e43516610104356101243561143b565b60408051918252519081900360200190f35b60006002308d8d8d8d8d8d6000604051602001526040518088600160a060020a0316600160a060020a0316606060020a02815260140187600160a060020a0316600160a060020a0316606060020a02815260140186815260200185600160a060020a0316600160a060020a0316606060020a02815260140184815260200183815260200182815260200197505050505050505060206040518083038160008661646e5a03f1151561069857fe5b50506040805151600160a060020a0388166000908152600760209081528382208383529052919091205490915060ff168061077c5750604080517f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c8101839052815190819003603c018120600082815260208381018552928401819052835191825260ff891682840152818401889052606082018790529251600160a060020a038a16936001936080808501949193601f1981019392819003909101918661646e5a03f1151561076857fe5b505060206040510351600160a060020a0316145b80156107885750874311155b80156107c25750600160a060020a03861660009081526008602090815260408083208484529091529020548b906107bf9084611682565b11155b15156107ce5760006000fd5b6107dc8c8c8c8c8a876116aa565b600160a060020a038616600090815260086020908152604080832084845290915290205461080a9083611682565b600160a060020a03871660009081526008602090815260408083208584529091529020557f6effdda786735d5033bfad5f53e5131abcced9e52be6c507b62d639685fbed6d8c838c8e8d830281151561085f57fe5b60408051600160a060020a039687168152602081019590955292851684840152046060830152828a166080830152339290921660a082015290519081900360c00190a15b505050505050505050505050565b60408051600060209182018190528251606060020a600160a060020a0330811682028352808c1682026014840152602883018b90528916026048820152605c8101879052607c8101869052609c81018590529251909260029260bc8083019391928290030181868661646e5a03f1151561092757fe5b5050604080518051600160a060020a03338116600081815260076020908152868220858352815290869020805460ff191660011790558c8316855284018b905290891683850152606083018890526080830187905260a0830186905260c083015291519192507f3f7f2eda73683c21a15f9435af1028c93185b5f1fa38270762dc32be606b3e85919081900360e00190a15b50505050505050565b600860209081526000928352604080842090915290825290205481565b60408051600060209182018190528251606060020a600160a060020a0330811682028352808f1682026014840152602883018e90528c16026048820152605c81018a9052607c8101899052609c81018890529251909260029260bc8083019391928290030181868661646e5a03f11515610a5557fe5b50506040805151600160a060020a0333166000908152600760209081528382208383529052919091205490915060ff1680610b395750604080517f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c8101839052815190819003603c018120600082815260208381018552928401819052835191825260ff881682840152818401879052606082018690529251600160a060020a033316936001936080808501949193601f1981019392819003909101918661646e5a03f11515610b2557fe5b505060206040510351600160a060020a0316145b1515610b455760006000fd5b600160a060020a0333811660008181526008602090815260408083208684528252918290208d905581518e851681529081018d9052928b1683820152606083018a90526080830189905260a0830188905260c083019190915260ff861660e083015261010082018590526101208201849052517f1e0b760c386003e9cb9bcf4fcf3997886042859d9b6ed6320e804597fcdb28b0918190036101400190a15b50505050505050505050565b33600160a060020a031660009081526000805160206119e1833981519152602052604090205481901015610c245760006000fd5b33600160a060020a031660009081526000805160206119e18339815191526020526040902054610c549082611987565b33600160a060020a031660008181526000805160206119e18339815191526020526040808220939093559151909183919081818185876187965a03f1925050501515610ca05760006000fd5b600160a060020a03331660008181526000805160206119e18339815191526020908152604080832054815193845291830193909352818301849052606082015290517ff341246adaac6f497bc2a656f546ab9e182111d630394f0c57c710a59a2cb5679181900360800190a15b50565b600160a060020a0382161515610d265760006000fd5b604080516000602091820181905282517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a0333811660048301523081166024830152604482018690529351938616936323b872dd9360648084019491938390030190829087803b1515610d9e57fe5b6102c65a03f11515610dac57fe5b50506040515115159050610dc05760006000fd5b600160a060020a0380831660009081526006602090815260408083203390941683529290522054610df19082611682565b600160a060020a038381166000818152600660209081526040808320339095168084529482529182902085905581519283528201929092528082018490526060810192909252517fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d79181900360800190a15b5050565b600060006002308d8d8d8d8d8d6000604051602001526040518088600160a060020a0316600160a060020a0316606060020a02815260140187600160a060020a0316600160a060020a0316606060020a02815260140186815260200185600160a060020a0316600160a060020a0316606060020a02815260140184815260200183815260200182815260200197505050505050505060206040518083038160008661646e5a03f11515610f1657fe5b50506040805151600160a060020a03881660009081526008602090815283822083835290529190912054925090505b509a9950505050505050505050565b600660209081526000928352604080842090915290825290205481565b60005433600160a060020a03908116911614610f8d5760006000fd5b600354811115610f9d5760006000fd5b60038190555b50565b60035481565b60005433600160a060020a03908116911614610fc85760006000fd5b600554811080610fd9575060045481115b15610fe45760006000fd5b60058190555b50565b600154600160a060020a031681565b600160a060020a03808d1660009081526006602090815260408083209385168352929052908120548390108015906110455750826110428e8e8e8e8e8e8e8e8e8e61143b565b10155b151561105357506000611057565b5060015b9c9b505050505050505050505050565b60005433600160a060020a039081169116146110835760006000fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b50565b60055481565b60005433600160a060020a039081169116146110d15760006000fd5b6004548111806110e2575060055481105b156110ed5760006000fd5b60048190555b50565b60005433600160a060020a039081169116146111125760006000fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b50565b600160a060020a03821615156111545760006000fd5b600160a060020a0380831660009081526006602090815260408083203390941683529290522054819010156111895760006000fd5b600160a060020a03808316600090815260066020908152604080832033909416835292905220546111ba9082611987565b600160a060020a03808416600081815260066020908152604080832033909516808452948252808320959095558451810182905284517fa9059cbb0000000000000000000000000000000000000000000000000000000081526004810194909452602484018690529351919363a9059cbb936044808201949293918390030190829087803b151561124757fe5b6102c65a03f1151561125557fe5b505060405151151590506112695760006000fd5b600160a060020a03808316600081815260066020908152604080832033959095168084529482529182902054825193845290830193909352818101849052606082019290925290517ff341246adaac6f497bc2a656f546ab9e182111d630394f0c57c710a59a2cb5679181900360800190a15b5050565b600760209081526000928352604080842090915290825290205460ff1681565b60045481565b33600160a060020a031660009081526000805160206119e183398151915260205260409020546113369034611682565b33600160a060020a031660008181526000805160206119e18339815191526020908152604080832085905580519283529082019290925234818301526060810192909252517fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d79181900360800190a15b565b60005433600160a060020a039081169116146113c45760006000fd5b6002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b50565b600254600160a060020a031681565b600160a060020a038083166000908152600660209081526040808320938516835292905220545b92915050565b600054600160a060020a031681565b60006000600060006002308f8f8f8f8f8f6000604051602001526040518088600160a060020a0316600160a060020a0316606060020a02815260140187600160a060020a0316600160a060020a0316606060020a02815260140186815260200185600160a060020a0316600160a060020a0316606060020a02815260140184815260200183815260200182815260200197505050505050505060206040518083038160008661646e5a03f115156114ee57fe5b50506040805151600160a060020a038a166000908152600760209081528382208383529052919091205490935060ff16806115d25750604080517f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c8101859052815190819003603c018120600082815260208381018552928401819052835191825260ff8b16828401528184018a9052606082018990529251600160a060020a038c16936001936080808501949193601f1981019392819003909101918661646e5a03f115156115be57fe5b505060206040510351600160a060020a0316145b80156115de5750894311155b15156115ed5760009350611671565b600160a060020a038816600090815260086020908152604080832086845290915290205461161c908e90611987565b600160a060020a03808e166000908152600660209081526040808320938d16835292905220549092508b90611651908f6119a0565b81151561165a57fe5b0490508082101561166d57819350611671565b8093505b5050509a9950505050505050505050565b600082820161169f84821080159061169a5750838210155b6119cf565b8091505b5092915050565b6000600060006000670de0b6b3a76400006116c7866003546119a0565b8115156116d057fe5b049350670de0b6b3a76400006116e8866004546119a0565b8115156116f157fe5b600254919004935060009250600160a060020a0316156117c857600254604080516000602091820181905282517f1cbd0519000000000000000000000000000000000000000000000000000000008152600160a060020a038b8116600483015293519390941693631cbd0519936024808301949391928390030190829087803b151561177957fe5b6102c65a03f1151561178757fe5b50506040515191505060018114156117bb57670de0b6b3a76400006117ae866005546119a0565b8115156117b757fe5b0491505b80600214156117c8578291505b5b600160a060020a03808b1660009081526006602090815260408083203390941683529290522054611803906117fe8786611682565b611987565b600160a060020a038b81166000908152600660209081526040808320338516845290915280822093909355908816815220546118519061184c6118468886611682565b87611987565b611682565b600160a060020a038b811660009081526006602090815260408083208b8516845290915280822093909355600154909116815220546118a29061184c6118978787611682565b85611987565b611682565b600160a060020a03808c166000908152600660208181526040808420600154861685528252808420959095558c84168352908152838220928a168252919091522054611902908a6118f38a896119a0565b8115156118fc57fe5b04611987565b600160a060020a0389811660009081526006602090815260408083208b85168452909152808220939093553390911681522054611953908a6119448a896119a0565b81151561194d57fe5b04611682565b600160a060020a03808a16600090815260066020908152604080832033909416835292905220555b50505050505050505050565b6000611995838311156119cf565b508082035b92915050565b600082820261169f84158061169a57508385838115156119bc57fe5b04145b6119cf565b8091505b5092915050565b801515610d0d5760006000fd5b5b50560054cdd369e4e8a8515e52ca72ec816c2101831ad1f18bf44102ed171459c9b4f8a165627a7a72305820595bea9da105b4a3f6f7c84e421acb39b26e736f391bcc3cc25de3266a68042c0029
Verified Source Code Partial Match
Compiler: v0.4.11+commit.68ef5810
Optimization: Yes (200 runs)
Bitcratic.sol 312 lines
pragma solidity ^0.4.11;
contract SafeMath {
function safeMul(uint a, uint b) internal returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function safeSub(uint a, uint b) internal returns (uint) {
assert(b <= a);
return a - b;
}
function safeAdd(uint a, uint b) internal returns (uint) {
uint c = a + b;
assert(c>=a && c>=b);
return c;
}
function assert(bool assertion) internal {
if (!assertion) throw;
}
}
contract Token {
/// @return total amount of tokens
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);
uint public decimals;
string public name;
}
contract StandardToken is Token {
function transfer(address _to, uint256 _value) returns (bool success) {
//Default assumes totalSupply can't be over max (2^256 - 1).
//If your token leaves out totalSupply and can issue more tokens as time goes on, you need to check if it doesn't wrap.
//Replace the if with this one instead.
if (balances[msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
//if (balances[msg.sender] >= _value && _value > 0) {
balances[msg.sender] -= _value;
balances[_to] += _value;
Transfer(msg.sender, _to, _value);
return true;
} else { return false; }
}
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
//same as above. Replace this line with the following if you want to protect against wrapping uints.
if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
//if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) {
balances[_to] += _value;
balances[_from] -= _value;
allowed[_from][msg.sender] -= _value;
Transfer(_from, _to, _value);
return true;
} else { return false; }
}
function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
function approve(address _spender, uint256 _value) returns (bool success) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
mapping(address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
uint256 public totalSupply;
}
contract ReserveToken is StandardToken, SafeMath {
address public minter;
function ReserveToken() {
minter = msg.sender;
}
function create(address account, uint amount) {
if (msg.sender != minter) throw;
balances[account] = safeAdd(balances[account], amount);
totalSupply = safeAdd(totalSupply, amount);
}
function destroy(address account, uint amount) {
if (msg.sender != minter) throw;
if (balances[account] < amount) throw;
balances[account] = safeSub(balances[account], amount);
totalSupply = safeSub(totalSupply, amount);
}
}
contract AccountLevels {
//given a user, returns an account level
//0 = regular user (pays take fee and make fee)
//1 = market maker silver (pays take fee, no make fee, gets rebate)
//2 = market maker gold (pays take fee, no make fee, gets entire counterparty's take fee as rebate)
function accountLevel(address user) constant returns(uint) {}
}
contract AccountLevelsTest is AccountLevels {
mapping (address => uint) public accountLevels;
function setAccountLevel(address user, uint level) {
accountLevels[user] = level;
}
function accountLevel(address user) constant returns(uint) {
return accountLevels[user];
}
}
contract Bitcratic is SafeMath {
address public admin; //the admin address
address public feeAccount; //the account that will receive fees
address public accountLevelsAddr; //the address of the AccountLevels contract
uint public feeMake; //percentage times (1 ether)
uint public feeTake; //percentage times (1 ether)
uint public feeRebate; //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)
event Order(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user);
event Cancel(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user, uint8 v, bytes32 r, bytes32 s);
event Trade(address tokenGet, uint amountGet, address tokenGive, uint amountGive, address get, address give);
event Deposit(address token, address user, uint amount, uint balance);
event Withdraw(address token, address user, uint amount, uint balance);
function Bitcratic(address admin_, address feeAccount_, address accountLevelsAddr_, uint feeMake_, uint feeTake_, uint feeRebate_) {
admin = admin_;
feeAccount = feeAccount_;
accountLevelsAddr = accountLevelsAddr_;
feeMake = feeMake_;
feeTake = feeTake_;
feeRebate = feeRebate_;
}
function() {
throw;
}
function changeAdmin(address admin_) {
if (msg.sender != admin) throw;
admin = admin_;
}
function changeAccountLevelsAddr(address accountLevelsAddr_) {
if (msg.sender != admin) throw;
accountLevelsAddr = accountLevelsAddr_;
}
function changeFeeAccount(address feeAccount_) {
if (msg.sender != admin) throw;
feeAccount = feeAccount_;
}
function changeFeeMake(uint feeMake_) {
if (msg.sender != admin) throw;
if (feeMake_ > feeMake) throw;
feeMake = feeMake_;
}
function changeFeeTake(uint feeTake_) {
if (msg.sender != admin) throw;
if (feeTake_ > feeTake || feeTake_ < feeRebate) throw;
feeTake = feeTake_;
}
function changeFeeRebate(uint feeRebate_) {
if (msg.sender != admin) throw;
if (feeRebate_ < feeRebate || feeRebate_ > feeTake) throw;
feeRebate = feeRebate_;
}
function deposit() payable {
tokens[0][msg.sender] = safeAdd(tokens[0][msg.sender], msg.value);
Deposit(0, msg.sender, msg.value, tokens[0][msg.sender]);
}
function withdraw(uint amount) {
if (tokens[0][msg.sender] < amount) throw;
tokens[0][msg.sender] = safeSub(tokens[0][msg.sender], amount);
if (!msg.sender.call.value(amount)()) throw;
Withdraw(0, msg.sender, amount, tokens[0][msg.sender]);
}
function depositToken(address token, uint amount) {
//remember to call Token(address).approve(this, amount) or this contract will not be able to do the transfer on your behalf.
if (token==0) throw;
if (!Token(token).transferFrom(msg.sender, this, amount)) throw;
tokens[token][msg.sender] = safeAdd(tokens[token][msg.sender], amount);
Deposit(token, msg.sender, amount, tokens[token][msg.sender]);
}
function withdrawToken(address token, uint amount) {
if (token==0) throw;
if (tokens[token][msg.sender] < amount) throw;
tokens[token][msg.sender] = safeSub(tokens[token][msg.sender], amount);
if (!Token(token).transfer(msg.sender, amount)) throw;
Withdraw(token, msg.sender, amount, tokens[token][msg.sender]);
}
function balanceOf(address token, address user) constant returns (uint) {
return tokens[token][user];
}
function order(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce) {
bytes32 hash = sha256(this, tokenGet, amountGet, tokenGive, amountGive, expires, nonce);
orders[msg.sender][hash] = true;
Order(tokenGet, amountGet, tokenGive, amountGive, expires, nonce, msg.sender);
}
function trade(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user, uint8 v, bytes32 r, bytes32 s, uint amount) {
//amount is in amountGet terms
bytes32 hash = sha256(this, tokenGet, amountGet, tokenGive, amountGive, expires, nonce);
if (!(
(orders[user][hash] || ecrecover(sha3("\x19Ethereum Signed Message:\n32", hash),v,r,s) == user) &&
block.number <= expires &&
safeAdd(orderFills[user][hash], amount) <= amountGet
)) throw;
tradeBalances(tokenGet, amountGet, tokenGive, amountGive, user, amount);
orderFills[user][hash] = safeAdd(orderFills[user][hash], amount);
Trade(tokenGet, amount, tokenGive, amountGive * amount / amountGet, user, msg.sender);
}
function tradeBalances(address tokenGet, uint amountGet, address tokenGive, uint amountGive, address user, uint amount) private {
uint feeMakeXfer = safeMul(amount, feeMake) / (1 ether);
uint feeTakeXfer = safeMul(amount, feeTake) / (1 ether);
uint feeRebateXfer = 0;
if (accountLevelsAddr != 0x0) {
uint accountLevel = AccountLevels(accountLevelsAddr).accountLevel(user);
if (accountLevel==1) feeRebateXfer = safeMul(amount, feeRebate) / (1 ether);
if (accountLevel==2) feeRebateXfer = feeTakeXfer;
}
tokens[tokenGet][msg.sender] = safeSub(tokens[tokenGet][msg.sender], safeAdd(amount, feeTakeXfer));
tokens[tokenGet][user] = safeAdd(tokens[tokenGet][user], safeSub(safeAdd(amount, feeRebateXfer), feeMakeXfer));
tokens[tokenGet][feeAccount] = safeAdd(tokens[tokenGet][feeAccount], safeSub(safeAdd(feeMakeXfer, feeTakeXfer), feeRebateXfer));
tokens[tokenGive][user] = safeSub(tokens[tokenGive][user], safeMul(amountGive, amount) / amountGet);
tokens[tokenGive][msg.sender] = safeAdd(tokens[tokenGive][msg.sender], safeMul(amountGive, amount) / amountGet);
}
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) {
if (!(
tokens[tokenGet][sender] >= amount &&
availableVolume(tokenGet, amountGet, tokenGive, amountGive, expires, nonce, user, v, r, s) >= amount
)) return false;
return true;
}
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) {
bytes32 hash = sha256(this, tokenGet, amountGet, tokenGive, amountGive, expires, nonce);
if (!(
(orders[user][hash] || ecrecover(sha3("\x19Ethereum Signed Message:\n32", hash),v,r,s) == user) &&
block.number <= expires
)) return 0;
uint available1 = safeSub(amountGet, orderFills[user][hash]);
uint available2 = safeMul(tokens[tokenGive][user], amountGet) / amountGive;
if (available1<available2) return available1;
return available2;
}
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) {
bytes32 hash = sha256(this, tokenGet, amountGet, tokenGive, amountGive, expires, nonce);
return orderFills[user][hash];
}
function cancelOrder(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, uint8 v, bytes32 r, bytes32 s) {
bytes32 hash = sha256(this, tokenGet, amountGet, tokenGive, amountGive, expires, nonce);
if (!(orders[msg.sender][hash] || ecrecover(sha3("\x19Ethereum Signed Message:\n32", hash),v,r,s) == msg.sender)) throw;
orderFills[msg.sender][hash] = amountGet;
Cancel(tokenGet, amountGet, tokenGive, amountGive, expires, nonce, msg.sender, v, r, s);
}
}
Write Contract 26 functions
These functions modify contract state and require a wallet transaction to execute.
accountLevelsAddr 0xf3412942
No parameters
returns: address
admin 0xf851a440
No parameters
returns: address
amountFilled 0x46be96c3
address tokenGet
uint256 amountGet
address tokenGive
uint256 amountGive
uint256 expires
uint256 nonce
address user
uint8 v
bytes32 r
bytes32 s
returns: uint256
availableVolume 0xfb6e155f
address tokenGet
uint256 amountGet
address tokenGive
uint256 amountGive
uint256 expires
uint256 nonce
address user
uint8 v
bytes32 r
bytes32 s
returns: uint256
balanceOf 0xf7888aec
address token
address user
returns: uint256
cancelOrder 0x278b8c0e
address tokenGet
uint256 amountGet
address tokenGive
uint256 amountGive
uint256 expires
uint256 nonce
uint8 v
bytes32 r
bytes32 s
changeAccountLevelsAddr 0xe8f6bc2e
address accountLevelsAddr_
changeAdmin 0x8f283970
address admin_
changeFeeAccount 0x71ffcb16
address feeAccount_
changeFeeMake 0x54d03b5c
uint256 feeMake_
changeFeeRebate 0x5e1d7ae4
uint256 feeRebate_
changeFeeTake 0x8823a9c0
uint256 feeTake_
deposit 0xd0e30db0
No parameters
depositToken 0x338b5dea
address token
uint256 amount
feeAccount 0x65e17c9d
No parameters
returns: address
feeMake 0x57786394
No parameters
returns: uint256
feeRebate 0x731c2f81
No parameters
returns: uint256
feeTake 0xc281309e
No parameters
returns: uint256
order 0x0b927666
address tokenGet
uint256 amountGet
address tokenGive
uint256 amountGive
uint256 expires
uint256 nonce
orderFills 0x19774d43
address
bytes32
returns: uint256
orders 0xbb5f4629
address
bytes32
returns: bool
testTrade 0x6c86888b
address tokenGet
uint256 amountGet
address tokenGive
uint256 amountGive
uint256 expires
uint256 nonce
address user
uint8 v
bytes32 r
bytes32 s
uint256 amount
address sender
returns: bool
tokens 0x508493bc
address
address
returns: uint256
trade 0x0a19b14a
address tokenGet
uint256 amountGet
address tokenGive
uint256 amountGive
uint256 expires
uint256 nonce
address user
uint8 v
bytes32 r
bytes32 s
uint256 amount
withdraw 0x2e1a7d4d
uint256 amount
withdrawToken 0x9e281a98
address token
uint256 amount
Top Interactions
| Address | Txns | Sent | Received |
|---|---|---|---|
| 0xBc432BCD...13b2 | 3 | 3 | |
| 0x84b9eee8...26E7 | 1 | 1 | |
| 0x6ba8b592...C5E9 | 1 | 1 | |
| 0x732731eD...768f | 1 | 1 | |
| 0x4F45a716...EF02 | 1 | 1 | |
| 0x10208E50...57b8 | 1 | 1 | |
| 0x7b683bbE...54f7 | 1 | 1 | |
| 0x55eAbAB9...02ca | 1 | 1 |
Token Balances (4)
View Transfers →Recent Transactions
|
| Hash | Block | Age | From/To | Value | |
|---|---|---|---|---|---|
| 0xaf1f7fc4...e70553 | 24,319,953 | IN | 0x6ba8b592...C5E9 | 0 ETH | |
| 0x09798967...2fa398 | 24,254,149 | IN | 0x732731eD...768f | 0 ETH | |
| 0x7511d32c...3ef8bf | 10,734,606 | IN | 0x55eAbAB9...02ca | 0 ETH | |
| 0xcd1ce239...6f10dd | 10,734,084 | IN | 0x4F45a716...EF02 | 0 ETH | |
| 0xabf3a354...49aec5 Fail | 10,733,918 | IN | 0xBc432BCD...13b2 | 0 ETH | |
| 0x10088afa...d34463 Fail | 10,733,899 | IN | 0xBc432BCD...13b2 | 0 ETH | |
| 0x538cf6fc...6ffd7f | 10,733,895 | IN | 0xBc432BCD...13b2 | 0 ETH | |
| 0x84e03afd...c9da52 | 10,733,623 | IN | 0x10208E50...57b8 | 0 ETH | |
| 0xb1a01ca2...51c207 | 10,733,021 | IN | 0x84b9eee8...26E7 | 0 ETH | |
| 0x4e7f4819...f91a8b | 10,732,999 | IN | 0x7b683bbE...54f7 | 0 ETH |