Guest User

Untitled

a guest
Jul 20th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. contract Exchange is Owned {
  2. function depositToken(address token, address target, uint256 amount) public returns (bool) {
  3. if (target == 0x0) target = msg.sender;
  4. require(acceptDeposit(token, target, amount));
  5. require(Token(token).transferFrom(msg.sender, this, amount));
  6. return true;
  7. }
  8.  
  9. function deposit(address target) public payable returns (bool) {
  10. if (target == 0x0) target = msg.sender;
  11. require(acceptDeposit(0x0, target, msg.value));
  12. return true;
  13. }
  14.  
  15. function trade(uint256[8] tradeValues, address[4] tradeAddresses, uint8[2] v, bytes32[4] rs) public onlyAdmin returns (bool) {
  16. /* amount is in amountBuy terms */
  17. /* tradeValues
  18. [0] amountBuy
  19. [1] amountSell
  20. [2] expires
  21. [3] nonce
  22. [4] amount
  23. [5] tradeNonce
  24. [6] feeMake
  25. [7] feeTake
  26. tradeAddressses
  27. [0] tokenBuy
  28. [1] tokenSell
  29. [2] maker
  30. [3] taker
  31. */
  32. ...
  33. bytes32 orderHash = keccak256(this, tradeAddresses[0], tradeValues[0], tradeAddresses[1], tradeValues[1], tradeValues[2], tradeValues[3], tradeAddresses[2]);
  34. bytes32 tradeHash = keccak256(orderHash, tradeValues[4], tradeAddresses[3], tradeValues[5]);
  35. ...
  36. }
  37. }
Add Comment
Please, Sign In to add comment