Last active
February 25, 2018 20:30
-
-
Save pakaplace/66e8c0b5b38f43d39715d3ec35c5ee66 to your computer and use it in GitHub Desktop.
Smart contract for converting Ether to ERC-Ether and then trading it via 0x with other ERC tokens
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.18; | |
import './WETH9.sol'; | |
import './Exchange.sol'; | |
contract NotShapeshift{ | |
WETH9 etherToken; //object for WETH9 Contract | |
Exchange exchange; | |
event Deposit(address sender, uint amount); | |
function NotShapeshift(){ | |
etherToken = new WETH9(); | |
exchange = Exchange(0x90fe2af704b34e0224bf2299c838e04d4dcf1364); | |
} | |
function wrapEth() payable{ | |
require(msg.value > 0); | |
etherToken.deposit.value(msg.value); | |
Deposit(msg.sender, msg.value); | |
// Deposit(msg.sender ,msg.value); | |
} | |
function getBalance() constant returns(address){ | |
etherToken.balanceOf(this); | |
} | |
function fillOrder(address[5] orderAddresses, uint[6] orderValues, uint fillTakerTokenAmount, bool shouldThrowOnInsufficientBalanceOrAllowance, uint8 v, bytes32 r, bytes32 s) public returns(uint){ | |
// exchange.setUnlimitedProxyAllowance(ZRX_TOKEN_CONTRACT, TOKEN_TRANSFER_PROXY_CONTRACT); | |
return exchange.fillOrder(orderAddresses, orderValues, fillTakerTokenAmount, shouldThrowOnInsufficientBalanceOrAllowance, v, r, s); // returns (uint filledTakerTokenAmount) | |
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens | |
} | |
function getWethBalance(address thisContractAddress) returns(uint){ | |
return etherToken.balanceOf(thisContractAddress); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment