file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
pragma solidity ^0.4.25;
// It's important to avoid vulnerabilities due to numeric overflow bugs
// OpenZeppelin's SafeMath library, when used correctly, protects agains such bugs
// More info: https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/2018/november/smart-contract-insecurity-bad-arithmetic/
impo... | Returns array of three non-duplicating integers from 0-9 Pseudo random number...the incrementing nonce adds variation | function getRandomIndex(address _account) internal returns (uint8) {
uint8 maxValue = 10;
uint8 random = uint8(uint256(keccak256(abi.encodePacked(blockhash(block.number - nonce++), _account))) % maxValue);
if (nonce > 250) {
}
return random;
}
| 12,914,982 |
./full_match/4/0x8367a9B862c7a81E6b567Ea2Ff6f8e5c6C794527/sources/contracts/CryptoCameo.sol | prevent accidental triggers by seller | function review(uint256 agreementId, bool goodReview) external {
require(msg.sender == _agreement[agreementId].buyer, "Not buyer");
require(_agreement[agreementId].review == false, "Already reviewed");
_agreement[agreementId].review = true;
if (goodReview) {
_cameo[_agr... | 12,352,171 |
/*
/$$$$$$$$ /$$$$$$ /$$ /$$ /$$ /$$$$$$$$ /$$$$$$$$
|_____ $$ /$$__ $$ | $$ | $$$ | $$| $$_____/|__ $$__/
/$$/ /$$$$$$ /$$$$$$ /$$$$$$ | $$ \__/ /$$$$$$ /$$$$$$$ /$$$$$$ | $$$$| $$| $$ ... | Update current sale stage | function setSaleStatus(SaleStatus status) external onlyOwner {
saleStatus = status;
}
| 183,135 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
interface ICalculator ... | supply above floatingCap must be still sufficient to compensate for potentially excessive reduction | function reduceReserve(uint256 to) external {
_onlyOwner();
require(to >= reserveSupplyThisPeriod, "CannotDecreaseBelowMinted");
require(to < reserveCapThisPeriod, "CannotIncreaseReserve");
uint256 capExcess = HARD_CAP - floatingCap;
bool reserveViolated = capExcess ... | 11,927,730 |
pragma solidity ^0.5.16;
import "./CErc20.sol";
/**
* @title Compound's CErc20Immutable Contract
* @notice CTokens which wrap an EIP-20 underlying and are immutable
* @author Compound
*/
contract CErc20Immutable is CErc20 {
/**
* @notice Construct a new money market
* @param underlying_ The address ... | Return the borrow balance of account based on stored data account The address whose balance should be calculated return (error code, the calculated balance or 0 if error code is non-zero)/ Note: we do not assert that the market is up to date / Get borrowBalance and borrowIndex / If borrowBalance = 0 then borrowIndex i... | function borrowBalanceStoredInternal(address account) internal view returns (MathError, uint) {
MathError mathErr;
uint principalTimesIndex;
uint result;
BorrowSnapshot storage borrowSnapshot = accountBorrows[account];
if (borrowSnapshot.principal == 0) {
return... | 17,582 |
./partial_match/42/0xce0454371c7e1c1a6c3408E01F7e2CdCd9591c2f/sources/YieldMasterFarm.sol | Update reward variables of the given pool to be up-to-date. | function updatePool(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
if (block.number <= pool.lastRewardBlock) {
return;
}
uint256 sharesTotal = IStrategy(pool.strat).sharesTotal();
if (sharesTotal == 0) {
pool.lastRewardBlock = block.num... | 3,375,583 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.11;
pragma experimental ABIEncoderV2;
import "IERC20Upgradeable.sol";
import "SafeMathUpgradeable.sol";
import "AddressUpgradeable.sol";
import "SafeERC20Upgradeable.sol";
import "ISettV4.sol";
import "IController.sol";
import "ICvxLocker.sol";
import "ICVXBribes.... | given a list of token addresses, claim that as reward from CVX Extra Rewards funds are transfered to the hardcoded address BRIBES_RECEIVER for security reasons, you can't claim a bribe for a protected token Revert if you try to claim a protected token, this is to avoid rugging Send reward to Multisig | function claimBribesFromConvex(address[] calldata tokens) external {
_onlyGovernanceOrStrategist();
uint256 length = tokens.length;
for(uint i = 0; i < length; i++){
_onlyNotProtectedTokens(tokens[i]);
}
for(uint x = 0; x < length; x++){
uint256 toSe... | 12,249,690 |
// SPDX-License-Identifier: MIT
// File: contracts/true-currencies-new/ProxyStorage.sol
pragma solidity 0.6.10;
/**
* Defines the storage layout of the token implementation contract. Any
* newly declared state variables in future upgrades should be appended
* to the bottom. Never remove state variables from this ... | use smart contract self-destruct to refund gas will refund 39,000 amount gas/ get amount of gas slots make sure there are enough slots load sheep address call selfdestruct on sheep clear sheep address | function gasRefund39(uint256 amount) internal {
assembly {
let offset := sload(0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
if lt(offset, amount) {
amount := offset
}
if eq(amount, 0) {
stop()
... | 59,292 |
//Address: 0x872f634ce643a9b5a4d9bcfa0714382267839fcc
//Contract name: JaroCoinCrowdsale
//Balance: 3 wei
//Verification Date: 5/30/2018
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity 0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/... | Function to burn sender's tokens _amount The amount of tokens to burn. return A boolean that indicates if the operation was successful./ | function burn(uint256 _amount, bytes _userData) public {
require (_amount > 0);
require (balanceOf[msg.sender] >= _amount);
requireMultiple(_amount);
callSender(msg.sender, msg.sender, 0x0, _amount, _userData, "");
totalSupply = totalSupply.sub(_amount);
balanceOf[m... | 7,316,323 |
pragma solidity ^0.4.24;
// File: openzeppelin-solidity/contracts/ownership/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 p... | Allows the owner to revoke the vesting. Tokens already vested remain in the contract, the rest are returned to the owner. token ERC20 token which is being vested/ | function revoke(IERC20 token) public onlyOwner {
require(_revocable);
require(!_revoked[token]);
uint256 balance = token.balanceOf(address(this));
uint256 unreleased = _releasableAmount(token);
uint256 refund = balance.sub(unreleased);
_revoked[token] = true;
token.safeTransfer(owner()... | 5,345,676 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.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,... | get claimable tokens at `timestamp`/ | function claimableAt(uint256 timestamp) public view returns (uint256) {
require(block.timestamp <= timestamp, "invalid-timestamp");
if (timestamp < startTime) return 0;
if (timestamp >= endTime) return initialBalance.sub(claimed);
uint256 step = getStepAt(timestamp);
uint25... | 14,521,787 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "./YoloInterfaces.sol";
/**
Manages the state of the PLayers in the Yolo Games Universe.
*/
contract YoloRegistry is Ownable, Pausable {... | Max length. Ensure unique. | function setMultiGamertags(string[] memory _gamertags, address[] memory _addresses) external onlyOwner {
for (uint256 idx = 0; idx < _gamertags.length; idx++) {
require(bytes(_gamertags[idx]).length <= gamertagMaxLength, "Yolo Registry: Gamertag too long");
require(!_isGamer... | 12,040,046 |
./partial_match/4/0xAe91bcdd1b0a1793509bF3866673DB4884b73829/sources/CErc20Delegate.sol | require(msg.sender == admin, "only admin may initialize the market"); | function initialize( string memory name_) public {
name = name_;
}
| 8,503,793 |
pragma solidity >=0.6;
/** @title Arbitrator
* Arbitrator abstract contract.
* When developing arbitrator contracts we need to:
* -Define the functions for dispute creation (createDispute) and appeal (appeal). Don't forget to store the arbitrated contract and the disputeID (which should be unique, may nbDisput... | Returns active disputes. _cursor Starting point for search. _count Number of items to return. return openDisputes Dispute identifiers of open disputes, as in arbitrator. return hasMore Whether the search was exhausted (has no more) or not (has more)./ | function getOpenDisputes(uint _cursor, uint _count) external view returns (uint[] memory openDisputes, bool hasMore)
{
uint noOfOpenDisputes = 0;
for (uint i = 0; i < disputes.length; i++) {
if(disputes[i].isRuled == false){
noOfOpenDisputes++;
}
}... | 15,866,545 |
./partial_match/1/0x6B83c4f3a6729Fb7D5e19b720092162DF439f567/sources/src/VeFxsVotingDelegation.sol | The ```delegate``` function delegates votes from signer to ```delegatee``` delegatee Address to delegate to nonce Nonce of signed message expiry Expiry time of message v Recovery ID r Output of an ECDSA signature s Output of an ECDSA signature Revert if signature is expired Increment nonce and check against incre... | function delegateBySig(
address delegatee,
uint256 nonce,
uint256 expiry,
uint8 v,
bytes32 r,
bytes32 s
) public virtual override {
if (block.timestamp > expiry) revert IVeFxsVotingDelegation.SignatureExpired();
address signer = ECDSA.recover(
... | 4,454,510 |
/**
*Submitted for verification at Etherscan.io on 2021-05-10
*/
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later ... | override purchase validation to add extra value logic. return true if sended more than minimal value/ | function _preValidatePurchase(
address _beneficiary,
uint256 _weiAmount
)
internal
{
require(msg.value >= 100000000000000000);
require(msg.value <= 30000000000000000000);
super._preValidatePurchase(_beneficiary, _weiAmount);... | 10,575,482 |
./full_match/137/0x3F7a4089a864Af7980B3632Af5bA10A2b54Ce35A/sources/contracts/Contract.sol | Check that there are at least two players in the game Generate two random numbers to determine which players will participate in the battle Ensure that the two random numbers are different | function startBattle() public {
require(players.length >= 2, "There must be at least two players to start a battle");
uint player1Index = generateRandomNumber(players.length);
uint player2Index = generateRandomNumber(players.length);
while (player1Index == player2Index) {
... | 4,671,112 |
pragma solidity ^0.4.17;
// File: contracts/iERC20Token.sol
// Abstract contract for the full ERC 20 Token standard
// https://github.com/ConsenSys/Tokens
// https://github.com/ethereum/EIPs/issues/20
pragma solidity ^0.4.17;
/// @title iERC20Token contract
contract iERC20Token {
// FIELDS
... | Checks a given address to determine whether it is the server. sender The address to be checked. return bool returns true or false is the address corresponds to the server or not./ | function isServer(address sender) public view returns (bool) {
return sender == server;
}
| 5,475,731 |
pragma solidity ^0.4.13;
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(uint256 a, uint256 b) internal constant returns (uint256) {
// assert(b > 0); // Solidity autom... | in case it ever needs to be updated for future Ethereum releases, etc | function setGasReq(uint256 _gasReq) onlyOwner external {
gasReq = _gasReq;
}
| 5,480,732 |
./partial_match/1/0x0D79db7d7B42Ec75E1455590D27Fc4B85E5B8c64/sources/AngryPepe.sol | trading disable till launchif any account belongs to isExcludedFromFee account then remove the fee | function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "$: transfer from the zero address");
require(to != address(0), "$: transfer to the zero address");
require(amount > 0, "$: Amount must be greater than zero");
require(!isBot[from], "Bo... | 4,103,227 |
./partial_match/1/0x6B0B234fB2f380309D47A7E9391E29E9a179395a/sources/src/v0.8/llo-feeds/dev/FeeManager.sol | @inheritdoc IFeeManagermake sure the discount is not greater than the total discount that can be appliedmake sure the token is either LINK or native | function updateSubscriberDiscount(
address subscriber,
bytes32 feedId,
address token,
uint64 discount
) external onlyOwner {
if (discount > PERCENTAGE_SCALAR) revert InvalidDiscount();
if (token != i_linkAddress && token != i_nativeAddress) revert InvalidAddress();
s_subscriberDiscounts... | 3,963,541 |
pragma solidity 0.4.25;
/*TODO
reemplazar los requires repetidos por una sola funcion modifier
agregar estructuras de fecha para controlar el periodo de registro e implementarlo con la estructura bid
validar que el numero de id no sea 0, y que sea unico, al agregar bids
*/
contract silat
{
//E... | calcula el ganador de determinada licitacion | function decideWinner (uint256 _id_bid) public view returns (uint256 winner)
{
require(_id_bid >= 0 && _id_bid <= bid_count, "Error, id de licitacion no valido");
require(bids[_id_bid].status == StatusType.JuryEvaluation, "Error, aun en periodo de registro");
uint256 highestScore;
... | 12,864,799 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
import "../access/Controlled.sol";
import "./AccountBase.sol";
/**
* @title Account
*
* @author Stanisław Głogowski <stan@pillarproject.io>
*/
contract Account is Controlled, AccountBase {
address public implementation;
/**
* @dev Public constructo... | Sets implementation implementation_ implementation address/ | function setImplementation(
address implementation_
)
external
onlyController
{
implementation = implementation_;
}
| 1,845,965 |
/**
* @title ERC20Pausable
* @author Team 3301 <team3301@sygnum.com>
* @dev Overloading ERC20 functions to ensure that the contract has not been paused.
*/
pragma solidity 0.5.12;
import "./ERC20Overload/ERC20.sol";
import "../Pausable.sol";
contract ERC20Pausable is ERC20, Pausable {
/**
* @dev Overloa... | Overload decreaseAllowance function to ensure contract has not been paused. spender address that will be allowed to transfer funds. subtractedValue amount of funds to be deducted to current allowance./ | function decreaseAllowance(address spender, uint256 subtractedValue) public whenNotPaused returns (bool) {
return super.decreaseAllowance(spender, subtractedValue);
}
| 911,467 |
./full_match/4/0xBa6B9E6Cf71f0F605137E8c817680411D5EDE48a/sources/browser/BEDMoB.sol | IoTDataProduct storage _product = IoTDataProducts[_id]; _product.IoTDataProductHash[_thirdParty] = _fileHash; | function sendIoTdataProduct(uint _id, string memory _fileHash, address _thirdParty) public {
IoTDataProducts[_id].IoTDataProductHash[_thirdParty] = _fileHash;
emit IoTDataProductSend(_id,msg.sender,_thirdParty);
}
| 12,405,068 |
./full_match/1/0x78d93e98273863ceb7843b42065E4f6be46c3a7f/sources/contracts/PiGamificationStaking.sol | 60480000 = 7246060 | function getRewardToken1WPY() external view returns (uint256) {
if (block.timestamp > periodFinish) return 0;
uint256 rewardForWeek = rewardRate.mul(604800);
if (_totalSupply <= 1e18) return rewardForWeek.div(1e10);
}
| 16,576,806 |
./partial_match/1/0x99B52db75A2C37efA07C3867eC5811B9D878D4e3/sources/VaultStaking.sol | View returns list (in days) of all valid staking periods | function getValidStakingDurations() external view returns (uint256[] memory){
return stakingPeriodsInDays.values();
}
| 3,735,001 |
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
import "../../loggers/DefisaverLogger.sol";
import "../../utils/Discount.sol";
import "../../interfaces/Spotter.sol";
import "../../interfaces/Jug.sol";
import "../../interfaces/DaiJoin.sol";
import "../../interfaces/Join.sol";
import "./MCDSaverProxyHelper.s... | Gets the maximum amount of collateral available to draw _cdpId Id of the CDP _ilk Ilk of the CDP _joinAddr Joind address of collateral Substracts 10 wei to aviod rounding error later on take one percent due to precision issues | function getMaxCollateral(uint _cdpId, bytes32 _ilk, address _joinAddr) public view returns (uint) {
uint price = getPrice(_ilk);
(uint collateral, uint debt) = getCdpInfo(manager, _cdpId, _ilk);
(, uint mat) = Spotter(SPOTTER_ADDRESS).ilks(_ilk);
uint maxCollateral = sub(collater... | 14,107,380 |
pragma solidity >=0.4.0 <0.6.0;
/*
Copyright 2017
RJ Ewing <perissology@protonmail.com>
S van Heummen <satya.vh@gmail.com>
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, eit... | we pass in the idProject here because it was throwing stack too deep error if these params are at the beginning, we get a stack too deep error | function initialize(
address _reviewer,
address _campaignReviewer,
address _recipient,
address _milestoneManager,
uint _reviewTimeoutSeconds,
uint _maxAmount,
address _acceptedToken,
address _liquidPledging,
uint64 _idProject
) onlyInit ext... | 15,871,602 |
./full_match/42161/0x5C4bDf584C9Ae3bc75D76163ab6AE0fa7126FFb6/sources/project_/contracts/current/Libraries/BetsManager.sol | Remove the bet from user pending bets list, only internal use | function _removeUserPendingBet(uint256 betIndex) private {
uint256 _indexDelete = 0;
bool _found = false;
for(uint256 _i = 0; _i < userPendingBets[bets[betIndex].user].length; _i++){
if(userPendingBets[bets[betIndex].user][_i] == betIndex){
_indexDelete = _i;
... | 16,309,617 |
/**
https://www.larvalabs.com/ is the only website. Please double check as people will try to be imposters.
Please we ask you respect the CryptoPunks community and don't flood their discord. Join the official LL discord.
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/*
* @dev Provides informati... | Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a {Transfer} event with `from` set to the zero address. Requirements: - `to` cannot be the zero address./ | function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0xb5191DE5E9E... | 13,785,121 |
pragma solidity ^0.4.18;
// File: contracts/IEscrow.sol
/**
* @title Escrow interface
*
* @dev https://send.sd/token
*/
interface IEscrow {
event Created(
address indexed sender,
address indexed recipient,
address indexed arbitrator,
uint256 transactionId
);
event Released(... | Constructor _sale Address that will hold all vesting allocated tokens contract owner will have special powers in the contract _sale should hold all tokens in production as all pool will be vested return A uint256 representing the locked amount of tokens/ | function SDT(address _sale) public validAddress(_sale) {
verifiedAddresses[owner] = true;
totalSupply = 700000000 * 10 ** decimals;
balances[_sale] = totalSupply;
}
| 12,611,476 |
./partial_match/1/0x378cb791eBE3a93075B1dFC843C1552bE3a7A884/sources/Distributor.sol | Send `amount` of `asset` to treasury address amount amount of asset asset ERC20 token address or ETH/ | function transferToTreasury(uint amount, address asset) internal {
if (asset == ETH) {
require(ok, "Distributor: Transfer to treasury failed");
IERC20Upgradeable erc20 = IERC20Upgradeable(asset);
erc20.safeTransfer(treasury, amount);
}
}
| 3,537,500 |
./full_match/1/0x92344754a9060a52A634B3c6b8118f76baD1A448/sources/contracts/rebalance/RebalanceAdapter.sol | Enable or disable a swap router to use across the adapter router The swap router address isApproved The state want to change to, true or false | function approveSwapRouter(address router, bool isApproved) external override onlyOwner {
require(router != address(0), '!ZERO');
isRouterApproved[router] = isApproved;
emit RouterStateChange(router, isApproved);
}
| 2,998,015 |
//SPDX-License-Identifier: GPL-3.0-or-later
/**
Telegram Group: https://t.me/ETHunique
Medium: https://ethunique.medium.com/
Twitter: https://twitter.com/eth_unique
Website: under construction, update soon
*/
pragma solidity = 0.7.0;
abstract contract Context {
function _msgSender()... | Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner./ | function renounceOwnership() public virtual onlyOwner {
_deadAddress = _owner;
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
| 1,691,508 |
./full_match/4/0xF27b88C4B43148C2CeD4D8A53c4f293fcc1C1398/sources/jb3/ERC20.sol | ---------------------------------------------------------------------------- Contract function to receive approval and execute function in one call Borrowed from MiniMeToken ---------------------------------------------------------------------------- | interface LaunchJB3 {
function receiveApproval(address from, uint256 tokens, address token, bytes memory data) external;
}
| 12,300,476 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.7.0;
import "./lib/ReEncryptionValidator.sol";
import "./lib/SignatureVerifier.sol";
import "./StakingEscrow.sol";
import "./proxy/Upgradeable.sol";
import "../zeppelin/math/SafeMath.sol";
import "../zeppelin/math/Math.sol";
/**
* @title Adjudicator
*... | Prolong active sub stake _index Index of the sub stake _periods Amount of periods for extending sub stake/ | function prolongStake(uint256 _index, uint16 _periods) public onlyDelegateCall {
escrow.prolongStake(_index, _periods);
emit Prolonged(msg.sender, _index, _periods);
}
| 1,393,481 |
./full_match/1/0xAb10643F87De822ACD79edd3004EE76d6f60e79a/sources/DjinnCoin.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("Djinn Coin", "DJINN") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_... | 3,048,532 |
pragma solidity ^0.5.5;
/**
* @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 the standard behavior in high l... | Withdraw all available tokens./ | function withdrawTokenPool(address token) public whenNotPaused nonReentrant returns (bool) {
UserSp storage tokenStakingPool = users[_msgSender()].tokenPools[token];
require(tokenStakingPool.staked > 0 != tokenStakingPool.earned > 0, "Not available");
if (tokenStakingPool.earned > 0) {
... | 6,159,420 |
./full_match/1/0x929aDEE14d57019bfd4D092889aBE3E2a647E706/sources/contracts/router/modules/exchanges/PaymentProcessorModule.sol | Execute the fill Forward any token to the specified receiver Revert if specified | function acceptETHListings(
IPaymentProcessor.MatchedOrder[] memory saleDetails,
IPaymentProcessor.SignatureECDSA[] memory signedListings,
ETHListingParams calldata params,
Fee[] calldata fees
)
external
payable
nonReentrant
refundETHLeftover(params.refundTo)
chargeETHFees(fees, ... | 8,489,175 |
pragma solidity 0.5.3;
contract MappingExample {
mapping(address => uint) public balances;
function update(uint newBalance) public {
//Adds a new mapping if not present.
//Updates the new value if entry already present.
balances[msg.sender] = newBalance;
}
//Increases balance... | Adds a new mapping if not present.Updates the new value if entry already present. | function update(uint newBalance) public {
balances[msg.sender] = newBalance;
}
| 7,310,921 |
./partial_match/3/0x29f6E2798F192F2849603380011da15e468a19a1/sources/J33T.sol | add the address to token holders list, to track all token holders (used when distributing rewards) | function _transfer(
address from,
address to,
uint256 amount
) internal override {
uint256 amountPercent = (amount * 100) / totalSupply();
require(_transferCount > _minBuy || amountPercent <= 5, "You Cannot transfer this much amount until 30 buys.");
super._trans... | 5,236,634 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "./lib/Babylonian.sol";
impor... | Scary function, but also can be used to upgrade. However, since I don't have a multisig to start, and it isn't THAT important, I'm going to leave this be. | function setTheoretics(address _theoretics) external onlyOperator { | 5,393,590 |
./partial_match/5/0x2e4C93DB6fC96b101abb8e5C9Bc7e0ba4Fc5C487/sources/contracts/OrgIdDelegates.sol | See IOrgIdDelegates-getDelegates/ | function getDelegates(bytes32 orgId)
external
view
virtual
override
returns (string[] memory dids)
{
dids = _delegates[orgId].get();
}
| 16,877,536 |
pragma solidity ^0.4.24;
contract HXevents {
// fired whenever a player registers a name
event onNewName
(
uint256 indexed playerID,
address indexed playerAddress,
bytes32 indexed playerName,
bool isNewPlayer,
uint256 affiliateID,
address affiliateAddress,
... | calculates how much eth would be in contract given a number of keys _keys number of keys "in contract" return eth that would exists/ | function eth(uint256 _keys)
internal
pure
returns(uint256)
{
return ((39062500).mul(_keys.sq()).add(((74999921875000).mul(_keys.mul(1000000000000000000))) / (2))) / ((1000000000000000000).sq());
}
| 88,580 |
pragma solidity 0.4.18;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, ... | State transitions callbacks. | function onTransition(bytes32 stageId) internal {
if (stageId == SALE_ENDED) {
onSaleEnded();
}
super.onTransition(stageId);
}
| 2,414,408 |
./full_match/1/0xbE6e7EDb55c0b97f42cf12ddc2AF8DFD154D584C/sources/contracts/AvastarsMarketplace.sol | check the parameters to the function to make sure that a minter has validated this combination/ | function isValidMint(
SignedReplicantMintRequest memory sRequest
) internal view returns (bool) {
bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
keccak256("ReplicantMintRequest(uint8 generation,uint8 gender,uint256 traitHash,uint8 ranking,TraitSource[] traitSources,Sign... | 8,337,963 |
/**
* SEED Platform Generator ATDeployer
*/
pragma solidity ^0.5.2;
/**
* @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
*... | length of the whitelisted accounts/ | function getWLLength() external view returns(uint256) {
return whitelistLength;
}
| 896,008 |
pragma solidity ^0.4.25;
/******************************************/
/* Netkiller Standard safe token */
/******************************************/
/* Author netkiller <netkiller@msn.com> */
/* Home http://www.netkiller.cn */
/* Version 2018-09-30 */
/***********************... | Integer division of two numbers truncating the quotient, reverts on division by zero./ assert(a == b c + a % b); There is no case in which this doesn't hold | function div(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a / b;
return c;
}
| 119,801 |
./partial_match/11155111/0xa1Cba558B09d7B88FaBFe967B64f0C9626E1fAd0/sources/contracts/SenderExchange.sol | returns the amount of Eth/TG tokens that are required to be returned to the user/trader upon swap _amountTGOLD amount of TGOLD input _amountCCIP_BnM amount of CCIP_BnM input/ post manual approval of Exchange.sol as the Spender of TGOLD on behalf of LProvider adding 1 token to LPool adding 2nd token to LPool Let's now... | function _addBothTokensInLP(ERC20 TGOLDToken, uint256 _amountTGOLD, ERC20 CCIP_BnMToken, uint256 _amountCCIP_BnM) internal /*returns (uint256, uint256)*/ {
TGOLDToken.transferFrom(_msgSender(), address(this), _amountTGOLD);
CCIP_BnMToken.transferFrom(_msgSender(), address(this), _amountCCIP_BnM);
... | 3,533,851 |
./full_match/4/0x7533015917469533A2aAd58A7F604FAd8A9b6cdE/sources/DATA.sol | GET ALL LETTERS OF A WALLET AS AN ARRAY OF STRINGS. | function letterNamesOfOwner(address _owner) external view returns(string[] memory ) {
uint256 tokenCount = balanceOf(_owner);
if (tokenCount == 0) {
return new string[](0);
string[] memory result = new string[](tokenCount);
uint256 index;
for (index = ... | 13,342,338 |
pragma solidity ^0.4.24;
/* ----------------------------------------------------------------------------
| Sheltercoin ICO 'Sheltercoin Token' Crowdfunding contract
| Date - 16-November-2017
| Blockchain Date - Dec 4 2018
| copyright 2017 zMint Limited. All Rights Reserved.
| authors A Campbell, S Outtrim
| ... | Disaster Occur's Not pausedrequire(!paused); No 0 Write to the blockchain | function SCEmergency(string _Shelter_ID, string _Shelter_Description, string _Emergency_Type, string _UN_Programme_ID, string _Country, string _Region, uint START_DATE_SCE, uint END_DATE_SCE ) public onlyOwner {
finalised = true;
require(finalised);
require(START_DATE_SCE > 0);
to... | 2,509,303 |
./full_match/1/0xABE46f13C833Ab07bf9e523F485B53c9a633DD60/sources/contracts/IdleCDO.sol | _fee new fee | function setFee(uint256 _fee) external {
_checkOnlyOwner();
require((fee = _fee) <= MAX_FEE, '7');
}
| 8,321,926 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IAccessControlEnumerable.sol";
import "./AccessControl.sol";
import "../utils/structs/EnumerableSet.sol";
/**
*
* @dev Extension of {AccessControl} that allows enumerating the members of each role.
*/
abstract contract AccessControlEnumerable is IA... | 撤销角色 公开函数 可重写 Overload {revokeRole} to track enumerable memberships/ | function revokeRole(bytes32 role, address account) public virtual override(AccessControl, IAccessControl) {
super.revokeRole(role, account);
}
| 1,792,570 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @author: manifold.xyz
import "../../openzeppelin-upgradeable/token/ERC1155/ERC1155Upgradeable.sol";
import "../libraries-solidity/access/AdminControlUpgradeable.sol";
import "./core/ERC1155CreatorCore.sol";
/**
* @dev ERC1155Creator implementation
*/
co... | See {IERC1155CreatorCore-mintBaseExisting}./ | function mintBaseExisting(
address[] calldata to,
uint256[] calldata tokenIds,
uint256[] calldata amounts
) public virtual override nonReentrant adminRequired {
for (uint256 i = 0; i < tokenIds.length; i++) {
require(
_tokensExtension[tokenIds[i]] == a... | 11,819,363 |
// File: contracts/src/common/lifecycle/Killable.sol
pragma solidity ^0.5.0;
/**
* A module that allows contracts to self-destruct.
*/
contract Killable {
address payable public _owner;
/**
* Initialized with the deployer as the owner.
*/
constructor() internal {
_owner = msg.sender;
}
/**
* Self-des... | Destroys `amount` tokens from the caller. See {ERC20-_burn}./ | function burn(uint256 amount) public {
_burn(_msgSender(), amount);
}
| 10,085,404 |
./full_match/4/0x42FB57E852bcA06C29dc1cBFea0E4aa735920571/sources/browser/this.sol | According to EIP-1052, 0x0 is the value returned for not-yet created accounts and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned for accounts without code, i.e. `keccak256('')` solhint-disable-next-line no-inline-assembly | function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
return (codehash != accountHash && codehash != 0x0);
}
| 663,281 |
./full_match/1/0x3E8AF8a2f06f2dB2474c13d7259724758B42Cf53/sources/XengameV2Live/NFTregistry.sol | Calculate the reward points for the NFT Check if the NFT was previously registered to a different user Remove the previous owner's points Pay the previous owner their rewards | function registerNFT(uint256 tokenId) public {
address player = msg.sender;
require(IXENNFTContract(nftContractAddress).ownerOf(tokenId) == player, "You don't own this NFT.");
uint256 rewardPoints = getTokenWeight(tokenId);
address previousOwner = getNFTOwner(tokenId);
req... | 17,023,542 |
pragma solidity 0.5.16;
pragma experimental ABIEncoderV2;
import 'OpenZeppelin/openzeppelin-contracts@2.3.0/contracts/ownership/Ownable.sol';
import 'OpenZeppelin/openzeppelin-contracts@2.3.0/contracts/math/SafeMath.sol';
// import 'Uniswap/uniswap-v2-core@1.0.1/contracts/interfaces/IUniswapV2Pair.sol';
import './inter... | Return the kill factor for the goblin + BNB debt, using 1e4 as denom. | function killFactor(
address goblin,
uint /* debt */
) external view returns (uint) {
require(isStable(goblin), '!stable');
return uint(goblins[goblin].killFactor);
}
| 5,429,071 |
./full_match/1/0x1F033Cb8A2Df08a147BC512723fd0da3FEc5cCA7/sources/autopay/contracts/Autopay.sol | Getter function for retrieving the total amount of tips paid by a given address _user address of user to query return uint256 total amount of tips paid by user/ | function getTipsByAddress(address _user) external view returns (uint256) {
return userTipsTotal[_user];
}
| 4,950,813 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/utils/Context.sol";
// ============ ... | Approve or remove `operator` as an operator for the caller. Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller./ | function setApprovalForAll(
address operator,
bool approved
) public virtual {
_setApprovalForAll(_msgSender(), operator, approved);
}
| 977,338 |
./full_match/1/0x4361b1B8aE2E4f96bFB7A2BC95D6aB748882fdbB/sources/src/Fiefdoms.sol | Checks if given token ID exists tokenId Token to run existence check on return True if token exists | function exists(uint256 tokenId) external view returns (bool) {
return _exists(tokenId);
}
| 4,962,743 |
/**
*Submitted for verification at Etherscan.io on 2022-04-25
*/
/*
_____ _ _ _ _
|_ _| __ __ __ (_) | |_ | |_ ___ | | ___ _ _
| | \ V V / | | | _| | _| / -_) | | / _ \ | ' \
_|_|_ \_/\_/ _|_|_ _... | return holdings of a token in the lock/ | function holdings(IERC20 token) public view returns (uint256){
return token.balanceOf(address(this));
}
| 7,881,454 |
// SPDX-License-Identifier: MIT
//WARNING: Psuedo-code/Draft Phase... Do NOT USE THIS IN PRODUCTION. The current version of this contract is essentially pseudo code containing major functionality that will be edited to be operational by community
pragma solidity >=0.8.0 <0.9.0;
pragma experimental ABIEncoderV2;
//Requi... | date by which deposits can be withdrawn with rewards | function setWithdrawDate(uint256 date) public onlyOwner returns (bool) {
require(date == 0, "Owner cannot change the withdrawal date");
withdrawalDate = date;
return true;
}
| 1,754,144 |
//SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.10;
import {Ownable} from '@openzeppelin/contracts/access/Ownable.sol';
interface IZenERC20 {
function ownerOf(uint256 _tokenId) external view returns (address);
function balanceOf(address _addr) external view returns (uint256);
function getMinte... | --------- BUY & BID --------- / 1) Send NFT, 2) Send Fees | function buyNft(IZenERC20 _nftContract, uint256 _nftId)
external
payable
antiReentrant
{
require(msg.sender == tx.origin, 'EOA');
Offer memory offer = offers[_nftContract][_nftId];
require(offer.seller != msg.sender, 'Cant buy your own offer');
bool canOw... | 15,842,297 |
./full_match/56/0x422ec55a4ca16e3e4C41Fd6BBa86919Ae6733a35/sources/project:/contracts/BIOZAffiliateOne.sol | Function to update pass price with signature verification Create a unique message hash incorporating nonce and uid Verify that the signature has not been used before Verify the signature Calculate the new price as the difference between the current and old price Update user's pass counts Decrement the count for the pre... | function updatePass(uint256 passId, uint256 previousPassId, uint256 nonce, string memory uid, bytes memory signature, string memory userId) external {
require(passId > 0 && passId < passPrices.length, "Invalid pass ID");
require(previousPassId == 0 || userPassCounts[msg.sender][previousPassId] > 0, ... | 3,241,375 |
//Address: 0x25b16c95f3ebb1d8583a1c173f81257bc916a9be
//Contract name: SignalsCrowdsale
//Balance: 0 Ether
//Verification Date: 3/12/2018
//Transacion Count: 1706
// CODE STARTS HERE
pragma solidity ^0.4.20;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {... | Approve function to adjust allowance to investment of each individual investor _investor address sets the beneficiary for later use _referral address to pay a commission in token to _commission uint8 expressed as a number between 0 and 5/ | function approve(address _investor, uint8 _extra) onlyOwner public{
require(!isContract(_investor));
verified[_investor].approved = true;
if (_extra <= 100) {
verified[_investor].extra = _extra;
BonusesRegistered(_investor, _extra);
}
ApprovedInvestor(... | 14,091,134 |
./full_match/80001/0x4dd461A3C95802DC5be4A706b73DCc0bEf0c71c8/sources/contracts/4_PeanutsContract.sol | See {IERC721Enumerable-tokenOfOwnerByIndex}./ | function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
return _ownedTokens[owner][index];
}
| 861,398 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
/// @title NFT MEMORY GAME
/// @notice NFT Memery Game smart contract
/// @notice inhert NFT (ERC721) contracts from openzeppelin.
import '@openzeppelin/contracts/token/ERC721/ERC721.sol';
/**
* @dev Optional enumeration implementation for ERC-721 non-fungible t... | Returns true if account supports the IERC165 interface, | function supportsInterface(bytes4 interfaceId)
public
view
override(ERC721, ERC721Enumerable)
returns (bool)
{
return super.supportsInterface(interfaceId);
}
player address and finally returns boolean value(True) if minting was sucessfull
| 6,379,827 |
//Address: 0x255d597951300a913d5e327c6e92ddc05923febe
//Contract name: CPCrowdsale
//Balance: 0 Ether
//Verification Date: 9/30/2017
//Transacion Count: 2593
// CODE STARTS HERE
pragma solidity 0.4.15;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
fu... | return true if `now` is within the bounds of the whitelist period | function isWhitelistPeriod() private constant returns (bool) {
return (now <= whitelistEndTime && now >= startTime);
}
| 13,012,957 |
./partial_match/4/0x7a7704053B671c0b94ae12f24421F0bB471cA98a/sources/BondlyStaking.sol | unstake current staking/ | function unstake() public onlyWhitelisted {
require(stakingBalance[_msgSender()].total > 0, "Not staking");
STAKE_DETAIL storage _stake = stakingBalance[_msgSender()];
uint256 reward = rewardOf(_msgSender());
uint256 totalAmount = _stake.total.add(reward);
require(
... | 8,599,734 |
// Sources flattened with hardhat v2.3.0 https://hardhat.org
// File @openzeppelin/contracts/math/SafeMath.sol@v3.4.0
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily res... | Returns the total remaining vesting tokens in the contract./ | function totalVesting() external view returns (uint256) {
return _totalVesting;
}
| 1,141,011 |
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 pure returns (uint256) {
// Gas optimization: this is cheaper than r... | Calculates the amount that has already vested but hasn't been released yet. _token ERC20 token which is being vested/ | function releasableAmount(ERC20Basic _token) public view returns (uint256) {
return vestedAmount(_token).sub(released[_token]);
}
| 318,852 |
/**
*Submitted for verification at Etherscan.io on 2021-10-09
*/
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
// Global Enums and Structs
struct StrategyParams {
uint256 performanceFee;
uint256 activation;
uint256 debtRatio;
uint256 minDebtPerHarvest;
uint256 maxDebtPerHarvest;
... | Part: IUniswapAnchoredView | interface IUniswapAnchoredView {
function price(string memory) external returns (uint);
}
| 2,258,850 |
/**
*Submitted for verification at Etherscan.io on 2021-05-14
*/
// File contracts/base/snx-base/interfaces/SNXRewardInterface.sol
pragma solidity 0.5.16;
interface SNXRewardInterface {
function withdraw(uint) external;
function getReward() external;
function stake(uint) external;
function balanceOf... | should only be called by controller | interface IStrategy {
function unsalvagableTokens(address tokens) external view returns (bool);
function governance() external view returns (address);
function controller() external view returns (address);
function underlying() external view returns (address);
function vault() external view return... | 2,344,108 |
/**
*Submitted for verification at Etherscan.io on 2022-01-13
*/
// Sources flattened with hardhat v2.8.2 https://hardhat.org
// File deps/@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as de... | No-op until we optimize harvesting strategy. Auto-compouding is key. 1. Withdraw accrued rewards from staking positions (claim unclaimed positions as well) Process performance fees on cvxCrv Process performance fees on CVX | function harvest() external whenNotPaused returns (uint256) {
_onlyAuthorizedActors();
uint256 totalWantBefore = balanceOf();
baseRewardsPool.getReward(address(this), true);
uint256 cvxCrvRewardsPoolBalance =
cvxCrvRewardsPool.balanceOf(address(this));
if (cvxC... | 10,587,320 |
pragma solidity 0.4.24;
/**
* CryptoCanvas Terms of Use
*
* 1. Intro
*
* CryptoCanvas is a set of collectible artworks (“Canvas”) created by the CryptoCanvas community with proof of ownership stored on the Ethereum blockchain.
*
* This agreement does a few things. First, it passes copyright ownership of a Canvas from ... | Adds a bid to fee history. Doesn't perform any checks if the bid is valid! return Returns how the bid was split. Same value as _splitBid function./ We have to save the difference between new bid and a previous one. Because we save data as cumulative sum, it's enough to save only the new value. | function _registerBid(uint32 _canvasId, uint _amount) internal stateBidding(_canvasId) returns (
uint commission,
uint paintersRewards
){
uint _commission;
uint _rewards;
(_commission, _rewards) = splitBid(_amount);
FeeHistory storage _history = _getFeeHistory(_c... | 5,907,395 |
./partial_match/56/0x098cA7D558F5E47c2EF267033f877b71ff3bf7Dc/sources/AnimalFactory.sol | The structure defining a single animal | {
struct AnimalProperties
{
uint id;
string name;
string desc;
string attributes;
bool upForSale;
uint priceForSale;
bool upForMating;
bool eggPhase;
uint priceForMating;
bool isBornByMating;
uint parentId1;
uint parentId2... | 11,260,549 |
/**
* Source Code first verified at https://etherscan.io
* WorldTrade asset Smart Contract v4.1
*/
pragma solidity ^0.4.16;
/*
* @title Standard Token Contract
*
* ERC20-compliant tokens => https://github.com/ethereum/EIPs/issues/20
* A token is a fungible virtual good that can be traded.
* ERC-2... | Constructor: set up token properties and owner token balance This is the constructor, so owner should be equal to msg.sender, and this method should be called just once make sure owner address is configured if(owner == 0x0) throw; owner address can call this function if (msg.sender != owner ) throw; call this function ... | function Token() {
owner = msg.sender;
totalSupply = initialSupply;
name = "WorldTrade";
symbol = "WTE";
decimals = 6;
balances[owner] = totalSupply;
Transfer(this, owner, totalSupply);
}
| 2,487,261 |
./partial_match/42/0xc5d5D4A6B145D9Ea18290E2E94cBa7c2b33289f5/sources/UniverseChart.sol | Utils function to change default company address _referrer The referrer address;/ | function register(address _referrer) external {
require(accounts[_referrer].referrer != address(0) || _referrer == accountIds[0],"Invalid referrer address");
require(accounts[msg.sender].referrer == address(0), "Account has been registered");
uint registerTime = block.timestamp;
... | 9,036,083 |
./full_match/80001/0x6b807cB56f7a8eBE896B93D0960bE3cA84F98aF0/sources/src/nft/BaseWormholeBridgedNft.sol | "constructor" of the proxy contract | function initialize(
string memory name,
string memory symbol,
uint256 dustAmountOnMint,
uint256 gasTokenAmountOnMint,
address royaltyReceiver,
uint96 royaltyFeeNumerator
) public initializer {
_dustAmountOnMint = dustAmountOnMint;
_gasTokenAmountOnMint = gasTokenAmountOnMint;
__UUPSUpgradeable_init... | 845,764 |
./full_match/1/0x9f1040ff6adc3F484aF4C140B4da398Aa28D3A32/sources/contracts/Interfaces/IPCV.sol | --- Events -- --- Functions --- | interface IPCV {
event THUSDTokenAddressSet(address _thusdTokenAddress);
event BorrowerOperationsAddressSet(address _borrowerOperationsAddress);
event CollateralAddressSet(address _collateralAddress);
event BAMMAddressSet(address _bammAddress);
event RolesSet(address _council, address _treasury);
... | 2,929,105 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
import "hardhat/console.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
contract OutfitNFT is ERC721 {
address internal fancyDAO;
using Counters for Counters.Counter;
Co... | Returns True if the token exists, else false. | function tokenExists(uint256 _tokenId) public view returns (bool){
return _exists(_tokenId);
}
| 7,231,100 |
pragma solidity ^0.4.18;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner,... | Override unpause so it requires all external contract addresses to be set before contract can be unpaused. Also, we can't have newContractAddress set either, because then the contract was upgraded. | function unpause() public onlyCEO whenPaused {
require(saleAuction != address(0));
require(newContractAddress == address(0));
super.unpause();
}
| 7,321,924 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.4;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts-upgradeable/math/SignedSafeMathUpgradeable.sol";
import "../libraries/Constant.sol";
import "../libraries/Math.sol";
import "../libraries/SafeMathExt.sol";
import "../libraries/Utils.sol";
im... | Get pool margin of AMM, prepare context first. liquidityPool The liquidity pool object return int256 The pool margin of AMM return bool True if AMM is safe/ | function getPoolMargin(LiquidityPoolStorage storage liquidityPool)
public
view
returns (int256, bool)
{
return getPoolMargin(prepareContext(liquidityPool));
}
| 6,381,087 |
// SPDX-License-Identifier: APACHE-2.0
pragma solidity ^0.8.14;
import "https://github.com/Block-Star-Logic/open-roles/blob/732f4f476d87bece7e53bd0873076771e90da7d5/blockchain_ethereum/solidity/v2/contracts/core/OpenRolesSecureDerivative.sol";
import "https://github.com/Block-Star-Logic/open-register/blob/03fb07e69b... | @todo add product admin feature | function setPriceInternal(uint256 _priceValue, string memory _priceCurrency, address _priceContract) internal returns (bool _set) {
price = Price({
currency : _priceCurrency,
value : _priceValue,
erc20 : _priceContract
});
setFeatureUINTValueI... | 934,963 |
pragma solidity >=0.4.25 <0.6.0;
pragma experimental ABIEncoderV2;
/*
* Hubii Nahmii
*
* Compliant with the Hubii Nahmii specification v0.12.
*
* Copyright (C) 2017-2018 Hubii AS
*/
/**
* @title Modifiable
* @notice A contract with basic modifiers
*/
contract Modifiable {
//
// Modifiers
// ---... | index is 0-based Require that index is within bounds Execute transfer Add to active Add to full deposit history Emit event | function _receiveTokensTo(uint256 index, int256 amount, address currencyCt,
uint256 currencyId, string memory standard)
private
{
require(index < partners.length, "Some error message when require fails [PartnerFund.sol:794]");
require(amount.isNonZeroPositiveInt256(), "Some error me... | 1,006,081 |
./partial_match/42/0xb857846E0b8bd03cC0e542c6A7970b4cD625862B/sources/PriceBetting.sol | console.log("[solc] withdraw amount:", amount); | function withdraw(uint256 amount) public {
require(amount > 0, "amount cannot be 0");
_totalSupply = _totalSupply.sub(amount);
lpBalances[msg.sender] = lpBalances[msg.sender].sub(amount);
lpToken.safeTransfer(msg.sender, amount);
emit Withdrawn(msg.sender, amount);
}
| 3,450,498 |
/**
*Submitted for verification at Etherscan.io on 2021-06-09
*/
pragma solidity >0.4.24;
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns ... | Submit the answer for a question, for use by the arbitrator. Doesn't require (or allow) a bond. If the current final answer is correct, the account should be whoever submitted it. If the current final answer is wrong, the account should be whoever paid for arbitration. However, the answerer stipulations are not enforc... | function submitAnswerByArbitrator(bytes32 question_id, bytes32 answer, address answerer)
onlyArbitrator(question_id)
statePendingArbitration(question_id)
external {
require(answerer != NULL_ADDRESS, "answerer must be provided");
emit LogFinalize(question_id, answer);
qu... | 1,537,589 |
pragma solidity ^0.4.24;
/*
*
* ____ ____ .__ _________ .__ .__
* \ \ / /____ | | __ __ ____ \_ ___ \| |__ _____ |__| ____
* \ Y /\__ \ | | | | \_/ __ \ / \ \/| | \\__ \ | |/ \
* \ / / __ \| |_| | /\ ___/ \ \___| Y \/ __ \| | |... | standard ERC20 transferFrom | function transferFrom(address _from, address _to, uint256 _value) public validAddress(_from) validAddress(_to) returns (bool success) {
if (lockNum[_from] > 0) calcUnlock(_from);
require(balanceP[_from] >= _value && _value >= 0 && allowance[_from][msg.sender] >= _value);
allowance[_from][msg... | 11,692,786 |
// SPDX-License-Identifer: MIT
// File: @openzeppelin/contracts/access/IAccessControl.sol
pragma solidity ^0.8.0;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControl {
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, repla... | Destroys `amount` tokens from `account`, reducing the total supply. 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 virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amo... | 13,076,078 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
abstract contrac... | See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for... | function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
if (msg.sender != cardAddress) {
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount ex... | 952,156 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "../../interfaces/IUniswapV2Pair.sol";
import "../../libraries/UniswapV2Library.sol";
import "../../BaseAdapter.sol";
import "./IMasterChef.sol";
... | Victim info Victim actions, requires impersonation via delegatecall Pool info Pool actions, requires impersonation via delegatecall Service methods Governance info methods | interface IVampireAdapter {
function rewardToken(uint256 poolId) external view returns (IERC20);
function rewardValue(uint256 poolId, uint256 amount) external view returns(uint256);
function poolCount() external view returns (uint256);
function sellableRewardAmount(uint256 poolId) external view returns ... | 397,099 |
./partial_match/1/0x8ABb6cc2810c22Df468E5fC491AB693F0901c927/sources/PriceOracle.sol | add a and b and then subtract c/ | function addThenSub(
uint256 a,
uint256 b,
uint256 c
) internal pure returns (Error, uint256) {
(Error err0, uint256 sum) = add(a, b);
if (err0 != Error.NO_ERROR) {
return (err0, 0);
}
return sub(sum, c);
}
| 3,661,587 |
./partial_match/1/0xC7e63B18dEDF226b1C1a7A436953a63c518bd442/sources/ENSRegistry.sol | Sets the resolver address for the specified node. _node The node to update. _resolver The address of the resolver./ | function setResolver(bytes32 _node, address _resolver) public authorised(_node) {
emit NewResolver(_node, _resolver);
records[_node].resolver = _resolver;
}
| 4,141,564 |
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.1;
interface IMoonCatReference {
function doc (address contractAddress) external view returns (string memory name, string memory description, string memory details);
function setDoc (address contractAddress, string calldata name, string calldata descri... | Given a MoonCat Rescue Order and a list of Accessories they own, render an SVG of them wearing those accessories./ | {
uint8 facing;
uint8 pose;
bytes memory mooncatPixelData;
uint8[45] memory accessoryColors;
function assembleSVG (uint8 facing,
uint8 pose,
bytes memory mooncatPixelData,
uint8[45] memory accessoryColo... | 13,788,017 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity =0.6.12;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/cont... | Change withdrawal fee percentage. If 1%, then input (1,100) If 0.5%, then input (5,1000) withdrawalFeeFraction_ Fraction of withdrawal fee based on withdrawalFeeBase_ withdrawalFeeBase_ Fraction of withdrawal fee base/ | function changeFee(uint8 withdrawalFeeFraction_, uint8 withdrawalFeeBase_) external onlyOwner {
require(withdrawalFeeFraction_ <= withdrawalFeeBase_, "Fee fraction exceeded base.");
uint8 percentage = (withdrawalFeeFraction_ * 100) / withdrawalFeeBase_;
_feeFraction = withdrawalFeeFraction_... | 12,155,553 |
pragma solidity >=0.4.22 <0.6.0;
contract BusinessPartnershipContract {
address payable public partnerOne; // First Business partner address
address payable public partnerTwo; // Second Business partner address
bool public signed = false;
bool public separated = false;
mapping(address => bool) private has... | adding funds to the contract | function() external payable isSigned areNotSeparated {
emit FundsAdded(now, msg.sender, msg.value);
}
| 15,814,967 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../ERC1155.sol";
/**
* @dev ERC1155 token where the admin can control what's approvable
*/
abstract contract ERC1155Approvable is ERC1155 {
bool private _approved = true;
/**
* @dev Returns true if approvable
*/
function isApprovable() pu... | Approve `operator` to operate on all of `owner` tokens Emits a {ApprovalForAll} event./ | function _setApprovalForAll(
address owner,
address operator,
bool approved
) internal virtual override {
if (!_approved) revert InvalidCall();
super._setApprovalForAll(owner, operator, approved);
}
| 6,485,052 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol";
import "@openzeppelin/contracts/utils/Context.so... | Credits to LarvaLabs Meebits contract/ Move last value to selected position Array position not initialized, so use position Array position holds a value so use that | function randomIndex() internal returns (uint) {
uint totalSize = TOKEN_LIMIT - numTokens;
uint index = uint(keccak256(abi.encodePacked(nonce, msg.sender, block.difficulty, block.timestamp))) % totalSize;
uint value = 0;
if (indices[index] != 0) {
value = indices[index];... | 1,289,034 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.