file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./full_match/1/0xEaaDA2523091827bF1318A2E80c3176d9305d07A/sources/contracts/TruthGPT.sol | Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but also transferring `value` wei to `target`. Requirements: - the calling contract must have an ETH balance of at least `value`. - the called Solidity function must be `payable`. _Available since v3.1._/ | function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, 'Address: low-level call with value failed');
}
| 9,644,656 |
pragma solidity ^0.4.24;
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() public { owner = msg.sender; }
modifier onlyOwner() {
address sender = msg.sender;
address _owner = owner;
require(msg.... | this method requires that you must have called etherInUSD earliar, must not be called except when round is ending. | function updateRateInWei() internal { | 62,882 |
./full_match/83/0x70d77fB99b9C7b3E41B2424e9Dcc898d49edbb4c/sources/contracts/CToken.sol | Applies accrued interest to total borrows and reserves This calculates interest accrued from the last checkpointed block up to the current block and writes new checkpoint to storage./ Remember the initial block number / Short-circuit accumulating 0 interest / | function accrueInterest() public returns (uint) {
uint currentBlockNumber = getBlockNumber();
uint accrualBlockNumberPrior = accrualBlockNumber;
if (accrualBlockNumberPrior == currentBlockNumber) {
return uint(Error.NO_ERROR);
}
uint borrowsPrior = totalBorrows;... | 9,557,514 |
pragma solidity ^0.5.0;
contract Ethreon123 {
// The general structure for a user
struct People {
string name;
address owner;
}
// Mapping to get User ID given the public address
mapping (address => uint) getUserId;
// Mapping to get all the Creator ID's patron has subscribed... | Function to get total number of patrons a creator has been subscribed by | function getSubscriberCount() public view returns (uint) {
require(getCreatorId[msg.sender] != 0, "Please register first!");
uint cid = getCreatorId[msg.sender];
return getSubscribers[cid].length;
}
| 2,509,174 |
pragma solidity ^0.4.23;
// @title iNovaStaking
// @dev The interface for cross-contract calls to the Nova Staking contract
// @author Dragon Foundry (https://www.nvt.gg)
// (c) 2018 Dragon Foundry LLC. All Rights Reserved. This code is not open source.
contract iNovaStaking {
function balanceOf(address _owner... | Adds an address as an admin for a game Can only be called by an admin of the game Operator privileges are managed on the layer 2 network _game - the gameId of the game _account - the address of the user to _isOperator - "true" to grant operator privileges, "false" to remove them | function setOperatorPrivileges(uint _game, address _account, bool _isOperator)
external
onlyGameAdmin(_game)
{
emit OperatorPrivilegesChanged(_game, _account, _isOperator);
}
| 7,873,505 |
./full_match/11155111/0xCb6529d9aa290Cae0aeb96f0ccCCf09b6f61024A/sources/contracts/Contract.sol | Public access functions | function getNotAsserted() public view returns (uint256[] memory) {
return notAsserted;
}
| 3,818,163 |
./full_match/5/0x6fdC2C8237B7252B69810CBC902dCB42903A64E9/sources/project_/contracts/PaymentSplitter.sol | calculating sum of all shares | function __PaymentSplitter_init_unchained(
address[] memory payees,
uint256[] memory shares_
) internal {
require(
payees.length == shares_.length,
"PaymentSplitter: payees and shares length mismatch"
);
require(payees.length > 0, "PaymentSplitter:... | 11,592,283 |
./full_match/80001/0xeb70EaC1371Ef898AC2781D7168c0d5A11da10cf/sources/contracts/trove-factory.sol | creates a trove if the token is supported _token any supported token address/ troves can only be created after the token owner has been set. This is a safety check not security a token without a price feed has a CR of zero and is useless trove.initialize(address(this), _token, msg.sender);allow the trove to transfe... | function createTrove(address _token) public override returns (ITrove trove) {
IMintableTokenOwner tokenOwner_cached = tokenOwner;
require(address(tokenOwner_cached) != address(0x0), "66c10 the token owner must be set");
require(tokenOwner_cached.owner() == address(this), "66c10 the token owner's owner mus... | 9,539,838 |
./full_match/4/0x25642a458ef3D0F4403A037e93B02E63A0C9DcD7/sources/browser/pxt_v1.sol | add the deposited tokens into existing balance transfer the tokens from the sender to this contract | function DepositRewardsPool(uint tokens) external {
require(token.balanceOf(msg.sender) >= tokens);
token_staking_rewards_pool = token_staking_rewards_pool + tokens;
require(token.transferFrom(msg.sender, address(this), tokens));
}
| 821,277 |
./full_match/80001/0x9C9d843EBbb9Ba67C716695C77133213F4B7a87E/sources/contracts/Cattle.sol | Make sure that Only users with the Minter Role can Mint these Cattle Genesis NFTs./ | function _canMint() internal view override returns (bool) {
return hasRole(MINTER_ROLE, msg.sender);
}
| 5,592,909 |
pragma solidity ^0.5.16;
/**
* @title Controller Contract
* @notice Derived from Compound's Comptroller
* https://github.com/compound-finance/compound-protocol/tree/master/contracts
*/
/**
* @title Careful Math
* @notice Derived from OpenZeppelin's SafeMath library
* https://github.com/OpenZeppe... | Return the address of the Artem token return The address of Artem/ | function getArtemAddress() public view returns (address) {
return 0x77dF79539083DCd4a8898dbA296d899aFef20067;
}
| 7,696,170 |
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
// Part: BalancerMathLib
library BalancerMathLib {
uint public constant BONE = 10 ** 18;
uint public constant MIN_BPOW_BASE = 1 wei;
uint public constant MAX_BPOW_BASE = (2 * BONE) - 1 wei;
uint public co... | sell reward and distribute evenly to each provider TODO migrate to ySwapper when ready | function sellRewards() public onlyAllowed {
uint _rewards = balanceOfReward();
if (_rewards > 0) {
uint rewardsA = _rewards.mul(currentWeightA()).div(1e18);
uint rewardsB = _rewards.sub(rewardsA);
_swap(rewardsA, _getPath(reward, tokenA), address(providerA));
... | 1,558,227 |
./partial_match/1/0xBf7Fd29146d50B014879518FBCD567243Ab8b92B/sources/OROCoin.sol | Utility costly function to encode bytes HEX representation as string. sig - signature as bytes32 to represent as string/ | function hexToString (bytes32 sig) internal pure returns (bytes memory) {
bytes memory str = new bytes(64);
for (uint8 i = 0; i < 32; ++i) {
str[2 * i] = byte((uint8(sig[i]) / 16 < 10 ? 48 : 87) + uint8(sig[i]) / 16);
str[2 * i + 1] = byte((uint8(sig[i]) % 16 < 10 ? 48 : 87) ... | 3,642,288 |
/**
*Submitted for verification at Etherscan.io on 2020-09-01
*/
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pur... | deliberately changing function signature to prevent accidental v1 deploy script reuse | function initialize(string name_, string symbol_, address owner_)
public
onlyDeployer
initializer
{
ERC20Detailed.initialize(name_, symbol_, uint8(DECIMALS));
Ownable.initialize(owner_);
rebasePausedDeprecated = false;
tokenPausedDeprecated = false;
... | 6,681,219 |
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... | Calls subscription contract and updated existing parameters If subscription is non existent this will create one _minRatio Minimum ratio below which repay is triggered _maxRatio Maximum ratio after which boost is triggered _optimalRatioBoost Ratio amount which boost should target _optimalRatioRepay Ratio amount wh... | function update(
uint128 _minRatio,
uint128 _maxRatio,
uint128 _optimalRatioBoost,
uint128 _optimalRatioRepay,
bool _boostEnabled
) public {
IAaveSubscription(AAVE_SUBSCRIPTION_ADDRESS).subscribe(_minRatio, _maxRatio, _optimalRatioBoost, _optimalRatioRepay, _boost... | 381,462 |
./full_match/43113/0xcF5eDfF2bF1D2567A494dEbc415d0C2b1Fd20138/sources/contracts/MasterChefCoryV2.sol | Safe cory transfer function, just in case if rounding error causes pool to not have enough Corys. | function safeCoryTransfer(address _to, uint256 _amount) internal {
uint256 coryBal = cory.balanceOf(address(this));
if (_amount > coryBal) {
cory.transfer(_to, coryBal);
cory.transfer(_to, _amount);
}
}
| 7,152,856 |
pragma solidity ^0.4.24;
import "./utl/SafeMath.sol";
/**
* @title A simple implementation of the ERC721 Non-Fungible Token Standard *
* @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
* modified from https://github.com/OpenZeppelin/openzeppelin-solidity/tree/master/contracts/token/... | calls all the internal functions above, to transfer a token from one user to another | function _clearApprovalAndTransfer(address _from, address _to, uint256 _tokenId) internal
{
_clearTokenApproval(_tokenId);
_removeTokenFromOwnersList(_from, _tokenId);
_setTokenOwner(_tokenId, _to);
_addTokenToOwnersList(_to, _tokenId);
}
| 12,616,932 |
pragma solidity >=0.7.2;
pragma experimental ABIEncoderV2;
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address ... | Initializes the OptionVault contract with storage variables. _owner is the owner of the contract who can set the manager _feeRecipient is the recipient address for withdrawal fees. _initCap is the initial vault's cap on deposits, the manager can increase this as necessary. _tokenName is the name of the vault share ... | function initialize(
address _owner,
address _feeRecipient,
uint256 _initCap,
string calldata _tokenName,
string calldata _tokenSymbol
) external initializer {
require(_owner != address(0), "!_owner");
require(_feeRecipient != address(0), "!_feeRecipient")... | 535,951 |
pragma solidity ^0.4.24;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
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;
... | -------------------------------------------------------------------------- Private-------------------------------------------------------------------------- | function updateHashrate(address addr) private
{
PlayerData storage p = players[addr];
uint256 hashrate = 0;
for (uint idx = 0; idx < numberOfMiners; idx++) {
MinerData storage m = minerData[idx];
hashrate = SafeMath.add(hashrate, SafeMath.mul(p.minerCount[idx], m.... | 7,869,610 |
./full_match/999/0x7bD210951EA4df63c35b9c7C09791732d2D89b8d/sources/contracts/GameCore.sol | it will settlement user's vZOO (include game primary) after a game round | function endGame(bytes32 _roundId, uint256 _gameResultAmount, uint256[] calldata _usersResultAmount) external onlyRole(OPERATOR_ROLE) {
GameRoundInfo storage _round = gameRoundInfo[_roundId];
if (_round.status != RoundStatus.STARTED) {
revert GameRoundNotStarted();
}
if (... | 16,369,246 |
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
contract Comment {
struct senders {
mapping(string => address) comment;
}
mapping(uint16 => senders) senderHandler;
mapping(uint16 => string[]) textHandler;
// mapping(uint16 => uint) latestIndex;
uint16[] public hotels;
// c... | constructor(uint16[] memory Hotels) public { hotels = Hotels; for (uint i = 0; i < Hotels.length; i++) { senderHandler[hotels[i]] = senders(); textHandler[hotels[i]] = new string[](1); textHandler[hotels[i]][0] = ""; } } latestIndex[hotel] = 1; | function addComment(uint16 hotel, string memory text) public {
if (!checkHotel(hotel) && !compareString(text, " ")) {
senderHandler[hotel] = senders();
textHandler[hotel] = new string[](1);
hotels.push(hotel);
textHandler[hotel][0] = text;
}
el... | 14,057,447 |
pragma solidity ^0.4.24;
contract CryptoFiat {
address public masterAccount;
modifier onlyMasterAccount {
require(msg.sender == masterAccount);
_ ;
}
// lookup table for finding a particular contract by ID
mapping(uint256 => address) public contractAddress;
mapping(address => ... | designateRecoveryAccount allows msg.sender to specify a trusted account that can recover the tokens | function designateRecoveryAccount(address recoveryAccount) public {
_setRecoveryAccountOf(msg.sender, recoveryAccount);
}
| 5,384,918 |
./partial_match/4/0xC8ECB5D2a3ee756216b3f151E4531Df2A01aB252/sources/DebaseToken.sol | Decrease the amount of tokens that an owner has allowed to a spender. spender The address which will spend the funds. subtractedValue The amount of tokens to decrease the allowance by./ | function decreaseAllowance(address spender, uint256 subtractedValue)
public
override
returns (bool)
{
require(!transfersPaused || transferPauseExemptList[msg.sender], "paused");
uint256 oldValue = _allowedDEBASE[msg.sender][spender];
if (subtractedValue >= oldVal... | 8,545,495 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
import "./Account.sol";
/**
* @title Account controller
*
* @dev Contract module which provides Account deployment mechanism
*
* @author Stanisław Głogowski <stan@pillarproject.io>
*/
contract AccountController {
address public accountRegistry;
addre... | Computes account CREATE2 address salt CREATE2 salt return account address/ | function _computeAccountAddress(
bytes32 salt
)
internal
view
returns (address)
{
bytes memory creationCode = abi.encodePacked(
type(Account).creationCode,
bytes12(0),
accountRegistry,
bytes12(0),
accountImplementation
);
bytes32 data = keccak256(
a... | 12,935,955 |
./full_match/1/0x91a15dA166c868aDFEbA188Fff314aC25a82a64D/sources/src/fighter/FighterTraits.sol | The original approach used an unstable sort as part of the weighted random selection via https:github.com/mroth/weightedrand. We avoid re-implementing Go's unstable sort here and just hardcode the resulting order of the items. The inlined bin lookup was generated with the `resource/inline-trait-selection` script. | function pickClass(int32 pick) internal pure returns (uint8 id) {
if (40 < pick) {
if (60 < pick) {
revert ValueOutOfBounds();
if (50 < pick) {
return (5);
return (4);
}
}
if (20 < pic... | 8,307,193 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol";
import "../../external/ERC1155PresetPauserUpgradeable.sol";
import "../../interfaces/IUniqueIdentity.sol";
/**
* @title UniqueIdentity
* @notice UniqueIdentity is an ERC1155-... | We include a nonce in every hashed message, and increment the nonce as part of a state-changing operation, so as to prevent replay attacks, i.e. the reuse of a signature. | function initialize(address owner, string memory uri) public initializer {
require(owner != address(0), "Owner address cannot be empty");
__ERC1155PresetPauser_init(owner, uri);
__UniqueIdentity_init(owner);
}
| 1,021,454 |
./full_match/1/0x4A4C3c1272A991f445173D4626Ae7E726571df1C/sources/browser/contracts/Offset.sol | Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is forwarded in {IERC721Receiver-onERC721Received} to contract recipients./ guard against re-entrancy attack in mint | function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
re... | 9,708,596 |
pragma solidity 0.5.14;
import "@openzeppelin/upgrades/contracts/Initializable.sol";
import "openzeppelin-solidity/contracts/lifecycle/Pausable.sol";
import "openzeppelin-solidity/contracts/access/roles/WhitelistedRole.sol";
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
import "openzeppelin-solidity... | Revoke of the placed vote Requirements: - proposal should exists - proposal should not be in a passed state - proposal should not be cancelled - vote should not been already revoked proposalId Proposal Id/ Exclude vote from the voting results Push tokens to the voter | function revokeVote(uint256 proposalId)
external
proposalExists(proposalId)
notPassed(proposalId)
notCancelled(proposalId)
{
Vote storage existedVote = votings[proposalId]
.votes[votings[proposalId].ids[msg.sender]];
require(!existedVote.revoked, "... | 14,021,380 |
./full_match/80001/0x593c1490121bEF64347dc951633bAA1Dc3526E38/sources/contracts/1_Storage.sol | See {IMarketplace-getTreasuryWallet}./ | function getTreasuryWallet() external view returns (address) {
return address(_treasuryWallet);
}
| 9,471,071 |
./full_match/4/0x5b3560Eddb566386d9b1DF26aC16b37C2fa765b6/sources/minichef.sol | Withdraw without caring about rewards. EMERGENCY ONLY. pid The index of the pool. See `poolInfo`. to Receiver of the LP tokens. | function emergencyWithdraw(uint256 pid, address to) public {
UserInfo storage user = userInfo[pid][msg.sender];
uint256 amount = user.amount;
user.amount = 0;
user.rewardDebt = 0;
IRewarder _rewarder = rewarder[pid];
if (address(_rewarder) != address(0)) {
... | 691,914 |
./full_match/42220/0x0690D67D7Cb8853F08832F05F4a4f8Ad6E674CA3/sources/ERC20CLUBBITCOIN.sol | 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), "BEP20: transfer from the zero address");
require(recipient != address(0), "BEP20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "BEP20: transfer amoun... | 16,359,917 |
pragma solidity ^0.4.21;
/*
from: https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/LICENSE
Parts of this code has been audited by OpenZeppelin and published under MIT Licenses
The MIT License (MIT)
Copyright (c) 2016 Smart Contract Solutions, Inc.
Permission is hereby granted, free of ch... | Function to mint tokens _to The address that will receive the minted tokens. _amount The amount of tokens to mint. return A boolean that indicates if the operation was successful./ | function mint(
address _to,
uint256 _amount
)
hasMintPermission
canMint
public
returns (bool)
{
require(_to != address(0));
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amo... | 13,115,000 |
// to test issue with nodes breaking with large clients over WS
// fixed in web3 with fragmentationThreshold: 8192
pragma solidity ^0.4.17;
contract BigFreakingContract {
event Transfer(address indexed from, address indexed to, uint value);
event Approval( address indexed owner, address indexed spender, uint valu... | TODO: should increase instead | function approve_432(address spender, uint value) public returns (bool ok) {
_approvals[msg.sender][spender] = value;
emit Approval( msg.sender, spender, value );
return true;
}
| 6,454,145 |
pragma solidity 0.4.24;
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "openzeppelin-solidity/contracts/lifecycle/Pausable.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "./IKODAV2.sol";
/**
* Auction interface definition - event and method definitions
*
* https://www... | Look up all the known data about the latest edition bidding round Returns zeros for all values when not valid/ | function auctionDetails(uint256 _editionNumber) public view returns (bool _enabled, address _bidder, uint256 _value, address _controller) {
address highestBidder = editionHighestBid[_editionNumber];
uint256 bidValue = editionBids[_editionNumber][highestBidder];
address controlAddress = editionNumberToArti... | 5,346,472 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, ... | Triggers stopped state. Requirements: - The contract must not be paused./ | function setPaused(bool _pause) public onlyOwner {
_paused = _pause;
if (_paused) {
emit Paused(_msgSender());
emit Unpaused(_msgSender());
}
}
| 11,994,832 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
/**
* Smart Contract that allows sharing of an uri with another address
*/
contract TheShareItNetwork {
address public owner;
event ShareIt(address sender, address receiver, string appId, string shareType, string data);
constructor() public {
... | Share data, emit event/ | function share(address receiver, string memory appId, string memory shareType, string memory data) public {
require(bytes(appId).length > 0);
emit ShareIt(msg.sender, receiver, appId, shareType, data);
}
| 14,052,248 |
./full_match/5/0x76777081471B4bBF2079996BCa68Ed5938bB6D34/sources/project_/contracts/Miragrow.sol | Swap tax token in the token contract to eth | function _swapTaxTokensForEth(uint256 tokenAmount) private {
_approveRouter();
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _primarySwapRouter.WETH();
_primarySwapRouter.swapExactTokensForETHSupportingFeeOnTransferTokens(tokenAmount,0,path,addr... | 1,849,671 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.6.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, ... | Withdraw without caring about rewards. EMERGENCY ONLY. | function emergencyWithdraw(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
require(
pool.emergencyWithdrawnable,
"!emergencyWithdrawnable not allowed"
);
UserInfo storage user = userInfo[_pid][msg.sender];
uint256 amount = user.amount;
... | 6,995,095 |
//pragma solidity ^0.4.10;
// Copyright 2017 Zerocoin Electric Coin Company LLC
//
// 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
//
//... | input The ZK Proof to verify | function verifyUnshielding(bytes proof, bytes32 spend_nf, bytes32 rt, uint64 value) constant external returns (bool) {
bytes32 buffer = verifyUnshieldingContract.run(proof, spend_nf, rt, value);
byte b = buffer[0];
if (b == 0x00) {
return false;
return true;
}... | 5,478,518 |
/**
*Submitted for verification at Etherscan.io on 2021-02-02
*/
// File: @openzeppelin/contracts/math/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overf... | executes the ERC20 token's `transfer` function and reverts upon failure the main purpose of this function is to prevent a non standard ERC20 token from failing silently _token ERC20 token address _to target address _value transfer amount/ | function safeTransfer(
IERC20Token _token,
address _to,
uint256 _value
) internal {
(bool success, bytes memory data) = address(_token).call(
abi.encodeWithSelector(TRANSFER_FUNC_SELECTOR, _to, _value)
);
require(success && (data.length == 0 || abi.dec... | 2,294,141 |
./partial_match/1/0xe6F4d9711121e5304b30aC2Aae57E3b085ad3c4d/sources/src/interfaces/pool/erc20/IERC20PoolLenderActions.sol | ERC20 Pool Lender Actions/ | interface IERC20PoolLenderActions {
function addCollateral(
uint256 amountToAdd_,
uint256 index_,
uint256 expiry_
) external returns (uint256 bucketLP_);
} | 3,630,059 |
pragma solidity ^0.4.18;
/**
* @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;
}
uint2... | Constructor that gives msg.sender all of existing tokens./ | function HTC() public {
totalSupply = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
| 11,731,540 |
pragma solidity ^0.5.8;
// Needed to work with Flight struct as returned memory argument for FlightSuretyData.getFlight() call
pragma experimental ABIEncoderV2;
// It's important to avoid vulnerabilities due to numeric overflow bugs
// OpenZeppelin's SafeMath library, when used correctly, protects agains such bugs
//... | After payout, insured passenger issues the withdraw request to get the payout in their wallet/ | function payFlightInsuree
(
address airline,
bytes32 key,
address payable passenger
)
external
... | 5,504,107 |
// SPDX-License-Identifier: GPL-3.0-or-later
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is dis... | Inserts a 22 bits signed integer shifted by an offset into a 256 bit word, replacing the old value. Returns the new word. Assumes `value` can be represented using 22 bits./ Integer values need masking to remove the upper bits of negative values. | function insertInt22(
bytes32 word,
int256 value,
uint256 offset
) internal pure returns (bytes32) {
bytes32 clearedWord = bytes32(uint256(word) & ~(_MASK_22 << offset));
return clearedWord | bytes32((uint256(value) & _MASK_22) << offset);
}
| 67,726 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.9;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin... | Changes the pools retentionRatio. Can only be set by the contract owner. retentionRatio_ new pool's retentionRatio/ | function setRetentionRatio(uint256 retentionRatio_) external onlyOwner {
emit RetentionRatioUpdated(_retentionRatio, retentionRatio_);
_retentionRatio = retentionRatio_;
}
| 1,776,260 |
./full_match/1/0x17B00548003683C423eecce4371b4bA56eEd962b/sources/contracts/token/ERC20/extensions/DramMintable.sol | solhint-disable-next-line func-name-mixedcase, no-empty-blocks | function __DramMintable_init_unchained() internal onlyInitializing {}
| 3,169,562 |
./partial_match/42/0xF1655Ce54F4f8cEdc1f0c15a7e29753c1058153B/sources/CFD.sol | keep the record in order to retain the last updated block number | function clearPosition(IExchange _exchange, address _trader) internal {
Position memory position = exchangeMap[address(_exchange)].positionMap[_trader];
exchangeMap[address(_exchange)].totalOpenNotional = exchangeMap[address(_exchange)].totalOpenNotional.subD(
position.openNotional
... | 3,394,680 |
./partial_match/1/0xF98bb4943eb8a3eB6234a9f6B1Fa758714381753/sources/src/contracts/IncentivizingLiquidityAMO.sol | Function to deposit incentives to all active pools (based on budget per unit of target Token) _unitIncentAmount Incentive per single unit of target Token _constIncent Incentivize considering constIncent | function incentivizeAllPoolsByUnitBudget(uint256 _unitIncentAmount, bool _constIncent) public onlyByOwnerOperator {
for (uint i = 0; i < poolArray.length; i++) {
if (_constIncent && poolHasConstIncent[poolArray[i]]) {
incentivizePoolByConstIncent(poolArray[i]);
in... | 4,404,906 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
//
// This contract handles swapping to and from PlatinumNugget, LuckySwap's staking token.
cont... | F1 - F10: OK C1 - C24: OK | function bridgeFor(address token) public view returns (address bridge) {
bridge = _bridges[token];
if (bridge == address(0)) {
bridge = weth;
}
}
| 175,895 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
/**
* @title The Tracks contract enables the storage of collections of
* text information with voting enabled on each memeber of the collection
... | Ban a user from participation. This function is only availble to the contract owner. banned, true to ban, false to unban./ | function banUser(address addr, bool banned) public onlyOwner {
bannedUsers[addr] = banned;
}
| 955,164 |
./partial_match/1/0x7995192bE61EA0B28ce14183DDA51eDF78F1c7AB/sources/FXNDepositor.sol | Locks the tokens held by the contract The contract must have tokens to lock If there is Token available in the contract transfer it to the locker | function _lockToken(uint256 _amount) internal {
if (_amount != 0) {
ILocker(locker).increaseLock(_amount, block.timestamp + MAX_LOCK_DURATION);
emit TokenLocked(msg.sender, _amount);
}
| 3,978,090 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.5;
import "@openzeppelin/contracts/access/Ownable.sol";
interface IWETH {
function deposit() external payable;
function transfer(address to, uint256 value) external returns (bool);
}
/**
* @title Drops
*
* Can pool any number of revenue splits into peri... | From https:github.com/protofire/zeppelin-solidity/blob/master/contracts/MerkleProof.sol Hash(current computed hash + current element of the proof) Hash(current element of the proof + current computed hash) | function verifyProof(
bytes32[] calldata proof,
bytes32 root,
bytes32 leaf
) private pure returns (bool) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
bytes32 proofElement = proof[i];
if (computedHash <= proofElement) {
computedHash = keccak256... | 12,901,326 |
/**
*Submitted for verification at Etherscan.io on 2020-05-27
*/
/**
*Submitted for verification at Etherscan.io on 2020-05-27
*/
pragma solidity 0.5.10; /*
___________________________________________________________________
_ _ ______
|... | Internal transfer, only can be called by this contract / | function _transfer(address _from, address _to, uint _value) internal {
require(!safeGuard,"safeGuard Active");
uint burnValue;
{
}
emit Transfer(_from, _to,_value);
}
| 15,835,591 |
./full_match/80001/0xa68B9086ED6Ee40A22C5DFED7bb23aC67C3F1656/sources/contracts/libraries/LibGroup.sol | Internal member leaves `member` will be refunded with his join deposit and Antic fee Emits `Left` event Members can leave only while the group is forming (open) Caller renounce his ownership Refund the caller with his join deposit | function _leave() internal {
LibState._stateGuard(StateEnum.OPEN);
address member = msg.sender;
uint256 ownershipRefundAmount = LibOwnership._renounceOwnership();
uint256 anticFeeRefundAmount = LibAnticFee._refundFeePayment(member);
uint256 refundAmount = ownershipRefundAmo... | 5,613,465 |
./full_match/42161/0x8cFd1F02c6B5B42C16Ef735e9bCc2d1Ecf5BB3B6/sources/contracts/zxcxz.sol | Add extra rewards to holders | function deposit() external payable onlyOwner {
}
| 16,300,298 |
./full_match/137/0x053600282BF056797d387825d331BB66998aAB24/sources/contracts/cryptolandia1.sol | solhint-disable-next-line max-line-length | function burn(uint256 tokenId) public virtual {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721Burnable: caller is not owner nor approved");
_burn(tokenId);
}
| 4,690,286 |
./full_match/1/0xaC0104Cca91D167873B8601d2e71EB3D4D8c33e0/sources/home/node/app/contracts/crowns/erc-20/contracts/CrownsToken/CrownsToken.sol | Moves `amount` tokens from `account` to {unconfirmedPayWave} without reducing the total supply. Will be paywaved among token holders. Emits a {Transfer} event with `to` set to the zero address. Requirements - `account` cannot be the zero address. - `account` must have at least `amount` tokens./ | function _burn(address account, uint256 amount) internal updateAccount(account) virtual {
require(account != address(0), "ERC20: burn from the zero address");
require(_getBalance(account) >= amount, "ERC20: Not enough token to burn");
_beforeTokenTransfer(account, address(0), amount);
... | 9,607,573 |
// to test issue with nodes breaking with large clients over WS
// fixed in web3 with fragmentationThreshold: 8192
pragma solidity ^0.4.17;
contract BigFreakingContract {
event Transfer(address indexed from, address indexed to, uint value);
event Approval( address indexed owner, address indexed spender, uint valu... | TODO: should increase instead | function approve_594(address spender, uint value) public returns (bool ok) {
_approvals[msg.sender][spender] = value;
emit Approval( msg.sender, spender, value );
return true;
}
| 6,454,307 |
./partial_match/42/0x7437364ad119bB7F540fD03001435E2B32Cd80B8/sources/BotGainsProtocolStorage.sol | if the eth amount here is 0 the previous cycle pool amount can NOT be 0 as wellprevious pool cycle CANNOT BE ZEROcaluclate dividendsupdate total divs for this cyclecaluclate FRAGS_PER_DIVIDEND_ON_CYCLE -- 1e30 order of magnitude greater in numerator, therefore numerical instability is nilupdate the frags per dividend o... | function BOTdeposit() payable onlyBot isNotUnlocked external {
uint256 ETHamount = msg.value;
if(ETHamount == 0){
if(POOL_ON_CYCLE[cycle] != 0) {
revert("deposit and pool funds must both be zero or both be non zero");
}
FRAGS_PER_ETH_ON_C... | 8,933,933 |
/**
*Submitted for verification at Etherscan.io on 2020-10-06
*/
pragma solidity ^0.6.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uin... | function to return the amount of unsold SWG tokens | function unsoldTokens()public view returns(uint256){
return totalTokenForSell.sub(totalTokensSold);
}
| 991,391 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/*
* @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 ... | Add time lock, only locker can add/ | function _addTimeLock(address account, uint amount, uint expiresAt) internal {
require(amount > 0, "Time Lock: lock amount must be greater than 0");
require(expiresAt > block.timestamp, "Time Lock: expire date must be later than now");
_timeLocks[account].push(TimeLock(amount, expiresAt));
emit TimeLo... | 12,885 |
pragma solidity ^0.4.11;
// ----------------------------------------------------------------------------
// Dao.Casino Crowdsale Token Contract
//
// NOTE: This is the new Dao.Casino token contract as the old Dao.Casino
// crowdsale/token contract was attached to a buggy Parity multisig that
// was ... | ------------------------------------------------------------------------ After sealing, no more filling is possible ------------------------------------------------------------------------ | function seal() onlyOwner {
require(!sealed);
sealed = true;
}
| 12,731,213 |
pragma solidity ^0.4.24;
/*
*
* Blockonix Tokens are governed by the Terms & Conditions separately notified to each existing token holder
* of Bitindia, and available on https://blockonix.com and https://blockonix.com/tokenswap
*
*/
/**
* Standard Interface for ERC20 Contract
*/
contract IERC20 {
function t... | Check `_value` tokens allowed to `_spender` by `_owner` _owner The address of the Owner _spender The address of the Spender/ | function allowance(address _owner, address _spender) view public returns (uint256 remaining) {
return approved[_owner][_spender];
}
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _... | 6,597,609 |
./full_match/5/0xF149970C2dbfC77F1F6304F42ea4712461f741e8/sources/contracts/CreamPaiToken.sol | Enable public trading | function enablePublicTrading() external onlyOwner {
publicTradingActive = true;
emit PublicTradingStarted();
}
| 1,854,195 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is... | Withdraw LP tokens. | function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pendingAmount = user.amount.mul(pool.accBonu... | 1,287,522 |
pragma solidity >=0.5.0 <0.7.0;
import "./openZeppelin/token/ERC20/ERC20.sol";
import "./openZeppelin/token/ERC20/ERC20Detailed.sol";
contract VacationManager is ERC20, ERC20Detailed {
//Set of States
enum StateType {Provisioned, Terminated}
//List of properties
StateType public State = StateType.Pro... | Transfer Eth to owner and terminate contract selfdestruct(mantainer); | function terminate() public {
require(State == StateType.Provisioned, "State is not 'Provisioned'");
require(msg.sender == mantainer, "Only owner can call this function");
State = StateType.Terminated;
}
| 7,308,147 |
// SPDX-License-Identifier: GNU GPLv3
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @dev Returns true if `account` is a contract.
*
* [////IMPORTANT]
* ====
* It is unsafe to assume that an address for which ... | Using this function a user can swap WVT tokens for underlying asset after the vest time has passed Calls LiquidController's withdrawToken function _wrappedTokenAddress Address of the wrapped asset _amount Amount of WVT tokens user wants to swap for underlying asset | function withdrawWrappedVestingToken(
address _wrappedTokenAddress,
uint256 _amount
) external virtual noReentrant {
LiquidController(liquidController).withdrawToken(
_wrappedTokenAddress,
_amount,
msg.sender
);
}
| 13,416,560 |
// SPDX-License-Identifier: MIT
import './abstract/ReaperBaseStrategy.sol';
import './interfaces/IUniswapRouter.sol';
import './interfaces/IMasterChef.sol';
import './interfaces/IUniswapV2Pair.sol';
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
pragma solidity 0.8.11;
/**
... | Gives the necessary allowances/ | function _giveAllowances() internal {
uint wantAllowance = type(uint).max - IERC20Upgradeable(want).allowance(address(this), MASTER_CHEF);
IERC20Upgradeable(want).safeIncreaseAllowance(
MASTER_CHEF,
wantAllowance
);
uint protoAllowance = type(uint).max - IERC2... | 1,757,673 |
./full_match/42220/0x413E395b10Be6F39f2AA0d80EEC48EDB88738aC4/sources/contracts/Interfaces.sol | Swaps `amount` `token` from this chain to `toChainID` chain with recipient `to` | interface IMultichainRouter {
function anySwapOut(
address token,
address to,
uint256 amount,
uint256 toChainID
) external;
}
| 16,316,104 |
pragma solidity >=0.4.24;
import './properties/Ownable.sol';
import './IERC20.sol';
import './lib/ECDSA.sol';
import './lib/SafeMath.sol';
/**
* @title Payment channel contract
*/
contract PaymentChannel is Ownable{
using SafeMath for uint192;
// Token used for payments
IERC20 public _token;
/... | Creates a new channel between `msg.sender` and `receiver` and transfers the `deposit` token deposit to this contract. Compatibility with ERC20 tokens. receiver The address that receives tokens. deposit The amount of tokens that the sender escrows./ needs approval first | function createChannel(address receiver, uint192 deposit) external {
_createChannel(msg.sender, receiver, deposit);
require(_token.transferFrom(msg.sender, address(this), deposit));
emit ChannelCreated(msg.sender, receiver, uint32(block.number), deposit);
}
| 12,980,637 |
./full_match/5/0x88E6A8bA858c86D4c395ed44797fA6Abf3a99fa7/sources/src/TwoSlots.sol | To obtain the price of an asset via the Pyth Network oracle. This function requires the retrieval of a parameter that can only be obtained offchain, usually via a frontend. _priceUpdateData Array of data obtained offchain and used to get fresh update price and pay oracle fees. return A price converted To uint256 to ... | function getPythPrice(bytes[] calldata _priceUpdateData) public payable returns (uint256) {
uint256 fee = IPyth(PYTH_CONTRACT).getUpdateFee(_priceUpdateData);
int64 pythPrice = IPyth(PYTH_CONTRACT).getPrice(PYTH_PRICE_ID).price;
if (pythPrice == 0) revert PriceNotAvailable();
return ... | 11,622,864 |
./full_match/1/0x6A9Eb4A409e6354BcEBb0DfABA1Eb33eB5e4d27B/sources/contracts/DistributionCreator.sol | Fetches data for `token` on the Uniswap `pool` | function _getUniswapTokenData(
IERC20Metadata token,
address pool
) internal view returns (UniswapTokenData memory data) {
data.add = address(token);
data.decimals = token.decimals();
data.symbol = token.symbol();
data.poolBalance = token.balanceOf(pool);
}
| 8,485,064 |
/**
*Submitted for verification at Etherscan.io on 2022-01-14
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
// File @openzeppelin/contracts/utils/introspection/IERC165.sol@v4.3.0
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implem... | Function to mint NFTs for giveaway and partnerships/ | function mintByOwner(
address _to,
uint256 _tokenId
)
public
onlyOwner
{
require(_tokenId < MAX_NFT, "Tokens number to mint cannot exceed number of MAX tokens");
_safeMint(_to, _tokenId);
}
| 6,091,979 |
pragma solidity >=0.6.0;
import "./IERC20.sol";
import "./SafeMath.sol";
/// @title A place to implement the functionality of Resources
/// @author Megan OBryan
/// @notice Generic implementation of IERC20
contract Resource is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balance... | Helper function to mint new tokens account The address of the account getting new tokens tokens The amount of tokens to be minted | function _mint(address account, uint256 tokens) internal {
require(account != address(0));
_totalSupply = _totalSupply.add(tokens);
_balances[account] = _balances[account].add(tokens);
emit Transfer(address(0), account, tokens);
}
| 1,048,320 |
./full_match/1/0xB09923cd48714286500300815F692052F8C5e293/sources/contracts/vaults/BaseVault.sol | Burn shares from the caller and release assets to the receiver/ | function _withdrawWithFees(
address caller,
address receiver,
address owner,
uint256 assets,
uint256 shares
) internal virtual returns (uint256 receiverAssets, uint256 receiverShares) {
if (caller != owner) {
_spendAllowance(owner, caller, shares);
... | 4,995,812 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "./lib/String.sol";
abstract contract ArcadeBaseCollection is Ownable, ERC721Enumerable {
using String for bytes32;
... | Get issued for certain gameId _gameId - token game return uint256 of the issuance of that game/ | function getIssued(string memory _gameId) external view returns (uint256) {
bytes32 _gameIdKey = getGameKey(_gameId);
return issued[_gameIdKey];
}
| 11,962,518 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/security/ReentrancyGuard.sol
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {n... | Function to spend user balance. Can be called by other authorised contracts. To be used for internal purchases of other NFTs, etc./ | function spendAURA(address user, uint256 amount) external onlyAuthorised nonReentrant {
require(getUserBalance(user) >= amount, "Insufficient balance");
uint256 tax = spendTaxCollectionStopped ? 0 : (amount * spendTaxAmount) / 100;
spentAmount[user] += amount;
activeTaxCollectedAmount += ta... | 12,192,151 |
./partial_match/1/0x3ba998989c94aecAEc717B4C4Cd4caa48905A47C/sources/DecentralizedOtcCollateralizedUsdc.sol | Converts ETH to USD./ | function _calcUsdVolume(uint256 volume) internal override returns (uint256) {
(uint256 ethPriceInverseE8, ) = _getOracleData();
return volume.mul(10**8) / ethPriceInverseE8;
}
| 4,257,309 |
// SPDX-License-Identifier: GPL-3.0
// 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 `u... | mint function for the public sale | function mint(uint256 _mintAmount)
public
payable
{
requireChecks(_mintAmount);
require(isMainSale == true, "sale not on");
if (msg.sender != owner()) {
require(msg.value >= cost * _mintAmount, "insufficient funds");
}
_safeMint(msg.sender, _mintAmount);
}
| 13,542,678 |
//Address: 0x990c2463c7c4dcb435948e3110006f352da8e666
//Contract name: YTIcons
//Balance: 1 wei
//Verification Date: 3/27/2018
//Transacion Count: 591
// CODE STARTS HERE
pragma solidity ^0.4.18;
/// @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens
/// @author Dieter Shirley <dete@axiomzen.... | Unlock a YTIcon and make it usable | function unlock(uint256 tokenId) public ownerOnly {
require(_cards[tokenId].isLocked);
_cards[tokenId].isLocked = false;
}
| 2,502,772 |
./full_match/4/0x99eea31E7daa9e0fB1F57d5d659992f81fa26b75/sources/vapenapes-contract-main/src/contracts/impl/ERC721Enumerable.sol | Private function to add a token to this extension's ownership-tracking data structures. to address representing the new owner of the given token ID tokenId uint256 ID of the token to be added to the tokens list of the given address/ | function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
uint256 length = ERC721.balanceOf(to);
_ownedTokens[to][length] = tokenId;
_ownedTokensIndex[tokenId] = length;
}
| 12,511,685 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.0;
import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "./DappToken.sol";
import "./DaiToken.sol";
contract TokenFarm { ... | A method to remove a staker. _staker The staker to remove./ | function removeStaker(address _staker)
public
{
(bool _isStaker, uint256 s) = isStaker(_staker);
if(_isStaker){
stakers[s] = stakers[stakers.length - 1];
stakers.pop();
}
}
| 15,846,340 |
./full_match/1/0x39775AF970759966a6eB30020bD0f77Ef856d21A/sources/DigitalSecurities/Roles.sol | Remove the `_role` from the `_address`. _role Role to removing from the `_address`. _address Address for removing the `_role`./ | function _removeRole(address _address, bytes32 _role) private {
revokeRole(_role, _address);
}
| 4,923,609 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.3;
import "@openzeppelin/contracts/access/Ownable.sol";
import "../libraries/Position.sol";
import "../accessors/NameAccessor.sol";
/// @title HologramPool - stores any data.
/// @author Shumpei Koike - <shumpei.koike@bridges.inc>
contract HologramPool is Nam... | Updates the staked transaction. key address of the target user index uint256 of the array index stakeTx values of the staked transaction | function updateStakedTx(
address key,
uint256 index,
Position.StakeTx memory stakeTx
) external onlyAllowedContract {
_staked[key][index] = stakeTx;
}
| 12,668,577 |
./full_match/4/0x6044efb9D4Ad89b8D99e5a910af73f2e158d898f/sources/browser/test.sol | this saves gas while using this multiple timeschecking all conditionstransferring PAX tokens from smart user to smart contract for level 1 | function _regUser2(uint _referrerID) internal returns(bool)
{
address msgSender = msg.sender;
uint originalReferrer = _referrerID;
updateFromOld(_referrerID);
require(!userInfos[msgSender].joined, 'User exist');
if(!(_referrerID > 0 && _referrerID <= lastIDCount))
... | 769,935 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
/**
* @title Proxy
* @dev Implements delegation of calls to other contracts, with proper
* forwarding of return values and bubbling of failures.
* It defines a fallback function that delegates all calls to the address
* ret... | if(dCur > 0) { IERC20(currency).safeTransferFrom(sender, put, uint(dCur)); IERC20(currency).safeTransferFrom(sender, address(config[_feeTo_]), uint(dCur).mul(feeRate).div(1e18));} else if(dCur < 0) { uint fee = uint(-dCur).mul(feeRate).div(1e18); Put(put).withdraw_(address(config[_feeTo_]), fee); Put(put... | function _transfer(address payable sender, address callOrPut, address undOrCur, int vol) internal {
if(vol > 0) {
address from = sender;
uint fee = uint(vol).mul(feeRate).div(1e18);
if(msg.value > 0 && undOrCur == address(config[_WETH_])) {
uint deltaAndFe... | 13,884,003 |
/**
*Submitted for verification at Etherscan.io on 2022-03-18
*/
// 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_SY... | distribute tokens to those that have already the legacy ones. | function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
function _afterTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
}
pragma solidity ^0.8.0;
}
pragma solidity ^0.8.... | 10,896,389 |
./full_match/11155111/0xA1166B9C7736c11AafCFc77eBD06f57473F419Fa/sources/contracts/CrowdFunding.sol | require used to check is everything okay? | function createCampaign(address _owner, string memory _title, string memory _description, uint256 _target,
uint256 _deadline, string memory _image) public returns (uint256) {
Campaign storage campaign = campaigns[numberofCampaigns];
require(campaign.deadline < block.timestamp , "The Deadline s... | 3,821,729 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.25 <0.8.0;
pragma experimental ABIEncoderV2;
import { IVault } from "./IVault.sol";
import { VaultBase } from "./VaultBase.sol";
import { IFujiAdmin } from "../IFujiAdmin.sol";
import { ReentrancyGuard } from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
im... | Initiates an Aave flashloan. info: data to be passed between functions executing flashloan logic/Initialize Instance of Aave Lending PoolPassing arguments to construct Aave flashloan -limited to 1 asset type for now. 0 = no debt, 1 = stable, 2 = variablemodes[0] = 0;address onBehalfOf = address(this);bytes memory para... | function _initiateAaveFlashLoan(FlashLoan.Info calldata info) internal {
ILendingPool aaveLp = ILendingPool(_aaveLendingPool);
address receiverAddress = address(this);
address[] memory assets = new address[](1);
assets[0] = address(info.asset);
uint256[] memory amounts = new uint256[](1);
amo... | 1,311,844 |
./full_match/4/0xFe6bad5DcCFb174d8Bf383e7C52825742348c187/sources/contracts/3_Ballot.sol | Returns the value associated with `key`. O(1). Requirements: - `key` must be in the map./ | function get(UintToUintMap storage map, uint256 key)
internal
view
returns (uint256)
{
return _get(map._inner, key);
}
| 12,431,498 |
/**
*Submitted for verification at Etherscan.io on 2020-09-04
*/
/**
*Submitted for verification at Etherscan.io on 2020-08-21
*/
/**
*Submitted for verification at Etherscan.io on 2020-08-11
*/
pragma solidity 0.5.17;
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverti... | Decrease the amount of tokens that an owner has allowed to a spender. spender The address which will spend the funds. subtractedValue The amount of tokens to decrease the allowance by./ | function decreaseAllowance(address spender, uint256 subtractedValue)
external
returns (bool)
{
uint256 oldValue = _allowedFragments[msg.sender][spender];
if (subtractedValue >= oldValue) {
_allowedFragments[msg.sender][spender] = 0;
}
emit Approval(ms... | 1,808,712 |
contract StandardTokenProtocol {
function totalSupply() constant returns (uint256 totalSupply) {}
function balanceOf(address _owner) constant returns (uint256 balance) {}
function transfer(address _recipient, uint256 _value) returns (bool success) {}
function transferFrom(address _from, address _r... | Initialization contract assigns address of crowdfund contract and end time. | function GUPToken(address _minter, uint _endMintingTime) {
endMintingTime = _endMintingTime;
minter = _minter;
}
| 13,073,452 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/to... | Destroy a box boxId id of the box ethAmount amount of eth to withdraw erc20ToWithdraw list of erc20 to withdraw erc721ToWithdraw list of erc721 to withdraw erc1155ToWithdraw list of erc1155 to withdraw to address of reception/ destroy the box withdraw ETH tokens withdraw ERC721 tokens withdraw ERC20 tokens withdr... | function destroy(
uint256 boxId,
uint256 ethAmount,
ERC20TokenInfos[] calldata erc20ToWithdraw,
ERC721TokenInfos[] calldata erc721ToWithdraw,
ERC1155TokenInfos[] calldata erc1155ToWithdraw,
address payable to
) external override onlyDelegateCall {
destroye... | 979,284 |
./full_match/5/0xA5990cE296b3F0864673bE54653808769Ed213E6/sources/contracts/Notes.sol | map address type to User type | function createNote(string memory note) public{
notes[msg.sender] = Note(note);
}
| 1,932,067 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.6.6;
interface UniswapPairContract {
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
}
interface xETHTokenInterface {
//Public functions
function maxScalingFactor() externa... | Initiates a new rebase operation, provided the minimum time period has elapsed. The supply adjustment equals (_totalSupply DeviationFromTargetRate) / rebaseLag Where DeviationFromTargetRate is (MarketOracleRate - targetRate) / targetRate and targetRate is 1e18/ Validate the address which triggered the rebas... | function rebase() public {
require(msg.sender == tx.origin, "Message sender is not where the tx originated!");
require(_isWhitelisted(msg.sender), "Message sender is not authorized for rebasing!");
uint256 elapsed = lastRebaseTimestampSec.add(minRebaseTimeIntervalSec);
require(elaps... | 14,456,406 |
// Copyright (C) 2021 BITFISH LIMITED
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distribu... | Modern versions of Solidity automatically add underflow checks, so we don't need to `require(_deposits[_depositor] < _deposit` here: | function _executeWithdrawal(
address depositor,
address payable beneficiary,
uint256 amount
)
internal
returns (uint256)
{
require(amount > 0, "Amount shouldn't be zero");
uint256 value = amount * (address(this).balance - _operatorClaimable) / _totalD... | 1,754,728 |
// SPDX-License-Identifier: bsl-1.1
/*
Copyright 2021 Unit Protocol: Artem Zakharov ([email protected]).
*/
pragma solidity 0.7.6;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "./WSSLPUserProxy.sol";
import "../../helpers/ReentrancyGuard.so... | Withdraw tokens from topdog to user proxy without caring about rewards. EMERGENCY ONLY. To withdraw tokens from user proxy to user use `withdrawToken`/ | function emergencyWithdraw() public nonReentrant {
WSSLPUserProxy userProxy = _requireUserProxy(msg.sender);
uint amount = userProxy.getDepositedAmount();
_burn(msg.sender, amount);
assert(balanceOf(msg.sender) == 0);
userProxy.emergencyWithdraw();
emit EmergencyWi... | 1,248,811 |
pragma solidity ^0.5.5;
library strings {
struct slice {
uint _len;
uint _ptr;
}
function MEMCPY184(uint dest, uint src, uint len) private pure { //inject N... | inject NONSTANDARD NAMING | function LEN420(slice memory self) internal pure returns (uint l) { | 6,431,672 |
pragma solidity ^0.4.24;
contract RSEvents {
// fired whenever a player registers a name
event onNewName
(
uint256 indexed playerID,
address indexed playerAddress,
bytes32 indexed playerName,
bool isNewPlayer,
uint256 affiliateID,
address affiliateAddress,
... | distributes eth based on fees to com, aff, and p3d/ pay 5% out to community rewards distribute share to affiliateuint256 _aff = _eth / 10;10% decide what to do with affiliate share of fees affiliate must not be self, and must have a name registered no affiliates, add to community This ensures Team Just cannot influence... | function distributeExternal(uint256 _pID, uint256 _eth, uint256 _affID, RSdatasets.EventReturns memory _eventData_)
private
returns(RSdatasets.EventReturns)
{
uint256 _aff = 0;
if (_affID != _pID && plyr_[_affID].name != '') {
plyr_[_affID].a... | 11,776,029 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.8.0;
contract Medicine {
uint public medicineCount = 0;
uint public usersCount = 0;
uint public orderStatusCount=0;
uint public orderStatusCountEndUser=0;
uint public medicineforendusersCount = 0;
uint public distributorQuantity = 0;
address public adm... | emit addedProduct(productCount,msg.sender,_name,_date,_time,_productinfo); | function deleteMedicine (uint _id) public {
delete(medicines[_id]);
delete meddescdirections[_id];
}
| 12,566,414 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.