More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 3,141 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Quick Convert | 5883493 | 2371 days ago | IN | 0 ETH | 0.00388269 | ||||
Transfer Ownersh... | 5520141 | 2434 days ago | IN | 0 ETH | 0.00018003 | ||||
Quick Convert | 5520134 | 2434 days ago | IN | 0 ETH | 0.00207491 | ||||
Quick Convert | 5520060 | 2434 days ago | IN | 0 ETH | 0.00206385 | ||||
Quick Convert | 5519799 | 2434 days ago | IN | 0 ETH | 0.0020043 | ||||
Quick Convert | 5519569 | 2434 days ago | IN | 0 ETH | 0.00267615 | ||||
Quick Convert | 5519384 | 2434 days ago | IN | 0 ETH | 0.00269086 | ||||
Quick Convert | 5519345 | 2434 days ago | IN | 0 ETH | 0.00199651 | ||||
Quick Convert | 5519248 | 2434 days ago | IN | 0 ETH | 0.00199494 | ||||
Quick Convert | 5519229 | 2434 days ago | IN | 0 ETH | 0.00418677 | ||||
Quick Convert | 5519148 | 2434 days ago | IN | 0 ETH | 0.0030343 | ||||
Quick Convert | 5519144 | 2434 days ago | IN | 0 ETH | 0.00492529 | ||||
Quick Convert | 5519034 | 2434 days ago | IN | 0 ETH | 0.0020682 | ||||
Quick Convert | 5519015 | 2434 days ago | IN | 0 ETH | 0.0019898 | ||||
Quick Convert | 5519008 | 2434 days ago | IN | 0 ETH | 0.00418677 | ||||
Quick Convert | 5518732 | 2434 days ago | IN | 0 ETH | 0.00198773 | ||||
Quick Convert | 5518365 | 2434 days ago | IN | 0 ETH | 0.00200082 | ||||
Quick Convert | 5518299 | 2434 days ago | IN | 0 ETH | 0.0020742 | ||||
Quick Convert | 5518165 | 2435 days ago | IN | 0 ETH | 0.00199734 | ||||
Quick Convert | 5518158 | 2435 days ago | IN | 0 ETH | 0.00418677 | ||||
Quick Convert | 5518123 | 2435 days ago | IN | 0 ETH | 0.00207775 | ||||
Quick Convert | 5517338 | 2435 days ago | IN | 0 ETH | 0.00200514 | ||||
Quick Convert | 5517223 | 2435 days ago | IN | 0 ETH | 0.00206673 | ||||
Quick Convert | 5517125 | 2435 days ago | IN | 0 ETH | 0.00206254 | ||||
Quick Convert | 5516694 | 2435 days ago | IN | 0 ETH | 0.00272476 |
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0xDA493921...e8F93bE0E The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
BancorConverter
Compiler Version
v0.4.18+commit.9cf6e910
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity)
/** *Submitted for verification at Etherscan.io on 2018-02-22 */ pragma solidity ^0.4.18; /* Utilities & Common Modifiers */ contract Utils { /** constructor */ function Utils() public { } // verifies that an amount is greater than zero modifier greaterThanZero(uint256 _amount) { require(_amount > 0); _; } // validates an address - currently only checks that it isn't null modifier validAddress(address _address) { require(_address != address(0)); _; } // verifies that the address is different than this contract address modifier notThis(address _address) { require(_address != address(this)); _; } // Overflow protected math functions /** @dev returns the sum of _x and _y, asserts if the calculation overflows @param _x value 1 @param _y value 2 @return sum */ function safeAdd(uint256 _x, uint256 _y) internal pure returns (uint256) { uint256 z = _x + _y; assert(z >= _x); return z; } /** @dev returns the difference of _x minus _y, asserts if the subtraction results in a negative number @param _x minuend @param _y subtrahend @return difference */ function safeSub(uint256 _x, uint256 _y) internal pure returns (uint256) { assert(_x >= _y); return _x - _y; } /** @dev returns the product of multiplying _x by _y, asserts if the calculation overflows @param _x factor 1 @param _y factor 2 @return product */ function safeMul(uint256 _x, uint256 _y) internal pure returns (uint256) { uint256 z = _x * _y; assert(_x == 0 || z / _x == _y); return z; } } /* Provides support and utilities for contract management */ contract Managed { address public manager; address public newManager; event ManagerUpdate(address indexed _prevManager, address indexed _newManager); /** @dev constructor */ function Managed() public { manager = msg.sender; } // allows execution by the manager only modifier managerOnly { assert(msg.sender == manager); _; } /** @dev allows transferring the contract management the new manager still needs to accept the transfer can only be called by the contract manager @param _newManager new contract manager */ function transferManagement(address _newManager) public managerOnly { require(_newManager != manager); newManager = _newManager; } /** @dev used by a new manager to accept a management transfer */ function acceptManagement() public { require(msg.sender == newManager); ManagerUpdate(manager, newManager); manager = newManager; newManager = address(0); } } /* Owned contract interface */ contract IOwned { // this function isn't abstract since the compiler emits automatically generated getter functions as external function owner() public view returns (address) {} function transferOwnership(address _newOwner) public; function acceptOwnership() public; } /* Provides support and utilities for contract ownership */ contract Owned is IOwned { address public owner; address public newOwner; event OwnerUpdate(address indexed _prevOwner, address indexed _newOwner); /** @dev constructor */ function Owned() public { owner = msg.sender; } // allows execution by the owner only modifier ownerOnly { assert(msg.sender == owner); _; } /** @dev allows transferring the contract ownership the new owner still needs to accept the transfer can only be called by the contract owner @param _newOwner new contract owner */ function transferOwnership(address _newOwner) public ownerOnly { require(_newOwner != owner); newOwner = _newOwner; } /** @dev used by a new owner to accept an ownership transfer */ function acceptOwnership() public { require(msg.sender == newOwner); OwnerUpdate(owner, newOwner); owner = newOwner; newOwner = address(0); } } /* ERC20 Standard Token interface */ contract IERC20Token { // these functions aren't abstract since the compiler emits automatically generated getter functions as external function name() public view returns (string) {} function symbol() public view returns (string) {} function decimals() public view returns (uint8) {} function totalSupply() public view returns (uint256) {} function balanceOf(address _owner) public view returns (uint256) { _owner; } function allowance(address _owner, address _spender) public view returns (uint256) { _owner; _spender; } function transfer(address _to, uint256 _value) public returns (bool success); function transferFrom(address _from, address _to, uint256 _value) public returns (bool success); function approve(address _spender, uint256 _value) public returns (bool success); } /* Token Holder interface */ contract ITokenHolder is IOwned { function withdrawTokens(IERC20Token _token, address _to, uint256 _amount) public; } /* We consider every contract to be a 'token holder' since it's currently not possible for a contract to deny receiving tokens. The TokenHolder's contract sole purpose is to provide a safety mechanism that allows the owner to send tokens that were sent to the contract by mistake back to their sender. */ contract TokenHolder is ITokenHolder, Owned, Utils { /** @dev constructor */ function TokenHolder() public { } /** @dev withdraws tokens held by the contract and sends them to an account can only be called by the owner @param _token ERC20 token contract address @param _to account to receive the new amount @param _amount amount to withdraw */ function withdrawTokens(IERC20Token _token, address _to, uint256 _amount) public ownerOnly validAddress(_token) validAddress(_to) notThis(_to) { assert(_token.transfer(_to, _amount)); } } /* Ether Token interface */ contract IEtherToken is ITokenHolder, IERC20Token { function deposit() public payable; function withdraw(uint256 _amount) public; function withdrawTo(address _to, uint256 _amount) public; } /* Smart Token interface */ contract ISmartToken is IOwned, IERC20Token { function disableTransfers(bool _disable) public; function issue(address _to, uint256 _amount) public; function destroy(address _from, uint256 _amount) public; } /* The smart token controller is an upgradable part of the smart token that allows more functionality as well as fixes for bugs/exploits. Once it accepts ownership of the token, it becomes the token's sole controller that can execute any of its functions. To upgrade the controller, ownership must be transferred to a new controller, along with any relevant data. The smart token must be set on construction and cannot be changed afterwards. Wrappers are provided (as opposed to a single 'execute' function) for each of the token's functions, for easier access. Note that the controller can transfer token ownership to a new controller that doesn't allow executing any function on the token, for a trustless solution. Doing that will also remove the owner's ability to upgrade the controller. */ contract SmartTokenController is TokenHolder { ISmartToken public token; // smart token /** @dev constructor */ function SmartTokenController(ISmartToken _token) public validAddress(_token) { token = _token; } // ensures that the controller is the token's owner modifier active() { assert(token.owner() == address(this)); _; } // ensures that the controller is not the token's owner modifier inactive() { assert(token.owner() != address(this)); _; } /** @dev allows transferring the token ownership the new owner still need to accept the transfer can only be called by the contract owner @param _newOwner new token owner */ function transferTokenOwnership(address _newOwner) public ownerOnly { token.transferOwnership(_newOwner); } /** @dev used by a new owner to accept a token ownership transfer can only be called by the contract owner */ function acceptTokenOwnership() public ownerOnly { token.acceptOwnership(); } /** @dev disables/enables token transfers can only be called by the contract owner @param _disable true to disable transfers, false to enable them */ function disableTokenTransfers(bool _disable) public ownerOnly { token.disableTransfers(_disable); } /** @dev withdraws tokens held by the controller and sends them to an account can only be called by the owner @param _token ERC20 token contract address @param _to account to receive the new amount @param _amount amount to withdraw */ function withdrawFromToken( IERC20Token _token, address _to, uint256 _amount ) public ownerOnly { ITokenHolder(token).withdrawTokens(_token, _to, _amount); } } /* Bancor Formula interface */ contract IBancorFormula { function calculatePurchaseReturn(uint256 _supply, uint256 _connectorBalance, uint32 _connectorWeight, uint256 _depositAmount) public view returns (uint256); function calculateSaleReturn(uint256 _supply, uint256 _connectorBalance, uint32 _connectorWeight, uint256 _sellAmount) public view returns (uint256); } /* Bancor Gas Price Limit interface */ contract IBancorGasPriceLimit { function gasPrice() public view returns (uint256) {} } /* Bancor Quick Converter interface */ contract IBancorQuickConverter { function convert(IERC20Token[] _path, uint256 _amount, uint256 _minReturn) public payable returns (uint256); function convertFor(IERC20Token[] _path, uint256 _amount, uint256 _minReturn, address _for) public payable returns (uint256); } /* Bancor Converter Extensions interface */ contract IBancorConverterExtensions { function formula() public view returns (IBancorFormula) {} function gasPriceLimit() public view returns (IBancorGasPriceLimit) {} function quickConverter() public view returns (IBancorQuickConverter) {} } /* EIP228 Token Converter interface */ contract ITokenConverter { function convertibleTokenCount() public view returns (uint16); function convertibleToken(uint16 _tokenIndex) public view returns (address); function getReturn(IERC20Token _fromToken, IERC20Token _toToken, uint256 _amount) public view returns (uint256); function convert(IERC20Token _fromToken, IERC20Token _toToken, uint256 _amount, uint256 _minReturn) public returns (uint256); // deprecated, backward compatibility function change(IERC20Token _fromToken, IERC20Token _toToken, uint256 _amount, uint256 _minReturn) public returns (uint256); } /* Bancor Converter v0.7 The Bancor version of the token converter, allows conversion between a smart token and other ERC20 tokens and between different ERC20 tokens and themselves. ERC20 connector balance can be virtual, meaning that the calculations are based on the virtual balance instead of relying on the actual connector balance. This is a security mechanism that prevents the need to keep a very large (and valuable) balance in a single contract. The converter is upgradable (just like any SmartTokenController). WARNING: It is NOT RECOMMENDED to use the converter with Smart Tokens that have less than 8 decimal digits or with very small numbers because of precision loss Open issues: - Front-running attacks are currently mitigated by the following mechanisms: - minimum return argument for each conversion provides a way to define a minimum/maximum price for the transaction - gas price limit prevents users from having control over the order of execution Other potential solutions might include a commit/reveal based schemes - Possibly add getters for the connector fields so that the client won't need to rely on the order in the struct */ contract BancorConverter is ITokenConverter, SmartTokenController, Managed { uint32 private constant MAX_WEIGHT = 1000000; uint32 private constant MAX_CONVERSION_FEE = 1000000; struct Connector { uint256 virtualBalance; // connector virtual balance uint32 weight; // connector weight, represented in ppm, 1-1000000 bool isVirtualBalanceEnabled; // true if virtual balance is enabled, false if not bool isPurchaseEnabled; // is purchase of the smart token enabled with the connector, can be set by the owner bool isSet; // used to tell if the mapping element is defined } string public version = '0.7'; string public converterType = 'bancor'; IBancorConverterExtensions public extensions; // bancor converter extensions contract IERC20Token[] public connectorTokens; // ERC20 standard token addresses IERC20Token[] public quickBuyPath; // conversion path that's used in order to buy the token with ETH mapping (address => Connector) public connectors; // connector token addresses -> connector data uint32 private totalConnectorWeight = 0; // used to efficiently prevent increasing the total connector weight above 100% uint32 public maxConversionFee = 0; // maximum conversion fee for the lifetime of the contract, represented in ppm, 0...1000000 (0 = no fee, 100 = 0.01%, 1000000 = 100%) uint32 public conversionFee = 0; // current conversion fee, represented in ppm, 0...maxConversionFee bool public conversionsEnabled = true; // true if token conversions is enabled, false if not // triggered when a conversion between two tokens occurs (TokenConverter event) event Conversion(address indexed _fromToken, address indexed _toToken, address indexed _trader, uint256 _amount, uint256 _return, int256 _conversionFee, uint256 _currentPriceN, uint256 _currentPriceD); // triggered when the conversion fee is updated event ConversionFeeUpdate(uint32 _prevFee, uint32 _newFee); /** @dev constructor @param _token smart token governed by the converter @param _extensions address of a bancor converter extensions contract @param _maxConversionFee maximum conversion fee, represented in ppm @param _connectorToken optional, initial connector, allows defining the first connector at deployment time @param _connectorWeight optional, weight for the initial connector */ function BancorConverter(ISmartToken _token, IBancorConverterExtensions _extensions, uint32 _maxConversionFee, IERC20Token _connectorToken, uint32 _connectorWeight) public SmartTokenController(_token) validAddress(_extensions) validMaxConversionFee(_maxConversionFee) { extensions = _extensions; maxConversionFee = _maxConversionFee; if (_connectorToken != address(0)) addConnector(_connectorToken, _connectorWeight, false); } // validates a connector token address - verifies that the address belongs to one of the connector tokens modifier validConnector(IERC20Token _address) { require(connectors[_address].isSet); _; } // validates a token address - verifies that the address belongs to one of the convertible tokens modifier validToken(IERC20Token _address) { require(_address == token || connectors[_address].isSet); _; } // verifies that the gas price is lower than the universal limit modifier validGasPrice() { assert(tx.gasprice <= extensions.gasPriceLimit().gasPrice()); _; } // validates maximum conversion fee modifier validMaxConversionFee(uint32 _conversionFee) { require(_conversionFee >= 0 && _conversionFee <= MAX_CONVERSION_FEE); _; } // validates conversion fee modifier validConversionFee(uint32 _conversionFee) { require(_conversionFee >= 0 && _conversionFee <= maxConversionFee); _; } // validates connector weight range modifier validConnectorWeight(uint32 _weight) { require(_weight > 0 && _weight <= MAX_WEIGHT); _; } // validates a conversion path - verifies that the number of elements is odd and that maximum number of 'hops' is 10 modifier validConversionPath(IERC20Token[] _path) { require(_path.length > 2 && _path.length <= (1 + 2 * 10) && _path.length % 2 == 1); _; } // allows execution only when conversions aren't disabled modifier conversionsAllowed { assert(conversionsEnabled); _; } // allows execution only for owner or manager modifier ownerOrManagerOnly { require(msg.sender == owner || msg.sender == manager); _; } /** @dev returns the number of connector tokens defined @return number of connector tokens */ function connectorTokenCount() public view returns (uint16) { return uint16(connectorTokens.length); } /** @dev returns the number of convertible tokens supported by the contract note that the number of convertible tokens is the number of connector token, plus 1 (that represents the smart token) @return number of convertible tokens */ function convertibleTokenCount() public view returns (uint16) { return connectorTokenCount() + 1; } /** @dev given a convertible token index, returns its contract address @param _tokenIndex convertible token index @return convertible token address */ function convertibleToken(uint16 _tokenIndex) public view returns (address) { if (_tokenIndex == 0) return token; return connectorTokens[_tokenIndex - 1]; } /* @dev allows the owner to update the extensions contract address @param _extensions address of a bancor converter extensions contract */ function setExtensions(IBancorConverterExtensions _extensions) public ownerOnly validAddress(_extensions) notThis(_extensions) { extensions = _extensions; } /* @dev allows the manager to update the quick buy path @param _path new quick buy path, see conversion path format in the BancorQuickConverter contract */ function setQuickBuyPath(IERC20Token[] _path) public ownerOnly validConversionPath(_path) { quickBuyPath = _path; } /* @dev allows the manager to clear the quick buy path */ function clearQuickBuyPath() public ownerOnly { quickBuyPath.length = 0; } /** @dev returns the length of the quick buy path array @return quick buy path length */ function getQuickBuyPathLength() public view returns (uint256) { return quickBuyPath.length; } /** @dev disables the entire conversion functionality this is a safety mechanism in case of a emergency can only be called by the manager @param _disable true to disable conversions, false to re-enable them */ function disableConversions(bool _disable) public ownerOrManagerOnly { conversionsEnabled = !_disable; } /** @dev updates the current conversion fee can only be called by the manager @param _conversionFee new conversion fee, represented in ppm */ function setConversionFee(uint32 _conversionFee) public ownerOrManagerOnly validConversionFee(_conversionFee) { ConversionFeeUpdate(conversionFee, _conversionFee); conversionFee = _conversionFee; } /* @dev returns the conversion fee amount for a given return amount @return conversion fee amount */ function getConversionFeeAmount(uint256 _amount) public view returns (uint256) { return safeMul(_amount, conversionFee) / MAX_CONVERSION_FEE; } /** @dev defines a new connector for the token can only be called by the owner while the converter is inactive @param _token address of the connector token @param _weight constant connector weight, represented in ppm, 1-1000000 @param _enableVirtualBalance true to enable virtual balance for the connector, false to disable it */ function addConnector(IERC20Token _token, uint32 _weight, bool _enableVirtualBalance) public ownerOnly inactive validAddress(_token) notThis(_token) validConnectorWeight(_weight) { require(_token != token && !connectors[_token].isSet && totalConnectorWeight + _weight <= MAX_WEIGHT); // validate input connectors[_token].virtualBalance = 0; connectors[_token].weight = _weight; connectors[_token].isVirtualBalanceEnabled = _enableVirtualBalance; connectors[_token].isPurchaseEnabled = true; connectors[_token].isSet = true; connectorTokens.push(_token); totalConnectorWeight += _weight; } /** @dev updates one of the token connectors can only be called by the owner @param _connectorToken address of the connector token @param _weight constant connector weight, represented in ppm, 1-1000000 @param _enableVirtualBalance true to enable virtual balance for the connector, false to disable it @param _virtualBalance new connector's virtual balance */ function updateConnector(IERC20Token _connectorToken, uint32 _weight, bool _enableVirtualBalance, uint256 _virtualBalance) public ownerOnly validConnector(_connectorToken) validConnectorWeight(_weight) { Connector storage connector = connectors[_connectorToken]; require(totalConnectorWeight - connector.weight + _weight <= MAX_WEIGHT); // validate input totalConnectorWeight = totalConnectorWeight - connector.weight + _weight; connector.weight = _weight; connector.isVirtualBalanceEnabled = _enableVirtualBalance; connector.virtualBalance = _virtualBalance; } /** @dev disables purchasing with the given connector token in case the connector token got compromised can only be called by the owner note that selling is still enabled regardless of this flag and it cannot be disabled by the owner @param _connectorToken connector token contract address @param _disable true to disable the token, false to re-enable it */ function disableConnectorPurchases(IERC20Token _connectorToken, bool _disable) public ownerOnly validConnector(_connectorToken) { connectors[_connectorToken].isPurchaseEnabled = !_disable; } /** @dev returns the connector's virtual balance if one is defined, otherwise returns the actual balance @param _connectorToken connector token contract address @return connector balance */ function getConnectorBalance(IERC20Token _connectorToken) public view validConnector(_connectorToken) returns (uint256) { Connector storage connector = connectors[_connectorToken]; return connector.isVirtualBalanceEnabled ? connector.virtualBalance : _connectorToken.balanceOf(this); } /** @dev returns the expected return for converting a specific amount of _fromToken to _toToken @param _fromToken ERC20 token to convert from @param _toToken ERC20 token to convert to @param _amount amount to convert, in fromToken @return expected conversion return amount */ function getReturn(IERC20Token _fromToken, IERC20Token _toToken, uint256 _amount) public view returns (uint256) { require(_fromToken != _toToken); // validate input // conversion between the token and one of its connectors if (_toToken == token) return getPurchaseReturn(_fromToken, _amount); else if (_fromToken == token) return getSaleReturn(_toToken, _amount); // conversion between 2 connectors uint256 purchaseReturnAmount = getPurchaseReturn(_fromToken, _amount); return getSaleReturn(_toToken, purchaseReturnAmount, safeAdd(token.totalSupply(), purchaseReturnAmount)); } /** @dev returns the expected return for buying the token for a connector token @param _connectorToken connector token contract address @param _depositAmount amount to deposit (in the connector token) @return expected purchase return amount */ function getPurchaseReturn(IERC20Token _connectorToken, uint256 _depositAmount) public view active validConnector(_connectorToken) returns (uint256) { Connector storage connector = connectors[_connectorToken]; require(connector.isPurchaseEnabled); // validate input uint256 tokenSupply = token.totalSupply(); uint256 connectorBalance = getConnectorBalance(_connectorToken); uint256 amount = extensions.formula().calculatePurchaseReturn(tokenSupply, connectorBalance, connector.weight, _depositAmount); // deduct the fee from the return amount uint256 feeAmount = getConversionFeeAmount(amount); return safeSub(amount, feeAmount); } /** @dev returns the expected return for selling the token for one of its connector tokens @param _connectorToken connector token contract address @param _sellAmount amount to sell (in the smart token) @return expected sale return amount */ function getSaleReturn(IERC20Token _connectorToken, uint256 _sellAmount) public view returns (uint256) { return getSaleReturn(_connectorToken, _sellAmount, token.totalSupply()); } /** @dev converts a specific amount of _fromToken to _toToken @param _fromToken ERC20 token to convert from @param _toToken ERC20 token to convert to @param _amount amount to convert, in fromToken @param _minReturn if the conversion results in an amount smaller than the minimum return - it is cancelled, must be nonzero @return conversion return amount */ function convert(IERC20Token _fromToken, IERC20Token _toToken, uint256 _amount, uint256 _minReturn) public returns (uint256) { require(_fromToken != _toToken); // validate input // conversion between the token and one of its connectors if (_toToken == token) return buy(_fromToken, _amount, _minReturn); else if (_fromToken == token) return sell(_toToken, _amount, _minReturn); // conversion between 2 connectors uint256 purchaseAmount = buy(_fromToken, _amount, 1); return sell(_toToken, purchaseAmount, _minReturn); } /** @dev buys the token by depositing one of its connector tokens @param _connectorToken connector token contract address @param _depositAmount amount to deposit (in the connector token) @param _minReturn if the conversion results in an amount smaller than the minimum return - it is cancelled, must be nonzero @return buy return amount */ function buy(IERC20Token _connectorToken, uint256 _depositAmount, uint256 _minReturn) public conversionsAllowed validGasPrice greaterThanZero(_minReturn) returns (uint256) { uint256 amount = getPurchaseReturn(_connectorToken, _depositAmount); require(amount != 0 && amount >= _minReturn); // ensure the trade gives something in return and meets the minimum requested amount // update virtual balance if relevant Connector storage connector = connectors[_connectorToken]; if (connector.isVirtualBalanceEnabled) connector.virtualBalance = safeAdd(connector.virtualBalance, _depositAmount); // transfer _depositAmount funds from the caller in the connector token assert(_connectorToken.transferFrom(msg.sender, this, _depositAmount)); // issue new funds to the caller in the smart token token.issue(msg.sender, amount); dispatchConversionEvent(_connectorToken, _depositAmount, amount, true); return amount; } /** @dev sells the token by withdrawing from one of its connector tokens @param _connectorToken connector token contract address @param _sellAmount amount to sell (in the smart token) @param _minReturn if the conversion results in an amount smaller the minimum return - it is cancelled, must be nonzero @return sell return amount */ function sell(IERC20Token _connectorToken, uint256 _sellAmount, uint256 _minReturn) public conversionsAllowed validGasPrice greaterThanZero(_minReturn) returns (uint256) { require(_sellAmount <= token.balanceOf(msg.sender)); // validate input uint256 amount = getSaleReturn(_connectorToken, _sellAmount); require(amount != 0 && amount >= _minReturn); // ensure the trade gives something in return and meets the minimum requested amount uint256 tokenSupply = token.totalSupply(); uint256 connectorBalance = getConnectorBalance(_connectorToken); // ensure that the trade will only deplete the connector if the total supply is depleted as well assert(amount < connectorBalance || (amount == connectorBalance && _sellAmount == tokenSupply)); // update virtual balance if relevant Connector storage connector = connectors[_connectorToken]; if (connector.isVirtualBalanceEnabled) connector.virtualBalance = safeSub(connector.virtualBalance, amount); // destroy _sellAmount from the caller's balance in the smart token token.destroy(msg.sender, _sellAmount); // transfer funds to the caller in the connector token // the transfer might fail if the actual connector balance is smaller than the virtual balance assert(_connectorToken.transfer(msg.sender, amount)); dispatchConversionEvent(_connectorToken, _sellAmount, amount, false); return amount; } /** @dev converts the token to any other token in the bancor network by following a predefined conversion path note that when converting from an ERC20 token (as opposed to a smart token), allowance must be set beforehand @param _path conversion path, see conversion path format in the BancorQuickConverter contract @param _amount amount to convert from (in the initial source token) @param _minReturn if the conversion results in an amount smaller than the minimum return - it is cancelled, must be nonzero @return tokens issued in return */ function quickConvert(IERC20Token[] _path, uint256 _amount, uint256 _minReturn) public payable validConversionPath(_path) returns (uint256) { IERC20Token fromToken = _path[0]; IBancorQuickConverter quickConverter = extensions.quickConverter(); // we need to transfer the source tokens from the caller to the quick converter, // so it can execute the conversion on behalf of the caller if (msg.value == 0) { // not ETH, send the source tokens to the quick converter // if the token is the smart token, no allowance is required - destroy the tokens from the caller and issue them to the quick converter if (fromToken == token) { token.destroy(msg.sender, _amount); // destroy _amount tokens from the caller's balance in the smart token token.issue(quickConverter, _amount); // issue _amount new tokens to the quick converter } else { // otherwise, we assume we already have allowance, transfer the tokens directly to the quick converter assert(fromToken.transferFrom(msg.sender, quickConverter, _amount)); } } // execute the conversion and pass on the ETH with the call return quickConverter.convertFor.value(msg.value)(_path, _amount, _minReturn, msg.sender); } // deprecated, backward compatibility function change(IERC20Token _fromToken, IERC20Token _toToken, uint256 _amount, uint256 _minReturn) public returns (uint256) { return convert(_fromToken, _toToken, _amount, _minReturn); } /** @dev utility, returns the expected return for selling the token for one of its connector tokens, given a total supply override @param _connectorToken connector token contract address @param _sellAmount amount to sell (in the smart token) @param _totalSupply total token supply, overrides the actual token total supply when calculating the return @return sale return amount */ function getSaleReturn(IERC20Token _connectorToken, uint256 _sellAmount, uint256 _totalSupply) private view active validConnector(_connectorToken) greaterThanZero(_totalSupply) returns (uint256) { Connector storage connector = connectors[_connectorToken]; uint256 connectorBalance = getConnectorBalance(_connectorToken); uint256 amount = extensions.formula().calculateSaleReturn(_totalSupply, connectorBalance, connector.weight, _sellAmount); // deduct the fee from the return amount uint256 feeAmount = getConversionFeeAmount(amount); return safeSub(amount, feeAmount); } /** @dev helper, dispatches the Conversion event The function also takes the tokens' decimals into account when calculating the current price @param _connectorToken connector token contract address @param _amount amount purchased/sold (in the source token) @param _returnAmount amount returned (in the target token) @param isPurchase true if it's a purchase, false if it's a sale */ function dispatchConversionEvent(IERC20Token _connectorToken, uint256 _amount, uint256 _returnAmount, bool isPurchase) private { Connector storage connector = connectors[_connectorToken]; // calculate the new price using the simple price formula // price = connector balance / (supply * weight) // weight is represented in ppm, so multiplying by 1000000 uint256 connectorAmount = safeMul(getConnectorBalance(_connectorToken), MAX_WEIGHT); uint256 tokenAmount = safeMul(token.totalSupply(), connector.weight); // normalize values uint8 tokenDecimals = token.decimals(); uint8 connectorTokenDecimals = _connectorToken.decimals(); if (tokenDecimals != connectorTokenDecimals) { if (tokenDecimals > connectorTokenDecimals) connectorAmount = safeMul(connectorAmount, 10 ** uint256(tokenDecimals - connectorTokenDecimals)); else tokenAmount = safeMul(tokenAmount, 10 ** uint256(connectorTokenDecimals - tokenDecimals)); } uint256 feeAmount = getConversionFeeAmount(_returnAmount); // ensure that the fee is capped at 255 bits to prevent overflow when converting it to a signed int assert(feeAmount <= 2 ** 255); if (isPurchase) Conversion(_connectorToken, token, msg.sender, _amount, _returnAmount, int256(feeAmount), connectorAmount, tokenAmount); else Conversion(token, _connectorToken, msg.sender, _amount, _returnAmount, int256(feeAmount), tokenAmount, connectorAmount); } /** @dev fallback, buys the smart token with ETH note that the purchase will use the price at the time of the purchase */ function() payable public { quickConvert(quickBuyPath, msg.value, 1); } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"constant":false,"inputs":[{"name":"_connectorToken","type":"address"},{"name":"_weight","type":"uint32"},{"name":"_enableVirtualBalance","type":"bool"},{"name":"_virtualBalance","type":"uint256"}],"name":"updateConnector","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"connectors","outputs":[{"name":"virtualBalance","type":"uint256"},{"name":"weight","type":"uint32"},{"name":"isVirtualBalanceEnabled","type":"bool"},{"name":"isPurchaseEnabled","type":"bool"},{"name":"isSet","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"connectorTokens","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_fromToken","type":"address"},{"name":"_toToken","type":"address"},{"name":"_amount","type":"uint256"}],"name":"getReturn","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newOwner","type":"address"}],"name":"transferTokenOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_disable","type":"bool"}],"name":"disableConversions","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_extensions","type":"address"}],"name":"setExtensions","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"extensions","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_amount","type":"uint256"}],"name":"getConversionFeeAmount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"acceptTokenOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"converterType","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"},{"name":"_weight","type":"uint32"},{"name":"_enableVirtualBalance","type":"bool"}],"name":"addConnector","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"},{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"withdrawFromToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"newManager","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"manager","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"clearQuickBuyPath","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_connectorToken","type":"address"},{"name":"_disable","type":"bool"}],"name":"disableConnectorPurchases","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"version","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"conversionFee","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"},{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"withdrawTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_fromToken","type":"address"},{"name":"_toToken","type":"address"},{"name":"_amount","type":"uint256"},{"name":"_minReturn","type":"uint256"}],"name":"change","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_connectorToken","type":"address"},{"name":"_sellAmount","type":"uint256"},{"name":"_minReturn","type":"uint256"}],"name":"sell","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"connectorTokenCount","outputs":[{"name":"","type":"uint16"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_connectorToken","type":"address"},{"name":"_sellAmount","type":"uint256"}],"name":"getSaleReturn","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_fromToken","type":"address"},{"name":"_toToken","type":"address"},{"name":"_amount","type":"uint256"},{"name":"_minReturn","type":"uint256"}],"name":"convert","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"acceptOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_disable","type":"bool"}],"name":"disableTokenTransfers","outputs":[],"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":"getQuickBuyPathLength","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"maxConversionFee","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_connectorToken","type":"address"},{"name":"_depositAmount","type":"uint256"}],"name":"getPurchaseReturn","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_connectorToken","type":"address"},{"name":"_depositAmount","type":"uint256"},{"name":"_minReturn","type":"uint256"}],"name":"buy","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"convertibleTokenCount","outputs":[{"name":"","type":"uint16"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"conversionsEnabled","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"acceptManagement","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_path","type":"address[]"}],"name":"setQuickBuyPath","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"newOwner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_connectorToken","type":"address"}],"name":"getConnectorBalance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newManager","type":"address"}],"name":"transferManagement","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"quickBuyPath","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_conversionFee","type":"uint32"}],"name":"setConversionFee","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_path","type":"address[]"},{"name":"_amount","type":"uint256"},{"name":"_minReturn","type":"uint256"}],"name":"quickConvert","outputs":[{"name":"","type":"uint256"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenIndex","type":"uint16"}],"name":"convertibleToken","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"token","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_token","type":"address"},{"name":"_extensions","type":"address"},{"name":"_maxConversionFee","type":"uint32"},{"name":"_connectorToken","type":"address"},{"name":"_connectorWeight","type":"uint32"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_fromToken","type":"address"},{"indexed":true,"name":"_toToken","type":"address"},{"indexed":true,"name":"_trader","type":"address"},{"indexed":false,"name":"_amount","type":"uint256"},{"indexed":false,"name":"_return","type":"uint256"},{"indexed":false,"name":"_conversionFee","type":"int256"},{"indexed":false,"name":"_currentPriceN","type":"uint256"},{"indexed":false,"name":"_currentPriceD","type":"uint256"}],"name":"Conversion","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_prevFee","type":"uint32"},{"indexed":false,"name":"_newFee","type":"uint32"}],"name":"ConversionFeeUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_prevManager","type":"address"},{"indexed":true,"name":"_newManager","type":"address"}],"name":"ManagerUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_prevOwner","type":"address"},{"indexed":true,"name":"_newOwner","type":"address"}],"name":"OwnerUpdate","type":"event"}]
Deployed Bytecode
0x60606040526004361061020b5763ffffffff60e060020a6000350416630ca7892381146102745780630e53aae9146102a657806319b64015146103015780631e1401f81461033357806321e6b53d1461036d578063228d28201461038c5780632314aad6146103a457806324f159c2146103c35780632a3c2c56146103d657806338a5e016146103ec5780633e8ff43f146103ff5780633f4d2fc21461048957806341a5b33d146104b657806342906029146104de578063481c6a75146104f15780634e2280c414610504578063514385be1461051757806354fd4d501461053b578063579cd3ca1461054e5780635e35359e1461057a5780635e5144eb146105a25780636a272462146105cd57806371f52bf3146105f257806372b44b2c1461061c57806375892cf11461063e57806379ba50971461066957806385d5e6311461067c5780638da5cb5b146106945780639396a7f0146106a757806394c275ad146106ba578063a2c4c336146106cd578063a59ac6dd146106ef578063ba9a8b3714610714578063bf75455814610727578063c8c2fe6c1461074e578063d395ee0f14610761578063d4ee1d90146107b0578063d8959512146107c3578063e4edf852146107e2578063e7ee85a514610801578063ecbca55d14610817578063f0843ba914610833578063f2c8d2471461087e578063f2fde38b14610898578063fc0c546a146108b7575b610271600980548060200260200160405190810160405280929190818152602001828054801561026457602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610246575b50505050503460016108ca565b50005b341561027f57600080fd5b6102a4600160a060020a036004351663ffffffff602435166044351515606435610be8565b005b34156102b157600080fd5b6102c5600160a060020a0360043516610cfc565b60405194855263ffffffff90931660208501529015156040808501919091529015156060840152901515608083015260a0909101905180910390f35b341561030c57600080fd5b610317600435610d42565b604051600160a060020a03909116815260200160405180910390f35b341561033e57600080fd5b61035b600160a060020a0360043581169060243516604435610d6a565b60405190815260200160405180910390f35b341561037857600080fd5b6102a4600160a060020a0360043516610e5f565b341561039757600080fd5b6102a46004351515610ede565b34156103af57600080fd5b6102a4600160a060020a0360043516610f41565b34156103ce57600080fd5b610317610fb5565b34156103e157600080fd5b61035b600435610fc4565b34156103f757600080fd5b6102a4610ffe565b341561040a57600080fd5b61041261106b565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561044e578082015183820152602001610436565b50505050905090810190601f16801561047b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561049457600080fd5b6102a4600160a060020a036004351663ffffffff602435166044351515611109565b34156104c157600080fd5b6102a4600160a060020a036004358116906024351660443561133d565b34156104e957600080fd5b6103176113d1565b34156104fc57600080fd5b6103176113e0565b341561050f57600080fd5b6102a46113ef565b341561052257600080fd5b6102a4600160a060020a03600435166024351515611417565b341561054657600080fd5b6104126114a0565b341561055957600080fd5b61056161150b565b60405163ffffffff909116815260200160405180910390f35b341561058557600080fd5b6102a4600160a060020a0360043581169060243516604435611523565b34156105ad57600080fd5b61035b600160a060020a0360043581169060243516604435606435611609565b34156105d857600080fd5b61035b600160a060020a0360043516602435604435611620565b34156105fd57600080fd5b610605611992565b60405161ffff909116815260200160405180910390f35b341561062757600080fd5b61035b600160a060020a0360043516602435611999565b341561064957600080fd5b61035b600160a060020a0360043581169060243516604435606435611a12565b341561067457600080fd5b6102a4611a9c565b341561068757600080fd5b6102a46004351515611b1d565b341561069f57600080fd5b610317611b7d565b34156106b257600080fd5b61035b611b8c565b34156106c557600080fd5b610561611b92565b34156106d857600080fd5b61035b600160a060020a0360043516602435611ba6565b34156106fa57600080fd5b61035b600160a060020a0360043516602435604435611e2e565b341561071f57600080fd5b610605612099565b341561073257600080fd5b61073a6120ab565b604051901515815260200160405180910390f35b341561075957600080fd5b6102a46120c4565b341561076c57600080fd5b6102a4600460248135818101908301358060208181020160405190810160405280939291908181526020018383602002808284375094965061214595505050505050565b34156107bb57600080fd5b6103176121a8565b34156107ce57600080fd5b61035b600160a060020a03600435166121b7565b34156107ed57600080fd5b6102a4600160a060020a03600435166122a0565b341561080c57600080fd5b6103176004356122f5565b341561082257600080fd5b6102a463ffffffff60043516612303565b61035b6004602481358181019083013580602081810201604051908101604052809392919081815260200183836020028082843750949650508435946020013593506108ca92505050565b341561088957600080fd5b61031761ffff600435166123f9565b34156108a357600080fd5b6102a4600160a060020a0360043516612449565b34156108c257600080fd5b61031761249e565b600080600085600281511180156108e357506015815111155b80156108fc5750600281518115156108f757fe5b066001145b151561090757600080fd5b8660008151811061091457fe5b90602001906020020151600754909350600160a060020a031663c31e05476000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561096957600080fd5b6102c65a03f1151561097a57600080fd5b5050506040518051925050341515610b0957600254600160a060020a0384811691161415610a7c57600254600160a060020a031663a24835d1338860405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b15156109f857600080fd5b6102c65a03f11515610a0957600080fd5b5050600254600160a060020a0316905063867904b4838860405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b1515610a6357600080fd5b6102c65a03f11515610a7457600080fd5b505050610b09565b82600160a060020a03166323b872dd33848960006040516020015260405160e060020a63ffffffff8616028152600160a060020a0393841660048201529190921660248201526044810191909152606401602060405180830381600087803b1515610ae657600080fd5b6102c65a03f11515610af757600080fd5b505050604051805190501515610b0957fe5b81600160a060020a031663c98fefed34898989336000604051602001526040518663ffffffff1660e060020a028152600401808060200185815260200184815260200183600160a060020a0316600160a060020a03168152602001828103825286818151815260200191508051906020019060200280838360005b83811015610b9c578082015183820152602001610b84565b50505050905001955050505050506020604051808303818588803b1515610bc257600080fd5b6125ee5a03f11515610bd357600080fd5b50505050604051805198975050505050505050565b6000805433600160a060020a03908116911614610c0157fe5b600160a060020a0385166000908152600a602052604090206001015485906601000000000000900460ff161515610c3757600080fd5b8460008163ffffffff16118015610c575750620f424063ffffffff821611155b1515610c6257600080fd5b600160a060020a0387166000908152600a602052604090206001810154600b54919450620f424063ffffffff918216928216929092038801161115610ca657600080fd5b5050600181018054600b805463ffffffff928316818416038801831663ffffffff199182161790915582549515156401000000000264ff0000000019929097169516949094179390931693909317909155905550565b600a602052600090815260409020805460019091015463ffffffff81169060ff640100000000820481169165010000000000810482169166010000000000009091041685565b6008805482908110610d5057fe5b600091825260209091200154600160a060020a0316905081565b600080600160a060020a038581169085161415610d8657600080fd5b600254600160a060020a0385811691161415610dad57610da68584611ba6565b9150610e57565b600254600160a060020a0386811691161415610dcd57610da68484611999565b610dd78584611ba6565b600254909150610e549085908390610e4f90600160a060020a03166318160ddd6000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515610e2e57600080fd5b6102c65a03f11515610e3f57600080fd5b50505060405180519050856124ad565b6124bc565b91505b509392505050565b60005433600160a060020a03908116911614610e7757fe5b600254600160a060020a031663f2fde38b8260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401600060405180830381600087803b1515610ec757600080fd5b6102c65a03f11515610ed857600080fd5b50505050565b60005433600160a060020a0390811691161480610f09575060035433600160a060020a039081169116145b1515610f1457600080fd5b600b80546cff000000000000000000000000191691156c0100000000000000000000000002919091179055565b60005433600160a060020a03908116911614610f5957fe5b80600160a060020a0381161515610f6f57600080fd5b8130600160a060020a031681600160a060020a031614151515610f9157600080fd5b505060078054600160a060020a031916600160a060020a0392909216919091179055565b600754600160a060020a031681565b600b54600090620f424090610fec90849068010000000000000000900463ffffffff166126cf565b811515610ff557fe5b0490505b919050565b60005433600160a060020a0390811691161461101657fe5b600254600160a060020a03166379ba50976040518163ffffffff1660e060020a028152600401600060405180830381600087803b151561105557600080fd5b6102c65a03f1151561106657600080fd5b505050565b60068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156111015780601f106110d657610100808354040283529160200191611101565b820191906000526020600020905b8154815290600101906020018083116110e457829003601f168201915b505050505081565b60005433600160a060020a0390811691161461112157fe5b600254600160a060020a033081169116638da5cb5b6000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561116d57600080fd5b6102c65a03f1151561117e57600080fd5b50505060405180519050600160a060020a03161415151561119b57fe5b82600160a060020a03811615156111b157600080fd5b8330600160a060020a031681600160a060020a0316141515156111d357600080fd5b8360008163ffffffff161180156111f35750620f424063ffffffff821611155b15156111fe57600080fd5b600254600160a060020a038781169116148015906112425750600160a060020a0386166000908152600a60205260409020600101546601000000000000900460ff16155b80156112605750600b54620f424063ffffffff918216870190911611155b151561126b57600080fd5b600160a060020a0386166000908152600a602052604081209081556001908101805466010000000000006501000000000063ffffffff1990921663ffffffff8a161764ff000000001916640100000000891515021765ff000000000019169190911766ff000000000000191617905560088054909181016112ec83826129e7565b5060009182526020909120018054600160a060020a031916600160a060020a0397909716969096179095555050600b805463ffffffff19811663ffffffff9182169490940116929092179091555050565b60005433600160a060020a0390811691161461135557fe5b600254600160a060020a0316635e35359e84848460405160e060020a63ffffffff8616028152600160a060020a0393841660048201529190921660248201526044810191909152606401600060405180830381600087803b15156113b857600080fd5b6102c65a03f115156113c957600080fd5b505050505050565b600454600160a060020a031681565b600354600160a060020a031681565b60005433600160a060020a0390811691161461140757fe5b60006114146009826129e7565b50565b60005433600160a060020a0390811691161461142f57fe5b600160a060020a0382166000908152600a602052604090206001015482906601000000000000900460ff16151561146557600080fd5b50600160a060020a03919091166000908152600a60205260409020600101805465ff0000000000191691156501000000000002919091179055565b60058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156111015780601f106110d657610100808354040283529160200191611101565b600b5468010000000000000000900463ffffffff1681565b60005433600160a060020a0390811691161461153b57fe5b82600160a060020a038116151561155157600080fd5b82600160a060020a038116151561156757600080fd5b8330600160a060020a031681600160a060020a03161415151561158957600080fd5b85600160a060020a031663a9059cbb868660006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156115e657600080fd5b6102c65a03f115156115f757600080fd5b5050506040518051905015156113c957fe5b600061161785858585611a12565b95945050505050565b6000806000806000600b600c9054906101000a900460ff16151561164057fe5b600754600160a060020a031663961a929c6000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561168857600080fd5b6102c65a03f1151561169957600080fd5b50505060405180519050600160a060020a031663fe173b976000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156116e857600080fd5b6102c65a03f115156116f957600080fd5b50505060405180513a1115905061170c57fe5b856000811161171a57600080fd5b600254600160a060020a03166370a082313360006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561177357600080fd5b6102c65a03f1151561178457600080fd5b5050506040518051891115905061179a57600080fd5b6117a48989611999565b945084158015906117b55750868510155b15156117c057600080fd5b600254600160a060020a03166318160ddd6000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561180857600080fd5b6102c65a03f1151561181957600080fd5b50505060405180519050935061182e896121b7565b9250828510806118475750828514801561184757508388145b151561184f57fe5b600160a060020a0389166000908152600a602052604090206001810154909250640100000000900460ff161561188e57815461188b90866126f3565b82555b600254600160a060020a031663a24835d1338a60405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b15156118e457600080fd5b6102c65a03f115156118f557600080fd5b50505088600160a060020a031663a9059cbb338760006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561195557600080fd5b6102c65a03f1151561196657600080fd5b50505060405180519050151561197857fe5b6119858989876000612705565b5092979650505050505050565b6008545b90565b600254600090611a0b9084908490600160a060020a03166318160ddd85604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156119eb57600080fd5b6102c65a03f115156119fc57600080fd5b505050604051805190506124bc565b9392505050565b600080600160a060020a038681169086161415611a2e57600080fd5b600254600160a060020a0386811691161415611a5657611a4f868585611e2e565b9150611a93565b600254600160a060020a0387811691161415611a7757611a4f858585611620565b611a8386856001611e2e565b9050611a90858285611620565b91505b50949350505050565b60015433600160a060020a03908116911614611ab757600080fd5b600154600054600160a060020a0391821691167f343765429aea5a34b3ff6a3785a98a5abb2597aca87bfbb58632c173d585373a60405160405180910390a36001805460008054600160a060020a0319908116600160a060020a03841617909155169055565b60005433600160a060020a03908116911614611b3557fe5b600254600160a060020a0316631608f18f8260405160e060020a63ffffffff84160281529015156004820152602401600060405180830381600087803b1515610ec757600080fd5b600054600160a060020a031681565b60095490565b600b54640100000000900463ffffffff1681565b60025460009081908190819081908190600160a060020a033081169116638da5cb5b83604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515611bfe57600080fd5b6102c65a03f11515611c0f57600080fd5b50505060405180519050600160a060020a0316141515611c2b57fe5b600160a060020a0388166000908152600a602052604090206001015488906601000000000000900460ff161515611c6157600080fd5b600160a060020a0389166000908152600a60205260409020600181015490965065010000000000900460ff161515611c9857600080fd5b600254600160a060020a03166318160ddd6000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515611ce057600080fd5b6102c65a03f11515611cf157600080fd5b505050604051805190509450611d06896121b7565b600754909450600160a060020a0316634b75f54f6000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515611d5157600080fd5b6102c65a03f11515611d6257600080fd5b50505060405180516001880154600160a060020a0390911691506329a00e7c908790879063ffffffff168c6000604051602001526040518563ffffffff1660e060020a028152600401808581526020018481526020018363ffffffff1663ffffffff168152602001828152602001945050505050602060405180830381600087803b1515611def57600080fd5b6102c65a03f11515611e0057600080fd5b505050604051805190509250611e1583610fc4565b9150611e2183836126f3565b9998505050505050505050565b6000806000600b600c9054906101000a900460ff161515611e4b57fe5b600754600160a060020a031663961a929c6000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515611e9357600080fd5b6102c65a03f11515611ea457600080fd5b50505060405180519050600160a060020a031663fe173b976000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515611ef357600080fd5b6102c65a03f11515611f0457600080fd5b50505060405180513a11159050611f1757fe5b8360008111611f2557600080fd5b611f2f8787611ba6565b92508215801590611f405750848310155b1515611f4b57600080fd5b600160a060020a0387166000908152600a602052604090206001810154909250640100000000900460ff1615611f8a578154611f8790876124ad565b82555b86600160a060020a03166323b872dd33308960006040516020015260405160e060020a63ffffffff8616028152600160a060020a0393841660048201529190921660248201526044810191909152606401602060405180830381600087803b1515611ff457600080fd5b6102c65a03f1151561200557600080fd5b50505060405180519050151561201757fe5b600254600160a060020a031663867904b4338560405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b151561206d57600080fd5b6102c65a03f1151561207e57600080fd5b50505061208e8787856001612705565b509095945050505050565b60006120a3611992565b600101905090565b600b546c01000000000000000000000000900460ff1681565b60045433600160a060020a039081169116146120df57600080fd5b600454600354600160a060020a0391821691167fbe4cc281795971a471c980e842627a7f1ea3892ddfce8c5b6357cd2611c1973260405160405180910390a36004805460038054600160a060020a0319908116600160a060020a03841617909155169055565b60005433600160a060020a0390811691161461215d57fe5b806002815111801561217157506015815111155b801561218a57506002815181151561218557fe5b066001145b151561219557600080fd5b6009828051611066929160200190612a0b565b600154600160a060020a031681565b600160a060020a0381166000908152600a6020526040812060010154819083906601000000000000900460ff1615156121ef57600080fd5b600160a060020a0384166000908152600a602052604090206001810154909250640100000000900460ff166122955783600160a060020a03166370a082313060006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561227557600080fd5b6102c65a03f1151561228657600080fd5b50505060405180519050612298565b81545b949350505050565b60035433600160a060020a039081169116146122b857fe5b600354600160a060020a03828116911614156122d357600080fd5b60048054600160a060020a031916600160a060020a0392909216919091179055565b6009805482908110610d5057fe5b60005433600160a060020a039081169116148061232e575060035433600160a060020a039081169116145b151561233957600080fd5b8060008163ffffffff16101580156123655750600b5463ffffffff640100000000909104811690821611155b151561237057600080fd5b600b547f81cd2ffb37dd237c0e4e2a3de5265fcf9deb43d3e7801e80db9f1ccfba7ee6009068010000000000000000900463ffffffff168360405163ffffffff9283168152911660208201526040908101905180910390a150600b805463ffffffff90921668010000000000000000026bffffffff000000000000000019909216919091179055565b600061ffff821615156124185750600254600160a060020a0316610ff9565b6008805461ffff60001985011690811061242e57fe5b600091825260209091200154600160a060020a031692915050565b60005433600160a060020a0390811691161461246157fe5b600054600160a060020a038281169116141561247c57600080fd5b60018054600160a060020a031916600160a060020a0392909216919091179055565b600254600160a060020a031681565b600082820183811015611a0b57fe5b6002546000908190819081908190600160a060020a033081169116638da5cb5b83604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561251257600080fd5b6102c65a03f1151561252357600080fd5b50505060405180519050600160a060020a031614151561253f57fe5b600160a060020a0388166000908152600a602052604090206001015488906601000000000000900460ff16151561257557600080fd5b866000811161258357600080fd5b600160a060020a038a166000908152600a6020526040902095506125a68a6121b7565b600754909550600160a060020a0316634b75f54f6000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156125f157600080fd5b6102c65a03f1151561260257600080fd5b50505060405180516001880154600160a060020a0390911691506349f9b0f7908a90889063ffffffff168d6000604051602001526040518563ffffffff1660e060020a028152600401808581526020018481526020018363ffffffff1663ffffffff168152602001828152602001945050505050602060405180830381600087803b151561268f57600080fd5b6102c65a03f115156126a057600080fd5b5050506040518051905093506126b584610fc4565b92506126c184846126f3565b9a9950505050505050505050565b60008282028315806126eb57508284828115156126e857fe5b04145b1515611a0b57fe5b6000818310156126ff57fe5b50900390565b600160a060020a0384166000908152600a60205260408120908080808061273761272e8b6121b7565b620f42406126cf565b6002549095506127b290600160a060020a03166318160ddd6000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561278657600080fd5b6102c65a03f1151561279757600080fd5b5050506040518051600189015490915063ffffffff166126cf565b600254909450600160a060020a031663313ce5676000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156127fd57600080fd5b6102c65a03f1151561280e57600080fd5b5050506040518051935050600160a060020a038a1663313ce5676000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561285f57600080fd5b6102c65a03f1151561287057600080fd5b505050604051805192505060ff838116908316146128c4578160ff168360ff1611156128af576128a88583850360ff16600a0a6126cf565b94506128c4565b6128c18484840360ff16600a0a6126cf565b93505b6128cd88610fc4565b90507f80000000000000000000000000000000000000000000000000000000000000008111156128f957fe5b861561296f57600254600160a060020a03338116918116908c167fcee13e282037fd063de72c4cf7955988112510b046cda38c12c47862c1785e7b8c8c868b8b604051808681526020018581526020018481526020018381526020018281526020019550505050505060405180910390a46129db565b600254600160a060020a03338116918c821691167fcee13e282037fd063de72c4cf7955988112510b046cda38c12c47862c1785e7b8c8c868a8c604051808681526020018581526020018481526020018381526020018281526020019550505050505060405180910390a45b50505050505050505050565b81548183558181151161106657600083815260209020611066918101908301612a72565b828054828255906000526020600020908101928215612a62579160200282015b82811115612a625782518254600160a060020a031916600160a060020a039190911617825560209290920191600190910190612a2b565b50612a6e929150612a8c565b5090565b61199691905b80821115612a6e5760008155600101612a78565b61199691905b80821115612a6e578054600160a060020a0319168155600101612a925600a165627a7a7230582037ee0633d265598ee53aaed2304e846833083a819e007ae463e8dcf5a3355c310029
Swarm Source
bzzr://37ee0633d265598ee53aaed2304e846833083a819e007ae463e8dcf5a3355c31
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
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.