More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 1,229 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Quick Convert | 5816437 | 2385 days ago | IN | 0 ETH | 0.00309613 | ||||
Quick Convert | 5816398 | 2385 days ago | IN | 0 ETH | 0.00322962 | ||||
Quick Convert | 5815787 | 2385 days ago | IN | 0 ETH | 0.00191054 | ||||
Transfer Ownersh... | 5815671 | 2385 days ago | IN | 0 ETH | 0.00031379 | ||||
Accept Ownership | 5815661 | 2385 days ago | IN | 0 ETH | 0.00013916 | ||||
Quick Convert | 5815616 | 2385 days ago | IN | 0 ETH | 0.00191776 | ||||
Quick Convert | 5815352 | 2385 days ago | IN | 0 ETH | 0.00191079 | ||||
Quick Convert | 5814685 | 2385 days ago | IN | 0 ETH | 0.00190931 | ||||
Quick Convert | 5814300 | 2385 days ago | IN | 0 ETH | 0.0019137 | ||||
Quick Convert | 5814243 | 2385 days ago | IN | 0 ETH | 0.00191866 | ||||
Quick Convert | 5813941 | 2385 days ago | IN | 0 ETH | 0.00191725 | ||||
Quick Convert | 5811676 | 2385 days ago | IN | 0 ETH | 0.00199566 | ||||
Quick Convert | 5810823 | 2386 days ago | IN | 0 ETH | 0.00198489 | ||||
Quick Convert | 5810527 | 2386 days ago | IN | 0 ETH | 0.00183934 | ||||
Quick Convert | 5810481 | 2386 days ago | IN | 0 ETH | 0.00199591 | ||||
Quick Convert | 5810022 | 2386 days ago | IN | 0 ETH | 0.00191692 | ||||
Quick Convert | 5809823 | 2386 days ago | IN | 0 ETH | 0.00199836 | ||||
Quick Convert | 5809815 | 2386 days ago | IN | 0 ETH | 0.0001922 | ||||
Quick Convert | 5809810 | 2386 days ago | IN | 0 ETH | 0.0001922 | ||||
Quick Convert | 5809778 | 2386 days ago | IN | 0 ETH | 0.00191891 | ||||
Quick Convert | 5809255 | 2386 days ago | IN | 0 ETH | 0.00191254 | ||||
Quick Convert | 5808936 | 2386 days ago | IN | 0 ETH | 0.00191692 | ||||
Quick Convert | 5808000 | 2386 days ago | IN | 0 ETH | 0.00191609 | ||||
Quick Convert | 5806985 | 2386 days ago | IN | 0 ETH | 0.0019878 | ||||
Quick Convert | 5806500 | 2386 days ago | IN | 0 ETH | 0.00199476 |
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0xc6725aE7...E49b9Db29 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 500 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity)
/** *Submitted for verification at Etherscan.io on 2018-04-17 */ 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; } } /* 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); } } /* 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); } } /* 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); } /* 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; } /* 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)); } } /* 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); function calculateCrossConnectorReturn(uint256 _connector1Balance, uint32 _connector1Weight, uint256 _connector2Balance, uint32 _connector2Weight, uint256 _amount) public view returns (uint256); } /* Bancor Gas Price Limit interface */ contract IBancorGasPriceLimit { function gasPrice() public view returns (uint256) {} function validateGasPrice(uint256) public view; } /* 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); function convertForPrioritized(IERC20Token[] _path, uint256 _amount, uint256 _minReturn, address _for, uint256 _block, uint256 _nonce, uint8 _v, bytes32 _r, bytes32 _s) 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.8 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.8'; 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 IERC20Token[] private convertPath; // 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); _; } // 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); _; } // allows execution only for quick convreter modifier quickConverterOnly { require(msg.sender == address(extensions.quickConverter())); _; } /** @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 convertInternal(IERC20Token _fromToken, IERC20Token _toToken, uint256 _amount, uint256 _minReturn) public quickConverterOnly 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 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) { convertPath = [_fromToken, token, _toToken]; return quickConvert(convertPath, _amount, _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) internal conversionsAllowed 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) internal conversionsAllowed 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) { return quickConvertPrioritized(_path, _amount, _minReturn, 0x0, 0x0, 0x0, 0x0, 0x0); } /** @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 @param _block if the current block exceeded the given parameter - it is cancelled @param _nonce the nonce of the sender address @param _v parameter that can be parsed from the transaction signature @param _r parameter that can be parsed from the transaction signature @param _s parameter that can be parsed from the transaction signature @return tokens issued in return */ function quickConvertPrioritized(IERC20Token[] _path, uint256 _amount, uint256 _minReturn, uint256 _block, uint256 _nonce, uint8 _v, bytes32 _r, bytes32 _s) 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.convertForPrioritized.value(msg.value)(_path, _amount, _minReturn, msg.sender, _block, _nonce, _v, _r, _s); } // deprecated, backward compatibility function change(IERC20Token _fromToken, IERC20Token _toToken, uint256 _amount, uint256 _minReturn) public returns (uint256) { return convertInternal(_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":false,"inputs":[{"name":"_path","type":"address[]"},{"name":"_amount","type":"uint256"},{"name":"_minReturn","type":"uint256"},{"name":"_block","type":"uint256"},{"name":"_nonce","type":"uint256"},{"name":"_v","type":"uint8"},{"name":"_r","type":"bytes32"},{"name":"_s","type":"bytes32"}],"name":"quickConvertPrioritized","outputs":[{"name":"","type":"uint256"}],"payable":true,"stateMutability":"payable","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":false,"inputs":[{"name":"_fromToken","type":"address"},{"name":"_toToken","type":"address"},{"name":"_amount","type":"uint256"},{"name":"_minReturn","type":"uint256"}],"name":"convertInternal","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","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":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":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
0x60606040526004361061020b5763ffffffff60e060020a6000350416630ca7892381146102745780630e53aae9146102a657806314c9035e1461030157806319b640151461037d5780631e1401f8146103af57806321e6b53d146103d7578063228d2820146103f65780632314aad61461040e57806324f159c21461042d5780632a2e2f0c146104405780632a3c2c561461046b57806338a5e016146104815780633e8ff43f146104945780633f4d2fc21461051e57806341a5b33d1461054b5780634290602914610573578063481c6a75146105865780634e2280c414610599578063514385be146105ac57806354fd4d50146105d0578063579cd3ca146105e35780635e35359e1461060f5780635e5144eb1461063757806371f52bf31461066257806372b44b2c1461068c57806375892cf1146106ae57806379ba5097146106d957806385d5e631146106ec5780638da5cb5b146107045780639396a7f01461071757806394c275ad1461072a578063a2c4c3361461073d578063ba9a8b371461075f578063bf75455814610772578063c8c2fe6c14610799578063d395ee0f146107ac578063d4ee1d90146107fb578063d89595121461080e578063e4edf8521461082d578063e7ee85a51461084c578063ecbca55d14610862578063f0843ba91461087e578063f2c8d247146108c9578063f2fde38b146108e3578063fc0c546a14610902575b610271600980548060200260200160405190810160405280929190818152602001828054801561026457602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610246575b5050505050346001610915565b50005b341561027f57600080fd5b6102a4600160a060020a036004351663ffffffff60243516604435151560643561096b565b005b34156102b157600080fd5b6102c5600160a060020a0360043516610a7f565b60405194855263ffffffff90931660208501529015156040808501919091529015156060840152901515608083015260a0909101905180910390f35b61036b60046024813581810190830135806020818102016040519081016040528093929190818152602001838360200280828437509496505084359460208101359450604081013593506060810135925060ff608082013516915060a08101359060c00135610ac5565b60405190815260200160405180910390f35b341561038857600080fd5b610393600435610e15565b604051600160a060020a03909116815260200160405180910390f35b34156103ba57600080fd5b61036b600160a060020a0360043581169060243516604435610e3d565b34156103e257600080fd5b6102a4600160a060020a0360043516610f27565b341561040157600080fd5b6102a46004351515610fa6565b341561041957600080fd5b6102a4600160a060020a0360043516611009565b341561043857600080fd5b61039361108a565b341561044b57600080fd5b61036b600160a060020a0360043581169060243516604435606435611099565b341561047657600080fd5b61036b6004356111a6565b341561048c57600080fd5b6102a46111e0565b341561049f57600080fd5b6104a761124d565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156104e35780820151838201526020016104cb565b50505050905090810190601f1680156105105780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561052957600080fd5b6102a4600160a060020a036004351663ffffffff6024351660443515156112eb565b341561055657600080fd5b6102a4600160a060020a036004358116906024351660443561152c565b341561057e57600080fd5b6103936115c0565b341561059157600080fd5b6103936115cf565b34156105a457600080fd5b6102a46115de565b34156105b757600080fd5b6102a4600160a060020a03600435166024351515611606565b34156105db57600080fd5b6104a761168f565b34156105ee57600080fd5b6105f66116fa565b60405163ffffffff909116815260200160405180910390f35b341561061a57600080fd5b6102a4600160a060020a0360043581169060243516604435611712565b341561064257600080fd5b61036b600160a060020a03600435811690602435166044356064356117f8565b341561066d57600080fd5b61067561180f565b60405161ffff909116815260200160405180910390f35b341561069757600080fd5b61036b600160a060020a0360043516602435611816565b34156106b957600080fd5b61036b600160a060020a036004358116906024351660443560643561188f565b34156106e457600080fd5b6102a461192f565b34156106f757600080fd5b6102a460043515156119bd565b341561070f57600080fd5b610393611a1d565b341561072257600080fd5b61036b611a2c565b341561073557600080fd5b6105f6611a32565b341561074857600080fd5b61036b600160a060020a0360043516602435611a46565b341561076a57600080fd5b610675611cce565b341561077d57600080fd5b610785611ce0565b604051901515815260200160405180910390f35b34156107a457600080fd5b6102a4611cf9565b34156107b757600080fd5b6102a46004602481358181019083013580602081810201604051908101604052809392919081815260200183836020028082843750949650611d8795505050505050565b341561080657600080fd5b610393611dea565b341561081957600080fd5b61036b600160a060020a0360043516611df9565b341561083857600080fd5b6102a4600160a060020a0360043516611ee2565b341561085757600080fd5b610393600435611f44565b341561086d57600080fd5b6102a463ffffffff60043516611f52565b61036b60046024813581810190830135806020818102016040519081016040528093929190818152602001838360200280828437509496505084359460200135935061091592505050565b34156108d457600080fd5b61039361ffff60043516612048565b34156108ee57600080fd5b6102a4600160a060020a0360043516612098565b341561090d57600080fd5b6103936120fa565b6000836002815111801561092b57506015815111155b801561094457506002815181151561093f57fe5b066001145b151561094f57600080fd5b610960858585600080808080610ac5565b91505b509392505050565b6000805433600160a060020a0390811691161461098457fe5b600160a060020a0385166000908152600a602052604090206001015485906601000000000000900460ff1615156109ba57600080fd5b8460008163ffffffff161180156109da5750620f424063ffffffff821611155b15156109e557600080fd5b600160a060020a0387166000908152600a602052604090206001810154600b54919450620f424063ffffffff918216928216929092038801161115610a2957600080fd5b5050600181018054600b805463ffffffff928316818416038801831663ffffffff199182161790915582549515156401000000000264ff0000000019929097169516949094179390931693909317909155905550565b600a602052600090815260409020805460019091015463ffffffff81169060ff640100000000820481169165010000000000810482169166010000000000009091041685565b60008060008a60028151118015610ade57506015815111155b8015610af7575060028151811515610af257fe5b066001145b1515610b0257600080fd5b8b600081518110610b0f57fe5b90602001906020020151600754909350600160a060020a031663c31e05476000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515610b6457600080fd5b6102c65a03f11515610b7557600080fd5b5050506040518051925050341515610d0457600254600160a060020a0384811691161415610c7757600254600160a060020a031663a24835d1338d60405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b1515610bf357600080fd5b6102c65a03f11515610c0457600080fd5b5050600254600160a060020a0316905063867904b4838d60405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b1515610c5e57600080fd5b6102c65a03f11515610c6f57600080fd5b505050610d04565b82600160a060020a03166323b872dd33848e60006040516020015260405160e060020a63ffffffff8616028152600160a060020a0393841660048201529190921660248201526044810191909152606401602060405180830381600087803b1515610ce157600080fd5b6102c65a03f11515610cf257600080fd5b505050604051805190501515610d0457fe5b81600160a060020a0316631134269a348e8e8e338f8f8f8f8f60006040516020015260405160e060020a63ffffffff8d160281526024810189905260448101889052600160a060020a03871660648201526084810186905260a4810185905260ff841660c482015260e48101839052610104810182905261012060048201908152908190610124018b818151815260200191508051906020019060200280838360005b83811015610dbf578082015183820152602001610da7565b505050509050019a50505050505050505050506020604051808303818588803b1515610dea57600080fd5b6125ee5a03f11515610dfb57600080fd5b5050505060405180519d9c50505050505050505050505050565b6008805482908110610e2357fe5b600091825260209091200154600160a060020a0316905081565b600080600160a060020a038581169085161415610e5957600080fd5b600254600160a060020a0385811691161415610e8057610e798584611a46565b9150610963565b600254600160a060020a0386811691161415610ea057610e798484611816565b610eaa8584611a46565b6002549091506109609085908390610f2290600160a060020a03166318160ddd6000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515610f0157600080fd5b6102c65a03f11515610f1257600080fd5b5050506040518051905085612109565b612118565b60005433600160a060020a03908116911614610f3f57fe5b600254600160a060020a031663f2fde38b8260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401600060405180830381600087803b1515610f8f57600080fd5b6102c65a03f11515610fa057600080fd5b50505050565b60005433600160a060020a0390811691161480610fd1575060035433600160a060020a039081169116145b1515610fdc57600080fd5b600b80546cff000000000000000000000000191691156c0100000000000000000000000002919091179055565b60005433600160a060020a0390811691161461102157fe5b80600160a060020a038116151561103757600080fd5b8130600160a060020a031681600160a060020a03161415151561105957600080fd5b50506007805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600754600160a060020a031681565b6007546000908190600160a060020a031663c31e054782604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156110e557600080fd5b6102c65a03f115156110f657600080fd5b50505060405180519050600160a060020a031633600160a060020a031614151561111f57600080fd5b600160a060020a03868116908616141561113857600080fd5b600254600160a060020a03868116911614156111605761115986858561232b565b915061119d565b600254600160a060020a0387811691161415611181576111598585856124ca565b61118d8685600161232b565b905061119a8582856124ca565b91505b50949350505050565b600b54600090620f4240906111ce90849068010000000000000000900463ffffffff16612770565b8115156111d757fe5b0490505b919050565b60005433600160a060020a039081169116146111f857fe5b600254600160a060020a03166379ba50976040518163ffffffff1660e060020a028152600401600060405180830381600087803b151561123757600080fd5b6102c65a03f1151561124857600080fd5b505050565b60068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156112e35780601f106112b8576101008083540402835291602001916112e3565b820191906000526020600020905b8154815290600101906020018083116112c657829003601f168201915b505050505081565b60005433600160a060020a0390811691161461130357fe5b600254600160a060020a033081169116638da5cb5b6000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561134f57600080fd5b6102c65a03f1151561136057600080fd5b50505060405180519050600160a060020a03161415151561137d57fe5b82600160a060020a038116151561139357600080fd5b8330600160a060020a031681600160a060020a0316141515156113b557600080fd5b8360008163ffffffff161180156113d55750620f424063ffffffff821611155b15156113e057600080fd5b600254600160a060020a038781169116148015906114245750600160a060020a0386166000908152600a60205260409020600101546601000000000000900460ff16155b80156114425750600b54620f424063ffffffff918216870190911611155b151561144d57600080fd5b600160a060020a0386166000908152600a602052604081209081556001908101805466010000000000006501000000000063ffffffff1990921663ffffffff8a161764ff000000001916640100000000891515021765ff000000000019169190911766ff000000000000191617905560088054909181016114ce8382612a88565b506000918252602090912001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0397909716969096179095555050600b805463ffffffff19811663ffffffff9182169490940116929092179091555050565b60005433600160a060020a0390811691161461154457fe5b600254600160a060020a0316635e35359e84848460405160e060020a63ffffffff8616028152600160a060020a0393841660048201529190921660248201526044810191909152606401600060405180830381600087803b15156115a757600080fd5b6102c65a03f115156115b857600080fd5b505050505050565b600454600160a060020a031681565b600354600160a060020a031681565b60005433600160a060020a039081169116146115f657fe5b6000611603600982612a88565b50565b60005433600160a060020a0390811691161461161e57fe5b600160a060020a0382166000908152600a602052604090206001015482906601000000000000900460ff16151561165457600080fd5b50600160a060020a03919091166000908152600a60205260409020600101805465ff0000000000191691156501000000000002919091179055565b60058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156112e35780601f106112b8576101008083540402835291602001916112e3565b600b5468010000000000000000900463ffffffff1681565b60005433600160a060020a0390811691161461172a57fe5b82600160a060020a038116151561174057600080fd5b82600160a060020a038116151561175657600080fd5b8330600160a060020a031681600160a060020a03161415151561177857600080fd5b85600160a060020a031663a9059cbb868660006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156117d557600080fd5b6102c65a03f115156117e657600080fd5b5050506040518051905015156115b857fe5b600061180685858585611099565b95945050505050565b6008545b90565b6002546000906118889084908490600160a060020a03166318160ddd85604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561186857600080fd5b6102c65a03f1151561187957600080fd5b50505060405180519050612118565b9392505050565b600060606040519081016040908152600160a060020a038088168352600254811660208401528616908201526118c990600c906003612aac565b50611806600c80548060200260200160405190810160405280929190818152602001828054801561192357602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311611905575b50505050508484610915565b60015433600160a060020a0390811691161461194a57600080fd5b600154600054600160a060020a0391821691167f343765429aea5a34b3ff6a3785a98a5abb2597aca87bfbb58632c173d585373a60405160405180910390a3600180546000805473ffffffffffffffffffffffffffffffffffffffff19908116600160a060020a03841617909155169055565b60005433600160a060020a039081169116146119d557fe5b600254600160a060020a0316631608f18f8260405160e060020a63ffffffff84160281529015156004820152602401600060405180830381600087803b1515610f8f57600080fd5b600054600160a060020a031681565b60095490565b600b54640100000000900463ffffffff1681565b60025460009081908190819081908190600160a060020a033081169116638da5cb5b83604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515611a9e57600080fd5b6102c65a03f11515611aaf57600080fd5b50505060405180519050600160a060020a0316141515611acb57fe5b600160a060020a0388166000908152600a602052604090206001015488906601000000000000900460ff161515611b0157600080fd5b600160a060020a0389166000908152600a60205260409020600181015490965065010000000000900460ff161515611b3857600080fd5b600254600160a060020a03166318160ddd6000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515611b8057600080fd5b6102c65a03f11515611b9157600080fd5b505050604051805190509450611ba689611df9565b600754909450600160a060020a0316634b75f54f6000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515611bf157600080fd5b6102c65a03f11515611c0257600080fd5b50505060405180516001880154600160a060020a0390911691506329a00e7c908790879063ffffffff168c6000604051602001526040518563ffffffff1660e060020a028152600401808581526020018481526020018363ffffffff1663ffffffff168152602001828152602001945050505050602060405180830381600087803b1515611c8f57600080fd5b6102c65a03f11515611ca057600080fd5b505050604051805190509250611cb5836111a6565b9150611cc18383612794565b9998505050505050505050565b6000611cd861180f565b600101905090565b600b546c01000000000000000000000000900460ff1681565b60045433600160a060020a03908116911614611d1457600080fd5b600454600354600160a060020a0391821691167fbe4cc281795971a471c980e842627a7f1ea3892ddfce8c5b6357cd2611c1973260405160405180910390a3600480546003805473ffffffffffffffffffffffffffffffffffffffff19908116600160a060020a03841617909155169055565b60005433600160a060020a03908116911614611d9f57fe5b8060028151118015611db357506015815111155b8015611dcc575060028151811515611dc757fe5b066001145b1515611dd757600080fd5b6009828051611248929160200190612aac565b600154600160a060020a031681565b600160a060020a0381166000908152600a6020526040812060010154819083906601000000000000900460ff161515611e3157600080fd5b600160a060020a0384166000908152600a602052604090206001810154909250640100000000900460ff16611ed75783600160a060020a03166370a082313060006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b1515611eb757600080fd5b6102c65a03f11515611ec857600080fd5b50505060405180519050611eda565b81545b949350505050565b60035433600160a060020a03908116911614611efa57fe5b600354600160a060020a0382811691161415611f1557600080fd5b6004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6009805482908110610e2357fe5b60005433600160a060020a0390811691161480611f7d575060035433600160a060020a039081169116145b1515611f8857600080fd5b8060008163ffffffff1610158015611fb45750600b5463ffffffff640100000000909104811690821611155b1515611fbf57600080fd5b600b547f81cd2ffb37dd237c0e4e2a3de5265fcf9deb43d3e7801e80db9f1ccfba7ee6009068010000000000000000900463ffffffff168360405163ffffffff9283168152911660208201526040908101905180910390a150600b805463ffffffff90921668010000000000000000026bffffffff000000000000000019909216919091179055565b600061ffff821615156120675750600254600160a060020a03166111db565b6008805461ffff60001985011690811061207d57fe5b600091825260209091200154600160a060020a031692915050565b60005433600160a060020a039081169116146120b057fe5b600054600160a060020a03828116911614156120cb57600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600254600160a060020a031681565b60008282018381101561188857fe5b6002546000908190819081908190600160a060020a033081169116638da5cb5b83604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561216e57600080fd5b6102c65a03f1151561217f57600080fd5b50505060405180519050600160a060020a031614151561219b57fe5b600160a060020a0388166000908152600a602052604090206001015488906601000000000000900460ff1615156121d157600080fd5b86600081116121df57600080fd5b600160a060020a038a166000908152600a6020526040902095506122028a611df9565b600754909550600160a060020a0316634b75f54f6000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561224d57600080fd5b6102c65a03f1151561225e57600080fd5b50505060405180516001880154600160a060020a0390911691506349f9b0f7908a90889063ffffffff168d6000604051602001526040518563ffffffff1660e060020a028152600401808581526020018481526020018363ffffffff1663ffffffff168152602001828152602001945050505050602060405180830381600087803b15156122eb57600080fd5b6102c65a03f115156122fc57600080fd5b505050604051805190509350612311846111a6565b925061231d8484612794565b9a9950505050505050505050565b6000806000600b600c9054906101000a900460ff16151561234857fe5b836000811161235657600080fd5b6123608787611a46565b925082158015906123715750848310155b151561237c57600080fd5b600160a060020a0387166000908152600a602052604090206001810154909250640100000000900460ff16156123bb5781546123b89087612109565b82555b86600160a060020a03166323b872dd33308960006040516020015260405160e060020a63ffffffff8616028152600160a060020a0393841660048201529190921660248201526044810191909152606401602060405180830381600087803b151561242557600080fd5b6102c65a03f1151561243657600080fd5b50505060405180519050151561244857fe5b600254600160a060020a031663867904b4338560405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b151561249e57600080fd5b6102c65a03f115156124af57600080fd5b5050506124bf87878560016127a6565b509095945050505050565b6000806000806000600b600c9054906101000a900460ff1615156124ea57fe5b85600081116124f857600080fd5b600254600160a060020a03166370a082313360006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561255157600080fd5b6102c65a03f1151561256257600080fd5b5050506040518051891115905061257857600080fd5b6125828989611816565b945084158015906125935750868510155b151561259e57600080fd5b600254600160a060020a03166318160ddd6000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156125e657600080fd5b6102c65a03f115156125f757600080fd5b50505060405180519050935061260c89611df9565b9250828510806126255750828514801561262557508388145b151561262d57fe5b600160a060020a0389166000908152600a602052604090206001810154909250640100000000900460ff161561266c5781546126699086612794565b82555b600254600160a060020a031663a24835d1338a60405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b15156126c257600080fd5b6102c65a03f115156126d357600080fd5b50505088600160a060020a031663a9059cbb338760006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561273357600080fd5b6102c65a03f1151561274457600080fd5b50505060405180519050151561275657fe5b61276389898760006127a6565b5092979650505050505050565b600082820283158061278c575082848281151561278957fe5b04145b151561188857fe5b6000818310156127a057fe5b50900390565b600160a060020a0384166000908152600a6020526040812090808080806127d86127cf8b611df9565b620f4240612770565b60025490955061285390600160a060020a03166318160ddd6000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561282757600080fd5b6102c65a03f1151561283857600080fd5b5050506040518051600189015490915063ffffffff16612770565b600254909450600160a060020a031663313ce5676000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561289e57600080fd5b6102c65a03f115156128af57600080fd5b5050506040518051935050600160a060020a038a1663313ce5676000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561290057600080fd5b6102c65a03f1151561291157600080fd5b505050604051805192505060ff83811690831614612965578160ff168360ff161115612950576129498583850360ff16600a0a612770565b9450612965565b6129628484840360ff16600a0a612770565b93505b61296e886111a6565b90507f800000000000000000000000000000000000000000000000000000000000000081111561299a57fe5b8615612a1057600254600160a060020a03338116918116908c167fcee13e282037fd063de72c4cf7955988112510b046cda38c12c47862c1785e7b8c8c868b8b604051808681526020018581526020018481526020018381526020018281526020019550505050505060405180910390a4612a7c565b600254600160a060020a03338116918c821691167fcee13e282037fd063de72c4cf7955988112510b046cda38c12c47862c1785e7b8c8c868a8c604051808681526020018581526020018481526020018381526020018281526020019550505050505060405180910390a45b50505050505050505050565b81548183558181151161124857600083815260209020611248918101908301612b20565b828054828255906000526020600020908101928215612b10579160200282015b82811115612b10578251825473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039190911617825560209290920191600190910190612acc565b50612b1c929150612b3a565b5090565b61181391905b80821115612b1c5760008155600101612b26565b61181391905b80821115612b1c57805473ffffffffffffffffffffffffffffffffffffffff19168155600101612b405600a165627a7a7230582093df7b0c26474239938a888006378c7981dcccb76280bec42779f81d5f5f9e150029
Swarm Source
bzzr://93df7b0c26474239938a888006378c7981dcccb76280bec42779f81d5f5f9e15
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.