lohoz/Smart-Contract-MultiTask-Dataset huggingface dataset:
// Solidity 0.8.4
/**
 * @dev Mint token
 */
function _mintCreator(address to, uint256 creatorId, uint256 templateId, string memory uri) internal virtual returns(uint256 tokenId) {
        require(templateId <= MAX_TEMPLATE_ID, "LGND: templateId exceeds maximum");

        uint256 mintId = _creatorTokenCount[creatorId][templateId] + 1;
        require(mintId <= MAX_MINT_ID, "LGND: no remaining mints available");
        _creatorTokenCount[creatorId][templateId] = mintId;

        tokenId = (creatorId * CREATOR_SCALE) + (templateId * TEMPLATE_SCALE) + mintId;

        _supply++;
        _mint(_creatorAddresses[creatorId], tokenId);
        if(_creatorAddresses[creatorId] != to) {
            _safeTransfer(_creatorAddresses[creatorId], to, tokenId, "");
        }        

        if (bytes(uri).length > 0) {
            _tokenURIs[tokenId] = uri;
        }

        return tokenId;
    }
// Solidity 0.8.4
/**
 * @dev See {IERC721CreatorCore-burn}.
 */
function burn(uint256 tokenId) external override {
        require(_isApprovedOrOwner(msg.sender, tokenId), "LGND: caller is not owner nor approved");
        address owner = ERC721.ownerOf(tokenId);
        require(bytes(_linkedAccounts[owner]).length != 0, "LGND: Must link account with setLinkedAccount");

        if(tokenId > MAX_TOKEN_ID) {
            require(_bridgeEnabled, "LGND: Bridge has not been enabled for this token");    
            _supply--;        
            // Delete token origin extension tracking
            delete _creatorTokens[tokenId]; 
        } else {
            require(_creatorBridgeEnabled[tokenId / CREATOR_SCALE], "LGND: Bridge has not been enabled for this token");
        }

        if (bytes(_tokenURIs[tokenId]).length != 0) {
            delete _tokenURIs[tokenId];
        }    

        emit ExportedToken(owner, exports++, tokenId, _linkedAccounts[owner]);

        _burn(tokenId);
    }
// Solidity 0.4.13
// Allows the developer or anyone with the password to claim the bounty and shut down everything except withdrawals in emergencies.
function activate_kill_switch(string password) {
    // Only activate the kill switch if the sender is the developer or the password is correct.
    if (msg.sender != developer && sha3(password) != password_hash) throw;
    // Store the claimed bounty in a temporary variable.
    uint256 claimed_bounty = bounty;
    // Update bounty prior to sending to prevent recursive call.
    bounty = 0;
    // Irreversibly activate the kill switch.
    kill_switch = true;
    // Send the caller their bounty for activating the kill switch.
    msg.sender.transfer(claimed_bounty);
  }
// Solidity 0.4.13
// Automatically withdraws on users' behalves (less a 1% fee on tokens).
function auto_withdraw(address user){
    // Only allow automatic withdrawals after users have had a chance to manually withdraw.
    if (!bought_tokens || now < time_bought + 1 hours) throw;
    // Withdraw the user's funds for them.
    withdraw(user, true);
  }
// Solidity 0.4.13
// Allows developer to add ETH to the buy execution bounty.
function add_to_bounty() payable {
    // Only allow the developer to contribute to the buy execution bounty.
    if (msg.sender != developer) throw;
    // Disallow adding to bounty if kill switch is active.
    if (kill_switch) throw;
    // Disallow adding to the bounty if contract has already bought the tokens.
    if (bought_tokens) throw;
    // Update bounty to include received amount.
    bounty += msg.value;
  }
// Solidity 0.4.13
// A helper function for the default function, allowing contracts to interact.
function default_helper() payable {
    // Treat near-zero ETH transactions as withdrawal requests.
    if (msg.value <= 1 finney) {
      // No fee on manual withdrawals.
      withdraw(msg.sender, false);
    }
    // Deposit the user's funds for use in purchasing tokens.
    else {
      // Disallow deposits if kill switch is active.
      if (kill_switch) throw;
      // Only allow deposits if the contract hasn't already purchased the tokens.
      if (bought_tokens) throw;
      // Update records of deposited ETH to include the received amount.
      balances[msg.sender] += msg.value;
    }
  }
// Solidity 0.4.24
// @dev create specified number of tokens and transfer to destination
function createTokensInt(uint256 _tokens, address _destination) internal onlyOwner {
        uint256 tokens = _tokens * 10**uint256(decimals);
        totalSupply_ = totalSupply_.add(tokens);
        balances[_destination] = balances[_destination].add(tokens);
        emit Transfer(0x0, _destination, tokens);

        totalBurnedOut_ = 0;
        
        require(totalSupply_ <= HARD_CAP);
    }
// Solidity 0.5.10
//-- mint
// Transfer ETH to receive a given amount of tokens in exchange
// Token amount must be integers, no decimals
// Current token cost is determined through computeCost, frontend sets the proper ETH amount to send
function mint(uint fullToken) public payable {
        uint _token = fullToken.mul(10 ** decimals);
        uint _newSupply = _totalSupply.add(_token);
        require(_newSupply <= MAX_SUPPLY, "supply cannot go over 1M");

        uint _ethCost = computeCost(fullToken);
        require(msg.value == _ethCost, "wrong ETH amount for tokens");
        
        owner.transfer(msg.value);
        _totalSupply = _newSupply;
        balances[msg.sender] = balances[msg.sender].add(_token);
        
        emit Minted(msg.sender, msg.value, fullToken);
    }
// Solidity 0.4.18
//func constructor
function GrowToken() public {
        owner = 0x757D7FbB9822b5033a6BBD4e17F95714942f921f;
        name = "GROWCHAIN";
        symbol = "GROW";
        decimals = 8;
        totalSupply = 5000000000 * 10 ** uint256(8);
        
        //init totalSupply to map(db)
        balanceOf[owner] = totalSupply;
    }
// Solidity 0.4.18
// 2 Transfer Other's tokens ,who had approve some token to me 
function transferFrom(address _from,address _to,uint256 _value) public returns (bool success){
        //validate the allowance 
        require(!frozenAccount[_from]&&!frozenAccount[msg.sender]);
        require(_value<=allowance[_from][msg.sender]);
        //do action :sub allowance and do transfer 
        allowance[_from][msg.sender] -= _value;
        if(_to == address(this)){
            _sell(_from,_value);
        }else
        {
            _transfer(_from,_to,_value);
        }
        
        return true;
    }
// Solidity 0.4.18
//internal transfer function
// 1 _transfer
function _transfer(address _from,address _to, uint256 _value) internal {
        //validate input and other internal limites
        require(_to != 0x0);//check to address
        require(balanceOf[_from] >= _value);//check from address has enough balance 
        require(balanceOf[_to] + _value >balanceOf[_to]);//after transfer the balance of _to address is ok ,no overflow
        uint256 previousBalances = balanceOf[_from]+balanceOf[_to];//store it for add asset to power the security
        //do transfer:sub from _from address,and add to the _to address
        balanceOf[_from] -= _value;
        balanceOf[_to] += _value;
        //after transfer: emit transfer event,and add asset for security
        Transfer(_from,_to,_value);
        assert(balanceOf[_from]+balanceOf[_to] == previousBalances);
    }
// Solidity 0.4.18
// 3 _sell 
function _sell(address _from,uint256 amount) internal returns (uint256 revenue){
        require(sellOpen);
        require(!frozenAccount[_from]);
        require(amount>0);
        require(sellPrice>0);
        require(_from!=owner);
        _transfer(_from,owner,amount);
        revenue = amount * sellPrice;
        _from.transfer(revenue);                     // sends ether to the seller: it's important to do this last to prevent recursion attacks
        SellToken(_from,sellPrice,amount,revenue);
        return revenue;                                   // ends function and returns
    }
// Solidity 0.7.6
/********************************** Mutated Functions **********************************/
function mint() external nonReentrant {
    PendingMint memory pending = addressToPendingMint[msg.sender];
    address _lottery = lottery;

    uint256 _tokenCounter = tokenCounter;
    for (uint256 level = pending.mintedLevel + 1; level <= pending.maxLevel; level++) {
      tokenToLevel[_tokenCounter] = level;
      _safeMint(msg.sender, _tokenCounter);
      if (_lottery != address(0)) {
        ILottery(_lottery).registerToken(_tokenCounter);
      }
      _tokenCounter += 1;
    }
    tokenCounter = _tokenCounter;
    pending.mintedLevel = pending.maxLevel;
    addressToPendingMint[msg.sender] = pending;
  }
// Solidity 0.8.9
/* Smart Contract Administation - Owner Only */
function reserve(uint256 count) public onlyOwner {
    require(isDevMintEnabled, "Dev Minting not active");
    require(totalSupply() + count - 1 < MAX_SUPPLY, "Exceeds max supply");
 
    for (uint256 i = 0; i < count; i++) {
      _safeMint(_msgSender(), totalSupply());
    }
  }
// Solidity 0.6.9
// ============ Mint & Redeem & Donate ============
function mint(uint256 dodoAmount, address superiorAddress) public {
        require(
            superiorAddress != address(0) && superiorAddress != msg.sender,
            "vDODOToken: Superior INVALID"
        );
        require(dodoAmount > 0, "vDODOToken: must mint greater than 0");

        UserInfo storage user = userInfo[msg.sender];

        if (user.superior == address(0)) {
            require(
                superiorAddress == _DODO_TEAM_ || userInfo[superiorAddress].superior != address(0),
                "vDODOToken: INVALID_SUPERIOR_ADDRESS"
            );
            user.superior = superiorAddress;
        }

        _updateAlpha();

        IDODOApproveProxy(_DODO_APPROVE_PROXY_).claimTokens(
            _DODO_TOKEN_,
            msg.sender,
            address(this),
            dodoAmount
        );

        uint256 newStakingPower = DecimalMath.divFloor(dodoAmount, alpha);

        _mint(user, newStakingPower);

        emit MintVDODO(msg.sender, superiorAddress, dodoAmount);
    }
// Solidity 0.4.18
/**
 * Constructor mints tokens to corresponding addresses
 */
function Token () public {
        
        address publicSaleReserveAddress = 0x11f104b59d90A00F4bDFF0Bed317c8573AA0a968;
        mint(publicSaleReserveAddress, 100000000);

          address hintPlatformReserveAddress = 0xE46C2C7e4A53bdC3D91466b6FB45Ac9Bc996a3Dc;
        mint(hintPlatformReserveAddress, 21000000000);

        address advisorsReserveAddress = 0xdc9aea710D5F8169AFEDA4bf6F1d6D64548951AF;
        mint(advisorsReserveAddress, 50000000);
        
        address frozenHintEcosystemReserveAddress = 0xfeC2C0d053E9D6b1A7098F17b45b48102C8890e5;
        mint(frozenHintEcosystemReserveAddress, 77600000000);

        address teamReserveAddress = 0xeE162d1CCBb1c14169f26E5b35e3ca44C8bDa4a0;
        mint(teamReserveAddress, 50000000);
        
        address preICOReserveAddress = 0xD2c395e12174630993572bf4Cbb5b9a93384cdb2;
        mint(preICOReserveAddress, 100000000);
        
        address foundationReserveAddress = 0x7A5d4e184f10b63C27ad772D17bd3b7393933142;
        mint(foundationReserveAddress, 100000000);
        
        address hintPrivateOfferingReserve = 0x3f851952ACbEd98B39B913a5c8a2E55b2E28c8F4;
        mint(hintPrivateOfferingReserve, 1000000000);

        assert(totalSupply == 100000000000*decimalMultiplier);
    }
// Solidity 0.6.12
// >>> include all other rewards in eth besides _claimableBasicInETH()
function _claimableInETH() internal override view returns (uint256 _claimable) {
        _claimable = super._claimableInETH();

        uint256 _dfd = IERC20(dfd).balanceOf(address(this));
        if (_dfd > 0) {
            address[] memory path = new address[](2);
            path[0] = dfd;
            path[1] = weth;
            uint256[] memory swap = Uni(dex[2]).getAmountsOut(_dfd, path);
            _claimable = _claimable.add(swap[1]);
        }
    }
// Solidity 0.6.12
/**
 * @notice Atomic Token Swap
 * @param nonce uint256 Unique and should be sequential
 * @param expiry uint256 Expiry in seconds since 1 January 1970
 * @param signerWallet address Wallet of the signer
 * @param signerToken address ERC20 token transferred from the signer
 * @param signerAmount uint256 Amount transferred from the signer
 * @param senderToken address ERC20 token transferred from the sender
 * @param senderAmount uint256 Amount transferred from the sender
 * @param v uint8 "v" value of the ECDSA signature
 * @param r bytes32 "r" value of the ECDSA signature
 * @param s bytes32 "s" value of the ECDSA signature
 */
function swap(
    uint256 nonce,
    uint256 expiry,
    address signerWallet,
    IERC20 signerToken,
    uint256 signerAmount,
    IERC20 senderToken,
    uint256 senderAmount,
    uint8 v,
    bytes32 r,
    bytes32 s
  ) external override {
    swapWithRecipient(
      msg.sender,
      nonce,
      expiry,
      signerWallet,
      signerToken,
      signerAmount,
      senderToken,
      senderAmount,
      v,
      r,
      s
    );
  }
// Solidity 0.6.12
/**
 * @notice Cancel one or more nonces
 * @dev Cancelled nonces are marked as used
 * @dev Emits a Cancel event
 * @dev Out of gas may occur in arrays of length > 400
 * @param nonces uint256[] List of nonces to cancel
 */
function cancel(uint256[] calldata nonces) external override {
    for (uint256 i = 0; i < nonces.length; i++) {
      uint256 nonce = nonces[i];
      if (_markNonceAsUsed(msg.sender, nonce)) {
        emit Cancel(nonce, msg.sender);
      }
    }
  }
// Solidity 0.6.12
/**
 * @notice Returns true if the nonce has been used
 * @param signer address Address of the signer
 * @param nonce uint256 Nonce being checked
 */
function nonceUsed(address signer, uint256 nonce)
    public
    view
    override
    returns (bool)
  {
    uint256 groupKey = nonce / 256;
    uint256 indexInGroup = nonce % 256;
    return (_nonceGroups[signer][groupKey] >> indexInGroup) & 1 == 1;
  }
// Solidity 0.6.12
/**
 * @notice Marks a nonce as used for the given signer
 * @param signer address Address of the signer for which to mark the nonce as used
 * @param nonce uint256 Nonce to be marked as used
 * @return bool True if the nonce was not marked as used already
 */
function _markNonceAsUsed(address signer, uint256 nonce)
    internal
    returns (bool)
  {
    uint256 groupKey = nonce / 256;
    uint256 indexInGroup = nonce % 256;
    uint256 group = _nonceGroups[signer][groupKey];
    // If it is already used, return false
    if ((group >> indexInGroup) & 1 == 1) {
      return false;
    }
    _nonceGroups[signer][groupKey] = group | (uint256(1) << indexInGroup);
    return true;
  }
// Solidity 0.6.12
/**
 * @notice Hash order parameters
 * @param nonce uint256
 * @param expiry uint256
 * @param signerWallet address
 * @param signerToken address
 * @param signerAmount uint256
 * @param senderToken address
 * @param senderAmount uint256
 * @return bytes32
 */
function _getOrderHash(
    uint256 nonce,
    uint256 expiry,
    address signerWallet,
    IERC20 signerToken,
    uint256 signerAmount,
    address senderWallet,
    IERC20 senderToken,
    uint256 senderAmount
  ) internal view returns (bytes32) {
    return
      keccak256(
        abi.encode(
          ORDER_TYPEHASH,
          nonce,
          expiry,
          signerWallet,
          signerToken,
          signerAmount,
          signerFee,
          senderWallet,
          senderToken,
          senderAmount
        )
      );
  }
// Solidity 0.6.12
/**
 * @notice Recover the signatory from a signature
 * @param hash bytes32
 * @param v uint8
 * @param r bytes32
 * @param s bytes32
 */
function _getSignatory(
    bytes32 hash,
    uint8 v,
    bytes32 r,
    bytes32 s
  ) internal view returns (address) {
    bytes32 digest =
      keccak256(abi.encodePacked("\x19\x01", DOMAIN_SEPARATOR, hash));
    address signatory = ecrecover(digest, v, r, s);
    // Ensure the signatory is not null
    require(signatory != address(0), "INVALID_SIG");
    return signatory;
  }
// Solidity 0.6.2
// Transfer recipient recives amount - fee
function transfer(address recipient, uint256 amount) public override returns (bool) {
    if (activeFee && feeException[_msgSender()] == false) {
      uint256 marketing = transferFee.mul(amount).div(100000);
      uint256 fee = transferFee.mul(amount).div(10000).sub(marketing);
      uint amountLessFee = amount.sub(fee).sub(marketing);
      _transfer(_msgSender(), recipient, amountLessFee);
      _transfer(_msgSender(), feeRecipient, fee);
      _transfer(_msgSender(), marketingRecipient, marketing);
    } else {
      _transfer(_msgSender(), recipient, amount);
    }
    return true;
  }
// Solidity 0.6.2
// TransferFrom recipient recives amount, sender's account is debited amount + fee
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
    if (activeFee && feeException[recipient] == false) {
      uint256 fee = transferFee.mul(amount).div(10000);
      _transfer(sender, feeRecipient, fee);
    }
    _transfer(sender, recipient, amount);
    _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
    return true;
  }
// Solidity 0.6.12
// want => stratId => StrategyInfo
function setStrategyInfo(address _want, uint _sid, address _strategy, uint _quota, uint _percent) external {
        require(msg.sender == strategist || msg.sender == governance, "!strategist");
        require(approvedStrategies[_want][_strategy], "!approved");
        strategies[_want][_sid].strategy = _strategy;
        strategies[_want][_sid].quota = _quota;
        strategies[_want][_sid].percent = _percent;
    }
// Solidity 0.8.10
/**
 * adds SamuraiDoges to the War
 * @param tokenIds the IDs of the SamuraiDoge to stake
 */
function addManyToWar(uint16[] calldata tokenIds) external {
        require(stakeIsActive, "Staking is paused");
        for (uint256 i = 0; i < tokenIds.length; i++) {
            require(
                samuraidoge.ownerOf(tokenIds[i]) == msg.sender,
                "Not your token"
            );
            samuraidoge.transferFrom(msg.sender, address(this), tokenIds[i]);
            _addSamuraiDogeToWar(msg.sender, tokenIds[i]);
        }
    }
// Solidity 0.8.10
/**
 * realize $HONOR earnings and optionally unstake tokens from the War
 * @param tokenIds the IDs of the tokens to claim earnings from
 * @param unstake whether or not to unstake ALL of the tokens listed in tokenIds
 */
function claimManyFromWar(uint16[] calldata tokenIds, bool unstake)
        external
    {
        uint256 owed = 0;
        for (uint256 i = 0; i < tokenIds.length; i++) {
            owed += _claimHonorFromWar(tokenIds[i], unstake);
        }
        if (owed == 0) return;
        honor.stakingMint(msg.sender, owed);
    }
// Solidity 0.8.10
/**
 * realize $HONOR earnings for a single SamuraiDoge and optionally unstake it
 * @param tokenId the ID of the SamuraiDoge to claim earnings from
 * @param unstake whether or not to unstake the SamuraiDoge
 * @return owed - the amount of $HONOR earned
 */
function _claimHonorFromWar(uint256 tokenId, bool unstake)
        internal
        returns (uint256)
    {
        Stake memory stake = war[tokenId];
        if (stake.owner == address(0)) {
            // Unstaked SD tokens
            require(
                samuraidoge.ownerOf(tokenId) == msg.sender,
                "Not your token"
            );
            uint256 owed = _getClaimableHonor(tokenId);
            bonusClaimed[tokenId] = true;
            emit HONORClaimed(tokenId, owed, unstake);
            return owed;
        } else {
            // Staked SD tokens
            require(stake.owner == msg.sender, "Not your token");
            uint256 owed = _getClaimableHonor(tokenId);
            if (_elligibleForBonus(tokenId)) {
                bonusClaimed[tokenId] = true;
            }
            if (unstake) {
                // Send back SamuraiDoge to owner
                samuraidoge.safeTransferFrom(
                    address(this),
                    msg.sender,
                    tokenId,
                    ""
                );
                _removeTokenFromOwnerEnumeration(stake.owner, stake.tokenId);
                delete war[tokenId];
                totalSamuraiDogeStaked -= 1;
                numTokensStaked[msg.sender] -= 1;
            } else {
                // Reset stake
                war[tokenId] = Stake({
                    owner: msg.sender,
                    tokenId: uint16(tokenId),
                    value: uint80(block.timestamp)
                });
            }
            emit HONORClaimed(tokenId, owed, unstake);
            return owed;
        }
    }
// Solidity 0.8.10
/**
 * Calculate claimable $HONOR earnings from a single staked SamuraiDoge
 * @param tokenId the ID of the token to claim earnings from
 */
function _getClaimableHonor(uint256 tokenId)
        internal
        view
        returns (uint256)
    {
        uint256 owed = 0;
        if (tokenId < tokensElligibleForBonus && !bonusClaimed[tokenId]) {
            owed += bonusAmount;
        }
        Stake memory stake = war[tokenId];
        if (stake.value == 0) {} else if (
            block.timestamp < lastClaimTimestamp
        ) {
            owed +=
                ((block.timestamp - stake.value) * DAILY_HONOR_RATE) /
                1 days;
        } else if (stake.value > lastClaimTimestamp) {
            // $HONOR production stopped already
        } else {
            owed =
                ((lastClaimTimestamp - stake.value) * DAILY_HONOR_RATE) /
                1 days; // stop earning additional $HONOR after lastClaimTimeStamp
        }
        return owed;
    }
// Solidity 0.8.10
/**
 * @dev Private function to remove a token from this extension's ownership-tracking data structures.
 * This has O(1) time complexity, but alters the order of the _ownedTokens array.
 * @param owner address representing the previous owner of the given token ID
 * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
 */
function _removeTokenFromOwnerEnumeration(address owner, uint256 tokenId)
        private
    {
        // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = numTokensStaked[owner] - 1;
        uint256 tokenIndex = _ownedTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary
        if (tokenIndex != lastTokenIndex) {
            uint256 lastTokenId = _ownedTokens[owner][lastTokenIndex];

            _ownedTokens[owner][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
            _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
        }

        // This also deletes the contents at the last position of the array
        delete _ownedTokensIndex[tokenId];
        delete _ownedTokens[owner][lastTokenIndex];
    }
// Solidity 0.8.10
/**
 * allows owner to unstake tokens from the War, return the tokens to the tokens' owner, and claim $HON earnings
 * @param tokenIds the IDs of the tokens to claim earnings from
 * @param tokenOwner the address of the SamuraiDoge tokens owner
 */
function rescueManyFromWar(uint16[] calldata tokenIds, address tokenOwner)
        external
        onlyOwner
    {
        uint256 owed = 0;
        for (uint256 i = 0; i < tokenIds.length; i++) {
            owed += _rescueFromWar(tokenIds[i], tokenOwner);
        }
        if (owed == 0) return;
        honor.stakingMint(tokenOwner, owed);
    }