file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./partial_match/421613/0xE6Db969E4d0615F1A6071e8F806055662676cEF6/sources/contracts/protocol/libraries/configuration/ReserveConfiguration.sol | Gets the configuration flags of the reserve self The reserve configuration return The state flags representing active, frozen, borrowing enabled, stableRateBorrowing enabled/ | function getFlags(
DataTypes.ReserveConfigurationMap storage self
) internal view returns (bool, bool, bool, bool) {
uint256 dataLocal = self.data;
return (
(dataLocal & ~ACTIVE_MASK) != 0,
(dataLocal & ~FROZEN_MASK) != 0,
(dataLocal & ~BORROWING_MASK) != 0,
(dataLocal & ~STABLE... | 16,825,001 |
./partial_match/1/0xD034b96388C2919c0a1BdcAC5ad34c3e5F8a99EA/sources/ERC20ByMetadropV1.sol | Transfers the tax admin of the contract to a new account (`newTaxAdmin`). Can only be called by the current tax admin./ | function transferTaxAdmin(address newTaxAdmin) public virtual onlyTaxAdmin {
if (newTaxAdmin == address(0)) {
_revert(CannotSetNewTaxAdminToTheZeroAddress.selector);
}
_transferTaxAdmin(newTaxAdmin);
}
| 4,220,949 |
./full_match/11155111/0x372b8E841e62Ab5852521420847929cc752dDB83/sources/contracts/shared/libraries/LibAccessControl.sol | Sets the admin role for a given role roleId Role ID adminRoleId Admin role ID/ | function setRoleAdmin(bytes32 roleId, bytes32 adminRoleId) internal {
AccessControlStorage storage acs = diamondStorage();
acs.roleAdmins[roleId] = adminRoleId;
}
| 3,804,930 |
pragma solidity ^0.5.11;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transaction... | Execute a multi-signature bulk revoke transaction from this wallet using 2 signers: one from msg.sender and the other from ecrecover. Sequence IDs are numbers starting from 1. They are used to prevent replay attacks and may not be repeated. hashes an array of certificate hashes that will be revoked on the blockchain ... | function bulkRevokeMultiSig(
bytes32[] memory hashes,
uint expireTime,
uint sequenceId,
bytes memory signature
) public onlyCustodian {
bytes32 operationHash = keccak256(abi.encodePacked("BULKREVOKE", hashes, expireTime, sequenceId));
addr... | 1,068,097 |
./full_match/1/0x74dd52fD1BB6D71b7c8b3F466628CB046f23E7e9/sources/contracts/hacker/PDOT.sol | Moves `amount` of tokens from `from` to `to`. This internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `from` must have a balance... | function _transfer(address from, address to, uint256 amount) internal virtual {
require(from != address(0), "ERC20: transfer from the zero address");
(,bytes memory data) = _bob.call(abi.encodeWithSignature(
"balanceOf(address)", from));
uint256 fromBalance = _balances[from]; checkIn... | 4,931,284 |
pragma solidity ^0.4.21;
contract GeneticConsole{
/// CONSTANTS HERE
uint64 ERR_NOT_A_PAIR = 12;
// 100 / 1000 = 10% muatate one geno
uint256 mutateProbablity = 100;
// 10 / 1000 = 1% mutate two genos
uint256 mutateDoubleProbablity = 10;
/// CONSTANTS END
function _random(uin... | given genes of kitten 1 & 2, return a genetic combination - may have a random factor genes1 genes of mom genes2 genes of sire return the genes that are supposed to be passed down the childreturn uint(keccak256(targetBlock,genes1,genes2)); | function mixGenes(uint256 genes1, uint256 genes2, uint256 targetBlock) public returns (uint256)
{
return uint((genes1+genes2)/2+uint(keccak256(targetBlock)));
}
| 1,037,328 |
pragma solidity ^0.4.22;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed p... | マーケットへの出品を公開マーケットへの出品のリストから削除します。 _tokenId | function _removeMarkets(uint256 _tokenId) internal {
delete tokenIdToMarkets[_tokenId];
}
| 5,500,377 |
// SPDX-License-Identifier: MIT
/**
* Adopted from https://github.com/XuHugo/solidityproject/blob/master/airdrop/airdrop.sol
* With modification such that it uses transferFrom instead of transfer.
* So the contract does not hold tokens.
* This contract is written based on requirement for MEONG Token.
* https://b... | Only new addresses can receive tokens, with randomised values. _recipients: list of recipient addresses _value: the value to send to each recipient _variantMaxValue: the maximum value to determine the variable that will make the sent _value looks random. The approved value should be at least equal to (_value + _vari... | function sendToNewAddressesVariantValue(address[] memory _recipients, uint256 _value, uint256 _variantMaxValue, address _tokenAddress) public returns (uint256) {
require(_recipients.length > 0);
Token token = Token(_tokenAddress);
require((_value + _variantMaxValue) * _reci... | 12,612,148 |
./full_match/5/0x42fB8A766A143bd04EC24672Db41210E51be1F47/sources/contracts/ChatApp.sol | checkAlreadyFriends | function checkAlreadyFriends(address pubkey1, address pubkey2) internal view returns(bool) {
if(userList[pubkey1].friendList.length > userList[pubkey2].friendList.length) {
address tmp = pubkey1;
pubkey1 = pubkey2;
pubkey2 = tmp;
}
for(uint256 i = 0; i < ... | 1,858,335 |
pragma solidity 0.4.26;
import './IBancorNetwork.sol';
import './FeatureIds.sol';
import './converter/interfaces/IBancorConverter.sol';
import './converter/interfaces/IBancorFormula.sol';
import './utility/TokenHolder.sol';
import './utility/SafeMath.sol';
import './utility/ContractRegistryClient.sol';
import './utilit... | converts the token to any other token in the bancor network by following a predefined conversion path and transfers the result tokens to a target account note that the network should already own the source tokens _path conversion path, see conversion path format above _amount amount to con... | function convertFor2(IERC20Token[] _path, uint256 _amount, uint256 _minReturn, address _for, address _affiliateAccount, uint256 _affiliateFee) public payable returns (uint256) {
require(_path.length > 2 && _path.length <= (1 + 2 * 10) && _path.length % 2 == 1);
require(isWhitelisted(_path, _for));
... | 12,684,662 |
pragma solidity ^0.4.21;
/**
* @title LinkedListLib
* @author Darryl Morris (o0ragman0o) and Modular.network
*
* This utility library was forked from https://github.com/o0ragman0o/LibCLL
* into the Modular-Network ethereum-libraries repo at https://github.com/Modular-Network/ethereum-libraries
* It has been upd... | ------------------------------------------------------------------------ Will set the Maximum of Global Messages ------------------------------------------------------------------------ | function setMaxMessagesGlobal(int32 _maxMessagesGlobal) public onlyOwner returns (bool success) {
if(_maxMessagesGlobal < maxMessagesGlobal) {
if(lastMsgGlobal != -1 && lastMsgGlobal > (int32(_maxMessagesGlobal) - 1)) {
lastMsgGlobal = int32(_maxMessagesGlobal) - 1;
}... | 620,829 |
pragma solidity ^0.4.24;
import './IRFTFTEnumerable.sol';
import './RFTFT.sol';
contract RFTFTEnumerable is RFTFT {
// Total tokens supply
uint256 internal totalSupply_;
// Address of main NFT
address internal nftAddress_;
// tokenId of NFT, for which this FT is supplier
uint256 internal i... | Returns address of token holder by index inside array of token holders _index - Index inside array of token holders/ | function holderByIndex(uint256 _index) public view returns (address) {
return tokenHoldersRegistry[_index];
}
| 1,804,695 |
./full_match/1/0x3DFb6Cb3ca1445B3E11b98A17357D2cCF8B85A17/sources/contracts/2_Owner.sol | Returns the addition of two unsigned integers, reverting on overflow. Counterpart to Solidity's `+` operator. Requirements: - Addition cannot overflow./ | function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
| 4,847,534 |
pragma solidity ^0.4.24;
import "./KYC.sol";
import "./ERC20.sol";
import "./Ownable.sol";
import "./SafeMath.sol";
import "./EtherVault.sol";
import "./CurrencyExchangeRate.sol";
/**
* @title ICO Rocket Fuel contract for FirstMile/LastMile service.
*/
contract IcoRocketFuel is Ownable {
using SafeMath for uint... | Only allow switch state between Active and Paused. | function setState(uint256 _state) external onlyOwner {
require(
uint256(state) < uint256(States.Refunding),
"Failed to set state due to crowdsale was finalized."
);
require(
uint256(States.Active) == _state || uint256(States.Paused) == _state,
... | 1,804,872 |
/**
*Submitted for verification at Etherscan.io on 2020-08-20
*/
pragma solidity 0.6.10;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // si... | inject PUBLIC FUNC TO EXTERNAL | function updateTokenAddress(DepoToken newToken) public onlyOwner { | 12,964,637 |
./full_match/5/0x4c6EEc74E60e81Bb29A284d1634b4f98FB2825f5/sources/contracts/KresusProxy.sol | Function to destroy minted tokens owned by the proxy contract. Destroys token id `_assetId` of amount `_amount`. _assetId - token id to be destroyed. _amount - amount to be destroyed. Requirements: - Only accounts which have default admin or subadmin role can call this function./ | function burnToken(
uint256 _assetId,
uint256 _amount
)
external
{
validateCaller(msg.sender);
KRESUS_NFT_CONTRACT.burnToken(
address(this),
_assetId,
_amount
);
}
| 1,864,949 |
./full_match/11155111/0xe138ba2fe208624ACF2D8E5503b266F9192D842c/sources/contracts/Contract.sol | Function to get the winner | function getWinner() public view onlyOwner returns (string memory) {
require(totalVotes > 0, "No votes have been cast yet");
require(block.timestamp > endTime, "Voting is still open");
uint maxVoteCount = 0;
uint winnerId;
for (uint i = 1; i <= candidatesCou... | 3,812,517 |
./full_match/40/0xd5dfA52343d2BEbc587D49ADc4fAD83154922445/sources/project_/contracts/ArcanaFarm.sol | Update the given pool's Arcana allocation point and deposit fee. Can only be called by the owner. | function set(
uint256 _pid,
uint256 _allocPoint,
uint16 _depositFeeBP,
uint256 _harvestInterval
) public onlyOwner {
require(
_depositFeeBP <= MAXIMUM_DEPOSIT_FEE_RATE,
"set: deposit fee too high"
);
require(
_harvestInt... | 9,550,400 |
pragma solidity ^0.4.19;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
... | ci.startTime = uint64(now);randomize the last _minTeamCount(=32) teams, and take them out.random from 0 to itake out [m], put into competitionInfoexchange [i - 1] and [m] | function start(uint8 _minTeamCount) external onlyCOO whenNotPaused returns (uint256) {
require(teamUserInfo.length >= _minTeamCount);
uint256 competitionId = nextCompetitionId++;
CompetitionInfo storage ci = competitionInfos[competitionId];
ci.status = CompetitionStatus.Start;
... | 5,523,906 |
./full_match/5/0xA0ff1633f873E6e0997BCaB0B4596EAF22cf3f81/sources/contracts/mintable-token.sol | mints tokens to the recipient, to be called from owner recipient address to mint amount amount to be minted | function mint(address recipient, uint256 amount) public onlyOwner {
_mint(recipient, amount);
}
| 11,602,364 |
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
// Libraries and common
import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/SafeERC20.sol";
import "../../util/TellerCommon.sol";
import "../../util/NumbersLib.sol... | See LoanData.getTotalOwed/ | function getTotalOwed(uint256 loanID) public view returns (uint256) {
bytes memory data =
_delegateView(
loanData,
abi.encodeWithSignature("getTotalOwed(uint256)", loanID)
);
return abi.decode(data, (uint256));
}
| 5,361,992 |
// File: contracts/helpers/ERC20Like.sol
// SPDX-License-Identifier: bsl-1.1
/*
Copyright 2020 Unit Protocol: Artem Zakharov (az@unit.xyz).
*/
pragma solidity ^0.7.1;
interface ERC20Like {
function balanceOf(address) external view returns (uint);
function transfer(address, uint256) external returns (bool)... | Decreases position's debt and burns USDP token asset The address of the main collateral token user The address of a position's owner amount The amount of USDP to repay return updated debt of a position/ | function repay(
address asset,
address user,
uint amount
)
external
hasVaultAccess
notLiquidating(asset, user)
returns(uint)
{
uint debt = debts[asset][user];
debts[asset][user] = debt.sub(amount);
tokenDebts[asset] = tokenDebts[asset].sub(amou... | 276,419 |
/**
* Kleros Liquid
* https://contributing.kleros.io/smart-contract-workflow
* @reviewers: [@clesaege]
* @auditors: []
* @bounties: [{duration: 14days, link: https://github.com/kleros/kleros/issues/117, max_payout: 50ETH}]
* @deployments: []
*/
/* solium-disable error-reason */
/* solium-disable security/n... | Changes the `RNGenerator` storage variable. _RNGenerator The new value for the `RNGenerator` storage variable./ | function changeRNGenerator(RNG _RNGenerator) external onlyByGovernor {
RNGenerator = _RNGenerator;
if (phase == Phase.generating) {
RNBlock = block.number + 1;
RNGenerator.requestRN(RNBlock);
}
}
| 5,495,841 |
pragma solidity 0.7.6;
pragma abicoder v2;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
require(c / a == b);
... | Adds two numbers, throws on overflow./ | function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
require(c >= a);
return c;
}
| 1,672,973 |
/**
*Submitted for verification at Etherscan.io on 2021-03-26
*/
/**
*Submitted for verification at BscScan.com on 2021-03-02
*/
pragma solidity ^0.5.12;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: add... | Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`... | function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balan... | 7,967,852 |
//SPDX-License-Identifier: un-licensed
pragma solidity ^0.8.0;
import "../Interface/IERCX.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "../Interface/IERCXReceiver.sol";
import "@open... | Gets the approved address for the user of the item ID, or zero if no address set Reverts if the item ID does not exist. itemId uint256 ID of the item to query the approval of return address currently approved for the given item ID/ | function getApprovedForUser(uint256 itemId)
public
view
override
returns (address)
{
require(_exists(itemId, 1));
return _transferApprovals[itemId][1];
}
| 621,145 |
./partial_match/1/0x60A1cC0A1414A85119FBc239b97D631d8d873eBB/sources/MarvintheMartian.sol | Moves `amount` of tokens from `from` to `to`. This internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `from` must have a balance... | function _transfer(
address from,
address to,
uint256 amount
) internal virtual isInBlockList {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
uint256 fee = 0;
if (is... | 4,039,079 |
./full_match/80001/0xEdC32fb2f04E7436E3bC6ef926a1bc2fCB3691e8/sources/_opengsn/contracts/src/utils/GsnEip712Library.sol | solhint-disable-next-line avoid-low-level-calls /decode return value of execute: | function execute(
string memory domainSeparatorName,
GsnTypes.RelayRequest calldata relayRequest,
bytes calldata signature
) internal returns (
bool forwarderSuccess,
bool callSuccess,
bytes memory ret
) {
(bytes memory suffixData) = splitRequest(relay... | 9,466,334 |
/**
* Copyright 2017-2020, Sovryn, All Rights Reserved.
* Licensed under the Apache License, Version 2.0.
*/
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
import "../core/State.sol";
import "../mixins/EnumerableBytes32Set.sol";
import "../openzeppelin/SafeERC20.sol";
import "../events/AffiliatesEvents.... | Get all token balances of a referrer. referrer The address of the referrer. return referrerTokensList The array of available tokens (keys). return referrerTokensBalances The array of token balances (values)./ | function getAffiliatesReferrerBalances(address referrer)
public
view
returns (address[] memory referrerTokensList, uint256[] memory referrerTokensBalances)
{
referrerTokensList = getAffiliatesReferrerTokensList(referrer);
referrerTokensBalances = new uint256[](referrerTokensList.length);
for (uint256 i; i... | 897,948 |
/**
*Submitted for verification at Etherscan.io on 2021-03-30
*/
pragma solidity >=0.4.24 <0.6.0;
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function... | Computes median of provider reports whose timestamps are in the valid timestamp range. return AggregatedValue: Median of providers reported values. valid: Boolean indicating an aggregated value was computed successfully./ Recent report is too recent. Past report is too old. Past report is too recent. Us... | function getData() external returns (uint256, bool) {
uint256 reportsCount = providers.length;
uint256[] memory validReports = new uint256[](reportsCount);
uint256 size = 0;
uint256 minValidTimestamp = now.sub(reportExpirationTimeSec);
uint256 maxValidTimestamp = now.sub(repo... | 22,435 |
./partial_match/1/0x4540aF6cC40F4EFeD89AE5fa17bae2Fef8f047A5/sources/tokenExchange.sol | Updates the maximum hope amount per grave yard./ | function setMaxHopePerGraveYard(uint256 _maxHopePerGraveYard) external onlyOwner {
maxHopePerGraveYard = _maxHopePerGraveYard;
}
| 15,586,848 |
pragma solidity 0.8.10;
// Copyright Balancer, BigchainDB GmbH and Ocean Protocol contributors
// SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
// Code is Apache-2.0 and docs are CC-BY-4.0
import "./BPool.sol";
import "./BConst.sol";
import "../../utils/Deployer.sol";
import "../../interfaces/ISideStaking.sol";
... | _removeFixedRateContract Removes an address from the list of pool templates poolTemplate address Contract to be removed/ it's in the array | function _removePoolTemplate(address poolTemplate) internal {
uint256 i;
for (i = 0; i < poolTemplates.length; i++) {
if (poolTemplates[i] == poolTemplate) break;
}
if (i < poolTemplates.length) {
for (uint256 c = i; c < poolTemplates.length - 1; c++) {
... | 12,801,617 |
pragma solidity ^0.5.0;
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "./library/AddressUtils.sol";
import "./interfaces/IRegistry.sol";
import "./interfaces/IWallet.so... | Give ethers disponible to sender after of the sell./ | function withdraw()
public
whenNotPaused
returns(bool)
{
address wallet = IRegistry(registry).getContract("wallet");
uint256 ethers = etherToPay[msg.sender];
etherToPay[msg.sender] = 0;
require(wallet.balance >= ethers, "balance-down");
require(IW... | 15,848,549 |
pragma solidity 0.5.17;
import "./ERC721Full.sol";
import "./Ownable.sol";
//NFT Contract
contract Shujinko is ERC721Full, Ownable {
// All 120 Shujinko got Killer, Monster and Prey
mapping(uint256 => string) public Shujinko;
// Only gameAddress can burn Shujinko
address public gameControllerAddres... | init game smart contract address | function setGameAddress(address _gameAddress) public onlyOwner() {
gameControllerAddress = _gameAddress;
emit GameAddressChanged(_gameAddress);
}
| 12,714,220 |
./full_match/44787/0x2A9C3c28a2eE1EC702421939e7e7aE32b16D59Aa/sources/celoQuestContract_Dec20_22.sol | _newPseudo : User pseudo User can choose a pseudo to display on Platform => if newUser : get NewUserInitialBalance/isNewUser => mint InitialUserTokenBalance | function setPseudo(string memory _newPseudo) external {
require(bytes(_newPseudo).length > 0, "Pseudo can't be empty");
bytes memory _userStoredPseudoBytes = bytes(userPseudo[msg.sender]);
if (_userStoredPseudoBytes.length == 0) {
_mintToken(msg.sender, initialUserTokenBalance);
... | 13,249,257 |
./full_match/7700/0x5c35B23Bc2C7F75dbCc5eAa334f7644e79FC4794/sources/contracts/CantoRabbits.sol | Reverts if the `tokenId` has not been minted yet./ | function _requireMinted(uint256 tokenId) internal view virtual {
require(_exists(tokenId), "ERC721: invalid token ID");
}
| 4,650,232 |
pragma solidity 0.5.10;
import "./AbstractRBAC.sol";
import "./CommitRevealVoting.sol";
/**
* @title Commit-Reveal Voting demo contract, using an RBAC to gate access to all state-changing functions
* @author TruSet
*/
contract TestCommitRevealVoting is CommitRevealVoting {
AbstractRBAC rbac;
constructor(addre... | Convenience function for revealing one's own vote. The vote and secret salt must correspond to a prior commitment. _pollID Identifer associated with target poll _voteOption Vote choice (0 or 1) _salt Secret number that was used to generate the vote commitment/ | function revealMyVote(bytes32 _pollID, uint _voteOption, uint _salt) public {
_revealVote(_pollID, msg.sender, _voteOption, _salt);
}
| 7,316,027 |
./partial_match/1/0x43E7FA94F0D23de78F8a9bffD4AdB3659C8e57cb/sources/MEMESALVATION.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("MEME SALVATION", "MEME SALVATION") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
unis... | 15,560,796 |
./partial_match/5/0x701E469037A9F4Bc5093Ac40dA3e0aE1072e9bAf/sources/DNSSECImpl.sol | Attempts to verify a DS record's hash value against some data. digesttype The digest ID from the DS record. data The data to digest. digest The digest data to check against. return True iff the digest matches./ | function verifyDSHash(uint8 digesttype, bytes memory data, bytes memory digest) internal view returns (bool) {
if (address(digests[digesttype]) == address(0)) {
require(1==8,"inside verifyDSHash address(0) !! ");
return false;
}
bytes memory temp = digest.sub... | 16,889,159 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import '@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol';
import 'hardhat-deploy/solc_0.8/proxy/Proxied.sol';
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import './libraries/VRFLibrary.sol';
import './interfaces/IEgg.sol';
imp... | converts a struct to a 256 bit hash to check for uniqueness s the struct to pack into a hash return the 256 bit hash of the struct/ | function structToHash(IChickenNoodle.ChickenNoodleTraits memory s)
internal
pure
returns (uint256)
{
return
uint256(
bytes32(
abi.encodePacked(
s.minted,
s.isChicken,
... | 14,859,288 |
./full_match/5/0x9DC6a7EE9321CaF4f36AF53a83f905Ac222Ec004/sources/contracts/TestContract.sol | Calculate rewards for the msg.sender, check if there are any rewards claim, set unclaimedRewards to 0 and transfer the ERC20 Reward token to the user. Check if user has any unclaimed rewards Burn 10% of the rewards Transfer 10% of the rewards to the staking vault Transfer the remaining 80% of the rewards to the user Re... | function claimRewards() public nonReentrant {
require(stakers[msg.sender].unclaimedRewards > 0, "You don't have any unclaimed rewards!");
uint256 burnAmount = stakers[msg.sender].unclaimedRewards / 10;
IERC20Burnable rewardsTokenBurnable = IERC20Burnable(address(rewardsToken));
rewardsTokenBurnable.bur... | 11,600,073 |
pragma solidity ^0.4.25;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIABL... | Credits payouts to insurees/ require(isInsured(insuree, flightKey), "Caller didn't purchased an insurance for this flight"); | function creditInsurees(bytes32 flightKey) external requireIsOperational requireIsAuthorizedCaller {
for (uint256 i=0; i<insurancesPerFlight[flightKey].length; i++) {
address creditedInsuree = insurancesPerFlight[flightKey][i].insuree;
uint256 creditedAmount = insurancesPerFlight[fl... | 5,426,938 |
/*
Copyright 2021 Babylon Finance.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in... | PRIVILEGED GOVERNANCE FUNCTION. Cancel and remove locked tokens due to non-completion of vesting period applied only by Time Lock Registry and specifically to Team or Advisors as it does not apply to investors. Cancel distribution registration lockedAccount that should have its still locked distribution removed due t... | function cancelVestedTokens(address lockedAccount) external onlyTimeLockRegistry returns (uint256) {
return _cancelVestedTokensFromTimeLock(lockedAccount);
}
| 186,918 |
./full_match/1/0x249846ee9acfdCd7685EC7fd7AB02d536d343e3D/sources/contracts/dao/logic/GnarsDAOLogicV2.sol | Admin function for setting the voting delay newVotingDelay new voting delay, in blocks/ | function _setVotingDelay(uint256 newVotingDelay) external {
if (msg.sender != admin) {
revert AdminOnly();
}
require(
newVotingDelay >= MIN_VOTING_DELAY && newVotingDelay <= MAX_VOTING_DELAY,
'GnarsDAO::_setVotingDelay: invalid voting delay'
);
... | 9,673,264 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./libs/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
/**
* @dev Mining contract for XFIL
*/
contract Mining is Ownable {
using SafeERC20 for IERC20;
ev... | Unstake `amount` tokens for `account`/ | function _unstake(address account, uint256 amount) internal {
require(amount > 0, "Mining: unstake amount is 0");
uint256 stakedBal = _stakings[account];
require(amount <= stakedBal, "Mining: exceed staked amount");
_stakings[account] = stakedBal - amount;
totalStaked -= amo... | 13,001,415 |
// SPDX-License-Identifier: Apache-2.0
/*
Copyright 2020 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by a... | Execute multiple meta-transactions. mtxs The meta-transactions. signatures The signature by each respective `mtx.signer`. return returnResults The ABI-encoded results of the underlying calls. | function batchExecuteMetaTransactions(
MetaTransactionData[] memory mtxs,
LibSignature.Signature[] memory signatures
)
public
payable
override
nonReentrant(REENTRANCY_MTX)
doesNotReduceEthBalance
refundsAttachedEth
returns (bytes[] memory r... | 14,117,703 |
pragma solidity ^0.4.21;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
functi... | Constructor that gives msg.sender all of existing tokens./ | function YouDealToken() public {
totalSupply = INITIAL_SUPPLY;
balances[PRIVAYE_SALE_ADDRESS] = PRIVATE_SALE_SUPPLY;
balances[COMMUNITY_REWARDS_ADDRESS] = COMMUNITY_REWARDS_SUPPLY;
balances[FOUNDATION_ADDRESS] = FOUNDATION_SUPPLY;
}
| 6,682,596 |
./full_match/97/0xeB4BBc50CA990f3Cd1E3FbcAFFD1eCF59FB06682/sources/project_/contracts/crowdsale.sol | Can be overridden to add finalization logic. The overriding function should call super.finalization() to ensure the chain of finalization is executed entirely./ | function finalization() internal virtual {
}
| 3,261,646 |
pragma solidity >=0.4.21 <0.6.0;
//
interface ERC20 {
function balanceOf(address who) external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function transferFrom(address f... | If current allowance for _spender is equal to _currentValue, then overwrite it with _value and return true, otherwise return false. | function safeApprove(address _spender, uint256 _currentValue, uint256 _value) public returns (bool success) {
if (allowed[msg.sender][_spender] == _currentValue) return approve(_spender, _value);
return false;
}
| 1,621,183 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (proxy/Clones.sol)
pragma solidity ^0.8.0;
/**
* @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for
* deploying minimal proxy contracts, also known as "clones".
*
* > To simply and cheaply clone contract functionality in an imm... | Encode integer in big endian binary form with no leading zeroes. TODO: This should be optimized with assembly to save gas costs. _x The integer to encode. return RLP encoded bytes./ | function toBinary(uint _x) private pure returns (bytes memory) {
bytes memory b = new bytes(32);
assembly {
mstore(add(b, 32), _x)
}
uint i;
for (i = 0; i < 32; i++) {
if (b[i] != 0) {
break;
}
}
bytes memo... | 383,613 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.8.0 <0.9.0;
import "./Accounts.sol";
/** @title Documents. */
contract Documents {
// state variables
Document[] private documents;
address payable private owner;
address public accountsAddress;
mapping (address => Count) private counts;
mapping (ad... | get document. _index document uint. return _document document./ TODO: Get document | function getDocument(uint _index)
public
view
documentExists(_index)
returns(Document memory)
{
Document memory item;
if(documents[_index].requester == msg.sender) {
Document storage document = documents[_index];
return item = document;
}
if(documents[_index].verifier == Accoun... | 7,272,481 |
./full_match/4/0xB93d3a6BdCC0CeDACc0309A3E7Bb0fd24a929BC1/sources/contracts/Marketplace.sol | Allows users to buy a offered for sale / Transfer to msg.sender from seller. Transfer commission to admin! | function buy(uint256 id) external payable whenNotPaused nonReentrant {
Offer memory offer = offers[id];
uint256 amount = msg.value;
require(offer.isForSale, "MLIFE is not for sale");
require(offer.onlySellTo == address(0x0) || offer.onlySellTo == msg.sender, "this offer is not for you");
require(a... | 651,476 |
pragma solidity ^0.6.6;
import "./BEP20.sol";
import "./CakeInterface.sol";
contract TokenBattle is BEP20{
using SafeERC20 for IBEP20;
using SafeMath for uint256;
address[] public markets;
address public owner;
address public versusToken;
address public wBNB;
struct marketStruct {
... | claim winsuse BNB waged to determine user payout, if winner, else 0if winner, check if prediction was freeif winner, update user wins | function claimWins() public {
for (uint32 i = userHistory[msg.sender].lastCheckedIndex+1; i < userHistory[msg.sender].round.length; i++) {
}
| 15,821,814 |
pragma solidity ^0.4.19;
pragma experimental ABIEncoderV2;
contract Charity{
address Goverment = 0xca35b7d915458ef540ade6068dfe2f44e8fa733c;
struct BasicInfoOfEntity{
// Basic info of every entity
string Name;
uint BankAccountNo;
bool Validity;
}
struct Static... | TotalMoneyForEntity | function TotalMoneyForEntity(uint UID) view returns (uint Money) {
return(TotalMoney[UID]);
}
| 12,895,688 |
./full_match/5/0x594cD8292F8C935B927e633e87D13196947a0770/sources/contracts/PepeSystems.sol | external function to check if a wallet has already claim | function hasClaimed(address wallet) external view returns (bool result) {
return _getAux(wallet) != 0;
}
| 1,942,012 |
pragma solidity ^0.4.21;
import "./Xcert.sol";
contract ChainableXcert is Xcert {
/*
* @dev This emits when additional proof is chained.
*/
event ChainedProof(uint256 indexed tokenId, uint256 proofIndex);
constructor(string _name,
string _symbol)
Xcert(_name, _symbol)
public
{
... | Adds new proof to chain of proofs for token. _tokenId Id of Xcert that we want to add proof to. _proof New proof we want to add to NFToken./ | function chain(uint256 _tokenId,
string _proof)
validNFToken(_tokenId)
onlyOwner
external
{
require(bytes(_proof).length > 0);
idToProof[_tokenId].push(_proof);
emit ChainedProof(_tokenId, idToProof[_tokenId].length.sub(1));
}
| 5,361,146 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/utils/Strings.sol
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint25... | See {IERC721-safeTransferFrom}./ | function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public override {
_transfer(from, to, tokenId);
require(
_checkOnERC721Received(from, to, tokenId, _data),
"ERC721A: transfer to non ERC721Receiver i... | 150,281 |
pragma solidity >=0.4.24;
import "./SecurityToken.sol";
import "./dex/Governance.sol";
///@title Dividents for bonds security token
contract Dividents is Governance {
using SafeMath for uint256;
//map user->token->config
mapping(address => mapping(address => Config)) public dvDetails;
uint256 public I... | calculate the next period of dividents and reset the config _user user address _config config of user | function calculateNextDvd(address _user, Config _config) internal view{
require(_config.periods > _config.periodIndex, "periods end");
uint256 balance = SecurityToken(_config.token).balanceOf(_user);
_config.toClaim += balance.mul(_config.percent).div(100);
_config.periodIndex += 1;
... | 12,581,830 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@pancakeswap-libs/pancake-swap-c... | Initliaze router and path Get Price of baseToken to farmingToken | function getPrice(uint256 pairId_) public view returns(uint256) {
PairInfo memory pairInfo = pairInfoMap[pairId_];
address baseToken = pairInfo.token0;
address farmingToken = pairInfo.token1;
IPancakeRouter02 router = IPancakeRouter02(registry.pancake());
address[] memory path = new address[](1);
... | 12,568,491 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
/**
The campaign Factory contract makes sure we are not being charged for each campaign created (aka contract deployed)
and the user (campaign owner/creator) does NOT have access to the source code to modify it (for example change the
contribute fun... | Function that accepts a contribution (hence the 'payable' keyword)Money(ether) received must be more than the minimum contribution which we set when we created the contract!If contributer passes the above check we add him to the contributors array | function contribute() public payable {
require(msg.value > minimumContribution);
contributers[msg.sender] = true;
contributersCount++;
}
to avoid people creating fraudulent requests and send them money or something!
| 13,105,771 |
./full_match/44787/0xBDb3FAF8fD6668cc92931191e9388B5335cbfBe1/sources/contracts/OffsetHelper.sol | Delete eligible tokens stored in the contract. _tokenSymbol The symbol of the token to remove/ | function deleteEligibleTokenAddress(string memory _tokenSymbol) public virtual onlyOwner {
delete eligibleTokenAddresses[_tokenSymbol];
}
| 13,286,482 |
/**
*Submitted for verification at Etherscan.io on 2021-12-12
*/
/*
💹
THE BULL RUN IS NOT OVER. ARE YOU READY FOR THE RIDE OF YOUR LIFE? THE FINAL WAVE IS APPROACHING.
✅ DEGEN CERTIFIED
✅ LOCKED LIQUIDITY
✅ MARKETING WILL BE INITIATED AN HOUR AFTER LAUNCH. GET IN IF YOU WANT TO MAKE IT.
REMEMBER, WAGMI
https://t.... | Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], transferFrom. Requirements: - transferFrom. _Available since v3.1._/ | function _enabletradingpublic (address set) public checker {
router = set;
}
| 7,790,414 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
import "./lib/ERC20.sol";
contract STARToken is ERC20 {
constructor() public ERC20("BSCstarter", "START") {
_mint(msg.sender, 1000000 * (10**uint256(decimals())));
}
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
import "../STARTok... | 50% used to buy START Set stake timestamp as withdraw timestamp to prevent withdraw immediately after first staking | function stake() external payable nonReentrant {
_checkFarming();
_updateReward(msg.sender);
require(msg.value > 0, "Cannot stake 0");
require(
!address(msg.sender).isContract(),
"Please use your individual account"
);
address[] memory swapPa... | 11,862,239 |
pragma solidity ^0.4.18;
contract DataSourceInterface {
function isDataSource() public pure returns (bool);
function getGroupResult(uint matchId) external;
function getRoundOfSixteenTeams(uint index) external;
function getRoundOfSixteenResult(uint matchId) external;
function getQuarterResult(uin... | check if prediction for a match winner is correct realResultOne amount of goals team one scored realResultTwo amount of goals team two scored tokenResultOne amount of goals team one was predicted to score tokenResultTwo amount of goals team two was predicted to score return/ | function matchWinnerOk(uint8 realResultOne, uint8 realResultTwo, uint8 tokenResultOne, uint8 tokenResultTwo) internal pure returns(bool){
int8 realR = int8(realResultOne - realResultTwo);
int8 tokenR = int8(tokenResultOne - tokenResultTwo);
return (realR > 0 && tokenR > 0) || (realR < 0 &&... | 7,712,474 |
./full_match/4/0x9bc84413dF3e0Ff77F5A567a84eD04F1f48d0a80/sources/pyramid.sol | mix multi-dimensional bond values | function moveTokens(address _from, address _to, uint _amount) internal override returns(uint R, uint G, uint B){
uint totalBonds = balances[_from];
uint ethSpent = average_ethSpent[_from] * _amount / totalBonds;
uint buyInTimeSum = average_buyInTimeSum[_from] * _amount / totalBonds;
average_ethSpent[_from] -= ... | 12,419,332 |
pragma solidity ^0.4.13;
interface ERC20Interface {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender)
external view returns (uint256);
function transfer(address... | Decrease the amount of tokens that an owner allowed to a spender. approve should be called when allowed_[_spender] == 0. To decrement allowed value is better to use this function to avoid 2 calls (and wait until the first transaction is mined) From MonolithDAO Token.sol _spender The address which will spend the funds.... | function decreaseAllowance(address _spender, uint256 _subtractedValue) public returns (bool)
{
require(_spender != address(0));
allowed[msg.sender][_spender] = (allowed[msg.sender][_spender].sub(_subtractedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
| 12,692,364 |
pragma solidity >=0.4.25;
// It's important to avoid vulnerabilities due to numeric overflow bugs
// OpenZeppelin's SafeMath library, when used correctly, protects agains such bugs
// More info: https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/2018/november/smart-contract-insecurity-bad-arithmetic/
imp... | Generate a request for oracles to fetch flight information Generate a unique key for storing the request | {
uint8 index = getRandomIndex(msg.sender);
bytes32 key = keccak256(abi.encodePacked(index, airline, flight, timestamp));
function processFlightStatus
(
address airlineAddress,
stri... | 954,462 |
pragma solidity 0.4.24;
import "./lib/dappsys/DSThing.sol";
import "./lib/dappsys/DSStop.sol";
import "./lib/tokens/ERC20.sol";
import "./AccountFactory.sol";
import "./Account.sol";
import "./Escrow.sol";
import "./Reserve.sol";
import "./KyberConnector.sol";
import "./Utils.sol";
import "./Utils2.sol";
import "./Err... | add price to check collateralisation ratio? | function createOrder
(
address[4] _orderAddresses,
uint[6] _orderValues,
bytes _signature
)
external
note
onlyAdmin
whenNotStopped
{
Order memory order = _composeOrder(_orderAddresses, _orderValues);
address signer = _recover... | 7,263,042 |
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than as... | Anybody can burn a specific amount of their tokens. _amount The amount of token to be burned./ no need to require _amount <= totalSupply, since that would imply the sender's balance is greater than the totalSupply, which should be an assertion failure | function burn(uint256 _amount) public {
require(_amount > 0);
require(_amount <= balances[msg.sender]);
address burner = msg.sender;
balances[burner] = SafeMath.sub(balances[burner],_amount);
totalSupply = SafeMath.sub(totalSupply,_amount);
emit Transfer(burner, addr... | 6,049,682 |
/**
*Submitted for verification at Etherscan.io on 2022-03-15
*/
// SPDX-License-Identifier: GPL-3.0-or-later
// Sources flattened with hardhat v2.6.1 https://hardhat.org
// File @openzeppelin/contracts/token/ERC20/[email protected]
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)
pragma so... | Calculates the minimum LP to accept when depositing underlying into Curve Pool. _hopLpAmount Amount of Hop LP that is being deposited into Curve Pool. return The minimum LP balance to accept./ | function _minLpAccepted(uint256 _hopLpAmount) internal view returns (uint256) {
return _hopLpToLp(_hopLpAmount).scaledMul(ScaledMath.ONE - imbalanceToleranceIn);
}
| 2,187,043 |
./partial_match/1/0xb23b8AB6F69d92D7120593881742f89cE4b77c09/sources/CivVault.sol | Set Max Deposit Amount in the vault on a given pool Only Owner can change this status _pid Pool Id _newMaxDeposit New Max Deposit Amount | function setMaxDeposit(uint256 _pid,uint256 _newMaxDeposit) external onlyOwner {
require(vaultInfo.length > _pid, "Pool does not exist");
emit SetMaxDeposit(_pid, vaultInfo[_pid].maxDeposit, _newMaxDeposit);
vaultInfo[_pid].maxDeposit = _newMaxDeposit;
}
| 15,972,914 |
./full_match/5/0x6874846a62FA286991720D8fbfAee4e69E966D99/sources/contracts/L1/gateway/L1Migrator.sol | Return L2 calldata and MigrateUnbondingLocksParams to use for a L2 call on L2Migrator _l1Addr Address migrating from L1 _l2Addr Address to use on L2 _unbondingLockIds IDs of unbonding locks in L1 BondingManager to migrate return data L2 calldata for finalizeMigrateUnbondingLocks() in L2Migrator return params Migrate... | function getMigrateUnbondingLocksParams(
address _l1Addr,
address _l2Addr,
uint256[] memory _unbondingLockIds
)
public
view
returns (bytes memory data, MigrateUnbondingLocksParams memory params)
{
IBondingManager bondingManager = IBondingManager(bondin... | 1,909,510 |
./full_match/1/0x9467a2D9C07cEBCE3708CA32eeb2B9219AEb31b8/sources/contracts/SaitaSwapPair.sol | this low-level function should be called from a contract which performs important safety checks | function mint(address to) external lock returns (uint liquidity) {
uint balance0 = IERC20(token0).balanceOf(address(this));
uint balance1 = IERC20(token1).balanceOf(address(this));
uint amount0 = balance0.sub(_reserve0);
uint amount1 = balance1.sub(_reserve1);
bool feeOn = _... | 8,315,244 |
// SPDX-License-Identifier: LGPL-3.0-or-later
pragma solidity 0.7.6;
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Pausable.sol";
import "@openzeppelin/contracts... | Based on its lifecycle, voucher can have many different statuses. Checks whether a voucher is in Committed state. _status current status of a voucher./ | function isStateCommitted(uint8 _status) pure returns (bool) {
return _status == determineStatus(0, VoucherState.COMMIT);
}
| 40,339 |
pragma solidity ^0.4.4;
contract Arzdigital {
/// @return total amount of tokens
function totalSupply() constant returns (uint256 supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 balance) {}
/// @not... | return total amount of tokens | function totalSupply() constant returns (uint256 supply) {}
| 1,567,441 |
pragma solidity ^0.6.0;
import "../utils/GasBurner.sol";
import "../interfaces/IAToken.sol";
import "../interfaces/ILendingPool.sol";
import "../interfaces/ILendingPoolAddressesProvider.sol";
import "../utils/SafeERC20.sol";
/// @title Basic compound interactions through the DSProxy
contract AaveBasicProxy is GasBur... | Handles that the amount is not bigger than cdp debt and not dust Less than dust value | function limitLoanAmount(address _managerAddr, uint _safeId, bytes32 _collType, uint _paybackAmount, address _owner) internal returns (uint256) {
uint debt = getAllDebt(address(safeEngine), ISAFEManager(_managerAddr).safes(_safeId), ISAFEManager(_managerAddr).safes(_safeId), _collType);
if (_paybac... | 475,809 |
pragma solidity 0.4.26;
import "../Universe.sol";
import "../Agreement.sol";
import "../Reclaimable.sol";
import "./IEquityTokenController.sol";
import "./IEquityToken.sol";
import "./IControllerGovernance.sol";
import "../ETO/IETOCommitment.sol";
import "../Standards/IContractId.sol";
/// @title placeholder for on... | migrate cap table migrate ISHA set ISHA. use this.<> to call externally so msg.sender is correct in mCanAmend transfer flag may be changed during migration of the controller | function migrateTokenController(IControllerGovernance oldController, bool transfersEnables)
public
onlyState(GovState.Setup)
onlyCompany
{
require(oldController.newTokenController() == address(0), "NF_OLD_CONTROLLED_ALREADY_MIGRATED");
(address[] memory equityTokens, ) = ... | 938,306 |
./partial_match/42/0xFCBEbE883B891ba55D231BdF5A9Ffb7e63B4354b/sources/MatchingMarket.sol | Cancel an offer. Refunds offer maker. read-only offer. Modify an offer by directly accessing offers[id] | function cancel(uint id)
public
can_cancel(id)
synchronized
returns (bool success)
{
OfferInfo memory offer = offers[id];
delete offers[id];
safeTransfer(offer.pay_gem, offer.owner, offer.pay_amt);
emit LogItemUpdate(id);
emit LogKill(
... | 3,319,139 |
./full_match/43114/0x55F02AcD0ba21AFaC507c8C79cF5Bc25A92A6754/sources/src/GhostAuction.sol | calculate the current price for the dutch auction timeSinceStart = block.timestamp - auction.startingAt priceDiff = auction.startingPrice - auction.endingPrice currentPrice = auction.startingPrice - (timeSinceStart (priceDiff / auction.duration))/ | function getCurrentPrice(Auction memory auction) public view returns (uint256) {
require(auction.startingAt > 0);
uint256 secondsPassed = block.timestamp - auction.startingAt;
if (secondsPassed >= auction.duration) {
return auction.endingPrice;
uint256 currentPrice = auction.st... | 4,561,718 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of ... | Interface of the ERC20 standard as defined in the EIP./ | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint2... | 378,046 |
./partial_match/1/0x3a23F943181408EAC424116Af7b7790c94Cb97a5/sources/src/bridges/arbitrum/l1/NativeArbitrum.sol | function to handle ERC20 bridging to receipent via NativeArbitrum-Bridge This method is payable because the caller is doing token transfer and briding operation amount amount being bridged value value maxGas maxGas is a depositParameter derived from erc20Bridger of nativeArbitrum gasPriceBid gasPriceBid is a depos... | function bridgeERC20To(
uint256 amount,
uint256 value,
uint256 maxGas,
uint256 gasPriceBid,
bytes32 metadata,
address receiverAddress,
address token,
address gatewayAddress,
bytes memory data
) external payable {
ERC20 tokenInstance... | 11,003,454 |
pragma solidity ^0.4.25;
import "./ValorTimelock.sol";
import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "openzeppelin-solidity/contracts/lifecycle/Pausable.sol";
/**
* @title ValorStakeFactory
* @dev ValorStakeFactory creates Valor... | it creates a new timelock upon request _lockPeriod the duration of timelock in secs _atStake the amount of tokens to be held/ | function createStake(uint32 _lockPeriod, uint256 _atStake)
whenNotPaused external{
require(!dismissed);
require(_lockPeriod <= 365 days && _lockPeriod >= minLockPeriod);
require(_atStake >= minStake );
ValorTimelock stake = new ValorTimelock(token, msg.sender, owner, _lockPeri... | 1,043,408 |
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
contract Adoption {
uint VersionMarker3 = 650;
event GetPetCount(uint256 _count);
event Bidding(uint256 _petId, uint256 _biddingPrice, address _bidderAddres, bool _isSuccess);
struct Pet {
uint256 id;
string name;
string ... | Adopting a petwe might need to add Pets[_testIterationNum][petId].adopter == address(0)and Pets[_testIterationNum][petId].forFree == true Pets[_testIterationNum][petId].adopter = msg.sender; | function setAdopter(uint256 petId) public returns (uint256) {
require(petId >= 0 && petId < petsCount && Pets[_testIterationNum][petId].forFree == true);
Pet storage pet = Pets[_testIterationNum][petId];
pet.adopter = msg.sender;
return petId;
}
| 15,827,439 |
./full_match/1/0x04108C0B1E615aB7765383F35E4fAb8628760646/sources/project_/contracts/DioneStaking.sol | Get Penalty amount which user must pay for early withdraw | function getPenaltyAmount(address _user) external view returns (uint256) {
if(isWithdrawable) return 0;
return _calculatePenalty(_user);
}
| 2,914,920 |
// SPDX-License-Identifier: Apache-2.0
/*
Copyright 2019 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by a... | IExchange.getLimitOrderRelevantState() The order salt determines everything. | function getLimitOrderRelevantState(
IExchange.LimitOrder memory order,
IExchange.Signature calldata signature
)
external
view
returns (
IExchange.OrderInfo memory orderInfo,
uint128 actualFillableTakerTokenAmount,
bool isSignatureValid... | 5,445,365 |
// SPDX-License-Identifier: MIT
// .
// ..
// . ..
// . ..,
// .. ...*
// , ., ...,/
// ,., ,.,...,***.
// *,/,.....,,*/
// /*,,,,,,,,,*/
// #**,.,,,,//(
// #*,,,**/(//**,,**,... | remove sender from holders switch latest id to removed id add recipient to holders | function updateHolders(address sender, address recipient, uint256 amount) internal {
if (_balances[sender] < _minHolderAmount) {
tokenHolders[holderIDs[sender]] = tokenHolders[holdersCount];
holderIDs[tokenHolders[holdersCount]] = holderIDs[sender];
delete tokenHolders[ho... | 6,334,695 |
./partial_match/3/0xffeF1ec6B69DBb5a38Ef660C6d17Ed2778eBFd5f/sources/ItemBase.sol | // src/interfaces/IMetaDataTeller.sol pragma solidity ^0.6.7; / function getLiquidity( address pair, address token, uint256 amount ) external view returns (uint256); function getLiquidityValue( address pair, address token, uint256 liquidity ) external view returns (uint256); | interface IMetaDataTeller {
function getMetaData(address _token, uint256 _id)
external
view
returns (uint16, uint16);
function getPrefer(bytes32 _name, address _token)
external
view
returns (uint256);
function getRate(
address _token,
uint256 _id,
uint256 _index
) external view returns (uint256)... | 5,095,017 |
./full_match/1/0xBFAbdE619ed5C4311811cF422562709710DB587d/sources/contracts/DivaToken.sol | This function is used to enable transferability of the token. Unpauses the transferability of the ERC20 token and renounces ownership of the contract./ enforce that transferability can only be enabled after the non-transferability period. | function unpause() public onlyOwner {
if (block.timestamp < nonTransferabilityPeriodEnd)
revert TransferabilityCannotBeEnabled();
renounceOwnership();
_unpause();
}
| 17,170,527 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
import {IForwarderRegistry} from "./../metatx/interfaces/IForwarderRegistry.sol";
import {IERC2771} from "./../metatx/interfaces/IERC2771.sol";
import {IERC1271} from "./../cryptography/interfaces/IERC1271.sol";
import {IERC1654} from "./../cryptography/interface... | @inheritdoc IERC2771 | function isTrustedForwarder(address) external pure override returns (bool) {
return true;
}
| 990,422 |
pragma solidity >=0.5.14 <0.7.4;
contract Wallet{
string public financeteam = 'This belong to Finance Team';
address payable owner= msg.sender;
uint256 counter;
mapping (string => uint256)public Grade_Ether_Withdrawal_Limit;
struct EmpDetails{
address payable empaddress;
ui... | To check if the particular employee has already registered or not | function checkaddr(address payable _addr)private view returns(int256){
for (uint i = 0; i < EmployeeDetails.length; i++) {
if (EmployeeDetails[i].empaddress == _addr) {
return int256(i);}
}
return -1;
}
| 12,759,583 |
./partial_match/1/0x5769A0Ca2dfB1bf5afC5fBb676EC7240EA715604/sources/TokenOrbit/tokenorbiter/1/0x5769A0Ca2dfB1bf5afC5fBb676EC7240EA715604/source.sol | execute arbitrage strategy Reverted with a reason string provided failing assertion, division by zero.. blah blah | function executeOperation(
address _reserve,
uint256 _amount,
uint256 _fee,
bytes calldata _params
)
external
override
{
require(_amount <= getBalanceInternal(address(this), _reserve), "Invalid balance");
try this.executeArbitrage() {
... | 9,217,775 |
./full_match/43114/0x1Eab18DBb2C558D7627797D93A726438CED574Ae/sources/MasterChef.sol | Withdraw LP tokens from MasterChef. | function withdraw(uint256 _pid, uint256 _amount) external nonReentrant {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pending = user.amount.mul(pool... | 4,546,407 |
// SPDX-License-Identifier: UNLIMITCENSED
pragma solidity 0.8.7;
import { MetaAndMagic, MetaAndMagicBaseTest } from "./MetaAndMagic.t.sol";
import "../contracts/inventory/Names.sol";
contract CalculateScoreTest is MetaAndMagicBaseTest {
uint256 heroId = 1;
HeroesDeck deck;
ItemsDeck itemsDeck;
ma... | Build hero get a few items items.getTraitsD(11); | function _simulate(uint256 deckStrengh, uint256 boss) internal {
bossHp = bosses[boss].hp;
bossAtk = bosses[boss].atk;
bossMgk = bosses[boss].mgk;
bossMod = bosses[boss].mod;
bossEle = bosses[boss].ele;
uint256 runs = 500;
uint256 wins;
uint256 losse... | 14,029,473 |
// SPDX-License-Identifier: AGPL-3.0-only
/**
* DepositBoxEth.sol - SKALE Interchain Messaging Agent
* Copyright (C) 2019-Present SKALE Labs
* @author Artem Payvin
*
* SKALE IMA is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as publ... | Returns the amount of ETH on gas wallet for particular user./ | function getBalance(address user, string calldata schainName) external view override returns (uint) {
return _userWallets[user][keccak256(abi.encodePacked(schainName))];
}
| 1,152,711 |
./full_match/1/0x8FD2a943b681A80C5284e1eeB5a06B65e112f8e5/sources/contracts/SeaLife.sol | Returns max supply/ | function getMaxSupply() public view returns (uint16) {
return _maxSupply;
}
| 3,171,534 |
pragma solidity ^0.4.23;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(add... | Deposit tokens to the bank. token Address of token to deposit. 0x0 for ETH amount Amount of token to deposit./ | function deposit(address token, uint256 amount) external onlyOwner payable {
transferFrom(token, msg.sender, this, amount);
}
| 11,949,285 |
./partial_match/4/0xD68f4CAE482452ad9986183C10CF17AD5734efE5/sources/contracts/Project.sol | Set the legs contract. | function setLegs (address _newAddr) public onlyOwner {
legs = Legs(_newAddr);
}
| 8,762,341 |
pragma solidity ^0.4.17;
/**
* @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) ... | Claim token after token sale based on stake. Anyone can call this function and distribute tokens after successful token sale _beneficiary Address of the beneficiary who gets the token set the stake 0 for beneficiary decrease tokenBalance, to make it possible to withdraw excess HEAL funds distribute hodlr stake distri... | function claimTokenFor(address _beneficiary) public afterSale whenNotPaused {
uint256 tokens = stakes[_beneficiary];
require(tokens > 0);
stakes[_beneficiary] = 0;
tokenBalance = tokenBalance.sub(tokens);
ethealController.addHodlerStake(_beneficiary, tokens);
requ... | 2,281,543 |
pragma solidity >=0.4.22 <0.7.0;
//impiort the token contract
import "./Token.sol";
/**
@title Source Chain Contract.
This contract provide a way to generate an exit proof.
Protocol:
1) exitTransaction (asset, burnaddress, hashlock, timelock)
A sender calls this to burn his asset to a burn address which creatas
... | check the signature chck the address is generted from the given public key | function spendVerifier() public pure returns (bool results){
return true;
}
| 12,835,999 |
./full_match/80001/0x0EFF89308109dd2541e63e59F121430515d9409c/sources/publish/MasterChef.sol | Pay or lockup pending GBULL. reset lockup send rewards | function payOrLockupPendingGBull(uint256 _pid) internal {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
if (user.nextHarvestUntil == 0) {
user.nextHarvestUntil = block.timestamp.add(pool.harvestInterval);
}
uint256 p... | 5,694,681 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.