ETH Price: $2,497.32 (-2.25%)

Contract

0xc7251bb5C96cF034213b9eD82Fc964eD78E97F0c
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Destroy72531502019-02-22 13:00:402071 days ago1550840440IN
0xc7251bb5...D78E97F0c
0 ETH0.0001348610
Set Price72524542019-02-22 9:03:422071 days ago1550826222IN
0xc7251bb5...D78E97F0c
0 ETH0.0003941514.3
Set Price72522902019-02-22 8:03:282071 days ago1550822608IN
0xc7251bb5...D78E97F0c
0 ETH0.0003031911
Set Price72521062019-02-22 7:01:182071 days ago1550818878IN
0xc7251bb5...D78E97F0c
0 ETH0.00026689.68
Set Price72519312019-02-22 6:00:512071 days ago1550815251IN
0xc7251bb5...D78E97F0c
0 ETH0.00026689.68
Set Price72517352019-02-22 5:00:462072 days ago1550811646IN
0xc7251bb5...D78E97F0c
0 ETH0.000181916.6
Set Price72515592019-02-22 4:00:352072 days ago1550808035IN
0xc7251bb5...D78E97F0c
0 ETH0.000181916.6
Set Price72514012019-02-22 3:01:062072 days ago1550804466IN
0xc7251bb5...D78E97F0c
0 ETH0.000151595.5
Set Price72512092019-02-22 2:00:462072 days ago1550800846IN
0xc7251bb5...D78E97F0c
0 ETH0.000160695.83
Set Price72510422019-02-22 1:00:422072 days ago1550797242IN
0xc7251bb5...D78E97F0c
0 ETH0.000151595.5
Set Price72508592019-02-22 0:03:262072 days ago1550793806IN
0xc7251bb5...D78E97F0c
0 ETH0.000151595.5
Set Price72506762019-02-21 23:00:122072 days ago1550790012IN
0xc7251bb5...D78E97F0c
0 ETH0.000166756.05
Set Price72505212019-02-21 22:02:132072 days ago1550786533IN
0xc7251bb5...D78E97F0c
0 ETH0.000160695.83
Set Price72503522019-02-21 21:00:232072 days ago1550782823IN
0xc7251bb5...D78E97F0c
0 ETH0.000151595.5
Set Price72501522019-02-21 20:00:312072 days ago1550779231IN
0xc7251bb5...D78E97F0c
0 ETH0.000151595.5
Set Price72499612019-02-21 19:00:092072 days ago1550775609IN
0xc7251bb5...D78E97F0c
0 ETH0.000181916.6
Set Price72497922019-02-21 18:01:242072 days ago1550772084IN
0xc7251bb5...D78E97F0c
0 ETH0.000181916.6
Set Price72496102019-02-21 17:00:182072 days ago1550768418IN
0xc7251bb5...D78E97F0c
0 ETH0.000151595.5
Set Price72494122019-02-21 15:59:402072 days ago1550764780IN
0xc7251bb5...D78E97F0c
0 ETH0.000151595.5
Set Price72492412019-02-21 14:58:532072 days ago1550761133IN
0xc7251bb5...D78E97F0c
0 ETH0.0004244715.4
Set Price72490902019-02-21 14:09:152072 days ago1550758155IN
0xc7251bb5...D78E97F0c
0 ETH0.000181916.6
Set Price72489022019-02-21 13:00:492072 days ago1550754049IN
0xc7251bb5...D78E97F0c
0 ETH0.000242558.8
Set Price72487292019-02-21 11:58:412072 days ago1550750321IN
0xc7251bb5...D78E97F0c
0 ETH0.000242558.8
Set Price72485532019-02-21 10:58:402072 days ago1550746720IN
0xc7251bb5...D78E97F0c
0 ETH0.0004002114.52
Set Price72483722019-02-21 9:58:532072 days ago1550743133IN
0xc7251bb5...D78E97F0c
0 ETH0.0003941514.3
View all transactions

Latest 16 internal transactions

Advanced mode:
Parent Transaction Hash Block From To
72531502019-02-22 13:00:402071 days ago1550840440
0xc7251bb5...D78E97F0c
0 ETH
72271822019-02-16 9:41:512077 days ago1550310111
0xc7251bb5...D78E97F0c
67.24866736 ETH
72057912019-02-11 7:15:192082 days ago1549869319
0xc7251bb5...D78E97F0c
31.54105598 ETH
72057912019-02-11 7:15:192082 days ago1549869319
0xc7251bb5...D78E97F0c
0.48032064 ETH
69473902018-12-25 1:04:492131 days ago1545699889
0xc7251bb5...D78E97F0c
0.71763812 ETH
69473902018-12-25 1:04:492131 days ago1545699889
0xc7251bb5...D78E97F0c
0.01092849 ETH
68421422018-12-07 10:40:522148 days ago1544179252
0xc7251bb5...D78E97F0c
2.6548836 ETH
68421422018-12-07 10:40:522148 days ago1544179252
0xc7251bb5...D78E97F0c
0.04042969 ETH
67679792018-11-25 4:22:202161 days ago1543119740
0xc7251bb5...D78E97F0c
4.36966477 ETH
67679792018-11-25 4:22:202161 days ago1543119740
0xc7251bb5...D78E97F0c
0.06654311 ETH
65490642018-10-20 7:56:462196 days ago1540022206
0xc7251bb5...D78E97F0c
8.13189101 ETH
65490642018-10-20 7:56:462196 days ago1540022206
0xc7251bb5...D78E97F0c
0.1238359 ETH
65196052018-10-15 12:15:422201 days ago1539605742
0xc7251bb5...D78E97F0c
10.99440059 ETH
65196052018-10-15 12:15:422201 days ago1539605742
0xc7251bb5...D78E97F0c
0.16742742 ETH
65062882018-10-13 8:27:502203 days ago1539419270
0xc7251bb5...D78E97F0c
9.92301173 ETH
65062882018-10-13 8:27:502203 days ago1539419270
0xc7251bb5...D78E97F0c
0.15111185 ETH
Loading...
Loading
Contract Self Destruct called at Txn Hash 0x300953010e64527a166e88e9bcfa649b9ef2d9a914e5fb998691859c9af23809


Contract Source Code Verified (Exact Match)

Contract Name:
ATxBuyback

Compiler Version
v0.4.19+commit.c4cbbb05

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2018-10-01
*/

pragma solidity ^0.4.18;

/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a * b;
        assert(a == 0 || c / a == b);
        return c;
    }

    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        // assert(b > 0); // Solidity automatically throws when dividing by 0
        uint256 c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold
        return c;
    }

    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        assert(b <= a);
        return a - b;
    }

    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        assert(c >= a);
        return c;
    }
}

/// @title ServiceAllowance.
///
/// Provides a way to delegate operation allowance decision to a service contract
contract ServiceAllowance {
    function isTransferAllowed(address _from, address _to, address _sender, address _token, uint _value) public view returns (bool);
}

contract ATxPlatformInterface {
    mapping(bytes32 => address) public proxies;
    function name(bytes32 _symbol) public view returns (string);
    function setProxy(address _address, bytes32 _symbol) public returns (uint errorCode);
    function isOwner(address _owner, bytes32 _symbol) public view returns (bool);
    function totalSupply(bytes32 _symbol) public view returns (uint);
    function balanceOf(address _holder, bytes32 _symbol) public view returns (uint);
    function allowance(address _from, address _spender, bytes32 _symbol) public view returns (uint);
    function baseUnit(bytes32 _symbol) public view returns (uint8);
    function proxyTransferWithReference(address _to, uint _value, bytes32 _symbol, string _reference, address _sender) public returns (uint errorCode);
    function proxyTransferFromWithReference(address _from, address _to, uint _value, bytes32 _symbol, string _reference, address _sender) public returns (uint errorCode);
    function proxyApprove(address _spender, uint _value, bytes32 _symbol, address _sender) public returns (uint errorCode);
    function issueAsset(bytes32 _symbol, uint _value, string _name, string _description, uint8 _baseUnit, bool _isReissuable) public returns (uint errorCode);
    function reissueAsset(bytes32 _symbol, uint _value) public returns (uint errorCode);
    function revokeAsset(bytes32 _symbol, uint _value) public returns (uint errorCode);
    function isReissuable(bytes32 _symbol) public view returns (bool);
    function changeOwnership(bytes32 _symbol, address _newOwner) public returns (uint errorCode);
}

/**
 * @title Owned contract with safe ownership pass.
 *
 * Note: all the non constant functions return false instead of throwing in case if state change
 * didn't happen yet.
 */
contract Owned {
    /**
     * Contract owner address
     */
    address public contractOwner;

    /**
     * Contract owner address
     */
    address public pendingContractOwner;

    function Owned() {
        contractOwner = msg.sender;
    }

    /**
    * @dev Owner check modifier
    */
    modifier onlyContractOwner() {
        if (contractOwner == msg.sender) {
            _;
        }
    }

    /**
     * @dev Destroy contract and scrub a data
     * @notice Only owner can call it
     */
    function destroy() onlyContractOwner {
        suicide(msg.sender);
    }

    /**
     * Prepares ownership pass.
     *
     * Can only be called by current owner.
     *
     * @param _to address of the next owner. 0x0 is not allowed.
     *
     * @return success.
     */
    function changeContractOwnership(address _to) onlyContractOwner() returns(bool) {
        if (_to  == 0x0) {
            return false;
        }

        pendingContractOwner = _to;
        return true;
    }

    /**
     * Finalize ownership pass.
     *
     * Can only be called by pending owner.
     *
     * @return success.
     */
    function claimContractOwnership() returns(bool) {
        if (pendingContractOwner != msg.sender) {
            return false;
        }

        contractOwner = pendingContractOwner;
        delete pendingContractOwner;

        return true;
    }
}

contract ERC20Interface {
    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(address indexed from, address indexed spender, uint256 value);
    string public symbol;

    function totalSupply() constant returns (uint256 supply);
    function balanceOf(address _owner) constant returns (uint256 balance);
    function transfer(address _to, uint256 _value) returns (bool success);
    function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
    function approve(address _spender, uint256 _value) returns (bool success);
    function allowance(address _owner, address _spender) constant returns (uint256 remaining);
}

/**
 * @title Generic owned destroyable contract
 */
contract Object is Owned {
    /**
    *  Common result code. Means everything is fine.
    */
    uint constant OK = 1;
    uint constant OWNED_ACCESS_DENIED_ONLY_CONTRACT_OWNER = 8;

    function withdrawnTokens(address[] tokens, address _to) onlyContractOwner returns(uint) {
        for(uint i=0;i<tokens.length;i++) {
            address token = tokens[i];
            uint balance = ERC20Interface(token).balanceOf(this);
            if(balance != 0)
                ERC20Interface(token).transfer(_to,balance);
        }
        return OK;
    }

    function checkOnlyContractOwner() internal constant returns(uint) {
        if (contractOwner == msg.sender) {
            return OK;
        }

        return OWNED_ACCESS_DENIED_ONLY_CONTRACT_OWNER;
    }
}

/// @title Provides possibility manage holders? country limits and limits for holders.
contract DataControllerInterface {

    /// @notice Checks user is holder.
    /// @param _address - checking address.
    /// @return `true` if _address is registered holder, `false` otherwise.
    function isHolderAddress(address _address) public view returns (bool);

    function allowance(address _user) public view returns (uint);

    function changeAllowance(address _holder, uint _value) public returns (uint);
}

/// @title ServiceController
///
/// Base implementation
/// Serves for managing service instances
contract ServiceControllerInterface {

    /// @notice Check target address is service
    /// @param _address target address
    /// @return `true` when an address is a service, `false` otherwise
    function isService(address _address) public view returns (bool);
}

contract ATxAssetInterface {

    DataControllerInterface public dataController;
    ServiceControllerInterface public serviceController;

    function __transferWithReference(address _to, uint _value, string _reference, address _sender) public returns (bool);
    function __transferFromWithReference(address _from, address _to, uint _value, string _reference, address _sender) public returns (bool);
    function __approve(address _spender, uint _value, address _sender) public returns (bool);
    function __process(bytes /*_data*/, address /*_sender*/) payable public {
        revert();
    }
}

contract ERC20 {
    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(address indexed from, address indexed spender, uint256 value);
    string public symbol;

    function totalSupply() constant returns (uint256 supply);
    function balanceOf(address _owner) constant returns (uint256 balance);
    function transfer(address _to, uint256 _value) returns (bool success);
    function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
    function approve(address _spender, uint256 _value) returns (bool success);
    function allowance(address _owner, address _spender) constant returns (uint256 remaining);
}

contract Platform {
    mapping(bytes32 => address) public proxies;
    function name(bytes32 _symbol) public view returns (string);
    function setProxy(address _address, bytes32 _symbol) public returns (uint errorCode);
    function isOwner(address _owner, bytes32 _symbol) public view returns (bool);
    function totalSupply(bytes32 _symbol) public view returns (uint);
    function balanceOf(address _holder, bytes32 _symbol) public view returns (uint);
    function allowance(address _from, address _spender, bytes32 _symbol) public view returns (uint);
    function baseUnit(bytes32 _symbol) public view returns (uint8);
    function proxyTransferWithReference(address _to, uint _value, bytes32 _symbol, string _reference, address _sender) public returns (uint errorCode);
    function proxyTransferFromWithReference(address _from, address _to, uint _value, bytes32 _symbol, string _reference, address _sender) public returns (uint errorCode);
    function proxyApprove(address _spender, uint _value, bytes32 _symbol, address _sender) public returns (uint errorCode);
    function issueAsset(bytes32 _symbol, uint _value, string _name, string _description, uint8 _baseUnit, bool _isReissuable) public returns (uint errorCode);
    function reissueAsset(bytes32 _symbol, uint _value) public returns (uint errorCode);
    function revokeAsset(bytes32 _symbol, uint _value) public returns (uint errorCode);
    function isReissuable(bytes32 _symbol) public view returns (bool);
    function changeOwnership(bytes32 _symbol, address _newOwner) public returns (uint errorCode);
}

contract ATxAssetProxy is ERC20, Object, ServiceAllowance {

    using SafeMath for uint;

    /**
     * Indicates an upgrade freeze-time start, and the next asset implementation contract.
     */
    event UpgradeProposal(address newVersion);

    // Current asset implementation contract address.
    address latestVersion;

    // Assigned platform, immutable.
    Platform public platform;

    // Assigned symbol, immutable.
    bytes32 public smbl;

    // Assigned name, immutable.
    string public name;

    /**
     * Only platform is allowed to call.
     */
    modifier onlyPlatform() {
        if (msg.sender == address(platform)) {
            _;
        }
    }

    /**
     * Only current asset owner is allowed to call.
     */
    modifier onlyAssetOwner() {
        if (platform.isOwner(msg.sender, smbl)) {
            _;
        }
    }

    /**
     * Only asset implementation contract assigned to sender is allowed to call.
     */
    modifier onlyAccess(address _sender) {
        if (getLatestVersion() == msg.sender) {
            _;
        }
    }

    /**
     * Resolves asset implementation contract for the caller and forwards there transaction data,
     * along with the value. This allows for proxy interface growth.
     */
    function() public payable {
        _getAsset().__process.value(msg.value)(msg.data, msg.sender);
    }

    /**
     * Sets platform address, assigns symbol and name.
     *
     * Can be set only once.
     *
     * @param _platform platform contract address.
     * @param _symbol assigned symbol.
     * @param _name assigned name.
     *
     * @return success.
     */
    function init(Platform _platform, string _symbol, string _name) public returns (bool) {
        if (address(platform) != 0x0) {
            return false;
        }
        platform = _platform;
        symbol = _symbol;
        smbl = stringToBytes32(_symbol);
        name = _name;
        return true;
    }

    /**
     * Returns asset total supply.
     *
     * @return asset total supply.
     */
    function totalSupply() public view returns (uint) {
        return platform.totalSupply(smbl);
    }

    /**
     * Returns asset balance for a particular holder.
     *
     * @param _owner holder address.
     *
     * @return holder balance.
     */
    function balanceOf(address _owner) public view returns (uint) {
        return platform.balanceOf(_owner, smbl);
    }

    /**
     * Returns asset allowance from one holder to another.
     *
     * @param _from holder that allowed spending.
     * @param _spender holder that is allowed to spend.
     *
     * @return holder to spender allowance.
     */
    function allowance(address _from, address _spender) public view returns (uint) {
        return platform.allowance(_from, _spender, smbl);
    }

    /**
     * Returns asset decimals.
     *
     * @return asset decimals.
     */
    function decimals() public view returns (uint8) {
        return platform.baseUnit(smbl);
    }

    /**
     * Transfers asset balance from the caller to specified receiver.
     *
     * @param _to holder address to give to.
     * @param _value amount to transfer.
     *
     * @return success.
     */
    function transfer(address _to, uint _value) public returns (bool) {
        if (_to != 0x0) {
            return _transferWithReference(_to, _value, "");
        }
        else {
            return false;
        }
    }

    /**
     * Transfers asset balance from the caller to specified receiver adding specified comment.
     *
     * @param _to holder address to give to.
     * @param _value amount to transfer.
     * @param _reference transfer comment to be included in a platform's Transfer event.
     *
     * @return success.
     */
    function transferWithReference(address _to, uint _value, string _reference) public returns (bool) {
        if (_to != 0x0) {
            return _transferWithReference(_to, _value, _reference);
        }
        else {
            return false;
        }
    }

    /**
     * Performs transfer call on the platform by the name of specified sender.
     *
     * Can only be called by asset implementation contract assigned to sender.
     *
     * @param _to holder address to give to.
     * @param _value amount to transfer.
     * @param _reference transfer comment to be included in a platform's Transfer event.
     * @param _sender initial caller.
     *
     * @return success.
     */
    function __transferWithReference(address _to, uint _value, string _reference, address _sender) public onlyAccess(_sender) returns (bool) {
        return platform.proxyTransferWithReference(_to, _value, smbl, _reference, _sender) == OK;
    }

    /**
     * Prforms allowance transfer of asset balance between holders.
     *
     * @param _from holder address to take from.
     * @param _to holder address to give to.
     * @param _value amount to transfer.
     *
     * @return success.
     */
    function transferFrom(address _from, address _to, uint _value) public returns (bool) {
        if (_to != 0x0) {
            return _getAsset().__transferFromWithReference(_from, _to, _value, "", msg.sender);
        }
        else {
            return false;
        }
    }

    /**
     * Performs allowance transfer call on the platform by the name of specified sender.
     *
     * Can only be called by asset implementation contract assigned to sender.
     *
     * @param _from holder address to take from.
     * @param _to holder address to give to.
     * @param _value amount to transfer.
     * @param _reference transfer comment to be included in a platform's Transfer event.
     * @param _sender initial caller.
     *
     * @return success.
     */
    function __transferFromWithReference(address _from, address _to, uint _value, string _reference, address _sender) public onlyAccess(_sender) returns (bool) {
        return platform.proxyTransferFromWithReference(_from, _to, _value, smbl, _reference, _sender) == OK;
    }

    /**
     * Sets asset spending allowance for a specified spender.
     *
     * @param _spender holder address to set allowance to.
     * @param _value amount to allow.
     *
     * @return success.
     */
    function approve(address _spender, uint _value) public returns (bool) {
        if (_spender != 0x0) {
            return _getAsset().__approve(_spender, _value, msg.sender);
        }
        else {
            return false;
        }
    }

    /**
     * Performs allowance setting call on the platform by the name of specified sender.
     *
     * Can only be called by asset implementation contract assigned to sender.
     *
     * @param _spender holder address to set allowance to.
     * @param _value amount to allow.
     * @param _sender initial caller.
     *
     * @return success.
     */
    function __approve(address _spender, uint _value, address _sender) public onlyAccess(_sender) returns (bool) {
        return platform.proxyApprove(_spender, _value, smbl, _sender) == OK;
    }

    /**
     * Emits ERC20 Transfer event on this contract.
     *
     * Can only be, and, called by assigned platform when asset transfer happens.
     */
    function emitTransfer(address _from, address _to, uint _value) public onlyPlatform() {
        Transfer(_from, _to, _value);
    }

    /**
     * Emits ERC20 Approval event on this contract.
     *
     * Can only be, and, called by assigned platform when asset allowance set happens.
     */
    function emitApprove(address _from, address _spender, uint _value) public onlyPlatform() {
        Approval(_from, _spender, _value);
    }

    /**
     * Returns current asset implementation contract address.
     *
     * @return asset implementation contract address.
     */
    function getLatestVersion() public view returns (address) {
        return latestVersion;
    }

    /**
     * Propose next asset implementation contract address.
     *
     * Can only be called by current asset owner.
     *
     * Note: freeze-time should not be applied for the initial setup.
     *
     * @param _newVersion asset implementation contract address.
     *
     * @return success.
     */
    function proposeUpgrade(address _newVersion) public onlyAssetOwner returns (bool) {
        // New version address should be other than 0x0.
        if (_newVersion == 0x0) {
            return false;
        }
        
        latestVersion = _newVersion;

        UpgradeProposal(_newVersion); 
        return true;
    }

    function isTransferAllowed(address, address, address, address, uint) public view returns (bool) {
        return true;
    }

    /**
     * Returns asset implementation contract for current caller.
     *
     * @return asset implementation contract.
     */
    function _getAsset() internal view returns (ATxAssetInterface) {
        return ATxAssetInterface(getLatestVersion());
    }

    /**
     * Resolves asset implementation contract for the caller and forwards there arguments along with
     * the caller address.
     *
     * @return success.
     */
    function _transferWithReference(address _to, uint _value, string _reference) internal returns (bool) {
        return _getAsset().__transferWithReference(_to, _value, _reference, msg.sender);
    }

    function stringToBytes32(string memory source) private pure returns (bytes32 result) {
        assembly {
            result := mload(add(source, 32))
        }
    }
}

contract ATxBuybackInterface {

	event EtherReceived(uint amount);
	event TokenExchanged(
		address recepient, 
		address token, 
		uint tokenAmount, 
		uint etherAmount, 
		uint feeAmount, 
		address feeReceiver, 
		uint price
	);
}

/// @title Token Buyback contract.
/// @notice Plays role of token exchange to Ether.
/// Has only one token at a contract. To support other tokens
/// there should be created other ATxBuyback contracts.
contract ATxBuyback is Object, ATxBuybackInterface, ServiceAllowance {

	using SafeMath for uint;

    struct FeeData {
        uint feeValue;
        uint feeDecimals;
    }

	/// @dev Redemption fee collector address
	address public rdCollectorAddress;
	/// @dev Fee value
	FeeData rdFee;

	/// @dev Token to exchange.
	ATxAssetProxy public token;
	/// @dev Price for 1 token
	uint public price;
	/// @dev Active flag
	bool public active;

	/// @dev Guards from invocation only when state is active
	modifier onlyActive {
		if (active) {
			_;
		}
	}

	function ATxBuyback(ATxAssetProxy _token) public {
		require(address(_token) != 0x0);
		token = _token;
	}

	/// @notice Sets a price (in wei) for selling one token
	/// @param _price "in wei" = 1 ATx
	function setPrice(uint _price) onlyContractOwner external returns (uint) {
		price = _price;
		return OK;
	}

	/// @notice Sets contract to active/non active state.
	/// Should be performed only by contract owner.
	/// @param _active next state of contract. True to activate a contract
	/// @return result code of an operation
	function setActive(bool _active) onlyContractOwner external returns (uint) {
		if (active == _active) {
			return;
		}

        active = _active;
		return OK;
	}

	/// @notice Setup redemption destination address
	/// @param _collectorAddress address where all redemptiom fee will be directed
	/// @return result code of an operation
	function setRdCollectorAddress(address _collectorAddress) onlyContractOwner external returns (uint) {
		require(_collectorAddress != 0x0);
		
		rdCollectorAddress = _collectorAddress;
		return OK;
	}

	/// @notice Setup redemption fee value
	/// @param _feeValue fee amount; the minimal value is 1
	/// @param _feeDecimals fee decimals, sets a precision for fee value
	/// @return result code of an operation
	function setRdFee(uint _feeValue, uint _feeDecimals) onlyContractOwner external returns (uint) {
		require(_validFee(_feeValue, _feeDecimals));

		rdFee = FeeData(_feeValue, _feeDecimals);
		return OK;
	}

	/// @notice Gets redemption fee value
	/// @return {
	/// 	"_value": "amount of percents",
	///		"_decimals": "percent's precision"
	/// }
	function getRdFee() public view returns (uint _value, uint _decimals) {
		FeeData memory _fee = rdFee;
		return (_fee.feeValue, _fee.feeDecimals);
	}

	/// @notice Withdraws all Ether from buyback contract to specified address.
	/// Allowed only for contract owner.
	/// @param _to destination address to send Ether
	/// @return result code of an operation
	function withdrawAllEth(address _to) onlyContractOwner external returns (uint) {
		uint _balance = address(this).balance;
		if (_balance == 0) {
			return 0;
		}

		_to.transfer(_balance);

		return OK;
	}

	/// ServiceAllowance
    ///
    /// @notice ServiceAllowance interface implementation
    /// @dev Should cover conditions for allowance of transfers
    function isTransferAllowed(address, address _to, address, address _token, uint) onlyActive public view returns (bool) {
        if (_token == address(token) && _to == address(this)) {
            return true;
        }
    }

	/// @notice Fallback function for ERC223 standard.
	/// Allowed to work only in active state.
	/// @param _sender original sender of token transfer
	/// @param _value amount of tokens that has been sent
	function tokenFallback(address _sender, uint _value, bytes) external {
		/// Don't allow to transfer and exchange tokens when Buyback contract
		/// is not in 'active' state
		if (!active) {
			revert();
		}
		
		/// This call should be produced by AssetProxy's backend - an Asset contract.
		/// Any other call will be followed by revert()
		ATxAssetProxy _token = token;
		if (msg.sender != _token.getLatestVersion()) {
			revert();
		}

		/// Need to check available ETH balance in order to fulfill holder's request
		/// about exchanging ATx Token to ETH equivalent
		uint _etherToExchange = _value.mul(price) / (10 ** uint(_token.decimals()));
		if (this.balance < _etherToExchange) {
			revert();
		}

		/// To prevent double spending we revoke transferred assets from foundation platform,
		ATxPlatformInterface _platform = ATxPlatformInterface(address(_token.platform()));
		require(OK == _platform.revokeAsset(_token.smbl(), _value));

		/// Take redemption fee and return left amount of Ether to transfer it to a holder
		uint _restEther = _takeRdFee(_etherToExchange);
		/// Transfer the rest to holder's account
		_sender.transfer(_restEther);

		/// Voila! Just emit the event to say to the world that one more exchange action was finished
		TokenExchanged(_sender, _token, _value, _restEther, _etherToExchange.sub(_restEther), rdCollectorAddress, price);
	}

	/// @notice Accepts Ether and emits EtherReceived event
	function() payable external {
		if (msg.value > 0) {
			EtherReceived(msg.value);
		}
	}

	/* Internal */

	function _takeRdFee(uint _fromValue) private returns (uint _restValue) {
		/// Here we check if redemption fee was setup after the contract initialization
		FeeData memory _fee = rdFee;
		require(_validFee(_fee.feeValue, _fee.feeDecimals));

		/// Calculate amount of redemption fee that we have to take from the whole sum
		uint _rdFeeEther;
		_rdFeeEther = _fromValue.mul(_fee.feeValue).div(10 ** _fee.feeDecimals);
		_restValue = _fromValue.sub(_rdFeeEther);

		/// At first use method collector.transfer() to ensure that if this move is not possible
		/// then revert all changes
		address _rdCollectorAddress = rdCollectorAddress;
		require(_rdCollectorAddress != 0x0);
		_rdCollectorAddress.transfer(_rdFeeEther);
	}

	function _validFee(uint _value, uint _decimals) private pure returns (bool) {
        return _value != 0 && _value / 10 ** _decimals.sub(1) >= 0 && _value / 10 ** _decimals.sub(1) < 10;
    }
}

Contract Security Audit

Contract ABI

[{"constant":true,"inputs":[],"name":"active","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getRdFee","outputs":[{"name":"_value","type":"uint256"},{"name":"_decimals","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"claimContractOwnership","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"}],"name":"changeContractOwnership","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"pendingContractOwner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_collectorAddress","type":"address"}],"name":"setRdCollectorAddress","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"destroy","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_price","type":"uint256"}],"name":"setPrice","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"price","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_active","type":"bool"}],"name":"setActive","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_feeValue","type":"uint256"},{"name":"_feeDecimals","type":"uint256"}],"name":"setRdFee","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_sender","type":"address"},{"name":"_value","type":"uint256"},{"name":"","type":"bytes"}],"name":"tokenFallback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"rdCollectorAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"_to","type":"address"},{"name":"","type":"address"},{"name":"_token","type":"address"},{"name":"","type":"uint256"}],"name":"isTransferAllowed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"contractOwner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"}],"name":"withdrawAllEth","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"tokens","type":"address[]"},{"name":"_to","type":"address"}],"name":"withdrawnTokens","outputs":[{"name":"","type":"uint256"}],"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"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"}],"name":"EtherReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"recepient","type":"address"},{"indexed":false,"name":"token","type":"address"},{"indexed":false,"name":"tokenAmount","type":"uint256"},{"indexed":false,"name":"etherAmount","type":"uint256"},{"indexed":false,"name":"feeAmount","type":"uint256"},{"indexed":false,"name":"feeReceiver","type":"address"},{"indexed":false,"name":"price","type":"uint256"}],"name":"TokenExchanged","type":"event"}]

6060604052341561000f57600080fd5b604051602080610db58339810160405280805160008054600160a060020a03191633600160a060020a039081169190911790915590925082161515905061005557600080fd5b60058054600160a060020a031916600160a060020a0392909216919091179055610d31806100846000396000f3006060604052600436106100e25763ffffffff60e060020a60003504166302fb0c5e811461012157806308ee33af146101485780634592cd1d14610173578063557f4bc9146101865780635aa77d3c146101a557806375ace438146101d457806383197ef01461020557806391b7f5ed14610218578063a035b1fe1461022e578063acec338a14610241578063c03bdbae14610259578063c0ee0b8a14610272578063c270ce28146102a1578063c32ee591146102b4578063ce606ee0146102e8578063d46d79bb146102fb578063d8f9659b1461031a578063fc0c546a14610374575b600034111561011f577f0a34e3d4f1e6b837dbce1011b61499fa1a483a0abee6a7a6697660b4b2d971323460405190815260200160405180910390a15b005b341561012c57600080fd5b610134610387565b604051901515815260200160405180910390f35b341561015357600080fd5b61015b610390565b60405191825260208201526040908101905180910390f35b341561017e57600080fd5b6101346103c8565b341561019157600080fd5b610134600160a060020a0360043516610420565b34156101b057600080fd5b6101b861047f565b604051600160a060020a03909116815260200160405180910390f35b34156101df57600080fd5b6101f3600160a060020a036004351661048e565b60405190815260200160405180910390f35b341561021057600080fd5b61011f6104ed565b341561022357600080fd5b6101f3600435610512565b341561023957600080fd5b6101f3610533565b341561024c57600080fd5b6101f36004351515610539565b341561026457600080fd5b6101f360043560243561057e565b341561027d57600080fd5b61011f60048035600160a060020a03169060248035916044359182019101356105da565b34156102ac57600080fd5b6101b861092f565b34156102bf57600080fd5b610134600160a060020a036004358116906024358116906044358116906064351660843561093e565b34156102f357600080fd5b6101b861098c565b341561030657600080fd5b6101f3600160a060020a036004351661099b565b341561032557600080fd5b6101f3600460248135818101908301358060208181020160405190810160405280939291908181526020018383602002808284375094965050509235600160a060020a03169250610a0d915050565b341561037f57600080fd5b6101b8610b5c565b60075460ff1681565b60008061039b610cee565b60036040805190810160405281548152600190910154602082015290508051816020015192509250509091565b60015460009033600160a060020a039081169116146103e95750600061041d565b50600180546000805473ffffffffffffffffffffffffffffffffffffffff19908116600160a060020a038416179091551681555b90565b6000805433600160a060020a039081169116141561047a57600160a060020a03821615156104505750600061047a565b506001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161781555b919050565b600154600160a060020a031681565b6000805433600160a060020a039081169116141561047a57600160a060020a03821615156104bb57600080fd5b5060028054600160a060020a03831673ffffffffffffffffffffffffffffffffffffffff199091161790556001919050565b60005433600160a060020a03908116911614156105105733600160a060020a0316ff5b565b6000805433600160a060020a039081169116141561047a5750600655600190565b60065481565b6000805433600160a060020a039081169116141561047a5760075460ff16151582151514156105675761047a565b506007805460ff1916911515919091179055600190565b6000805433600160a060020a03908116911614156105d4576105a08383610b6b565b15156105ab57600080fd5b604080519081016040528381526020810183905260038151815560208201516001918201559150505b92915050565b60075460009081908190819060ff1615156105f457600080fd5b600554600160a060020a0316935083630e6d1de96000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561063f57600080fd5b6102c65a03f1151561065057600080fd5b50505060405180519050600160a060020a031633600160a060020a031614151561067957600080fd5b83600160a060020a031663313ce5676000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156106bf57600080fd5b6102c65a03f115156106d057600080fd5b5050506040518051905060ff16600a0a6106f560065489610bcc90919063ffffffff16565b8115156106fe57fe5b0492508230600160a060020a031631101561071857600080fd5b83600160a060020a0316634bde38c86000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561075e57600080fd5b6102c65a03f1151561076f57600080fd5b50505060405180519050915081600160a060020a031663ca448a8885600160a060020a031663cb4e75bb6000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156107d057600080fd5b6102c65a03f115156107e157600080fd5b505050604051805190508960006040516020015260405160e060020a63ffffffff851602815260048101929092526024820152604401602060405180830381600087803b151561083057600080fd5b6102c65a03f1151561084157600080fd5b5050506040518051600114905061085757600080fd5b61086083610bf0565b9050600160a060020a03881681156108fc0282604051600060405180830381858888f19350505050151561089357600080fd5b7fbf7cd8c76679a5af7e65803ef600bcf955fbbaf7972de3861a1f848b3a50159f888589846108c8888263ffffffff610cc516565b600254600654600160a060020a0390911690604051600160a060020a03978816815295871660208701526040808701959095526060860193909352608085019190915290931660a083015260c082019290925260e001905180910390a15050505050505050565b600254600160a060020a031681565b60075460009060ff161561098357600554600160a060020a03848116911614801561097a575030600160a060020a031685600160a060020a0316145b15610983575060015b95945050505050565b600054600160a060020a031681565b60008054819033600160a060020a0390811691161415610a075750600160a060020a033016318015156109d15760009150610a07565b600160a060020a03831681156108fc0282604051600060405180830381858888f193505050501515610a0257600080fd5b600191505b50919050565b6000805481908190819033600160a060020a0390811691161415610b5357600092505b8551831015610b4e57858381518110610a4557fe5b90602001906020020151915081600160a060020a03166370a082313060006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b1515610aa857600080fd5b6102c65a03f11515610ab957600080fd5b50505060405180519150508015610b435781600160a060020a031663a9059cbb868360006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515610b2757600080fd5b6102c65a03f11515610b3857600080fd5b505050604051805150505b600190920191610a30565b600193505b50505092915050565b600554600160a060020a031681565b60008215801590610b9b57506000610b8a83600163ffffffff610cc516565b600a0a84811515610b9757fe5b0410155b8015610bc55750600a610bb583600163ffffffff610cc516565b600a0a84811515610bc257fe5b04105b9392505050565b6000828202831580610be85750828482811515610be557fe5b04145b1515610bc557fe5b6000610bfa610cee565b6000806003604080519081016040528154815260019091015460208201529250610c2983518460200151610b6b565b1515610c3457600080fd5b610c5d8360200151600a0a610c518551889063ffffffff610bcc16565b9063ffffffff610cd716565b9150610c6f858363ffffffff610cc516565b600254909450600160a060020a03169050801515610c8c57600080fd5b600160a060020a03811682156108fc0283604051600060405180830381858888f193505050501515610cbd57600080fd5b505050919050565b600082821115610cd157fe5b50900390565b6000808284811515610ce557fe5b04949350505050565b6040805190810160405260008082526020820152905600a165627a7a723058201caf712d4583d3b389f5b00267b046d3cd6c57ec5de7d0c1f92440131e01d51f0029000000000000000000000000a668a4148f348f3fc8d1f614232742e4da641ac3

Deployed Bytecode

0x6060604052600436106100e25763ffffffff60e060020a60003504166302fb0c5e811461012157806308ee33af146101485780634592cd1d14610173578063557f4bc9146101865780635aa77d3c146101a557806375ace438146101d457806383197ef01461020557806391b7f5ed14610218578063a035b1fe1461022e578063acec338a14610241578063c03bdbae14610259578063c0ee0b8a14610272578063c270ce28146102a1578063c32ee591146102b4578063ce606ee0146102e8578063d46d79bb146102fb578063d8f9659b1461031a578063fc0c546a14610374575b600034111561011f577f0a34e3d4f1e6b837dbce1011b61499fa1a483a0abee6a7a6697660b4b2d971323460405190815260200160405180910390a15b005b341561012c57600080fd5b610134610387565b604051901515815260200160405180910390f35b341561015357600080fd5b61015b610390565b60405191825260208201526040908101905180910390f35b341561017e57600080fd5b6101346103c8565b341561019157600080fd5b610134600160a060020a0360043516610420565b34156101b057600080fd5b6101b861047f565b604051600160a060020a03909116815260200160405180910390f35b34156101df57600080fd5b6101f3600160a060020a036004351661048e565b60405190815260200160405180910390f35b341561021057600080fd5b61011f6104ed565b341561022357600080fd5b6101f3600435610512565b341561023957600080fd5b6101f3610533565b341561024c57600080fd5b6101f36004351515610539565b341561026457600080fd5b6101f360043560243561057e565b341561027d57600080fd5b61011f60048035600160a060020a03169060248035916044359182019101356105da565b34156102ac57600080fd5b6101b861092f565b34156102bf57600080fd5b610134600160a060020a036004358116906024358116906044358116906064351660843561093e565b34156102f357600080fd5b6101b861098c565b341561030657600080fd5b6101f3600160a060020a036004351661099b565b341561032557600080fd5b6101f3600460248135818101908301358060208181020160405190810160405280939291908181526020018383602002808284375094965050509235600160a060020a03169250610a0d915050565b341561037f57600080fd5b6101b8610b5c565b60075460ff1681565b60008061039b610cee565b60036040805190810160405281548152600190910154602082015290508051816020015192509250509091565b60015460009033600160a060020a039081169116146103e95750600061041d565b50600180546000805473ffffffffffffffffffffffffffffffffffffffff19908116600160a060020a038416179091551681555b90565b6000805433600160a060020a039081169116141561047a57600160a060020a03821615156104505750600061047a565b506001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161781555b919050565b600154600160a060020a031681565b6000805433600160a060020a039081169116141561047a57600160a060020a03821615156104bb57600080fd5b5060028054600160a060020a03831673ffffffffffffffffffffffffffffffffffffffff199091161790556001919050565b60005433600160a060020a03908116911614156105105733600160a060020a0316ff5b565b6000805433600160a060020a039081169116141561047a5750600655600190565b60065481565b6000805433600160a060020a039081169116141561047a5760075460ff16151582151514156105675761047a565b506007805460ff1916911515919091179055600190565b6000805433600160a060020a03908116911614156105d4576105a08383610b6b565b15156105ab57600080fd5b604080519081016040528381526020810183905260038151815560208201516001918201559150505b92915050565b60075460009081908190819060ff1615156105f457600080fd5b600554600160a060020a0316935083630e6d1de96000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561063f57600080fd5b6102c65a03f1151561065057600080fd5b50505060405180519050600160a060020a031633600160a060020a031614151561067957600080fd5b83600160a060020a031663313ce5676000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156106bf57600080fd5b6102c65a03f115156106d057600080fd5b5050506040518051905060ff16600a0a6106f560065489610bcc90919063ffffffff16565b8115156106fe57fe5b0492508230600160a060020a031631101561071857600080fd5b83600160a060020a0316634bde38c86000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561075e57600080fd5b6102c65a03f1151561076f57600080fd5b50505060405180519050915081600160a060020a031663ca448a8885600160a060020a031663cb4e75bb6000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156107d057600080fd5b6102c65a03f115156107e157600080fd5b505050604051805190508960006040516020015260405160e060020a63ffffffff851602815260048101929092526024820152604401602060405180830381600087803b151561083057600080fd5b6102c65a03f1151561084157600080fd5b5050506040518051600114905061085757600080fd5b61086083610bf0565b9050600160a060020a03881681156108fc0282604051600060405180830381858888f19350505050151561089357600080fd5b7fbf7cd8c76679a5af7e65803ef600bcf955fbbaf7972de3861a1f848b3a50159f888589846108c8888263ffffffff610cc516565b600254600654600160a060020a0390911690604051600160a060020a03978816815295871660208701526040808701959095526060860193909352608085019190915290931660a083015260c082019290925260e001905180910390a15050505050505050565b600254600160a060020a031681565b60075460009060ff161561098357600554600160a060020a03848116911614801561097a575030600160a060020a031685600160a060020a0316145b15610983575060015b95945050505050565b600054600160a060020a031681565b60008054819033600160a060020a0390811691161415610a075750600160a060020a033016318015156109d15760009150610a07565b600160a060020a03831681156108fc0282604051600060405180830381858888f193505050501515610a0257600080fd5b600191505b50919050565b6000805481908190819033600160a060020a0390811691161415610b5357600092505b8551831015610b4e57858381518110610a4557fe5b90602001906020020151915081600160a060020a03166370a082313060006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b1515610aa857600080fd5b6102c65a03f11515610ab957600080fd5b50505060405180519150508015610b435781600160a060020a031663a9059cbb868360006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515610b2757600080fd5b6102c65a03f11515610b3857600080fd5b505050604051805150505b600190920191610a30565b600193505b50505092915050565b600554600160a060020a031681565b60008215801590610b9b57506000610b8a83600163ffffffff610cc516565b600a0a84811515610b9757fe5b0410155b8015610bc55750600a610bb583600163ffffffff610cc516565b600a0a84811515610bc257fe5b04105b9392505050565b6000828202831580610be85750828482811515610be557fe5b04145b1515610bc557fe5b6000610bfa610cee565b6000806003604080519081016040528154815260019091015460208201529250610c2983518460200151610b6b565b1515610c3457600080fd5b610c5d8360200151600a0a610c518551889063ffffffff610bcc16565b9063ffffffff610cd716565b9150610c6f858363ffffffff610cc516565b600254909450600160a060020a03169050801515610c8c57600080fd5b600160a060020a03811682156108fc0283604051600060405180830381858888f193505050501515610cbd57600080fd5b505050919050565b600082821115610cd157fe5b50900390565b6000808284811515610ce557fe5b04949350505050565b6040805190810160405260008082526020820152905600a165627a7a723058201caf712d4583d3b389f5b00267b046d3cd6c57ec5de7d0c1f92440131e01d51f0029

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000a668a4148f348f3fc8d1f614232742e4da641ac3

-----Decoded View---------------
Arg [0] : _token (address): 0xa668a4148F348f3FC8D1F614232742e4dA641aC3

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000a668a4148f348f3fc8d1f614232742e4da641ac3


Swarm Source

bzzr://1caf712d4583d3b389f5b00267b046d3cd6c57ec5de7d0c1f92440131e01d51f

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
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.