lohoz/Smart-Contract-MultiTask-Dataset huggingface dataset:
// Solidity 0.5.4
/**
 	 * @dev exchange `amount` TAOCurrency from `fromDenominationName` denomination to TAOCurrency in `toDenominationName` denomination
 	 * @param amount The amount of TAOCurrency to exchange
 	 * @param fromDenominationName The origin denomination
 	 * @param toDenominationName The target denomination
 	 */
function exchangeDenomination(uint256 amount, bytes8 fromDenominationName, bytes8 toDenominationName) public isValidDenomination(fromDenominationName) isValidDenomination(toDenominationName) {
		address _nameId = _nameFactory.ethAddressToNameId(msg.sender);
		require (_nameId != address(0));
		require (amount > 0);
		Denomination memory _fromDenomination = denominations[denominationIndex[fromDenominationName]];
		Denomination memory _toDenomination = denominations[denominationIndex[toDenominationName]];
		TAOCurrency _fromDenominationCurrency = TAOCurrency(_fromDenomination.denominationAddress);
		TAOCurrency _toDenominationCurrency = TAOCurrency(_toDenomination.denominationAddress);
		require (_fromDenominationCurrency.whitelistBurnFrom(_nameId, amount));
		require (_toDenominationCurrency.mint(_nameId, amount));

		// Store the DenominationExchange information
		totalDenominationExchanges++;
		bytes32 _exchangeId = keccak256(abi.encodePacked(this, _nameId, totalDenominationExchanges));
		denominationExchangeIdLookup[_exchangeId] = totalDenominationExchanges;

		DenominationExchange storage _denominationExchange = denominationExchanges[totalDenominationExchanges];
		_denominationExchange.exchangeId = _exchangeId;
		_denominationExchange.nameId = _nameId;
		_denominationExchange.fromDenominationAddress = _fromDenomination.denominationAddress;
		_denominationExchange.toDenominationAddress = _toDenomination.denominationAddress;
		_denominationExchange.amount = amount;

		emit ExchangeDenomination(_nameId, _exchangeId, amount, _fromDenomination.denominationAddress, TAOCurrency(_fromDenomination.denominationAddress).symbol(), _toDenomination.denominationAddress, TAOCurrency(_toDenomination.denominationAddress).symbol());
	}
// Solidity 0.5.4
/**
 	 * @dev Get DenominationExchange information given an exchange ID
 	 * @param _exchangeId The exchange ID to query
 	 * @return The name ID that performed the exchange
 	 * @return The from denomination address
 	 * @return The to denomination address
 	 * @return The from denomination symbol
 	 * @return The to denomination symbol
 	 * @return The amount exchanged
 	 */
function getDenominationExchangeById(bytes32 _exchangeId) public view returns (address, address, address, string memory, string memory, uint256) {
		require (denominationExchangeIdLookup[_exchangeId] > 0);
		DenominationExchange memory _denominationExchange = denominationExchanges[denominationExchangeIdLookup[_exchangeId]];
		return (
			_denominationExchange.nameId,
			_denominationExchange.fromDenominationAddress,
			_denominationExchange.toDenominationAddress,
			TAOCurrency(_denominationExchange.fromDenominationAddress).symbol(),
			TAOCurrency(_denominationExchange.toDenominationAddress).symbol(),
			_denominationExchange.amount
		);
	}
// Solidity 0.5.4
/**
 	 * @dev Return the highest possible denomination given a base amount
 	 * @param amount The amount to be converted
 	 * @return the denomination short name
 	 * @return the denomination address
 	 * @return the integer amount at the denomination level
 	 * @return the fraction amount at the denomination level
 	 * @return the denomination public name
 	 * @return the denomination symbol
 	 * @return the denomination num of decimals
 	 * @return the denomination multiplier (power of ten)
 	 */
function toHighestDenomination(uint256 amount) public view returns (bytes8, address, uint256, uint256, string memory, string memory, uint8, uint256) {
		uint256 integerAmount;
		uint256 fractionAmount;
		uint256 index;
		for (uint256 i=totalDenominations; i>0; i--) {
			Denomination memory _denomination = denominations[i];
			(integerAmount, fractionAmount) = fromBase(amount, _denomination.name);
			if (integerAmount > 0) {
				index = i;
				break;
			}
		}
		require (index > 0 && index <= totalDenominations);
		require (integerAmount > 0 || fractionAmount > 0);
		require (denominations[index].denominationAddress != address(0));
		TAOCurrency _tc = TAOCurrency(denominations[index].denominationAddress);
		return (
			denominations[index].name,
			denominations[index].denominationAddress,
			integerAmount,
			fractionAmount,
			_tc.name(),
			_tc.symbol(),
			_tc.decimals(),
			_tc.powerOfTen()
		);
	}
// Solidity 0.7.0
/**
 *  @dev Set aside tokens for marketing, Owner does not need to pay. Tokens are sent to the Owner.
 */
function mintTeamTokens(uint256 _numberOfTokens) public onlyOwner {
        require(_numberOfTokens <= MAX_TOTAL_TOKENS, 'Can not mint more than the total supply.');
        require(_numberOfTokens >= 100, 'Can not mint more than 100 NFTs at a time.');
        require(totalSupply().add(_numberOfTokens) <= MAX_TOTAL_TOKENS, 'Minting would exceed max supply of Tokens');
        uint256 supply = totalSupply();
        uint256 i;
        for (i = 0; i < _numberOfTokens; i++) {
            _safeMint(msg.sender, supply + i);
        }
    }
// Solidity 0.7.0
/**
 *  @dev Mint any amount of Tokens to another address for free.
 */
function mintTokenAndTransfer(address _to, uint256 _numberOfTokens) public onlyOwner {
        require(_numberOfTokens <= MAX_TOTAL_TOKENS, 'Can not mint more than the total supply.');
        require(totalSupply().add(_numberOfTokens) <= MAX_TOTAL_TOKENS, 'Minting would exceed max supply of Tokens');
        require(address(_to) != address(this), 'Cannot mint to contract itself.');
        require(address(_to) != address(0), 'Cannot mint to a null address.');
        uint256 supply = totalSupply();
        for (uint256 i = 0; i < _numberOfTokens; i++) {
            if (totalSupply() < MAX_TOTAL_TOKENS) {
                _safeMint(_to, supply + i);
            }
        }
    }
// Solidity 0.7.0
/**
 *  @dev Vending part of the contract, any address can purchase Tokens based on the contract price.
 */
function mintTokens(uint256 _numberOfTokens) public payable {
        require(saleIsActive, 'Sale must be active to mint.');
        require(_numberOfTokens <= MAX_TOKEN_ALLOWANCE, 'Minting allowance is being enforced');
        require(
            totalSupply().add(_numberOfTokens) <= MAX_TOTAL_TOKENS,
            'Purchase would exceed max supply of contract tokens'
        );
        require(PER_TOKEN_PRICE.mul(_numberOfTokens) <= msg.value, 'Incorrect ETH value sent, not enough');

        for (uint256 i = 0; i < _numberOfTokens; i++) {
            uint256 mintIndex = totalSupply();
            if (totalSupply() < MAX_TOTAL_TOKENS) {
                _safeMint(msg.sender, mintIndex);
            }
        }

        /*
            If we haven't set the starting index and this is either 
                1) the last saleable token or 
                2) the first token to be sold after
            the end of pre-sale, set the starting index block
        */
        if (startingIndexBlock == 0 && (totalSupply() == MAX_TOTAL_TOKENS || block.timestamp >= REVEAL_TIMESTAMP)) {
            startingIndexBlock = block.number;
        }
    }
// Solidity 0.4.17
// Also used to adjust price if already for sale
function listSpriteForSale (uint spriteId, uint price) {
        require (price > 0);
        if (broughtSprites[spriteId].owner != msg.sender) {
            require (broughtSprites[spriteId].timesTraded == 0);
            
            // This will be the owner of a Crypto Kitty, who can control the price of their unbrought Sprite
            address kittyOwner = KittyCore(KittyCoreAddress).ownerOf(spriteId);
            require (kittyOwner == msg.sender);
            
            broughtSprites[spriteId].owner = msg.sender;
            broughtSprites[spriteId].spriteImageID = uint(block.blockhash(block.number-1))%360 + 1; 
        }
        broughtSprites[spriteId].forSale = true;
        broughtSprites[spriteId].price = price;
    }
// Solidity 0.5.10
/** @notice  Extend the time lock of a pending request.
 *
 * @dev  Requests made by the primary account receive the default time lock.
 * This function allows the primary account to apply the extended time lock
 * to one its own requests.
 *
 * @param  _requestMsgHash  The request message hash of a pending request.
 */
function extendRequestTimeLock(bytes32 _requestMsgHash) public onlyPrimary {
        Request storage request = requestMap[_requestMsgHash];

        // reject ‘null’ results from the map lookup
        // this can only be the case if an unknown `_requestMsgHash` is received
        require(request.callbackAddress != address(0));

        // `extendRequestTimeLock` must be idempotent
        require(request.extended != true);

        // set the `extended` flag; note that this is never unset
        request.extended = true;

        emit TimeLockExtended(request.timestamp + extendedTimeLock, _requestMsgHash);
    }
// Solidity 0.5.10
/** @notice  Core logic of the `increaseApproval` function.
 *
 * @dev  This function can only be called by the referenced proxy,
 * which has an `increaseApproval` function.
 * Every argument passed to that function as well as the original
 * `msg.sender` gets passed to this function.
 * NOTE: approvals for the zero address (unspendable) are disallowed.
 *
 * @param  _sender  The address initiating the approval.
 */
function increaseApprovalWithSender(
        address _sender,
        address _spender,
        uint256 _addedValue
    )
        public
        onlyProxy
        returns (bool success)
    {
        require(_spender != address(0));
        uint256 currentAllowance = erc20Store.allowed(_sender, _spender);
        uint256 newAllowance = currentAllowance + _addedValue;

        require(newAllowance >= currentAllowance);

        erc20Store.setAllowance(_sender, _spender, newAllowance);
        erc20Proxy.emitApproval(_sender, _spender, newAllowance);
        return true;
    }
// Solidity 0.5.10
/** @notice  Confirms a pending increase in the token supply.
 *
 * @dev  When called by the custodian with a lock id associated with a
 * pending increase, the amount requested to be printed in the print request
 * is printed to the receiving address specified in that same request.
 * NOTE: this function will not execute any print that would overflow the
 * total supply, but it will not revert either.
 *
 * @param  _lockId  The identifier of a pending print request.
 */
function confirmPrint(bytes32 _lockId) public onlyCustodian {
        PendingPrint storage print = pendingPrintMap[_lockId];

        // reject ‘null’ results from the map lookup
        // this can only be the case if an unknown `_lockId` is received
        address receiver = print.receiver;
        require (receiver != address(0));
        uint256 value = print.value;

        delete pendingPrintMap[_lockId];

        uint256 supply = erc20Store.totalSupply();
        uint256 newSupply = supply + value;
        if (newSupply >= supply) {
          erc20Store.setTotalSupply(newSupply);
          erc20Store.addBalance(receiver, value);

          emit PrintingConfirmed(_lockId, receiver, value);
          erc20Proxy.emitTransfer(address(0), receiver, value);
        }
    }
// Solidity 0.5.10
/** @notice  Burns the specified value from the sender's balance.
 *
 * @dev  Sender's balanced is subtracted by the amount they wish to burn.
 *
 * @param  _value  The amount to burn.
 *
 * @return  success  true if the burn succeeded.
 */
function burn(uint256 _value) public returns (bool success) {
        require(blocked[msg.sender] != true);
        uint256 balanceOfSender = erc20Store.balances(msg.sender);
        require(_value <= balanceOfSender);

        erc20Store.setBalance(msg.sender, balanceOfSender - _value);
        erc20Store.setTotalSupply(erc20Store.totalSupply() - _value);

        erc20Proxy.emitTransfer(msg.sender, address(0), _value);

        return true;
    }
// Solidity 0.5.10
/** @notice  Burns the specified value from the balance in question.
 *
 * @dev  Suspected balance is subtracted by the amount which will be burnt.
 *
 * @dev If suspected balance has less than the amount requested, it will be set to 0.
 *
 * @param  _from  The address of suspected balance.
 *
 * @param  _value  The amount to burn.
 *
 * @return  success  true if the burn succeeded.
 */
function burn(address _from, uint256 _value) public onlyCustodian returns (bool success) {
        uint256 balance = erc20Store.balances(_from);
        if(_value <= balance){
            erc20Store.setBalance(_from, balance - _value);
            erc20Store.setTotalSupply(erc20Store.totalSupply() - _value);
            erc20Proxy.emitTransfer(_from, address(0), _value);
            emit Wiped(_from, _value, 0);
        }
        else {
            erc20Store.setBalance(_from,0);
            erc20Store.setTotalSupply(erc20Store.totalSupply() - balance);
            erc20Proxy.emitTransfer(_from, address(0), balance);
            emit Wiped(_from, balance, _value - balance);
        }
        return true;
    }
// Solidity 0.5.10
/** @notice  A function for a sender to issue multiple transfers to multiple
 * different addresses at once. This function is implemented for gas
 * considerations when someone wishes to transfer, as one transaction is
 * cheaper than issuing several distinct individual `transfer` transactions.
 *
 * @dev  By specifying a set of destination addresses and values, the
 * sender can issue one transaction to transfer multiple amounts to
 * distinct addresses, rather than issuing each as a separate
 * transaction. The `_tos` and `_values` arrays must be equal length, and
 * an index in one array corresponds to the same index in the other array
 * (e.g. `_tos[0]` will receive `_values[0]`, `_tos[1]` will receive
 * `_values[1]`, and so on.)
 * NOTE: transfers to the zero address are disallowed.
 *
 * @param  _tos  The destination addresses to receive the transfers.
 * @param  _values  The values for each destination address.
 * @return  success  If transfers succeeded.
 */
function batchTransfer(address[] memory _tos, uint256[] memory _values) public returns (bool success) {
        require(_tos.length == _values.length);
        require(blocked[msg.sender] != true);
        uint256 numTransfers = _tos.length;
        uint256 senderBalance = erc20Store.balances(msg.sender);

        for (uint256 i = 0; i < numTransfers; i++) {
          address to = _tos[i];
          require(to != address(0));
          require(blocked[to] != true);
          uint256 v = _values[i];
          require(senderBalance >= v);

          if (msg.sender != to) {
            senderBalance -= v;
            erc20Store.addBalance(to, v);
          }
          erc20Proxy.emitTransfer(msg.sender, to, v);
        }

        erc20Store.setBalance(msg.sender, senderBalance);

        return true;
    }
// Solidity 0.5.10
/** @notice  Enables the delegation of transfer control for many
 * accounts to the sweeper account, transferring any balances
 * as well to the given destination.
 *
 * @dev  An account delegates transfer control by signing the
 * value of `sweepMsg`. The sweeper account is the only authorized
 * caller of this function, so it must relay signatures on behalf
 * of accounts that delegate transfer control to it. Enabling
 * delegation is idempotent and permanent. If the account has a
 * balance at the time of enabling delegation, its balance is
 * also transfered to the given destination account `_to`.
 * NOTE: transfers to the zero address are disallowed.
 *
 * @param  _vs  The array of recovery byte components of the ECDSA signatures.
 * @param  _rs  The array of 'R' components of the ECDSA signatures.
 * @param  _ss  The array of 'S' components of the ECDSA signatures.
 * @param  _to  The destination for swept balances.
 */
function enableSweep(uint8[] memory _vs, bytes32[] memory _rs, bytes32[] memory _ss, address _to) public onlySweeper {
        require(_to != address(0));
        require(blocked[_to] != true);
        require((_vs.length == _rs.length) && (_vs.length == _ss.length));

        uint256 numSignatures = _vs.length;
        uint256 sweptBalance = 0;

        for (uint256 i = 0; i < numSignatures; ++i) {
            address from = ecrecover(keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32",sweepMsg)), _vs[i], _rs[i], _ss[i]);
            require(blocked[from] != true);
            // ecrecover returns 0 on malformed input
            if (from != address(0)) {
                sweptSet[from] = true;

                uint256 fromBalance = erc20Store.balances(from);

                if (fromBalance > 0) {
                    sweptBalance += fromBalance;

                    erc20Store.setBalance(from, 0);

                    erc20Proxy.emitTransfer(from, _to, fromBalance);
                }
            }
        }

        if (sweptBalance > 0) {
          erc20Store.addBalance(_to, sweptBalance);
        }
    }
// Solidity 0.5.10
/** @notice  For accounts that have delegated, transfer control
 * to the sweeper, this function transfers their balances to the given
 * destination.
 *
 * @dev The sweeper account is the only authorized caller of
 * this function. This function accepts an array of addresses to have their
 * balances transferred for gas efficiency purposes.
 * NOTE: any address for an account that has not been previously enabled
 * will be ignored.
 * NOTE: transfers to the zero address are disallowed.
 *
 * @param  _froms  The addresses to have their balances swept.
 * @param  _to  The destination address of all these transfers.
 */
function replaySweep(address[] memory _froms, address _to) public onlySweeper {
        require(_to != address(0));
        require(blocked[_to] != true);
        uint256 lenFroms = _froms.length;
        uint256 sweptBalance = 0;

        for (uint256 i = 0; i < lenFroms; ++i) {
            address from = _froms[i];
            require(blocked[from] != true);
            if (sweptSet[from]) {
                uint256 fromBalance = erc20Store.balances(from);

                if (fromBalance > 0) {
                    sweptBalance += fromBalance;

                    erc20Store.setBalance(from, 0);

                    erc20Proxy.emitTransfer(from, _to, fromBalance);
                }
            }
        }

        if (sweptBalance > 0) {
            erc20Store.addBalance(_to, sweptBalance);
        }
    }
// Solidity 0.5.10
/** @notice  Core logic of the ERC20 `transferFrom` function.
 *
 * @dev  This function can only be called by the referenced proxy,
 * which has a `transferFrom` function.
 * Every argument passed to that function as well as the original
 * `msg.sender` gets passed to this function.
 * NOTE: transfers to the zero address are disallowed.
 *
 * @param  _sender  The address initiating the transfer in proxy.
 */
function transferFromWithSender(
        address _sender,
        address _from,
        address _to,
        uint256 _value
    )
        public
        onlyProxy
        returns (bool success)
    {
        require(_to != address(0));

        uint256 balanceOfFrom = erc20Store.balances(_from);
        require(_value <= balanceOfFrom);

        uint256 senderAllowance = erc20Store.allowed(_from, _sender);
        require(_value <= senderAllowance);

        erc20Store.setBalance(_from, balanceOfFrom - _value);
        erc20Store.addBalance(_to, _value);

        erc20Store.setAllowance(_from, _sender, senderAllowance - _value);

        erc20Proxy.emitTransfer(_from, _to, _value);

        return true;
    }
// Solidity 0.4.24
/**
 * @dev function to check whether passed address is a contract address
 */
function isContract(address _address) private view returns (bool is_contract) {
      uint256 length;
      assembly {
      //retrieve the size of the code on target address, this needs assembly
        length := extcodesize(_address)
      }
      return (length > 0);
    }
// Solidity 0.4.24
// Transfer token to compnay 
function companyTokensRelease(address _company) external onlyOwner returns(bool) {
   require(_company != address(0), "Address is not valid");
   require(!ownerRelease, "owner release has already done");
    if (now > contractDeployed.add(365 days) && releasedForOwner == false ) {          
          balances[_company] = balances[_company].add(_lockedTokens);
          
          releasedForOwner = true;
          ownerRelease = true;
          emit CompanyTokenReleased(_company, _lockedTokens);
          _lockedTokens = 0;
          return true;
        }
    }
// Solidity 0.5.10
/** @notice  Requests wipe of suspected accounts.
 *
 * @dev  Returns a unique lock id associated with the request.
 * Only linitedPrinter can call this function, and confirming the request is authorized
 * by the custodian.
 *
 * @param  _from  The array of suspected accounts.
 *
 * @param  _value  array of amounts by which suspected accounts will be wiped.
 *
 * @return  lockId  A unique identifier for this request.
 */
function requestWipe(address[] memory _from, uint256[] memory _value) public onlyLimitedPrinter returns (bytes32 lockId) {
        lockId = generateLockId();
        uint256 amount = _from.length;

        for(uint256 i = 0; i < amount; i++) {
            address from = _from[i];
            uint256 value = _value[i];
            pendingWipeMap[lockId].push(wipeAddress(value, from));
        }

        emit WipeRequested(lockId);

        return lockId;
    }
// Solidity 0.5.10
/** @notice  Confirms a pending wipe of suspected accounts.
 *
 * @dev  When called by the custodian with a lock id associated with a
 * pending wipe, the amount requested is burned from the suspected accounts.
 *
 * @param  _lockId  The identifier of a pending wipe request.
 */
function confirmWipe(bytes32 _lockId) public onlyCustodian {
        uint256 amount = pendingWipeMap[_lockId].length;
        for(uint256 i = 0; i < amount; i++) {
            wipeAddress memory addr = pendingWipeMap[_lockId][i];
            address from = addr.from;
            uint256 value = addr.value;
            erc20Impl.burn(from, value);
        }

        delete pendingWipeMap[_lockId];

        emit WipeCompleted(_lockId);
    }
// Solidity 0.5.10
/** @notice  Requests transfer from suspected account.
 *
 * @dev  Returns a unique lock id associated with the request.
 * Only linitedPrinter can call this function, and confirming the request is authorized
 * by the custodian.
 *
 * @param  _from  address of suspected accounts.
 *
 * @param  _to  address of reciever.
 *
 * @param  _value  amount which will be transfered.
 *
 * @return  lockId  A unique identifier for this request.
 */
function requestTransfer(address _from, address _to, uint256 _value) public onlyLimitedPrinter returns (bytes32 lockId) {
        lockId = generateLockId();
        require (_value != 0);
        pendingTransferMap[lockId] = transfer(_value, _from, _to);

        emit TransferRequested(lockId, _from, _to, _value);

        return lockId;
    }