lohoz/Smart-Contract-MultiTask-Dataset huggingface dataset:
// Solidity 0.4.24
/**
 * @notice Verified KYC and global status for two accounts and return true or throw if either account is not verified
 * @dev | This method has an `internal` view
 * @param self Internal storage proxying TokenIOStorage contract
 * @param accountA Ethereum address of first account holder to verify
 * @param accountB Ethereum address of second account holder to verify
 * @return { "verified" : "Returns true if both accounts are successfully verified" }
 */
function verifyAccounts(Data storage self, address accountA, address accountB) internal view returns (bool verified) {
    require(
      verifyAccount(self, accountA),
      "Error: Account is not verified for operation. Please ensure account has been KYC approved."
    );
    require(
      verifyAccount(self, accountB),
      "Error: Account is not verified for operation. Please ensure account has been KYC approved."
    );
    return true;
  }
// Solidity 0.4.24
/**
 * @notice Verified KYC and global status for a single account and return true or throw if account is not verified
 * @dev | This method has an `internal` view
 * @param self Internal storage proxying TokenIOStorage contract
 * @param account Ethereum address of account holder to verify
 * @return { "verified" : "Returns true if account is successfully verified" }
 */
function verifyAccount(Data storage self, address account) internal view returns (bool verified) {
    require(
      getKYCApproval(self, account),
      "Error: Account does not have KYC approval."
    );
    require(
      getAccountStatus(self, account),
      "Error: Account status is `false`. Account status must be `true`."
    );
    return true;
  }
// Solidity 0.4.24
/**
 * @notice Transfer an amount of currency token from msg.sender account to another specified account
 * @dev This function is called by an interface that is accessible directly to the account holder
 * @dev | This method has an `internal` view
 * @dev | This method uses `forceTransfer()` low-level api
 * @param self Internal storage proxying TokenIOStorage contract
 * @param  currency Currency symbol of the token (e.g. USDx, JYPx, GBPx)
 * @param to Ethereum address of account to send currency amount to
 * @param amount Value of currency to transfer
 * @param data Arbitrary bytes data to include with the transaction
 * @return { "success" : "Return true if successfully called from another contract" }
 */
function transfer(Data storage self, string currency, address to, uint amount, bytes data) internal returns (bool success) {
    require(address(to) != 0x0, "Error: `to` address cannot be null." );
    require(amount > 0, "Error: `amount` must be greater than zero");

    address feeContract = getFeeContract(self, address(this));
    uint fees = calculateFees(self, feeContract, amount);

    require(
      setAccountSpendingAmount(self, msg.sender, getFxUSDAmount(self, currency, amount)),
      "Error: Unable to set spending amount for account.");

    require(
      forceTransfer(self, currency, msg.sender, to, amount, data),
      "Error: Unable to transfer funds to account.");

    // @dev transfer fees to fee contract
    require(
      forceTransfer(self, currency, msg.sender, feeContract, fees, getFeeMsg(self, feeContract)),
      "Error: Unable to transfer fees to fee contract.");

    return true;
  }
// Solidity 0.4.24
/**
 * @notice Transfer an amount of currency token from account to another specified account via an approved spender account
 * @dev This function is called by an interface that is accessible directly to the account spender
 * @dev | This method has an `internal` view
 * @dev | Transactions will fail if the spending amount exceeds the daily limit
 * @dev | This method uses `forceTransfer()` low-level api
 * @dev | This method implements ERC20 transferFrom() method with approved spender behavior
 * @dev | msg.sender == spender; `updateAllowance()` reduces approved limit for account spender
 * @param self Internal storage proxying TokenIOStorage contract
 * @param  currency Currency symbol of the token (e.g. USDx, JYPx, GBPx)
 * @param from Ethereum address of account to send currency amount from
 * @param to Ethereum address of account to send currency amount to
 * @param amount Value of currency to transfer
 * @param data Arbitrary bytes data to include with the transaction
 * @return { "success" : "Return true if successfully called from another contract" }
 */
function transferFrom(Data storage self, string currency, address from, address to, uint amount, bytes data) internal returns (bool success) {
    require(
      address(to) != 0x0,
      "Error: `to` address must not be null."
    );

    address feeContract = getFeeContract(self, address(this));
    uint fees = calculateFees(self, feeContract, amount);

    /// @dev NOTE: This transaction will fail if the spending amount exceeds the daily limit
    require(
      setAccountSpendingAmount(self, from, getFxUSDAmount(self, currency, amount)),
      "Error: Unable to set account spending amount."
    );

    /// @dev Attempt to transfer the amount
    require(
      forceTransfer(self, currency, from, to, amount, data),
      "Error: Unable to transfer funds to account."
    );

    // @dev transfer fees to fee contract
    require(
      forceTransfer(self, currency, from, feeContract, fees, getFeeMsg(self, feeContract)),
      "Error: Unable to transfer fees to fee contract."
    );

    /// @dev Attempt to update the spender allowance
    require(
      updateAllowance(self, currency, from, amount),
      "Error: Unable to update allowance for spender."
    );

    return true;
  }
// Solidity 0.4.24
/**
 * @notice Low-level transfer method
 * @dev | This method has an `internal` view
 * @dev | This method does not include fees or approved allowances.
 * @dev | This method is only for authorized interfaces to use (e.g. TokenIOFX)
 * @param self Internal storage proxying TokenIOStorage contract
 * @param  currency Currency symbol of the token (e.g. USDx, JYPx, GBPx)
 * @param from Ethereum address of account to send currency amount from
 * @param to Ethereum address of account to send currency amount to
 * @param amount Value of currency to transfer
 * @param data Arbitrary bytes data to include with the transaction
 * @return { "success" : "Return true if successfully called from another contract" }
 */
function forceTransfer(Data storage self, string currency, address from, address to, uint amount, bytes data) internal returns (bool success) {
    require(
      address(to) != 0x0,
      "Error: `to` address must not be null."
    );

    bytes32 id_a = keccak256(abi.encodePacked('token.balance', currency, getForwardedAccount(self, from)));
    bytes32 id_b = keccak256(abi.encodePacked('token.balance', currency, getForwardedAccount(self, to)));

    require(
      self.Storage.setUint(id_a, self.Storage.getUint(id_a).sub(amount)),
      "Error: Unable to set storage value. Please ensure contract has allowed permissions with storage contract."
    );
    require(
      self.Storage.setUint(id_b, self.Storage.getUint(id_b).add(amount)),
      "Error: Unable to set storage value. Please ensure contract has allowed permissions with storage contract."
    );

    emit Transfer(currency, from, to, amount, data);

    return true;
  }
// Solidity 0.4.24
/**
 * @notice Low-level method to update spender allowance for account
 * @dev | This method is called inside the `transferFrom()` method
 * @dev | msg.sender == spender address
 * @param self Internal storage proxying TokenIOStorage contract
 * @param  currency Currency symbol of the token (e.g. USDx, JYPx, GBPx)
 * @param account Ethereum address of account holder
 * @param amount Value to reduce allowance by (i.e. the amount spent)
 * @return { "success" : "Return true if successfully called from another contract" }
 */
function updateAllowance(Data storage self, string currency, address account, uint amount) internal returns (bool success) {
    bytes32 id = keccak256(abi.encodePacked('token.allowance', currency, getForwardedAccount(self, account), getForwardedAccount(self, msg.sender)));
    require(
      self.Storage.setUint(id, self.Storage.getUint(id).sub(amount)),
      "Error: Unable to set storage value. Please ensure contract has allowed permissions with storage contract."
    );
    return true;
  }
// Solidity 0.4.24
/**
 * @notice Low-level method to set the allowance for a spender
 * @dev | This method is called inside the `approve()` ERC20 method
 * @dev | msg.sender == account holder
 * @param self Internal storage proxying TokenIOStorage contract
 * @param spender Ethereum address of account spender
 * @param amount Value to set for spender allowance
 * @return { "success" : "Return true if successfully called from another contract" }
 */
function approveAllowance(Data storage self, address spender, uint amount) internal returns (bool success) {
    require(spender != 0x0,
        "Error: `spender` address cannot be null.");

    string memory currency = getTokenSymbol(self, address(this));

    require(
      getTokenFrozenBalance(self, currency, getForwardedAccount(self, spender)) == 0,
      "Error: Spender must not have a frozen balance directly");

    bytes32 id_a = keccak256(abi.encodePacked('token.allowance', currency, getForwardedAccount(self, msg.sender), getForwardedAccount(self, spender)));
    bytes32 id_b = keccak256(abi.encodePacked('token.balance', currency, getForwardedAccount(self, msg.sender)));

    require(
      self.Storage.getUint(id_a) == 0 || amount == 0,
      "Error: Allowance must be zero (0) before setting an updated allowance for spender.");

    require(
      self.Storage.getUint(id_b) >= amount,
      "Error: Allowance cannot exceed msg.sender token balance.");

    require(
      self.Storage.setUint(id_a, amount),
      "Error: Unable to set storage value. Please ensure contract has allowed permissions with storage contract.");

    emit Approval(msg.sender, spender, amount);

    return true;
  }
// Solidity 0.4.24
/**
 * @notice Deposit an amount of currency into the Ethereum account holder
 * @dev | The total supply of the token increases only when new funds are deposited 1:1
 * @dev | This method should only be called by authorized issuer firms
 * @param self Internal storage proxying TokenIOStorage contract
 * @param  currency Currency symbol of the token (e.g. USDx, JYPx, GBPx)
 * @param account Ethereum address of account holder to deposit funds for
 * @param amount Value of currency to deposit for account
 * @param issuerFirm Name of the issuing firm authorizing the deposit
 * @return { "success" : "Return true if successfully called from another contract" }
 */
function deposit(Data storage self, string currency, address account, uint amount, string issuerFirm) internal returns (bool success) {
    bytes32 id_a = keccak256(abi.encodePacked('token.balance', currency, getForwardedAccount(self, account)));
    bytes32 id_b = keccak256(abi.encodePacked('token.issued', currency, issuerFirm));
    bytes32 id_c = keccak256(abi.encodePacked('token.supply', currency));


    require(self.Storage.setUint(id_a, self.Storage.getUint(id_a).add(amount)),
      "Error: Unable to set storage value. Please ensure contract has allowed permissions with storage contract.");
    require(self.Storage.setUint(id_b, self.Storage.getUint(id_b).add(amount)),
      "Error: Unable to set storage value. Please ensure contract has allowed permissions with storage contract.");
    require(self.Storage.setUint(id_c, self.Storage.getUint(id_c).add(amount)),
      "Error: Unable to set storage value. Please ensure contract has allowed permissions with storage contract.");

    emit Deposit(currency, account, amount, issuerFirm);

    return true;

  }
// Solidity 0.4.24
/**
 * @notice Method for setting a registered issuer firm
 * @dev | Only Token, Inc. and other authorized institutions may set a registered firm
 * @dev | The TokenIOAuthority.sol interface wraps this method
 * @dev | If the registered firm is unapproved; all authorized addresses of that firm will also be unapproved
 * @param self Internal storage proxying TokenIOStorage contract
 * @param issuerFirm Name of the firm to be registered
 * @param approved Approval status to set for the firm (true/false)
 * @return { "success" : "Return true if successfully called from another contract" }
 */
function setRegisteredFirm(Data storage self, string issuerFirm, bool approved) internal returns (bool success) {
    bytes32 id = keccak256(abi.encodePacked('registered.firm', issuerFirm));
    require(
      self.Storage.setBool(id, approved),
      "Error: Unable to set storage value. Please ensure contract has allowed permissions with storage contract."
    );
    return true;
  }
// Solidity 0.4.24
/**
 * @notice Set transaction status if the transaction has been used
 * @param self Internal storage proxying TokenIOStorage contract
 * @param txHash keccak256 ABI tightly packed encoded hash digest of tx params
 * @return { "success" : "Return true if successfully called from another contract" }
 */
function setTxStatus(Data storage self, bytes32 txHash) internal returns (bool success) {
    bytes32 id = keccak256(abi.encodePacked('tx.status', txHash));
    /// @dev Ensure transaction has not yet been used;
    require(!getTxStatus(self, txHash),
      "Error: Transaction status must be false before setting the transaction status.");

    /// @dev Update the status of the transaction;
    require(self.Storage.setBool(id, true),
      "Error: Unable to set storage value. Please ensure contract has allowed permissions with storage contract.");

    return true;
  }
// Solidity 0.4.24
/**
 * @notice Deprecate a contract interface
 * @dev | This is a low-level method to deprecate a contract interface.
 * @dev | This is useful if the interface needs to be updated or becomes out of date
 * @param self Internal storage proxying TokenIOStorage contract
 * @param contractAddress Ethereum address of the contract interface
 * @return {"success" : "Returns true if successfully called from another contract"}
 */
function setDeprecatedContract(Data storage self, address contractAddress) internal returns (bool success) {
    require(contractAddress != 0x0,
        "Error: cannot deprecate a null address.");

    bytes32 id = keccak256(abi.encodePacked('depcrecated', contractAddress));

    require(self.Storage.setBool(id, true),
      "Error: Unable to set storage value. Please ensure contract interface is allowed by the storage contract.");

    return true;
  }
// Solidity 0.4.24
/**
 * @notice Set the Account Spending Period Limit as UNIX timestamp
 * @dev | Each account has it's own daily spending limit
 * @param self Internal storage proxying TokenIOStorage contract
 * @param account Ethereum address of the account holder
 * @param period Unix timestamp of the spending period
 * @return {"success" : "Returns true is successfully called from a contract"}
 */
function setAccountSpendingPeriod(Data storage self, address account, uint period) internal returns (bool success) {
    bytes32 id = keccak256(abi.encodePacked('limit.spending.period', account));
    require(self.Storage.setUint(id, period),
      "Error: Unable to set storage value. Please ensure contract interface is allowed by the storage contract.");

    return true;
  }
// Solidity 0.4.24
/**
 * @notice Set the account spending amount for the daily period
 * @dev | Each account has it's own daily spending limit
 * @dev | This transaction will throw if the new spending amount is greater than the limit
 * @dev | This method is called in the `transfer()` and `transferFrom()` methods
 * @param self Internal storage proxying TokenIOStorage contract
 * @param account Ethereum address of the account holder
 * @param amount Set the amount spent for the daily period
 * @return {"success" : "Returns true is successfully called from a contract"}
 */
function setAccountSpendingAmount(Data storage self, address account, uint amount) internal returns (bool success) {

    /// @dev NOTE: Always ensure the period is current when checking the daily spend limit
    require(updateAccountSpendingPeriod(self, account),
      "Error: Unable to update account spending period.");

    uint updatedAmount = getAccountSpendingAmount(self, account).add(amount);

    /// @dev Ensure the spend limit is greater than the amount spend for the period
    require(
      getAccountSpendingLimit(self, account) >= updatedAmount,
      "Error: Account cannot exceed its daily spend limit.");

    /// @dev Update the spending period amount if within limit
    bytes32 id = keccak256(abi.encodePacked('account.spending.amount', account, getAccountSpendingPeriod(self, account)));
    require(self.Storage.setUint(id, updatedAmount),
      "Error: Unable to set storage value. Please ensure contract interface is allowed by the storage contract.");

    return true;
  }
// Solidity 0.4.24
/**
 * @notice Low-level API to ensure the account spending period is always current
 * @dev | This method is internally called by `setAccountSpendingAmount()` to ensure
 * spending period is always the most current daily period.
 * @param self Internal storage proxying TokenIOStorage contract
 * @param account Ethereum address of the account holder
 * @return {"success" : "Returns true is successfully called from a contract"}
 */
function updateAccountSpendingPeriod(Data storage self, address account) internal returns (bool success) {
    uint begDate = getAccountSpendingPeriod(self, account);
    if (begDate > now) {
      return true;
    } else {
      uint duration = 86400; // 86400 seconds in a day
      require(
        setAccountSpendingPeriod(self, account, begDate.add(((now.sub(begDate)).div(duration).add(1)).mul(duration))),
        "Error: Unable to update account spending period.");

      return true;
    }
  }
// Solidity 0.4.24
/**
 * @notice Set the foreign currency exchange rate to USD in basis points
 * @dev | This value should always be relative to USD pair; e.g. JPY/USD, GBP/USD, etc.
 * @param self Internal storage proxying TokenIOStorage contract
 * @param currency The TokenIO currency symbol (e.g. USDx, JPYx, GBPx)
 * @param bpsRate Basis point rate of foreign currency exchange rate to USD
 * @return { "success": "Returns true if successfully called from another contract"}
 */
function setFxUSDBPSRate(Data storage self, string currency, uint bpsRate) internal returns (bool success) {
    bytes32 id = keccak256(abi.encodePacked('fx.usd.rate', currency));
    require(
      self.Storage.setUint(id, bpsRate),
      "Error: Unable to update account spending period.");

    return true;
  }
// Solidity 0.4.24
/**
 * @notice Return the foreign currency USD exchanged amount
 * @param self Internal storage proxying TokenIOStorage contract
 * @param currency The TokenIO currency symbol (e.g. USDx, JPYx, GBPx)
 * @param fxAmount Amount of foreign currency to exchange into USD
 * @return {"amount" : "Returns the foreign currency amount in USD"}
 */
function getFxUSDAmount(Data storage self, string currency, uint fxAmount) internal view returns (uint amount) {
    uint usdDecimals = getTokenDecimals(self, 'USDx');
    uint fxDecimals = getTokenDecimals(self, currency);
    /// @dev ensure decimal precision is normalized to USD decimals
    uint usdAmount = ((fxAmount.mul(getFxUSDBPSRate(self, currency)).div(10000)).mul(10**usdDecimals)).div(10**fxDecimals);
    return usdAmount;
  }
// Solidity 0.4.24
/**
 	 * @notice Set Fee Parameters for Fee Contract
 	 * @dev The min, max, flat transaction fees should be relative to decimal precision
 	 * @param feeBps Basis points transaction fee
 	 * @param feeMin Minimum transaction fees
 	 * @param feeMax Maximum transaction fee
 	 * @param feeFlat Flat transaction fee
 	 * returns {"success" : "Returns true if successfully called from another contract"}
 	 */
function setFeeParams(uint feeBps, uint feeMin, uint feeMax, uint feeFlat, bytes feeMsg) public onlyOwner returns (bool success) {
		require(lib.setFeeBPS(feeBps), "Error: Unable to set fee contract basis points.");
		require(lib.setFeeMin(feeMin), "Error: Unable to set fee contract minimum fee.");
		require(lib.setFeeMax(feeMax), "Error: Unable to set fee contract maximum fee.");
		require(lib.setFeeFlat(feeFlat), "Error: Unable to set fee contract flat fee.");
		require(lib.setFeeMsg(feeMsg), "Error: Unable to set fee contract default message.");
		return true;
	}
// Solidity 0.4.24
/**
 	 * @notice Transfer collected fees to another account; onlyOwner
 	 * @param  currency Currency symbol of the token (e.g. USDx, JYPx, GBPx)
 	 * @param  to 			Ethereum address of account to send token amount to
 	 * @param  amount	  Amount of tokens to transfer
 	 * @param  data		  Arbitrary bytes data message to include in transfer
 	 * @return {"success": "Returns ture if successfully called from another contract"}
 	 */
function transferCollectedFees(string currency, address to, uint amount, bytes data) public onlyOwner returns (bool success) {
		require(
			lib.forceTransfer(currency, address(this), to, amount, data),
			"Error: unable to transfer fees to account."
		);
		return true;
	}
// Solidity 0.5.17
/**
 * @dev Burns a specific wrapped punk
 */
function burn(uint256 punkIndex)
        public
        whenNotPaused
    {
        address sender = _msgSender();

        require(_isApprovedOrOwner(sender, punkIndex), "PunkWrapper: caller is not owner nor approved");

        _burn(punkIndex);

        // Transfers ownership of punk on original cryptopunk smart contract to caller
        _punkContract.transferPunk(sender, punkIndex);
    }
// Solidity 0.4.24
// -------------------------------------------------------------------------
// Public external interface
// -------------------------------------------------------------------------
function () external payable {
        // Distribute deposited Ether to all members related to their profit-share
        for (uint i=0; i<memberIndex.length; i++) {
            members[memberIndex[i]].unpaid = 
                // Adding current deposit to members unpaid Wei amount
                members[memberIndex[i]].unpaid.add(
                    // MemberShare * DepositedWei / 100 = WeiAmount of member-share to be added to members unpaid holdings
                    members[memberIndex[i]].share.mul(msg.value).div(100)
                );
        }
        
        // Trigger 'Deposit'-event
        emit Deposit(msg.sender, msg.value);
    }
// Solidity 0.6.5
/// @notice create an Estate from a quad (a group of land forming a square on a specific grid in the Land contract)
/// @param sender address perforing the operation that will create an Estate from its land token
/// @param to the estate will belong to that address
/// @param size edge size of the quad, 3, 6, 12 or 24
/// @param x top left corner position of the quad
/// @param y top left corner position of the quad
function createFromQuad(
        address sender,
        address to,
        uint256 size,
        uint256 x,
        uint256 y
    ) external returns (uint256) {
        require(to != address(0), "DESTINATION_ZERO_ADDRESS");
        require(to != address(this), "DESTINATION_ESTATE_CONTRACT");
        _check_create_authorized(sender);
        uint256 estateId = _mintEstate(to);
        _addSingleQuad(sender, estateId, size, x, y, true, 0);
        return estateId;
    }