file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppe... | stakingToken.safeTransfer(msg.sender, _amount); | function _withdraw(uint256 _amount) private {
_totalSupply = _totalSupply.sub(_amount);
_balances[msg.sender] = _balances[msg.sender].sub(_amount);
}
| 1,260,034 |
./full_match/1/0x184e48FA8B332D3D3FB08eDa535Fd7591e340Bb2/sources/contracts/NFT/ERC721M.sol | ____________________________________________________________________________________________________________________ (function) totalSupply Returns total supply (minted - burned) --------------------------------------------------------------------------------------------------------------------- return totalSupply_ ... | function totalSupply() external view virtual returns (uint256 totalSupply_) {
}
| 4,934,975 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.1;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
interface IMinterFactory {
function mintTo(address to, address tokenAddress) extern... | Returns the number of active stakings for the user user The user whose number of stakings will be returned/ | function getActiveStakingCount(address user) public view returns(uint256) {
uint256 count = 0;
for (uint256 i = 0; i < stakers[user].stakingNumber; ++i) {
if (stakers[user].activeStakings[i]) {
++count;
}
}
return count;
}
| 12,899,608 |
/**
*Submitted for verification at Etherscan.io on 2020-10-11
*/
// SPDX-License-Identifier: GPL-3.0-or-later
/**
Author: CoFiX Core, https://cofix.io
Commit hash: v0.9.4-0-g7a4e0e2
Repository: https://github.com/Computable-Finance/CoFiX
Issues: https://github.com/Computable-Finance/CoFiX/issues
*/
pragma solidit... | msg.value = amountIn + oracle fee | {
require(msg.value > amountIn, "CRouter: insufficient msg.value");
address pair = pairFor(factory, token);
assert(IWETH(WETH).transfer(pair, amountIn));
uint oracleFeeChange;
uint256[4] memory tradeInfo;
IWETH(WETH).deposit{value: amountIn}();
function addLiquid... | 5,407,561 |
// SPDX-License-Identifier: GPL-3.0
/// @title The Nouns NFT descriptor
/*********************************
* ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ *
* ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ *
* ░░░░░░█████████░░█████████░░░ *
* ░░░░░░██░░░████░░██░░░████░░░ *
* ░░██████░░░████████░░░████░░░ *
* ░░██░░██░░░████░░██░░░████░░░ *
... | Get lookup seed/ | function lookupCustomSeed(uint256 nounId) public view override returns (INounsSeeder.Seed memory) {
return preCalcSeeds[nounId];
}
| 13,038,173 |
/* SPDX-License-Identifier: LGPL-3.0-or-later */
pragma solidity ^0.7.0;
import "./Admin.sol";
import "./Exponential.sol";
import "./Erc20Interface.sol";
import "./SafeErc20.sol";
import "./ReentrancyGuard.sol";
import "./BalanceSheetInterface.sol";
import "./FintrollerInterface.sol";
import "./FyTokenInterface.sol";... | Frees a portion or all of the locked collateral. Emits a {FreeCollateral} event. Requirements: - The vault must be open. - The amount to free cannot be zero. - There must be enough locked collateral. - The borrower account cannot fall below the collateralization ratio. fyToken The address of the fyToken contract. co... | function freeCollateral(FyTokenInterface fyToken, uint256 collateralAmount)
external
override
isVaultOpenForMsgSender(fyToken)
returns (bool)
{
FreeCollateralLocalVars memory vars;
require(collateralAmount > 0, "ERR_FREE_COLLATERAL_ZERO");
Vault memory v... | 11,675,231 |
./full_match/42/0x9e05606a5c4cdbc38D5468e197A8A7bf47263252/sources/stakingOliver/uniswaprouter.sol | given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset | function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut, bool status) internal pure returns (uint amountOut) {
require(amountIn > 0, 'UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT');
require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
uint256 feeV... | 16,241,516 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./interfaces/IUniswapV2Router.sol";
import "./inter... | Withdraw LP tokens | function withdrawLiquidity(uint256 _pid, uint256 _ulid) external {
UserInfo[] memory user = userInfo[_pid][msg.sender];
PoolInfo storage pool = poolInfo[_pid];
require(_ulid < user.length, "PCL: OUT_OF_BOUNDS");
require(user[_ulid].liquidity > 0, "PCL: NO_LIQUIDITY");
require... | 7,274,936 |
pragma solidity 0.5.11;
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error.
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c /... | return the the number of decimals of ETH Price./ | function currentETHPriceDecimals() public view returns (uint256 decimals) {
return(_decimals);
}
| 2,561,254 |
./full_match/56/0xC139cBFDE476574B1505D001E33CCE4011e54472/sources/project:/contracts/shard_warriors_game.sol | check is battle is active check second player if no one turns in 10 minutes wins player with more hp drawwins player2wins player1 we are player1 or player2? we are player1battles[battleId].timestampP1 = block.timestamp; no turns in 10 minutes- win player2require(battles[battleId].turnP2 == 0, "You have alreadymade your... | function fightTurn(address user, uint256 turn, uint256 battleId)
external onlyAllowedContract {
require(battles[battleId].result == 0, "Fight is over");
require(battles[battleId].player2 != address(0), "No player2");
if (
block.timestamp >= battles[battleId].timestampP2+600 ||
block.timesta... | 3,237,021 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "./interfaces/IComptroller.sol";
import "./interfaces/IConverter.sol";
import "./interfaces/ICToken.sol";
import ... | Get the hypothetical debt in USD value of this contract after borrow borrowAmount The hypothetical borrow amount return The hypothetical debt in USD value/ | function hypotheticalDebtUSD(uint256 borrowAmount)
external
view
returns (uint256)
{
return getHypotheticalDebtValue(borrowAmount);
}
| 10,326,081 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.16 <8.10.0;
contract ProvStorage {
//Global variables storing latest transaction count.
uint txNumber_upload = 0;
uint txNumber_download = 0;
string latest_txHash_upload = "";
string latest_txHash_download = "";
string temp_txHash = "origin";
// Upload ... | --------------------------------------------------------Upload Get---------return the latest transaction number | function getTxNumber_up_latest() public view returns (uint){
return txNumber_upload;
}
| 2,528,266 |
./full_match/1/0x56356710715D2D29232D0D8784390e2a1C42514E/sources/arb-bridge-peripherals/contracts/tokenbridge/ethereum/gateway/L1GatewayRouter.sol | Allows L1 Token contract to trustlessly register its gateway. param _gateway l1 gateway address param _maxGas max gas for L2 retryable exrecution param _gasPriceBid gas price for L2 retryable ticket param _maxSubmissionCost base submission cost L2 retryable tick3et param _creditBackAddress address for crediting back ... | function setGateway(
address _gateway,
uint256 _maxGas,
uint256 _gasPriceBid,
uint256 _maxSubmissionCost,
address _creditBackAddress
) public payable returns (uint256) {
require(
ArbitrumEnabledToken(msg.sender).isArbitrumEnabled() == uint8(0xa4b1),
... | 9,736,275 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppe... | receiver = _getTokenOwner(tokenId); | function royaltyInfo(uint256 tokenId, uint256 salePrice) external virtual override view
returns (address receiver, uint256 royaltyAmount) {
require(_exists(tokenId), "Token doesnt exist.");
receiver = RoyaltyReceiver;
royaltyAmount = (_getRoyalty() * salePrice) / 10000;
}
| 5,877,288 |
pragma solidity ^0.4.23;
/**
* @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... | Reject all ERC223 compatible tokens from_ address The address that is transferring the tokens value_ uint256 the amount of the specified token data_ Bytes The data passed from the caller./ | function tokenFallback(address from_, uint256 value_, bytes data_) external pure {
from_;
value_;
data_;
revert();
}
| 2,109,959 |
pragma solidity 0.6.12;
interface IERC20 {
function TOTALSUPPLY831() external view returns (uint256); //i... | inject NONSTANDARD NAMING | function LOG714(address p0, bool p1, uint p2, uint p3) internal view { | 14,087,951 |
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721Holder.sol";
import "./RaribleERC721.sol";
import "./NFTShardERC20.sol";
import "./Compound.sol";
import "./IChainlinkPriceFeed.sol";
import "./IRaribleExcha... | withdraw from aave/compound buy from rarible distribute shards pool status inactive send profit from aave/compound to owner deposit to aave/compound | function buyShards() public payable returns(bool) {
require(msg.value > 0 , "amount should be more than 0");
require(pool.status == PoolStatus.active, "Pool is not active anymore");
buyers[msg.sender] = buyers[msg.sender].add(msg.value);
pool.soldPrice = pool.soldPrice.add(msg.value)... | 12,978,971 |
./full_match/43114/0xBC1293c42d73185CF8c3e6FB44d57b44D3679Ea4/sources/avaxrocket.sol | generate the uniswap pair path of token -> WAVAX make the swap | function swapTokensForEth(uint256 tokenAmount) private {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = joeV2Router.WAVAX();
_approve(address(this), address(joeV2Router), tokenAmount);
joeV2Router.swapExactTokensForAVAX... | 4,586,782 |
./full_match/3/0x7E86962BBF0Fa912882676AED1f02a7385E337E5/sources/contracts/KeysWithPlonkVerifier.sol | we only have access to value of the d(x) witness polynomial on the next trace step, so we only need one element here and deal with it in other places by having this in mind | function getVkBlock30() internal pure returns(VerificationKey memory vk) {
vk.domain_size = 4194304;
vk.num_inputs = 1;
vk.omega = PairingsBn254.new_fr(0x18c95f1ae6514e11a1b30fd7923947c5ffcec5347f16e91b4dd654168326bede);
vk.selector_commitments[0] = PairingsBn254.new_g1(
... | 8,107,425 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.6.0;
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/GSN/Context.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20Pausable.sol";
/**
* @dev {ERC20} token... | Creates `amount` new tokens for `to`. See {ERC20-_mint}. Requirements: - the caller must have the `MINTER_ROLE`./ | function mint(address to, uint256 amount) public virtual {
require(hasRole(MINTER_ROLE, _msgSender()), "ERC20MinterPauserBurner: must have minter role to mint");
_mint(to, amount);
}
| 7,300,073 |
./full_match/1/0x761e4f2beFcaaFF5eF5a8bd51adf63203FD5256D/sources/contracts/Master_Router.sol | Show the contract WETH balance | function balanceOfWETH() external view onlyOwner returns (uint){
uint wethBalance = IWETH(WETH).balanceOf(address(this));
return wethBalance;
}
| 8,432,667 |
// File: @ensdomains/ens/contracts/ENS.sol
pragma solidity >=0.4.24;
interface ENS {
// Logged when the owner of a node assigns a new owner to a subnode.
event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);
// Logged when the owner of a node transfers ownership to a new account.
... | Sets the address where domains are migrated to. _migration Address of the new registrar./ | function setMigrationAddress(address _migration) public registrar_owner_only {
require(stopped);
migration = _migration;
}
| 1,073,569 |
./full_match/11155111/0xF1De736CcBb1a37591f7fCA4CA415932a4a8d632/sources/contracts/gateway/GraphTokenGateway.sol | Change the paused state of the contract _newPaused New value for the pause state (true means the transfers will be paused)/ | function setPaused(bool _newPaused) external onlyGovernorOrGuardian {
if (!_newPaused) {
_checksBeforeUnpause();
}
_setPaused(_newPaused);
}
| 3,805,495 |
./partial_match/42/0x7Dab59e2Ca3a043316C2039453989d8519756d92/sources/DisposableGovernance.sol | to burn the deposited cover tokens coverId is id of cover whose tokens have to be burned return the status of the successful burning/ | function burnDepositCN(uint coverId) public onlyInternal returns (bool success) {
address _of = qd.getCoverMemberAddress(coverId);
uint amount;
(amount,) = td.depositedCN(coverId);
amount = (amount.mul(50)).div(100);
bytes32 reason = keccak256(abi.encodePacked("CN", _of, coverId));
tc.burnLock... | 3,299,959 |
pragma solidity ^0.4.24;
contract AccessAccount{
//the banks address
address bankAddress;
//the owners address
address onwerAddress;
//the balance of the account
uint balance;
//the accounts limit
uint accountLimit;
//if the account is frozen
bool frozen;
//the different typ... | _newLimit : the new limit allows the bank to change the limit of an account. there are no checks here as the bank contains them. The chekcs are to ensure that the limit is not less than the current balance as to prevent errors of exceeding limits./ | function setLimit(uint _newLimit)
public
isBank()
{
accountLimit = _newLimit;
}
| 5,528,296 |
pragma solidity ^0.5.17;
import "./ReentrancyGuard.sol";
import "../Escapable.sol";
import "../../../registry/AdminRole.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/EnumerableSet.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
contract TokenBank is R... | Remove all tokens attributed to VAULT account and transfer them to drainVaultReceiver address. Remove all the tokens from Vault: Transfer all the tokens from the TokenBank to the evac address: | function drainVault() external onlyAdmin nonReentrant {
uint256 vaultBalance = tokenBalances[VAULT];
_subFromBalance(VAULT, vaultBalance);
require(
IERC20(token).transfer(drainVaultReceiver, vaultBalance),
"Transfer failed"
);
emit DrainVault(drainV... | 6,461,284 |
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed
// with this work for additional information regarding copyright
// ownership. The ASF licenses this file to you under the Apache
// License, Version 2.0 (the "License"); you may no... | Choose which offer to accept, based on the proposed prices. The decision process can differ for other markets, and it can be very complicated. Even in some cases, the decision must be made in the backend. (only owner or managers can access this function). | function decideRequest(uint requestIdentifier, uint[] /*acceptedOfferIDs*/) external returns (int status) {
if(!(msg.sender == owner || isManager(msg.sender))) {
emit FunctionStatus(int(Status.AccessDenied));
return int(Status.AccessDenied);
}
require(msg.sender == ow... | 6,479,473 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721EnumerableChaos.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import ... | Toggle this function if pausing should suspend transfers | function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual override(ERC721EnumerableChaos) {
require(!paused(), "Pausable: paused");
super._beforeTokenTransfer(from, to, tokenId);
}
| 14,510,829 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns... | See {IERC165-supportsInterface}./ | function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
| 1,209,911 |
// File: @openzeppelin\contracts\utils\Strings.sol
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 ... | Clothes = Body、Head = SkinColor 7 - Front 6 - Eyes 5 - Hat Front 4 - Beak 3 - SkinColor 2 - Hat Back 1 - Clothes 1011400 0 - Background 001、1011400、2011000、3010400、4011400、5011000、6010400 | function getAttributes(uint256 _tokenId) public view returns(HeadPortrait721Interface.Attribute memory attribute){
uint256 random = getRandom(_tokenId);
uint256 _background = random % 1000;
if(_background < 10){
attribute.background = 7;
attribute.background = 5;
... | 2,226 |
./full_match/1/0xDFa5FAfac70a610E4224B85b7FC4764a0b90d2eA/sources/contracts/shared/interfaces/IProposedOwnable.sol | IProposedOwnable Defines a minimal interface for ownership with a two step proposal and acceptance process/ | interface IProposedOwnable {
event OwnershipProposed(address indexed proposedOwner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
function owner() external view returns (address owner_);
function proposed() external view returns (address proposed_);
function propose... | 4,876,734 |
/**
*Submitted for verification at Etherscan.io on 2021-07-08
*/
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.7.0;
pragma experimental ABIEncoderV2;
// New Silver 2 addresses at Wed Jul 7 16:08:49 WEST 2021
contract Addresses {
address constant public ACTIONS = 0x80F33ED0A69935dd74310b9D0009D0BA64... | set spell as ward on the core contract to be able to wire the new contracts correctly contract migration --> assumption: root contract is already ward on the new contracts | function execute() internal {
SpellTinlakeRootLike root = SpellTinlakeRootLike(ROOT_CONTRACT);
root.relyContract(JUNIOR_TRANCHE, address(this));
root.relyContract(SENIOR_TRANCHE, address(this));
root.relyContract(ASSESSOR, address(this));
root.relyContract(RESERVE, address(t... | 7,921,135 |
pragma solidity ^0.4.25;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIABL... | Initial funding for the insurance. Unless there are too many delayed flights resulting in insurance payouts, the contract should be self-sustaining/ | {
require(msg.value >= 10 ether, "Inadaquate funds");
require(airlines[sender].isRegistered, "Sending account must be registered before it can be funded");
uint256 existingAmount = funds[sender];
uint256 totalAmount = existingAmount.add(msg.value);
funds[sender] = 0;
f... | 12,808,341 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
contract SimpleStorage{
//type of data in solidity
uint256 favoriteNumber;
bool favoriteBool;
//struct is like objects in java can store different vairables and be identified as a struct
struct People {
uint256 favoriteNumber;
... | function that stores data only in memory so that when the contract stops it gets deleted its the opposite of storage | function addPerson(string memory _name, uint256 _favoriteNumber) public{
nameToFavoriteNumber[_name]=_favoriteNumber;
}
| 5,385,576 |
/* solium-disable security/no-block-members */
pragma solidity ^0.5.8;
import "./License.sol";
/**
* @title ArbitratorLicense
* @dev Contract for management of an arbitrator license
*/
contract ArbitrationLicense is License {
enum RequestStatus {NONE,AWAIT,ACCEPTED,REJECTED,CLOSED}
struct Request{
a... | Allows arbitrator to accept a seller's request _id request id/ | function acceptRequest(bytes32 _id) public {
require(isLicenseOwner(msg.sender), "Arbitrator should have a valid license");
require(requests[_id].status == RequestStatus.AWAIT, "This request is not pending");
require(!arbitratorlicenseDetails[msg.sender].acceptAny, "Arbitrator already accept... | 1,067,466 |
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
interface TokenInterface {
function BALANCEOF701(address) external view returns (uint); //inject NONSTANDARD NAMING
function TRANSFER721(address, uint) external returns (bool); //inject ... | inject NONSTANDARD NAMING | function ACCOUNTLINK6(uint) external view returns (AccountLink memory); | 6,447,977 |
./full_match/1/0xDfa6cEe8D50E6C67B34C2b8203699e50F7a9e332/sources/browser/blackfisk/nft.sol | Changes the name for BlackFisk tokenId/ If already named, dereserve old name | function changeName(uint256 tokenId, string memory newName) public {
address owner = ownerOf(tokenId);
require(_msgSender() == owner, "ERC721: caller is not the owner");
require(validateName(newName) == true, "Not a valid new name");
require(sha256(bytes(newName)) != sha256(bytes(_t... | 3,054,128 |
./full_match/97/0x252Fda773e9428635b6B592941217D167Ca775B7/sources/pixoupdatecode.sol | for checking maxprofit reached or not using pixo value in dollar if maxprofit reached with calculate the pixo value in doller price if maxprofit is not reached the calculate only reward | function _withdraw(address from) private returns (bool) {
uint256 amount;
uint256 maxCapReach = MaxProfitReached[msg.sender];
uint256 totalreward = _calculate(from, deposits[from].endTime);
uint256 harvestTime = harvestTimes[msg.sender];
uint256 reward = totalreward.div(lockD... | 3,283,594 |
./full_match/7700/0xF00714a287a8A011cD407C30d8542207E274F783/sources/contracts/periphery/libraries/HempSwapV2Library.sol | given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset | function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) internal pure returns (uint amountOut) {
require(amountIn > 0, 'HempSwapV2Library: INSUFFICIENT_INPUT_AMOUNT');
require(reserveIn > 0 && reserveOut > 0, 'HempSwapV2Library: INSUFFICIENT_LIQUIDITY');
uint amountInWithFee = ... | 4,658,626 |
./full_match/42/0x2b46ce1953E2B2Eca6924dc9416150e271a2569C/sources/LotteryContract_flat.sol | The winners of the lottery can call this function to transfer their winnings from the lottery contract to their own address. The winners will need to burn their LOT tokens to claim the lottery rewards. This is executed by the lottery contract itself. Requirements: - The Lottery is settled i.e. the lotteryStatus is CLOS... | function collectRewards() payable public nonReentrant {
require(
lotteryStatus == LotteryStatus.CLOSED,
"The Lottery is not settled. Please try in a short while."
);
bool isWinner = false;
for (uint256 i = 0; i < lotteryConfig.playersLimit; i... | 16,209,140 |
./partial_match/1/0x8Fc8f8269ebca376D046Ce292dC7eaC40c8D358A/sources/DFI.sol | Creates `amount` new tokens for `to`. Requirements: - the caller must have the `MINTER_ROLE`./ | function mint(address to, uint256 amount) public virtual {
require(hasRole(MINTER_ROLE, _msgSender()), "DFI: must have minter role to mint");
_mint(to, amount);
}
| 3,701,685 |
./full_match/1/0xceB327107AFBD082E12C4370Dc4c3CE388C4AE22/sources/contracts/protocol/Sector3DAOPriority.sol | Checks if the smart contract has received enough funding to cover claims for a past epoch. Epochs without contributions are excluded from funding./ | function isEpochFunded(uint16 epochNumber) public view returns (bool) {
if (epochNumber >= getEpochNumber()) {
revert EpochNotYetEnded();
}
if (getEpochContributions(epochNumber).length == 0) {
return false;
}
uint16 numberOfEpochsWithContributions = 0;
for (uint16 i = 0; i <= epoc... | 3,115,611 |
./partial_match/56/0xAB966070B18C0230eC40Ce010F38c94c6541CCa7/sources/BvaultsStrategy.sol | Harvest farm tokens Swap earned to token0 by ratio0 Swap earned to token1 by ratio1 | function earn() public whenNotPaused {
require(isAutoComp, "BvaultsStrategy: !isAutoComp");
require(!notPublic || isAuthorised(msg.sender), "BvaultsStrategy: !authorised");
if (isCAKEStaking) {
IPancakeswapFarm(farmContractAddress).deposit(pid, 0);
}
emit Earne... | 11,047,673 |
pragma solidity ^0.4.13;
contract Ownable {
address public owner;
function Ownable() {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner {
if (newOwner != address(0)) {
owner = ne... | Set transfer upper limit transferLimit Transfer upper limit return Whether the operation was successful or not/ | function setTransferLimit(uint256 transferLimit) returns (bool) {
transferLimits[msg.sender] = transferLimit;
}
| 881,024 |
./full_match/43114/0xc6C477D12C4ac10FB033531A70eCB1F7cfc34E2a/sources/test.sol | generate the pancake pair path of token -> weth make the swap | function swapTokensForAvax(
address routerAddress,
uint256 tokenAmount
) public {
IJoeRouter02 joeRouter = IJoeRouter02(routerAddress);
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = joeRouter.WAVAX();
joeRouter.swapExactTok... | 4,557,057 |
// SPDX-License-Identifier: GPL-3.0-or-later
// File: @openzeppelin/contracts/GSN/Context.sol
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... | Creates a new option period Option period in seconds (1 days <= period <= 4 weeks) amount Option amount strike Strike price of the option optionType Call or Put option type return optionID Created option's ID/ | function create(
uint256 period,
uint256 amount,
uint256 strike,
OptionType optionType
)
external
payable
returns (uint256 optionID)
{
(uint256 total, uint256 settlementFee, uint256 strikeFee, ) = fees(
period,
amount,
... | 1,130,869 |
./full_match/1/0xc258fF338322b6852C281936D4EdEff8AdfF23eE/sources/src/VotingEscrow.sol | Get timestamp when `_addr`'s lock finishes _addr User wallet address return Epoch time of the lock end | function locked__end(address _addr) external view returns (uint) {
return locked[_addr].end;
}
| 4,833,329 |
//solium-disable linebreak-style
pragma solidity ^0.4.24;
import "zos-lib/contracts/migrations/Migratable.sol";
//import "openzeppelin-zos/contracts/ownership/Ownable.sol";
import "./SafeMath.sol";
import "./Blacklist.sol";
contract NTFToken {
//need approve first with DApp to call this function
fun... | change voting smart contract address | function moveVoteContract(address _to) public onlyOwner {
voteAddress = _to;
}
| 12,703,058 |
./partial_match/1/0xA16b6E155C7703Fa6A9F9E9a2706DAe544542037/sources/MKFS.sol | Set maximum transaction | function setMaxTxn(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
| 2,851,114 |
//SPDX-License-Identifier: MIT
pragma solidity 0.8.3;
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol";
import { Base64 } from "./libraries/Base64.sol";
/// @title EternalNFT
... | Generates a random number using hash of the encoded imput string _input The string used in generating random number return uint256 The random number generated | function random(string memory _input) internal view returns(uint256) {
return uint256(keccak256(abi.encodePacked(randomResult, _input)));
}
| 5,476,140 |
./partial_match/42/0xd8C4c1eb0756b59f49146aFC801b70d43ED7dAB0/sources/MasterChef.sol | Withdraw LP tokens from MasterChef. | function withdraw(uint256 _pid) public{
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.isUsed, 'user is not existed');
require(user.endBlock < block.number, "token is still locked");
massUpdatePools();
uint256 originWeight = user.originWeight;
PoolIn... | 3,451,368 |
/*
Copyright 2020 dYdX Trading Inc.
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 ... | Perform the liquidation by constructing the correct arguments and sending it to the perpetual./ Create accounts. Base protocol requires accounts to be sorted. Create trade args. | function _doLiquidation(
I_PerpetualV1 perpetual,
address liquidatee,
SignedMath.Int memory maxPositionDelta
)
private
{
bool takerFirst = address(msg.sender) < liquidatee;
address[] memory accounts = new address[](2);
uint256 takerIndex = takerFirst ?... | 12,681,868 |
./partial_match/56/0x99f3bC99e619ea587f9BfD7EfD0914Cb3a12c815/sources/FightersNFT.sol | Token URI functions (set and override for tokenURI) | function setBaseTokenUri(string calldata _baseTokenUri) external onlyAdmin {
baseTokenUri = _baseTokenUri;
}
| 11,114,619 |
pragma solidity ^0.4.24;
import "./AccessAccount.sol";
contract TrustAccount is AccessAccount {
//array of all the owner addresses
address[] owners;
//counter of all owners
uint noOfOwners = 0;
//ballot counter
uint ballotIDs = 0;
//the different types of votes
enum VoteType {removeOwn... | _ballotID : the ballots ID returns the details fo a single ballot/ | function getBallot(uint _ballotID)
public
view
returns(
VoteType typeOfVote,
uint startTime,
uint endTime,
address currentAddress,
address newAddress,
bool actedOn,
bool bankVoted,
bool banksV... | 1,041,598 |
./partial_match/137/0xf9177F9B7709FB8941db5AfDDC3F7eE3878984BF/sources/DARKv2.sol | This function is what other darkusd pools will call to mint new DB (similar to the darkUSD mint) | function pool_mint(address m_address, uint256 m_amount) external onlyPools {
if(trackingVotes){
uint32 srcRepNum = numCheckpoints[address(this)];
uint96 srcRepOld = srcRepNum > 0 ? checkpoints[address(this)][srcRepNum - 1].votes : 0;
uint96 srcRepNew = add96(srcRe... | 3,511,159 |
/**
*Submitted for verification at Etherscan.io on 2020-02-12
*/
// File: @aragon/court/contracts/lib/os/IsContract.sol
// Brought from https://github.com/aragon/aragonOS/blob/v4.3.0/contracts/common/IsContract.sol
// Adapted to use pragma ^0.5.8 and satisfy our linter rules
pragma solidity ^0.5.8;
contract IsCon... | Refunds accidentally sent ERC20 tokens. Only governor can do it _token Token to be refunded _recipient Address to send funds to _amount Amount to be refunded/ | function refundToken(ERC20 _token, address _recipient, uint256 _amount) external onlyGovernor {
require(_amount > 0, ERROR_ZERO_AMOUNT);
uint256 selfBalance = _token.balanceOf(address(this));
require(selfBalance >= _amount, ERROR_NOT_ENOUGH_BALANCE);
require(_token.safeTransfer(_rec... | 12,908,668 |
./full_match/1/0x05999eB831ae28Ca920cE645A5164fbdB1D74Fe9/sources/contracts/Staking.sol | Returns econds until the next epoch begins return seconds_ Till next epoch | function secondsToNextEpoch() external view returns (uint256 seconds_) {
return epoch.end - block.timestamp;
}
| 3,192,928 |
//OFFICIAL TG: https://t.me/CryptoKnightErc
// SPDX-License-Identifier: MIT
pragma solidity =0.8.10 >=0.8.10 >=0.8.0 <0.9.0;
pragma experimental ABIEncoderV2;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() inte... | exclude from paying fees or having max transaction amount | constructor() ERC20("Crypto Knight", "CN") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = I... | 14,648,239 |
./full_match/5/0x21716a1bb391A4Dc136Be30F7a014Bb1888f29d2/sources/Pupe.sol | burns the total amount lost, then mints 50% of that to the message sender | function adopt(address _ownerAddress) public nonReentrant {
require(timeToAbandonment(_ownerAddress) == 0, "address not abandoned");
uint256 adoptAmount = balanceOf(_ownerAddress);
_burn(_ownerAddress, adoptAmount);
_mint(msg.sender, adoptAmount / 2);
emit Adopted(_ownerAddr... | 7,052,683 |
./partial_match/1/0xC61b9439F9C3D74011b59fe8E28cE4fffB41D3B5/sources/InvestementBeta.sol | Withdraw an asset from the contract by the manager. _asset asset'address. _amount amount to send./ | function withdrawAsset( address _asset, uint256 _amount) external whenNotPaused onlyManager {
uint256 _index = assets.getIndex(_asset);
uint256 _price;
uint256 _decimals;
uint256 _decimalsPrice;
address _oracle;
( , _oracle, _price, _decimals ) = assets.assets(_index... | 3,702,244 |
pragma solidity ^0.4.11;
library DateTimeLib {
/*
* Date and Time utilities for ethereum contracts
*
*/
struct _DateTime {
uint16 year;
uint8 month;
uint8 day;
uint8 hour;
uint8 minute;
uint8 second;
uint8 weekday;
}
... | fallback function can be used to buy tokens | function() public payable {
buy(msg.sender, msg.value);
}
| 1,031,671 |
pragma solidity ^0.4.17;
contract ERC20 {
function totalSupply() public view returns (uint supply);
function balanceOf( address who ) public view returns (uint value);
function allowance( address owner, address spender ) public view returns (uint _allowance);
function transfer( address to, uint... | 指定したユーザに対し、(トークン所有者に代わって)指定した分量のトークンの送付を許可する spender {address} - 送付操作を許可する対象ユーザのアドレス amount {uint} - 送付を許可するコインの分量 return {bool} 許可に成功した場合は true を返す/ | function approve(address spender, uint amount) public returns (bool) {
if (implementation.approve(msg.sender, spender, amount)) {
Approval(msg.sender, spender, amount);
return true;
return false;
}
}
| 6,415,993 |
/**
*Submitted for verification at Etherscan.io on 2022-02-17
*/
// File: contracts/safetoken-imports.sol
/**
* SPDX-License-Identifier: MIT
*/
pragma solidity ^0.8.4;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uin... | The code below removes balances of addresses excluded from rewards from rSupply and tSupply, which effectively increases the % of transaction fees delivered to non-excluded holders/ | function _getCurrentSupply() internal view returns(uint256, uint256) {
uint256 rSupply = _reflectedSupply;
uint256 tSupply = TOTAL_SUPPLY;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_reflectedBalances[_excluded[i]] > rSupply || _balances[_excluded[i]] > tSupply) retu... | 10,016,226 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
// Access Control
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
// ... | Override, imposed by Interfaces from AccessControlUpgradeable and ERC721Upgradeable. Override, imposed by Interfaces from AccessControlUpgradeable and ERC721Upgradeable. | function supportsInterface(bytes4 interfaceId) public view virtual override(AccessControlUpgradeable, ERC721Upgradeable) returns (bool) {
return
interfaceId == type(IAccessControlUpgradeable).interfaceId ||
interfaceId == type(IERC721Upgradeable).interfaceId ||
interfaceI... | 12,659,737 |
// File: @openzeppelin/contracts/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 {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no ... | withdraw a valid amount from a locked token/ remove the user if all tokens are unlocked and withdrawn | function withdraw(
address _lockToken,
uint256 _index,
uint256 _lock_id,
uint256 _amount
) external nonReentrant {
require(_amount > 0, "DLock: ZERO WITHDRAWL NOT ALLOWED");
uint256 lock_id = users[msg.sender].locksForToken[_lockToken][_index];
TokenLock s... | 526,431 |
./full_match/421613/0x65A6cFF0264c210cCf25C6ef6c9bA48BA2D82725/sources/project_/contracts/Spacestation.sol | Check 1:1 correspondency between doge and tool | function unstakeDogesAndTools(uint256[] calldata _dogeIds, uint256[] calldata _toolIds) public nonReentrant whenNotPaused {
address owner = _msgSender();
require(ownedDogeStakesBalance[owner] - _dogeIds.length >= ownedToolStakesBalance[owner] - _toolIds.length, "Needs at least doge for each tool");
... | 11,579,708 |
./full_match/42161/0x471E35C0D689564E31f4476a1f8fa7a7cd626c15/sources/contracts/GaurVault1_ERC4626.sol | Helper function to perform round-up/ceiling integer division. Based on the formula: x / y + (x % y != 0) | function roundUpDiv(uint256 x, uint256 y) internal pure returns (uint256) {
require(y != 0, "Division by 0");
uint256 q = x / y;
if (x % y != 0) q++;
return q;
}
| 16,303,435 |
pragma solidity ^0.4.24;
/// @title Football Exchange contract
/// @author Sixte de Maupeou
contract SimpleERC721 {
// Functions
function totalSupply() public pure returns (uint8 total);
function balanceOf(address _owner) public view returns (uint8 balance);
function ownerOf(uint8 _tokenId) public vie... | transfer player with _tokenId to sender Ensure amount paid is at least player price Tag player as sold Transfer the player to the sender Set player price to 0 as default for send paid amount to the previous owner | function transfer(uint8 _tokenId) payable external {
require(_tokenId < totalSupply());
require(!playerSold[_tokenId]);
address oldOwner = ownerOf(_tokenId);
address newOwner = msg.sender;
require(newOwner != address(0));
require(newOwner != oldOwner);
requ... | 15,843,816 |
./partial_match/4/0xDa848cF8Caf841fE5457F2690881fcCDa71626eF/sources/Tantinople.sol | Deposit LP tokens to Tantinople for MEDAL allocation. | function deposit(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
uint256 userAmount = user.amount;
uint256 pending = userAmount
.mul(pool.accMedalPerShare... | 8,635,739 |
./full_match/1/0x4722B25813593FF79f34A4ff4375B8e23095c708/sources/src/PriceBulletin.sol | @inheritdoc IAggregatorV3/ | function version() external pure returns (string memory) {
return VERSION;
}
| 9,643,134 |
pragma solidity ^0.4.24;
contract Kiwiana {
address public owner;
mapping (address => uint) public payments;
mapping (address => string) public allergies;
address public chris = 0xC369B30c8eC960260631E20081A32e4c61E5Ea9d;
constructor() public {
owner = msg.sender;
}
modifier onlyO... | you paid so we care about your allergies | function allergy(string _description) public payable returns(bool) {
if(payments[msg.sender] >= 100000000000000000) {
allergies[msg.sender] = _description;
return true;
}
return false;
}
| 10,845,703 |
pragma solidity ^0.8.0;
/**
* @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 tokens owned by `account`.
... | 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 virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
uint256 senderBalance = _balances[sender];
require... | 231,507 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @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 o... | Function to update the token name _newTokenName The token name to be updated./ | function updateTokenName(string memory _newTokenName) public onlyOwner {
_name = _newTokenName;
}
| 1,423,781 |
pragma solidity ^0.4.4;
import './Shareable.sol';
/*
* DayLimit
*
* inheritable "property" contract that enables methods to be protected by placing a linear limit (specifiable)
* on a particular resource per calendar day. is multiowned to allow the limit to be altered. resource that method
* uses is specified in... | resets the amount already spent today. needs many of the owners to confirm | function resetSpentToday() onlymanyowners(sha3(msg.data)) external {
spentToday = 0;
}
| 14,044,193 |
// SPDX-License-Identifier: None
// HungryBunz Implementation V1
pragma solidity ^0.8.0;
import "./Ownable.sol";
import "./PaymentSplitter.sol";
import "./ERC721.sol";
import "./ECDSA.sol";
import "./Strings.sol";
import "./Initializable.sol";
contract OwnableDelegateProxy { }
contract ProxyRegistry {
mapping(ad... | Rank as current. E.G. (1, 10000) sets threshold to evolve to rank 2to 10000 pounds or thiccness points | function updateEvolveThiccness(uint8 rank, uint8 season, uint16 threshold) public onlyOwner {
_evolveThiccness[season][rank] = threshold;
}
| 12,149,225 |
//Address: 0x8fea6eb21213f311e1316330533d12d28a3b6e67
//Contract name: JWCToken
//Balance: 0 Ether
//Verification Date: 1/30/2018
//Transacion Count: 2
// CODE STARTS HERE
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function... | Set token exchange rate _tokenExchangeRate - rate of eth-token/ | function setTokenExchangeRate(uint256 _tokenExchangeRate) public onlyOwner returns (bool) {
require(_tokenExchangeRate>0);
tokenExchangeRate=_tokenExchangeRate;
return true;
}
| 992,368 |
// File: openzeppelin-solidity\contracts\token\ERC20\ERC20Basic.sol
pragma solidity 0.4.24;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* See https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function b... | Calculates remaining tokens available in the ICO after a sale is processed _newIssue Number of tokens to be purchased/ | function _setAvailableInSale(uint256 _newIssue) internal {
availableInSale = totalSaleVolume.sub(_newIssue);
}
| 15,854,306 |
./partial_match/1/0xB6Fc6E2385d55CCb83e297Bd92E2Bd89795B47A3/sources/PonyCore.sol | setNextGen0Price 상승율을 변경 _increaseRate 가격상승율 | function setNextGen0PriceRate(uint256 _increaseRate)
public
onlyCOO
{
require(_increaseRate <= 10000);
nextGen0PriceRate = _increaseRate;
}
| 4,123,382 |
pragma solidity ^0.4.18;
/**
* @title SafeMath for performing valid mathematics.
*/
library SafeMath {
function Mul(uint a, uint b) internal pure returns (uint) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function Div(uint a, uint b) internal pure returns (uint) {... | Refund the investors in case target of crowdsale not achieved/If purchase has been made during CrowdSalereturn everythingReduce totalWeiReceivedUpdate totalSupply reduce balancesset everything to zero after transfer successful | function refund() public onlyOwner {
assert(refundStatus == 2 || refundStatus == 3);
uint batchSize = countInvestorsRefunded.Add(30) < countTotalInvestors ? countInvestorsRefunded.Add(30): countTotalInvestors;
for(uint i=countInvestorsRefunded.Add(1); i <= batchSize; i++){
addres... | 1,781,035 |
// SPDX-License-Identifier: MIT
// 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 distributed in ... | Computer bring me magic number How much will we receive in return Update user's ratio If user's ratio is approx curve ratio, then just swap I.e. ratio converges Otherwise, we keep iterating We swapping too little We swapping too much Cannot swap more than zap | function _calcBaseSwapAmount(uint256 initialSwapAmount, ZapData memory zapData) internal view returns (uint256) {
uint256 swapAmount = initialSwapAmount;
uint256 delta = swapAmount.div(2);
uint256 recvAmount;
uint256 curveRatio;
uint256 userRatio;
for (uint256 i = 0;... | 1,135,699 |
pragma solidity ^0.4.17;
contract SimpleStorage {
uint myVariable;
// From demo issue #3
// event Odd();
// event Even();
function set(uint x) public {
// assert(x == 0); // From demo issue/bug #2
myVariable = x;
// From demo issue #3
// if (x % 2 == 0) {
... | assert(x == 0); From demo issue/bug 2 From demo issue 3 if (x % 2 == 0) { Odd(); maybe need "emit"? } else { Even(); } | function set(uint x) public {
myVariable = x;
}
| 6,352,614 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/access/IAccessControl.sol
pragma solidity ^0.8.0;
interface IAccessControl {
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
event RoleGranted(bytes32 indexed role, address indexed a... | update: rewards for a given pool id (public) | function updatePool(uint pid) public validatePoolByPid(pid) {
Pools storage pool = poolInfo[pid];
uint lpSupply = pool.lpToken.balanceOf(address(this));
uint multiplier = getMultiplier(pool.lastRewardTime, block.timestamp);
uint soulReward = multiplier * soulPerSecond * pool.alloc... | 957,130 |
./full_match/137/0xf6fe664d0D61297fBfBb829A1FF77286b887a9Fd/sources/project:/contracts/TxocoCalPadri.sol | Overrides safeBatchTransferFrom function to only allow administrators to transfer tokens./ | function safeBatchTransferFrom(address _from, address _to, uint256[] memory _ids, uint256[] memory _values, bytes memory _data) public override {
require(administrators[msg.sender] || msg.sender == address(this), "Only administrators can transfer tokens");
super.safeBatchTransferFrom(_from, _to, _id... | 3,738,026 |
./full_match/1/0x66d53c077b4d1f2Cc7422a37651EDA95d4F85521/sources/src/interfaces/ILayerZeroEndpoint.sol | send a LayerZero message to the specified address at a LayerZero endpoint. _dstChainId - the destination chain identifier _destination - the address on destination chain (in bytes). address length/format may vary by chains _payload - a custom bytes payload to send to the destination contract _refundAddress - if the... | interface ILayerZeroEndpoint is ILayerZeroUserApplicationConfig {
function send(
uint16 _dstChainId,
bytes calldata _destination,
bytes calldata _payload,
address payable _refundAddress,
address _zroPaymentAddress,
bytes calldata _adapterParams
) external payable;... | 5,016,759 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.4;
import "./libraries/Data.sol";
import "./libraries/Fork.sol";
import "./libraries/ForkDeposit.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./IDestinationContract.sol";
imp... | Deny depostit one fork | function denyDepositOneFork(bytes32 forkKey) external {
ForkDeposit.Info memory forkDeposit = hashOnionForkDeposits
.getDepositEnsure(forkKey);
IERC20(tokenAddress).safeTransferFrom(
msg.sender,
address(this),
forkDeposit.amount
);
ha... | 5,533,112 |
./partial_match/1313161554/0x140e8a21d08CbB530929b012581a7C7e696145eF/sources/XpolarRewardPool.sol | do not allow to drain core token (xpolar or lps) if less than 90 days after pool ends | function governanceRecoverUnsupported(
IERC20 _token,
uint256 amount,
address to
) external onlyOperator {
if (block.timestamp < poolEndTime + 90 days) {
require(_token != xpolar, "xpolar");
uint256 length = poolInfo.length;
for (uint256 pid = ... | 16,932,746 |
pragma solidity ^0.4.11;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(... | percent awarded for test passed by candidate | function new_service_fee(uint8 _service_fee) public onlyOwner {
service_fee = _service_fee;
}
| 1,018,146 |
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
// SPDX-License-Identifier: MIT OR Apache-2.0
import "./ReentrancyGuard.sol";
import "./SafeMath.sol";
import "./SafeMathUInt128.sol";
import "./SafeCast.sol";
import "./Utils.sol";
import "./Storage.sol";
import "./Config.sol";
import "./Events.sol";
im... | Notification that upgrade finishes Can be external because Proxy contract intercepts illegal calls of this function | function upgradeFinishes() external override {
upgradePreparationActive = false;
upgradePreparationActivationTime = 0;
}
| 72,115 |
pragma solidity ^0.5.12;
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas opti... | Internal function to transfer ownership of a given token ID to another address. As opposed to {transferFrom}, this imposes no restrictions on msg.sender. from current owner of the token to address to receive the ownership of the given token ID tokenId uint256 ID of the token to be transferred/ | function _transferFrom(address from, address to, uint256 tokenId) internal {
require(_ownerOf(tokenId) == from);
require(to != address(0));
_clearApproval(tokenId);
_ownedTokensCount[from].decrement();
_ownedTokensCount[to].increment();
if(_tokenFirstOwner[tokenId]==addr... | 14,112,902 |
./full_match/5/0xeF78f20cDE58EfC8193C5A3077696d115809Ca5F/sources/src/ERC721SeaDrop.sol | Update the creator payout address for this nft contract on SeaDrop. Only the owner can set the creator payout address. seaDropImpl The allowed SeaDrop contract. payoutAddress The new payout address./ Ensure the sender is only the owner or contract itself. Ensure the SeaDrop is allowed. Update the cr... | function updateCreatorPayoutAddress(
address seaDropImpl,
address payoutAddress
) external {
_onlyOwnerOrSelf();
_onlyAllowedSeaDrop(seaDropImpl);
ISeaDrop(seaDropImpl).updateCreatorPayoutAddress(payoutAddress);
}
| 1,887,596 |
pragma solidity 0.4.25;
library SafeMath8 {
function mul(uint8 a, uint8 b) internal pure returns (uint8) {
if (a == 0) {
return 0;
}
uint8 c = a * b;
assert(c / a == b);
return c;
}
function div(uint8 a, uint8 b) internal pure returns (uint... | select one of 16 variations | function _calculateGen(
uint8[16] _momGen,
uint8[16] _dadGen,
uint8 _random
) internal pure returns (uint8[16] gen) {
if (_random < 4) {
return _chooseGen(_random, _momGen, _momGen);
return _chooseGen(_random.sub(4), _momGen, _dadGen);
return _... | 5,428,486 |
/**
* @authors: [@unknownunknown1]
* @reviewers: [@ferittuncer, @clesaege, @satello*, @mtsalenc*, @remedcu]
* @auditors: []
* @bounties: [{ link: https://github.com/kleros/kleros/issues/155, maxPayout: 100 ETH }]
* @deployments: []
* @tools: [MythX]
*/
/* solium-disable security/no-block-members */
/* sol... | Approves a transaction list or creates a dispute if more than one list was submitted. TRUSTED. If nothing was submitted changes session./ | function executeSubmissions() public duringApprovalPeriod {
Session storage session = sessions[sessions.length - 1];
require(session.status == Status.NoDispute, "Can't approve transaction list while dispute is active.");
if (session.submittedLists.length == 0) {
lastApprovalTime ... | 12,753,165 |
./full_match/314/0x7b7f1f85F599b63432F5D782041c25Dad354f999/sources/node_modules/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol | Returns the admin of this proxy./ | function _proxyAdmin() internal virtual returns (address) {
return _admin;
}
| 8,082,474 |
//Address: 0x2399e275a35b9562f7fc93869abe9948e7b509bb
//Contract name: SKToken
//Balance: 0 Ether
//Verification Date: 5/14/2018
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity ^0.4.21;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
... | Destroy tokens from other account Remove `_value` tokens from the system irreversibly on behalf of `_from`. _from the address of the sender _value the amount of money to burn/ | function burnFrom(address _from, uint256 _value) whenNotPaused onlyPayloadSize(2*32) public returns (bool success) {
require(!frozenAccount[msg.sender]);
require(!frozenAccount[_from]);
emit Burn(_from, _value);
return true;
}
| 5,449,098 |
./full_match/4/0x3d5dcE9a17b0595304C23a3a06503A39CDbcd2eB/sources/contracts/OrangeadNFT_v2_Testnet.sol | Set unrevaled URI prefix/ | function setUriPrefixUnrevealed(string memory uriPrefixUnrevealed_)
public
onlyOwner
{
_uriPrefixUnrevealed = uriPrefixUnrevealed_;
}
| 12,498,907 |
/**
*Submitted for verification at Etherscan.io on 2020-10-21
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.6;
// From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol
// Subject to the MIT license.
/**
* @dev Wrappers over Solidity's arithmetic operations with a... | blacklists a keeper from participating in the network keeper the address being slashed/ | function revoke(address keeper) external {
require(msg.sender == governance, "Keep3r::slash: only governance can resolve");
keepers[keeper] = false;
blacklist[keeper] = true;
slash(keeper, bonds[keeper]);
}
| 603,503 |
/**
*Submitted for verification at Etherscan.io on 2021-06-18
*/
// Sources flattened with hardhat v2.3.0 https://hardhat.org
// SPDX-License-Identifier: MIT
// File contracts/IBeacon.sol
pragma solidity ^0.8.0;
/**
* @dev This is the interface that {BeaconProxy} expects of its beacon.
*/
interface IBeacon {
... | ----------------------------------------------------- Returns the latest Chainlink Oracle ETH USD price----------------------------------------------------- If the round is not complete yet, timestamp is 0 | function getLatestPrice() public {
(
uint80 roundID,
int price,
uint startedAt,
uint timeStamp,
uint80 answeredInRound
) = priceFeed.latestRoundData();
require(timeStamp > 0, "Round not complete");
ethPrice = uint(price) / ... | 7,029,000 |
pragma solidity 0.4.24;
// File: contracts\lib\Ownable.sol
/**
* @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 Owner... | finalizes crowdsale/ | function finalization() internal {
if (crowdsaleCap > tokenOnSale.totalSupply()) {
uint256 remainingTokens = crowdsaleCap.sub(tokenOnSale.totalSupply());
tokenOnSale.mint(wallet, remainingTokens);
}
tokenOnSale.transferOwnership(initialTokenOwner);
super.fin... | 953,336 |
./full_match/1/0x82a7b5842085f434c6584A8c44b6A1C15c25a512/sources/contracts/configurations/NoopPool.sol | Get implementation version return Implementation version/ | function IMPLEMENTATION_VERSION() external pure returns (string memory) {
return "0.1";
}
| 9,659,371 |
// SPDX-License-Identifier: MIT LICENSE
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "./interfaces/IWnD.sol";
import "./interfaces/ITower.sol";
i... | Y U checking on this address in the same block it's being modified... hmmmm | function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override(ERC721Enumerable, IERC721Enumerable) blockIfChangingAddress returns (uint256) {
require(admins[_msgSender()] || lastWriteAddress[owner].blockNum < block.number, "hmmmm what doing?");
uint256 tokenId = super.token... | 11,701,197 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.