Contract Overview
Transactions:
1 txn
TxHash | Block | Age | From | To | Value | [TxFee] | |
---|---|---|---|---|---|---|---|
0x0179b132b7334c5425ddb33f55b04a9ec444c533fea312d263353ca97315f631 | 5910134 | 231 days 23 hrs ago | 0xdb0a49ebed788cd412744a4f9f1ce8d16d019b2e | IN | Contract Creation | 0 Ether | 0.0708639 |
[ Download CSV Export ]
Latest 25 Internal Transaction, Click here to view more Internal Transactions as a result of Contract Execution
[ Download CSV Export ]
Warning: The compiled contract might be susceptible to ExpExponentCleanup (medium/high-severity), EventStructWrongData (very low-severity), NestedArrayFunctionCallDecoder (medium-severity) Solidity Compiler Bugs.
Contract Source Code Verified (Exact Match)
Contract Source Code Verified (Exact Match)
Contract Name: | BancorHandler |
Compiler Version: | v0.4.21+commit.dfe3193c |
Optimization Enabled: | No |
Runs (Optimizer): | 200 |
Contract Source Code
pragma solidity ^0.4.21; // File: contracts/ExchangeHandler.sol /// @title Interface for all exchange handler contracts interface ExchangeHandler { /// @dev Get the available amount left to fill for an order /// @param orderAddresses Array of address values needed for this DEX order /// @param orderValues Array of uint values needed for this DEX order /// @param exchangeFee Value indicating the fee for this DEX order /// @param v ECDSA signature parameter v /// @param r ECDSA signature parameter r /// @param s ECDSA signature parameter s /// @return Available amount left to fill for this order function getAvailableAmount( address[8] orderAddresses, uint256[6] orderValues, uint256 exchangeFee, uint8 v, bytes32 r, bytes32 s ) external returns (uint256); /// @dev Perform a buy order at the exchange /// @param orderAddresses Array of address values needed for each DEX order /// @param orderValues Array of uint values needed for each DEX order /// @param exchangeFee Value indicating the fee for this DEX order /// @param amountToFill Amount to fill in this order /// @param v ECDSA signature parameter v /// @param r ECDSA signature parameter r /// @param s ECDSA signature parameter s /// @return Amount filled in this order function performBuy( address[8] orderAddresses, uint256[6] orderValues, uint256 exchangeFee, uint256 amountToFill, uint8 v, bytes32 r, bytes32 s ) external payable returns (uint256); /// @dev Perform a sell order at the exchange /// @param orderAddresses Array of address values needed for each DEX order /// @param orderValues Array of uint values needed for each DEX order /// @param exchangeFee Value indicating the fee for this DEX order /// @param amountToFill Amount to fill in this order /// @param v ECDSA signature parameter v /// @param r ECDSA signature parameter r /// @param s ECDSA signature parameter s /// @return Amount filled in this order function performSell( address[8] orderAddresses, uint256[6] orderValues, uint256 exchangeFee, uint256 amountToFill, uint8 v, bytes32 r, bytes32 s ) external returns (uint256); } // File: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } // File: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract Token is ERC20Basic { function allowance(address owner, address spender) public view returns (uint256); function transferFrom(address from, address to, uint256 value) public returns (bool); function approve(address spender, uint256 value) public returns (bool); event Approval(address indexed owner, address indexed spender, uint256 value); } /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ function Ownable() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) public onlyOwner { require(newOwner != address(0)); emit OwnershipTransferred(owner, newOwner); owner = newOwner; } } interface BancorConverter { function quickConvert(address[] _path, uint256 _amount, uint256 _minReturn) public payable returns (uint256); } contract BancorHandler is ExchangeHandler, Ownable { address public totlePrimary; uint256 constant MAX_UINT = 2**256 - 1; modifier onlyTotle() { require(msg.sender == totlePrimary); _; } function BancorHandler( address _totlePrimary ) public { require(_totlePrimary != address(0x0)); totlePrimary = _totlePrimary; } // Public functions function getAvailableAmount( address[8] orderAddresses, // [converterAddress, conversionPath ... ] uint256[6] orderValues, // [amountToGive, minReturn, EMPTY, EMPTY, EMPTY, EMPTY] uint256 exchangeFee, // ignore uint8 v, // ignore bytes32 r, // ignore bytes32 s // ignore ) external returns (uint256) { // Return amountToGive return orderValues[0]; } function performBuy( address[8] orderAddresses, // [converterAddress, conversionPath ... ] uint256[6] orderValues, // [amountToGive, minReturn, EMPTY, EMPTY, EMPTY, EMPTY] uint256 exchangeFee, // ignore uint256 amountToFill, // ignore uint8 v, // ignore bytes32 r, // ignore bytes32 s // ignore ) external payable onlyTotle returns (uint256 amountObtained) { address destinationToken; (amountObtained, destinationToken) = trade(orderAddresses, orderValues); transferTokenToSender(destinationToken, amountObtained); } function performSell( address[8] orderAddresses, // [converterAddress, conversionPath ... ] uint256[6] orderValues, // [amountToGive, minReturn, EMPTY, EMPTY, EMPTY, EMPTY] uint256 exchangeFee, // ignore uint256 amountToFill, // ignore uint8 v, // ignore bytes32 r, // ignore bytes32 s // ignore ) external onlyTotle returns (uint256 amountObtained) { approveExchange(orderAddresses[0], orderAddresses[1]); (amountObtained, ) = trade(orderAddresses, orderValues); transferEtherToSender(amountObtained); } function trade( address[8] orderAddresses, // [converterAddress, conversionPath ... ] uint256[6] orderValues // [amountToGive, minReturn, EMPTY, EMPTY, EMPTY, EMPTY] ) internal returns (uint256 amountObtained, address destinationToken) { // Find the length of the conversion path uint256 len; for(len = 1; len < orderAddresses.length; len++) { if(orderAddresses[len] == 0) { require(len > 1); destinationToken = orderAddresses[len - 1]; len--; break; } else if(len == orderAddresses.length - 1) { destinationToken = orderAddresses[len]; break; } } // Create an array of that length address[] memory conversionPath = new address[](len); // Move the contents from orderAddresses to conversionPath for(uint256 i = 0; i < len; i++) { conversionPath[i] = orderAddresses[i + 1]; } amountObtained = BancorConverter(orderAddresses[0]) .quickConvert.value(msg.value)(conversionPath, orderValues[0], orderValues[1]); } function transferTokenToSender(address token, uint256 amount) internal { require(Token(token).transfer(msg.sender, amount)); } function transferEtherToSender(uint256 amount) internal { msg.sender.transfer(amount); } function approveExchange(address exchange, address token) internal { if(Token(token).allowance(address(this), exchange) == 0) { require(Token(token).approve(exchange, MAX_UINT)); } } function withdrawToken(address _token, uint _amount) external onlyOwner returns (bool) { return Token(_token).transfer(owner, _amount); } function withdrawETH(uint _amount) external onlyOwner returns (bool) { owner.transfer(_amount); } function setTotle(address _totlePrimary) external onlyOwner { require(_totlePrimary != address(0)); totlePrimary = _totlePrimary; } function() public payable { // Check in here that the sender is a contract! (to stop accidents) uint256 size; address sender = msg.sender; assembly { size := extcodesize(sender) } require(size > 0); } }
Contract ABI
[{"constant":false,"inputs":[{"name":"_totlePrimary","type":"address"}],"name":"setTotle","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"orderAddresses","type":"address[8]"},{"name":"orderValues","type":"uint256[6]"},{"name":"exchangeFee","type":"uint256"},{"name":"v","type":"uint8"},{"name":"r","type":"bytes32"},{"name":"s","type":"bytes32"}],"name":"getAvailableAmount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"orderAddresses","type":"address[8]"},{"name":"orderValues","type":"uint256[6]"},{"name":"exchangeFee","type":"uint256"},{"name":"amountToFill","type":"uint256"},{"name":"v","type":"uint8"},{"name":"r","type":"bytes32"},{"name":"s","type":"bytes32"}],"name":"performSell","outputs":[{"name":"amountObtained","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totlePrimary","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"},{"name":"_amount","type":"uint256"}],"name":"withdrawToken","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"orderAddresses","type":"address[8]"},{"name":"orderValues","type":"uint256[6]"},{"name":"exchangeFee","type":"uint256"},{"name":"amountToFill","type":"uint256"},{"name":"v","type":"uint8"},{"name":"r","type":"bytes32"},{"name":"s","type":"bytes32"}],"name":"performBuy","outputs":[{"name":"amountObtained","type":"uint256"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"_amount","type":"uint256"}],"name":"withdrawETH","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_totlePrimary","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"}]
Contract Creation Code
6060604052341561000f57600080fd5b6040516020806110cf83398101604052808051906020019091905050336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156100a757600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050610fd7806100f86000396000f300606060405260043610610099576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680632183e390146100b65780634102bf5c146100ef5780634981b3ca1461015b5780638da5cb5b146101d05780639675bb9c146102255780639e281a981461027a578063bdd5be2f146102d4578063f14210a61461033e578063f2fde38b14610379575b600080339050803b91506000821115156100b257600080fd5b5050005b34156100c157600080fd5b6100ed600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506103b2565b005b34156100fa57600080fd5b61014560048080610100019091908060c001909190803590602001909190803560ff16906020019091908035600019169060200190919080356000191690602001909190505061048d565b6040518082815260200191505060405180910390f35b341561016657600080fd5b6101ba60048080610100019091908060c001909190803590602001909190803590602001909190803560ff1690602001909190803560001916906020019091908035600019169060200190919050506104af565b6040518082815260200191505060405180910390f35b34156101db57600080fd5b6101e36105d6565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561023057600080fd5b6102386105fb565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561028557600080fd5b6102ba600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610621565b604051808215151515815260200191505060405180910390f35b61032860048080610100019091908060c001909190803590602001909190803590602001909190803560ff169060200190919080356000191690602001909190803560001916906020019091905050610760565b6040518082815260200191505060405180910390f35b341561034957600080fd5b61035f6004808035906020019091905050610831565b604051808215151515815260200191505060405180910390f35b341561038457600080fd5b6103b0600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506108f4565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561040d57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561044957600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600085600060068110151561049e57fe5b602002013590509695505050505050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561050d57600080fd5b61056988600060088110151561051f57fe5b602002013573ffffffffffffffffffffffffffffffffffffffff1689600160088110151561054957fe5b602002013573ffffffffffffffffffffffffffffffffffffffff16610a49565b6105bd88600880602002604051908101604052809291908260086020028082843782019150505050508860068060200260405190810160405280929190826006602002808284378201915050505050610c1f565b50809150506105cb81610e8c565b979650505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561067e57600080fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b151561074157600080fd5b5af1151561074e57600080fd5b50505060405180519050905092915050565b600080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156107bf57600080fd5b61081389600880602002604051908101604052809291908260086020028082843782019150505050508960068060200260405190810160405280929190826006602002808284378201915050505050610c1f565b80925081935050506108258183610ecf565b50979650505050505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561088e57600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f1935050505015156108ef57600080fd5b919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561094f57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561098b57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008173ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e30856040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b1515610b1957600080fd5b5af11515610b2657600080fd5b505050604051805190501415610c1b578073ffffffffffffffffffffffffffffffffffffffff1663095ea7b3837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1515610bf857600080fd5b5af11515610c0557600080fd5b505050604051805190501515610c1a57600080fd5b5b5050565b6000806000610c2c610f97565b6000600192505b6008831015610cd55760008784600881101515610c4c57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff161415610ca257600183111515610c7c57600080fd5b8660018403600881101515610c8d57fe5b60200201519350828060019003935050610cd5565b6001600803831415610cc8578683600881101515610cbc57fe5b60200201519350610cd5565b8280600101935050610c33565b82604051805910610ce35750595b90808252806020026020018201604052509150600090505b82811015610d70578660018201600881101515610d1457fe5b60200201518282815181101515610d2757fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508080600101915050610cfb565b866000600881101515610d7f57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1663f0843ba93484896000600681101515610db057fe5b60200201518a6001600681101515610dc457fe5b60200201516040518563ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018080602001848152602001838152602001828103825285818151815260200191508051906020019060200280838360005b83811015610e43578082015181840152602081019050610e28565b505050509050019450505050506020604051808303818588803b1515610e6857600080fd5b5af11515610e7557600080fd5b505050506040518051905094505050509250929050565b3373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515610ecc57600080fd5b50565b8173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1515610f7157600080fd5b5af11515610f7e57600080fd5b505050604051805190501515610f9357600080fd5b5050565b6020604051908101604052806000815250905600a165627a7a72305820499ce0ebe636b8bf0a272ffe1a874af8109d9c6a7ab4a2d517a8ff2ebbaafeec0029000000000000000000000000d94c60e2793ad587400d86e4d6fd9c874f0f79ef
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000d94c60e2793ad587400d86e4d6fd9c874f0f79ef
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000d94c60e2793ad587400d86e4d6fd9c874f0f79ef
Swarm Source:
bzzr://499ce0ebe636b8bf0a272ffe1a874af8109d9c6a7ab4a2d517a8ff2ebbaafeec
Block | Age | transaction | Difficulty | GasUsed | Reward |
---|
Block | Age | Uncle Number | Difficulty | GasUsed | Reward |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.