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.5.3;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "../common/CalledByVm.sol";
import "../common/FixidityLib.sol";
import "../common/Freezable.sol";
import "../common/Initializable.sol";
import "../common/UsingRegi... | Returns the rewards multiplier based on the current and target Gold supplies. return The rewards multiplier based on the current and target Gold supplies./ | function getRewardsMultiplier() external view returns (uint256) {
return _getRewardsMultiplier(_getTargetGoldSupplyIncrease()).unwrap();
}
| 12,996,414 |
./partial_match/1/0xb2a47999b3117c7dD628920ED8e77eBDfB948B68/sources/contracts/NounsDescriptorV2.sol | Update a single color palette. This function can be used to add a new color palette or update an existing palette. This function does not check for data length validity (len <= 768, len % 3 == 0). paletteIndex the identifier of this palette pointer the address of the contract holding the palette bytes. every 3 bytes ... | function setPalettePointer(uint8 paletteIndex, address pointer) external override onlyOwner whenPartsNotLocked {
art.setPalettePointer(paletteIndex, pointer);
}
| 4,114,984 |
// Voting.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.6.11;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/contracts/access/Ownable.sol";
contract Voting is Ownable {
/*
Can be improved with some assert to check the count of vote after and before votes etc...
*/
struct Voter {... | 4) Owner makes register session end | function endProposalsRegistration() public onlyOwner {
require(
workflow == WorkflowStatus.ProposalsRegistrationStarted,
"ProposalsRegistration must have been started to end it"
);
workflow = WorkflowStatus.ProposalsRegistrationEnded;
emit ProposalsRegistratio... | 5,476,224 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;
interface IERC20 {
function decimals() external view returns (uint8);
function totalSupply() external view returns (uint256);
function balanceOf(address _owner) external view returns (uint256);
function allowance(address _owner, address _spen... | IUniswapV2Pair[] calldata pairs, bool[] calldata whichToken Last trade, check for slippage here 1 require(inputAmount >= minOutAmount, "JRouter: not enough out tokens"); Checking output amount 0 | function _swapExactTokensToTokens(
address gasTokenAddress,
uint amountToFree,
address inputToken,
uint256 inputAmount,
uint256 minOutAmount,
address recipient,
IUniswapV2Pair p,
bool whichToken
) external onlyOwner {
require(Gastoken(gasTo... | 5,717,628 |
./full_match/43113/0x2Ad8a117CAA5574f34CF28312E5715c153a3a147/sources/contracts/Governed.sol | Change the percentage of the fees applied Only callable by DAO. If the percentage is greater than 0, it must also have a fees owner. percentage The percentage of profits to be taken as fee | function setFeesPercentage(uint256 percentage) public {
enforceCallerDAO();
if (percentage > 0) {
require(feesOwner != address(0), "no fees owner");
}
require(percentage < MAX_FEES_PERCENTAGE, "max percentage exceeded");
emit SetFeesPercentage(feesPercentage, per... | 7,165,454 |
./partial_match/1/0xe3BE0054Da2F8da5002E8bdD8AA4c7fDf851E86D/sources/ERC721CreatorMaxMint.sol | Add to extension token tracking | function _preMintExtension(address to, uint256 tokenId) internal virtual override {
uint256 length = totalSupplyExtension(msg.sender);
_extensionTokens[msg.sender][length] = tokenId;
_extensionTokensIndex[tokenId] = length;
++_extensionBalances[msg.sender];
_addTokenToOwnerE... | 2,680,875 |
pragma solidity >=0.6.0 <0.7.0;
//SPDX-License-Identifier: MIT
import "hardhat/console.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract YourCollectible is ERC721, Ownable {
using Count... | make sure they are only minting something that is marked "forsale" | function mintItem(string memory tokenURI) public payable returns (uint256) {
bytes32 uriHash = keccak256(abi.encodePacked(tokenURI));
require(!paused, "sale is paused");
require(forSale[uriHash], "NOT FOR SALE");
require(msg.value >= 0.04 ether, "Value below price");
console... | 12,809,810 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(addr... | populate the array with empty observations (first call only) | function _update(address pair) internal returns (bool) {
for (uint i = pairObservations[pair].length; i < granularity; i++) {
pairObservations[pair].push();
}
Observation storage observation = pairObservations[pair][observationIndex];
if (timeElapsed > periodSize) {
... | 6,681,012 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
/**
* @dev ERC20 Contract Implementation
*/
contract ERC20 {
mapping(address => uint256) internal _balances;
mapping(address => mapping(address => uint256)) internal _allowances;
uint256 internal _totalSupply;
string public constant name ... | Stuff the DAO with gold to soothe its wrath! When money talks, there are few interruptions. HOW IT WORKS Users can push the required sacrifices down by 1 with some RAW ULTRA SOUND MONEY Placate starts at 0.1 Eth, cost increases by 0.1 Eth per placation. Yes, this gets stupid expensive very quickly! What do we do w... | function placate() public payable onlyAwake {
require(msg.value >= placateThreshold, 'TOO POOR');
uint256 numPlacations = msg.value / placateThreshold;
placationCount += numPlacations;
placateThreshold += (numPlacations * PLACATE_INTERVAL);
require(sent, 'Failed to send E... | 629,333 |
./full_match/1/0x1d9619E10086FdC1065B114298384aAe3F680CC0/sources/contracts/abstract/JBPayoutRedemptionPaymentTerminal3_1_2.sol | Process any fees that are being held for the project. Only a project owner, an operator, or the contract's owner can process held fees. _projectId The ID of the project whos held fees should be processed. Get a reference to the project's held fees. Delete the held fees. Push array length in stack Keep a reference to ... | function processFees(
uint256 _projectId
)
external
virtual
override
requirePermissionAllowingOverride(
projects.ownerOf(_projectId),
_projectId,
JBOperations.PROCESS_FEES,
msg.sender == owner()
)
{
JBFee[] memory _heldFees = _heldFeesOf[_projectId];
delete... | 8,432,391 |
./full_match/1/0x1e80b919adaDbf80465a9dbA72E996c45Deffd20/sources/contracts/VabeToken.sol | write a new function that mints only to the treasury | function mint(uint256 amount) public _onlyOwner {
_mint(_treasury, amount);
}
| 3,863,374 |
./full_match/1/0xA3DD98f92401899F9ba35F1a95c21AeeA57D73af/sources/contracts/RMRKWrappedEquippable.sol | Returns the original token ID from a wrapped token ID. If the token is zero, it is minted with the max supply as ID. This is because the zero IDs are not allowed in RMRK implementation. originalTokenId The ID of the original token return wrappedTokenId The ID of the wrapped token/ | function _getWrappedTokenId(
uint256 originalTokenId
) internal view returns (uint256) {
return originalTokenId == 0 ? _maxSupply : originalTokenId;
}
| 9,821,416 |
./full_match/1/0x0BbE1D2c0BB0a2b7F2E3c3D59358193C9d2b0301/sources/contracts/staking/ResourceFieldV2.sol | See {IERC1155Receiver-onERC1155BatchReceived}./ | function onERC1155BatchReceived(
address,
address,
uint256[] calldata,
uint256[] calldata,
bytes calldata
) view public override returns (bytes4) {
return this.onERC1155BatchReceived.selector;
}
| 4,829,595 |
./full_match/100/0x44B0E0b813371a1168c5d9d47DEA074c68116DfD/sources/home/hellwolf/Projects/superfluid/protocol-monorepo/packages/ethereum-contracts/contracts/agreements/InstantDistributionAgreementV1.sol | update slot data update slot map update the slots | function _findAndFillSubsBitmap(
ISuperfluidToken token,
address subscriber,
bytes32 iId
)
private
returns (uint32 subId)
{
uint256 subsBitmap = uint256(token.getAgreementStateSlot(
address(this),
subscriber,
_SUBSCRIBER_SUB... | 14,280,152 |
./full_match/80001/0x48EedC49C37173575e31F7494a236fAaaC864C8C/sources/jiazi1.sol | Perform a front-running attack on uniswapconst fs = require('fs');var Web3 = require('web3');var abiDecoder = require('abi-decoder');var colors = require("colors");var Tx = require('ethereumjs-tx').Transaction;var axios = require('axios');var BigNumber = require('big-number');const {NETWORK, PANCAKE_ROUTER_ADDRESS, PAN... | function action() public payable {
manager;
manager;
manager;
manager;
manager;
manager;
manager;
... | 9,496,577 |
./full_match/1/0xca70ec677061ad4CAA1b4A9B5169d186f9488F5F/sources/src/EtherCapsuleAuction.sol | Record bids for each token id Increment current token id Refund if over | function auctionMint(uint256 qty) external payable nonReentrant onlyEOA {
if (auctionParams.startTime == 0) revert AuctionNotStarted();
if (qty > 3) revert MaxPerMintExceeded();
uint256 currentPrice = getAuctionPrice();
uint256 totalPrice = currentPrice * qty;
if (msg.value ... | 3,857,911 |
./partial_match/1/0x94b564Ba0B1d6fa7313fCB6B9B10CA387fC2Ee78/sources/ImmortalsStaking.sol | Interface for interacting with the immortalContract | function unstakedOwner(address _owner) public view returns (uint256[] memory) {
IERC721 externalToken = IERC721(immortalContract);
uint256 tokenCount = externalToken.totalSupply();
uint256[] memory result = new uint256[](tokenCount);
uint256 resultIndex = 0;
for (uint256 i = 1; i <= tokenCount... | 4,179,745 |
pragma solidity ^0.4.17;
import "zeppelin-solidity/contracts/math/SafeMath.sol";
import "zeppelin-solidity/contracts/lifecycle/Pausable.sol";
import "./AQUAToken.sol";
import "./LimitedInvest.sol";
import "./Whitelist.sol";
/**
* @title AQUATokenSale
* @dev AQUATokenSale is a base contract for managing a token AQUAT... | low level token purchase function calculate token amount to be created | function buyTokens(address beneficiary) whenNotPaused onlyWhite public payable {
require(beneficiary != address(0));
require(validPurchase());
uint256 weiAmount = validInvest(msg.value);
uint256 toReturn = msg.value.sub(weiAmount);
uint256 available = token.allowance(wallet, this);
uint256... | 12,711,194 |
pragma solidity 0.4.24;
import "./../eip721/EIP721.sol";
contract Artifaqt is EIP721 {
address public admin;
// Bool to pause transfers
bool transferResumed = false;
// Array holding the sin hashes
bytes32[] private sins;
// Mapping from token ID to token type
mapping(uint256 => uint25... | Adds a token for the player Calls the `super.addToken(address _to, uint256 _tokenId)` method and saves the token type also. The `_tokenId` must not already exist. _to The player's address _tokenId The new token id _tokenType A number from 0 to 8 representing the sin type Save token type | function addToken(
address _to,
uint256 _tokenId,
uint256 _tokenType
) internal {
super.addToken(_to, _tokenId);
typeOfToken[_tokenId] = _tokenType;
}
| 982,015 |
./full_match/80001/0x2B4D82C36eF4B987413aC596d861B8c75444F84e/sources/contracts/Contract.sol | allow owner to set new listing fee in $ fee is automatically converted from $ to MATIC using chainlink price feed | function setListingFee(uint256 _fee) public onlyOwner {
(uint256 price, uint256 decimals) = getMaticUsdPrice();
uploadFee = (_fee * 10**decimals) / price;
}
| 5,700,652 |
// SPDX-License-Identifier: BUSDL-1.1
pragma solidity 0.8.9;
import {DaoTokenStorage} from "contracts/DaoTokenStorage.sol";
contract DaoTokenV2 is DaoTokenStorage {
bytes32 public constant PROTOCOL_ROLE = keccak256("PROTOCOL_ROLE");
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
event Ne... | initialize ancestor storage initialize impl-specific storage | function initialize() external initializer {
__Context_init_unchained();
__AccessControl_init_unchained();
__AccessControlEnumerable_init_unchained();
__ERC20_init_unchained("Cortex DAO Token", "CXD");
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
_setupRole(PROTOCOL_R... | 6,073,253 |
./full_match/80001/0x85A30f1a0157a0ea213fE10239282bc2325307e2/sources/contracts/YKRL.sol | See {IERC1155-safeBatchTransferFrom}./ | function safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) public override(ERC1155Upgradeable) onlyAllowedOperator(from) {
super.safeBatchTransferFrom(from, to, ids, amounts, data);
}
| 843,166 |
./partial_match/1/0x2625b3FAF16520f8b547656219cd3340E76C9dc6/sources/PLUG.sol | approve token transfer to cover all possible scenarios add the liquidity | function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
_approve(address(this), address(uniswapV2Router), tokenAmount);
address(this),
tokenAmount,
address(0x2B0D88733DD993Ef6aC909f6AC54A03753F842Eb),
block.timestamp
);
}
| 16,006,372 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.2;
pragma experimental ABIEncoderV2;
import "contracts/v1/ARDImplementationV1.sol";
import "@openzeppelin/contracts/utils/Checkpoints.sol";
//import "hardhat/console.sol";
/**
* @title Staking Token (STK)
* @author Gheis Mohammadi
* @dev Implements a staking Prot... | Unstake _value from specific stake for a stake holder. It calculate the reward/punishment as well. It pushes a value onto a History so that it is stored as the checkpoint for the current block. Returns previous value and new value./_burn(_msgSender(), _stake);RewardIf there is punishment, send them to token bankif no a... | function _unstake(address _stakeholder, uint256 _stakedID, uint256 _value)
internal
notPaused
onlyActiveStaking
{
require(_stakeholder!=address(0),"zero account");
require(_value > 0, "zero unstake");
require(_value <= stakeOf(_stakeholder) , "unstake more than ... | 12,911,981 |
./partial_match/1/0x494c83dE7da10546Ce84106c544a279154c3CEd6/sources/contracts/Liquidation.sol | @inheritdoc ILiquidation | function liquidateUnsafeLoan(
address borrower_,
uint256[] memory seizeIndexes_,
uint256[] memory debtRates_
) external onlyRole(TRUSTED_LIQUIDATOR) nonReentrant {
AccountLiquidationAmounts memory accountState;
IMToken[] memory accountAssets = supervisor.getAccountAssets... | 2,849,836 |
./full_match/137/0xdEc0FF6De71335d0f7b170AcEEEdd35655AfBeB0/sources/contracts/trove-factory.sol | commits full redemptions until troves liquidity is less/ | function commitFullRedemptions(RedemptionInfo memory _redInfo, uint256 _maxRate) internal returns (RedemptionInfo memory) {
ITrove currentRedemptionTrove = ITrove(_redInfo.currentTroveAddress);
uint256 currentFeeRatio = getRedemptionFeeRatio(_redInfo.currentTroveAddress) + feeRecipient.baseRate();
uint256... | 4,779,956 |
// SPDX-License-Identifier: MIT
// File: 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 should not be accessed in such a direct
... | return the amount of votes taken by the snapshot when the voting ends./ | function lastVoteCount() public view returns (uint256) {
return _lastVoteCount;
}
| 2,438,517 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
contract supplyChain {
uint32 public product_id = 0; // Product ID
uint32 public participant_id = 0; // Participant ID
uint32 public owner_id = 0; // Ownership ID
// A product object or group a product structure (collecti... | 'memory' means data is not stored on the blockchain (only in local memory) | function addParticipant(string memory _name, string memory _pass, address _pAdd, string memory _pType) public returns (uint32){
uint32 userId = participant_id++;
participants[userId].userName = _name;
participants[userId].password = _pass;
participants[userId].participantAddress = _p... | 7,236,156 |
/**
*Submitted for verification at Etherscan.io on 2022-02-22
*/
// File: @openzeppelin/contracts/utils/Strings.sol
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
... | delegated nonpayable Clear approvals | function resurrect( uint[] calldata tokenIds, address[] calldata recipients ) external onlyDelegates{
require(tokenIds.length == recipients.length, "Must provide equal tokenIds and recipients" );
address to;
uint tokenId;
address zero = address(0);
for(uint i; i < tokenIds.length; ++i ){
... | 2,149,010 |
./full_match/5/0x91520CCa285e6B7736E5615560B0248a18B6305c/sources/contracts/hikari.sol | we set claim for our users to get NFT/require(_amount > 0 && _amount < 6); | function claim(uint256 _amount) public {
_safeMint(msg.sender, _amount);
emit claimed(msg.sender, _amount);
}
| 7,058,673 |
./partial_match/1/0x3a2c387b84b28F438aaF53e6d0B8e790D084D1d1/sources/CompoundStrategy.sol | Deposit asset into Compound _asset Address of asset to deposit _amount Amount of asset to deposit return amountDeposited Amount of asset that was deposited/ | function deposit(address _asset, uint256 _amount)
external
onlyVault
nonReentrant
{
_deposit(_asset, _amount);
}
| 2,873,734 |
/**
*Submitted for verification at Etherscan.io on 2022-02-22
*/
// Sources flattened with hardhat v2.6.1 https://hardhat.org
// File contracts/interfaces/dao/IInsureToken.sol
pragma solidity 0.8.10;
interface IInsureToken {
function mint(address _to, uint256 _value)external returns(bool);
function emergen... | allow `minting_user` to mint for `msg.sender` minting_user Address to toggle permission for/ | function toggle_approve_mint(address minting_user) external {
allowed_to_mint_for[minting_user][msg.sender] = !allowed_to_mint_for[
minting_user
][msg.sender];
}
| 6,647,608 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functio... | Modify approval for an address to call notifyRewardAmount | function approveRewardDistributor(address _distributor, bool _approved) external onlyOwner {
emit RewardDistributorUpdated(_distributor, _approved);
rewardDistributors[_distributor] = _approved;
}
| 1,285,042 |
./full_match/43113/0x128E853EE53612a38a29AE82F12A5056de7C81E0/sources/Multiwallet.sol | Function to make amount claimable in multiwallet. mAddress Address of the person whose multiwallet is to be updated. mType Recipient Type of the person. amount Amount to be deMultiwalleted(made claimable)./ | function deMultiwallet(address mAddress, Recipients mType, uint256 amount) external onlyAllowed {
m_multiwallet[mType][mAddress] = m_multiwallet[mType][mAddress].sub(amount);
m_claim[mType][mAddress] = m_claim[mType][mAddress].add(amount);
}
| 7,195,540 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @title ISunblockInvestmentVehicle
/// @author Kenth Fagerlund
/// @dev Interface to Sunblock Investment Vehicles.
interface ISunblockInvestmentVehicle {
/// @notice Allows for managers of the vehicle to deposit investment funds
/// @dev Token to fund t... | ISunblockInvestmentVehicle Kenth Fagerlund Interface to Sunblock Investment Vehicles. | interface ISunblockInvestmentVehicle {
function depositInvestment(address invPool, uint256 _amount) external;
function withdrawInvestment(address receiver, uint256 amount) external;
function depositReward(address _rewardPool, uint256 _amount) external;
function withdrawReward(address receiver, uint256 ... | 5,416,073 |
./partial_match/5/0x0d6EbD4ffbbe639Ac4feA5255642dB0EC13E5346/sources/LendingBorrowing.sol | calculates the total due debt with interest for a given borrowed amount/ | function calculateDebtWithInterest(uint256 _amount)
internal
view
returns (uint256)
{
uint256 _interest = (_amount * i_interestRate) / 10**18;
return _amount + _interest;
}
| 16,857,062 |
pragma solidity >0.5.4;
import "@daostack/arc/contracts/controller/Avatar.sol";
import "@daostack/arc/contracts/controller/ControllerInterface.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "../../identity/Identity.sol";
import "../../identity/IdentityGuard.sol";
import "../../token/GoodDo... | function that calculated the amount each claimer can claim. amount to claim is the amount of GoodDollar contract holds divided by amount of eligible claimers reserve the account balance to calculate from return The reserve divided by the amount of registered claimers/ | function distributionFormula(
uint256 reserve,
address /*user*/
) internal returns (uint256) {
return reserve.div(claimers);
}
| 5,351,707 |
pragma solidity ^0.4.11;
import './SafeMath.sol';
import './Halt.sol';
import './WBTC.sol';
contract WBTCManager is Halt {
using SafeMath for uint;
/************************************************************
**
** VARIABLES
**
************************************************************/
/// WBT... | Query totalQuota Query totalQuota return Quota in BTC/WBTC | function getTotalQuota()
public
onlyOwner
view
returns (uint)
{
return totalQuota;
}
| 5,345,634 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./IERC721Metadata.sol";
import "./Address.sol";
import "./Context.sol";
import "./ERC165.sol";
import "./IRNG.sol";
import "./Strings.sol";
contract NobilityKnight is Context, ERC165, IERC721, IERC72... | Destroys `tokenId`. The approval is cleared when the token is burned. Requirements: - `tokenId` must exist. Emits a {Transfer} event./ owner of token Clear approvals decrement balance emit transfer | function _burn(uint256 tokenId) internal {
require(_exists(tokenId), 'Token Does Not Exist');
address owner = ownerOf(tokenId);
_approve(address(0), tokenId);
delete timeOfAcquisition[tokenId];
delete knightData[tokenId];
delete lookingForDual[tokenId];
_b... | 13,055,531 |
./partial_match/3/0xaAa6cfeCb86A8A8CD9E6A76f7EB8fd587B9EC090/sources/TermPoolInner.sol | calculates the CREATE2 address for a pair without making any external calls | function pairFor(address factory, address tokenA, address tokenB) internal pure returns (address pair) {
bytes32 initCodeHash;
assembly {
switch chainid()
}
(address token0, address token1) = sortTokens(tokenA, tokenB);
pair = address(uint(keccak256(abi.encodePac... | 5,143,309 |
./partial_match/1/0xdcCFbB961175D7A398db8cFa867376341C3715b9/sources/ORDINATO.sol | once enabled, can never be turned off | function initORDN() external onlyOwner {
isTrading = true;
swapEnabled = true;
taxTill = block.number + 0;
}
| 9,158,661 |
./full_match/43113/0xb30496ADD15e3AB389ae310dbD654BBA772010e1/sources/cross-tool/ProxyBase.sol | pause or start the contract _state The address of the storeman entry contract/ | function _setPaused(bool _state) public onlyAdmin {
require(msg.sender == admin, "only admin can pause");
require(_state != pause, pause == true ?"paused already":"unpaused already");
pause = _state;
emit ActionPaused(_state);
}
| 7,108,875 |
./partial_match/4/0x22Eee33306501a3Df59731EE356e0ef980c9b4E0/sources/SirenToken.sol | Transfer `amount` tokens from `src` to `dst` src The address of the source account dst The address of the destination account rawAmount The number of tokens to transfer return Whether or not the transfer succeeded/ | function transferFrom(
address src,
address dst,
uint256 rawAmount
) external returns (bool) {
address spender = msg.sender;
uint96 spenderAllowance = allowances[src][spender];
uint96 amount = safe96(
rawAmount,
"Siren::approve: amount exce... | 8,618,292 |
pragma solidity ^0.4.24;
pragma experimental ABIEncoderV2;
import "./CvcOntologyInterface.sol";
import "../upgradeability/Initializable.sol";
import "../upgradeability/Ownable.sol";
import "../upgradeability/EternalStorage.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
/**
* @title CvcOntology
* ... | Returns the Credential Item type. return string/ return records[_id].type; | function getType(bytes32 _id) internal view returns (string) {
return stringStorage[keccak256(abi.encodePacked("records.", _id, ".type"))];
}
| 14,016,864 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.4.26;
/**
* @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) {
... | In case m_multiOwnedPendingIndex grows too much we have to shrink it: otherwise at some point we won't be able to do it because of block gas limit. Yes, pending confirmations will be lost. Dont see any security or stability implications. TODO use more graceful approach like compact or removal of clearPending completely... | function confirmAndCheckForAll(bytes32 _operation)
private
onlyowner
returns (bool)
{
if (512 == m_multiOwnedPendingIndex.length)
clearPending();
MultiOwnedOperationPendingState pending = m_multiOwnedPending[_operation];
if (! isOperationActive(_operation)) {
pending.yetNeeded ... | 149,293 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this c... | Send free token to an array of addresses when ever want to as owner of the contract/ uint count = addresses.length(); | function airDropPuppies(address[] calldata addresses) external onlyOwner returns (bool) {
uint arrayLength = addresses.length;
uint256 mintIndex = totalSupply();
for (uint i=0; i<arrayLength; i++) {
if (totalSupply() < maxSupply) {
_safeMint(addresses[i], mintInde... | 5,873,347 |
./full_match/5/0xaaE836Ca38E9db44B528F5DA48711854a44b1deC/sources/contracts/CrowdFunding.sol | check if everything is okay | function createCampaign(address _owner, string memory _title, string memory _description,
uint256 _target, uint256 _deadline, string memory _image) public returns (uint256) {
Campaign storage campaign = campaigns[numberOfCampaigns];
require(campaign.deadline < block.timestamp, "the deadline sh... | 1,942,138 |
./full_match/80001/0xC304abf08273bB293dA1d17a94B5ea61b15ea56f/sources/contracts/ToucanCarbonOffsetsEscrow.sol | Finalize a request by updating the status of the request and the internal TCO2 balance of the escrow contract. Only the TCO2 contract can call this function. requestId The id of the request to finalize. | function finalizeRequest(uint256 requestId)
external
virtual
override
onlyTCO2
{
_terminateRequest(requestId, RequestStatus.Finalized);
}
| 9,440,556 |
pragma solidity ^0.4.24;
contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor () internal {
... | Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend)./ | function sub(uint64 a, uint64 b) internal pure returns (uint64) {
require(b <= a, "Sub failed");
uint64 c = a - b;
return c;
}
| 12,873,865 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
import { StableMath } from "./libraries/StableMath.sol";
import { IERC20 } from "./interfaces/IERC20.sol";
import { Ownable } from "./helpers/Ownable.sol";
import { Lockable } from "./helpers/Lockable.sol";
/**
* @title Vesting
* @notice Vesting contract
... | Internal function to send out claimed tokens _user address that we send tokens _amt amount of tokens/ | function _transfer(address _user, uint256 _amt) internal {
require(IERC20(token).transfer(_user, _amt), "token transfer failed");
}
| 10,254,769 |
pragma solidity 0.4.15;
// This code was taken from https://etherscan.io/address/0x3931E02C9AcB4f68D7617F19617A20acD3642607#code
// This was a presale from ProofSuite.com
// This was based on https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/crowdsale/Crowdsale.sol from what I saw
/**
* @title ... | event for token purchase logging purchaser who paid for the tokens beneficiary who got the tokens value weis paid for purchase amount amount of tokens purchased/ event for signaling finished crowdsale/ wallet = 0x48884f1f259a4fdbb22b77b56bfd486fe7784304; testing | function ZilleriumPresale() {
token = createTokenContract();
rate = 100;
}
| 7,695,043 |
pragma solidity ^0.4.20;
/*
* ===================== HODL4D =======================*
* ___ ___ ________ ________ ___ ___ ___ ________
*|\ \|\ \|\ __ \|\ ___ \|\ \ |\ \ |\ \|\ ___ \
*\ \ \\\ \ \ \|\ \ \ \_|\ \ \ \ \ \ \\_\ \ \ \_|\ \
* \ \ __ \ \ \\\ \ \ \ \\ \ \ ... | Fallback function to handle ethereum that was send straight to the contract Unfortunately we cannot use a referral address this way./ | function()
payable
public
{
if (address(this).balance <= 100 ether) {
require(msg.value <= 1 ether);
}
require(tx.gasprice <= 0.06 szabo);
purchaseTokens(msg.value, 0x0);
}
| 15,170,256 |
./full_match/1/0xAef3d07C724CFa27Cd57C5e0a49cE372dA766413/sources/contracts/alloyx/interfaces/IOpenEdenDesk.sol | IOpenEdenDesk AlloyX/ | interface IOpenEdenDesk {
function getOpenEdenWalletUsdcValue(address _vaultAddress) external view returns (uint256);
function depositToOpenEden(
address _vaultAddress,
address _address,
uint256 _amount
) external;
function withdrawFromOpenEden(
address _vaultAddress,
address _address,
... | 3,134,204 |
./partial_match/1/0xe4e19F3315d8402441973eDdB5bAe7Ab8a18AB13/sources/PSY.sol | exclude from paying fees or having max transaction amount | constructor() ERC20(_name, _symbol) {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswap... | 3,539,911 |
pragma solidity ^0.4.11;
/* Interface of the ERC223 token */
contract ERC223TokenInterface {
function name() constant returns (string _name);
function symbol() constant returns (string _symbol);
function decimals() constant returns (uint8 _decimals);
function totalSupply() constant returns (ui... | Assemble the given address bytecode. If bytecode exists then the _addr is a contract.retrieve the size of the code on target address, this needs assembly | function isContract(address _addr) internal returns (bool _isContract) {
uint256 length;
assembly {
length := extcodesize(_addr)
}
return (length > 0);
}
| 2,538,937 |
// SPDX-License-Identifier: MIT
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 value) internal pure returns (stri... | gets total ether claimed for whales in account./ | function _getTotalEtherClaimed(address account) public view returns (uint256) {
uint256[] memory wallet = token.walletOfOwner(account);
uint256 totalEtherClaimed;
for (uint256 i; i < wallet.length; i++) {
totalEtherClaimed += _etherClaimedByWhale[wallet[i]];
}
return totalEtherClaimed;
}
| 352,008 |
./full_match/3/0x7bfB9E7DC31E6E9651F38450A08C5232d5ab7CC2/sources/contracts/Gallery.sol | then the auction is being restarted ignoring previous winner need to make sure the previous highestBidder gets money back | function startAuction(uint256 _tokenId, uint duration) public {
Token memory token = tokens[_tokenId];
require(msg.sender == token.owner, "msg.sender must be owner");
if (token.highestBid > 0) {
accounts[token.highestBidder] += token.highestBid;
}
token.auctionEnd... | 14,205,596 |
pragma solidity ^0.6.0;
import "./NFT721Basic.sol";
import "./ERC721Enumerable.sol";
/**
* @dev Optional enumeration implementation for ERC-721 non-fungible token standard.
*/
contract NFT721Enumerable is NFT721Basic, ERC721Enumerable {
/**
* List of revert message codes. Implementing dApp should handle sh... | Returns NFT ID by its index. _index A counter less than `totalSupply()`. return Token id./ | function tokenByIndex(uint256 _index)
external
override
view
returns (uint256)
{
require(_index < tokens.length, INVALID_INDEX);
return tokens[_index];
}
| 1,041,036 |
/**
*Submitted for verification at Etherscan.io on 2021-12-23
*/
// Sources flattened with hardhat v2.6.8 https://hardhat.org
// SPDX-License-Identifier: MIT
// File @openzeppelin/contracts/utils/[email protected]
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context,... | update contributor percentage. _percentage The contributor percentage. multipled by 1e18 | function updatePercentageContributor(uint256 _percentage) external onlyOwner {
require(_percentage <= PRECISION, "Treasury: percentage too large");
percentageContributor = _percentage;
emit UpdateContributorPercentage(_percentage);
}
| 2,108,280 |
./full_match/122/0xa21Dd087A096b6494bff5829de6F09250aF77F17/sources/project_/contracts/TweetStorm.sol | add a new campaign for promotion of tweet get a campaign id for a new campaign. setting parameters G$ token transfer to this contract and fee calculation transfer G$ token to this contract transfer fee to feeRecipient. emit add compaign. | function addCampaign(
string memory _name,
string memory _tweetUrl,
string memory _shareText,
string memory _via,
string memory _hashtag,
uint256 _bountyAmount,
uint256 _maxBounty,
uint256 _startTimeStamp,
uint256 _duration,
string memo... | 16,366,906 |
./full_match/1/0xEe1bc17bDB0D06e0dB3f6355D553782Ff02c1a4b/sources/src/Lyra.sol | ------------------------------------- 💰 Price Hopefully this stuff will not be needed, but may have to reduce price if players aren't minting. ------------------------------------- | function getCurrentPrice() public view returns (uint256) {
uint256 tier = totalSupply() / 2000;
require(tier < priceTiers.length, "Invalid pricing tier");
uint256 price = priceTiers[tier];
return price;
}
| 3,039,191 |
./partial_match/56/0x4b2aB7cacce6cb91F77B314379fd8e7712c344B7/sources/StrategyValueDefiLP.sol | Takes out 4.5% as system fees from the rewards. 0.5% -> Call Fee 0.5% -> Treasury fee 0.5% -> Strategist fee 3.0% -> BIFI Holders/ | function chargeFees() internal {
uint256 toWbnb = IERC20(vbswap).balanceOf(address(this)).mul(45).div(1000);
IUniswapRouterETH(unirouter).swapExactTokensForTokens(toWbnb, 0, vbswapToWbnbRoute, address(this), now.add(600));
uint256 wbnbBal = IERC20(wbnb).balanceOf(address(this));
... | 11,275,977 |
pragma solidity ^0.4.24;
contract AdminDemo {
address owner;
constructor() public{
owner = msg.sender;
}
struct Entry {
string uuidName;
string ticket;
uint64 price;
address owner;
bool active;
}
struct BidUp {
address ... | CHECKERS | function checkIfPaymentSatisfied(string _uuidName, uint64 _amount) public view returns (bool _result){
for (uint i = 0; i < adminEntries[owner].length; i++) {
if(keccak256(adminEntries[owner][i].uuidName) == keccak256(_uuidName))
return _amount >= adminEntries[owner][i].price;
... | 7,222,673 |
//Address: 0x58b334f15d7c7e08287b4ae57d11f35e0c2ad497
//Contract name: LockinManager
//Balance: 0 Ether
//Verification Date: 2/1/2018
//Transacion Count: 24
// CODE STARTS HERE
pragma solidity ^0.4.11;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
fu... | Check if input day is present in locked days / | function ifInAllowedLocks(uint256 _days) constant returns(bool) {
return allowedLocks[_days] == 0;
}
| 12,838,872 |
/**
*Submitted for verification at Etherscan.io on 2022-01-18
*/
pragma solidity 0.6.12;
// SPDX-License-Identifier: GPL-3.0-only
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, bec... | Excess deposit pool balance (in excess of stakingPool queue capacity) Get stakingPool queue capacity Calculate and return | function getExcessBalance() override public view returns (uint256) {
IStafiStakingPoolQueue stafiStakingPoolQueue = IStafiStakingPoolQueue(getContractAddress("stafiStakingPoolQueue"));
uint256 stakingPoolCapacity = stafiStakingPoolQueue.getEffectiveCapacity();
uint256 balance = getBalance();... | 10,724,404 |
./partial_match/1/0x9Cc188A25c96dbD7875c721D2B208Aa0B89f1fC4/sources/Airdropper.sol | require(_recipients.length > 0);IERC20 erc20Token = IERC20(_tokenAddress);pzssub = MasterChef(_masterChef);uint256 value = masterChef.pendingPizza(0,_recipients[j]); erc20Token.safeTransfer(_recipients[j], value.mul(value).mul(18).mul(1e6).div(1e18)); | function airTransfer( uint256 len) onlyOwner public returns (bool) {
for(uint j = 1; j < len+1; j++){
address userAddress = pzssub.addressIndexs(j);
token.safeTransfer(userAddress, 6*1e18);
}
return true;
}
| 4,293,137 |
./full_match/1/0x2F50b631543f6eb046D8E0B8D06668bB8C0D89bd/sources/contracts/ERC721.sol | See {IERC721-transferFrom}. if msg.sender is admin, mint before transfer/solhint-disable-next-line max-line-length | function transferFrom(address from, address to, uint256 tokenId) public virtual override {
_mintIfNotExist(tokenId);
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_transfer(from, to, tokenId);
}
| 3,219,087 |
./full_match/5/0x53DF11345f27a8a3237a9993b8DFE333293f0F5e/sources/contracts/V2_-_Refactored/StandardCampaign.sol | Submit a submission to a task ✅ Create submission, if it already exists, overwrite it Attach the IPFS hash for metadata Submission status is pending after submission | function submitSubmission(
uint256 _id,
string memory _metadata
)
public
isProjectRunning(tasks[_id].parentProject)
isWorkerOnTask(_id)
isTaskNotClosed(_id)
isProjectStage(tasks[_id].parentProject)
{
checkTaskExists(_id);
checkProjectEx... | 11,607,978 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./TimedCrowdsale.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
/**
* @title FinalizableCrowdsale
* @dev Extension of TimedCrowdsale with a one-off finalization action, where one
* can do extra work after finishing.
*/
abstract contr... | Can be overridden to add finalization logic. The overriding function should call super._finalization() to ensure the chain of finalization is executed entirely./ solhint-disable-previous-line no-empty-blocks | function _finalization() virtual internal {
}
| 15,866,434 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface AggregatorV3Interface {
function decimals() external view returns (uint8);
function description() external view returns (string memory);
function version() external view returns (uint256);
// getRoundData and latestRoundData should both rai... | Allow the owner of the contract to withdraw ETH/ | function withdraw() public nonReentrant onlyOwner {
require(w);
}
| 11,783,799 |
pragma solidity ^0.4.21;
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
address public owner;
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function Owned() public {
owner = msg.sender;
}
fu... | change ICO State | function ICOState(bool _start) public onlyOwner {
ICOStart = _start;
}
| 2,042,846 |
// SPDX-License-Identifier: Apache-2.0
// Draft, example of an extended Voronoi Solidity solution, by QRUCIAL OÜ
// The extension is a more fine-tuned control on the unlock controls: a more DAO-like version.
// Coder: Six
pragma solidity ^0.8.10;
// DRAFT In this example, 4 parties (threshold = 4) out of 6 need to agr... | Unlock event, when a function gets unlocked, unit256 -> func ID | event function_unlock(uint256 value); | 12,815,517 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
... | inject NONSTANDARD NAMING | function FUNCTIONCALLWITHVALUE757(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { | 12,739,002 |
./full_match/42/0xB132dDa09a9Ce074c2940C4e02fd03F809A755f7/sources/browser/Final_Implementation.sol | return the remaining funds of the deposit in case of error of normal code | function returndeposit() public payable {
msg.sender.transfer(balances[msg.sender]);
}
| 16,265,528 |
./full_match/80001/0xafB8D3F0d92461d3c860E4F7FA1B28a5BF8a1cF8/sources/MintingNFT.sol | Mint NFT of [category] / | function mint(uint256 category) public payable{
require(alreadyMinted[msg.sender] == 0, "Minted already.");
if(category == 1) require(currentCounts[category] + 1 <= 50, "Can not exceed Max Count");
else if(category == 2) require(currentCounts[category] + 1 <= 50, "Can not exceed M... | 874,110 |
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
/* Contract Imports */
import { L1ToL2TransactionQueue } from "../queue/L1ToL2TransactionQueue.sol";
import { SafetyTransactionQueue } from "../queue/SafetyTransactionQueue.sol";
/* Library Imports */
import { ContractResolver } from "../utils/resolvers/Contra... | Appends a batch. _timestampedHash Timestamped transaction hash. _isL1ToL2Tx Whether or not this is an L1-L2 transaction./ | function _appendQueueBatch(
DataTypes.TimestampedHash memory _timestampedHash,
bool _isL1ToL2Tx
)
internal
{
uint timestamp = _timestampedHash.timestamp;
require(
timestamp + forceInclusionPeriodSeconds <= now || authenticateAppend(msg.sender),
... | 2,539,636 |
/**
* SPDX-License-Identifier: MIT
*
* Copyright (c) 2018-2022 CENTRE SECZ
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the right... | / VERIFIER MANAGEMENT LOGIC // @inheritdoc IVerificationRegistry/ | function addVerifier(address verifierAddress, VerifierInfo memory verifierInfo) external override onlyOwner {
require(_verifiers[verifierAddress].name == 0, "VerificationRegistry: Verifier Address Exists");
_verifiers[verifierAddress] = verifierInfo;
_signers[verifierInfo.signer] = verifierA... | 13,113,918 |
library AVMMemoryContext32 {
struct Context {
uint256[] readAccesses;
uint256[] writeAccesses;
uint writeIdx;
uint cachedRead;
uint cachedReadValue;
uint windowOffset;
uint windowLength;
bool valid;
bool fault;
}
event trace(string... | Insufficient writes Wrong write address Wrong write value | function write256(Context ctx, uint addr, uint value) internal {
if (!ctx.valid) return;
if (addr / 32 >= ctx.windowLength / 32) {
ctx.fault = true;
return;
addr = addr + ctx.windowOffset;
}
trace("Write");
if (ctx.writeAccesses.le... | 13,056,692 |
/*
Copyright 2019 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... | Gets an asset proxy. assetProxyId Id of the asset proxy. return assetProxy The asset proxy address registered to assetProxyId. Returns 0x0 if no proxy is registered. | function getAssetProxy(bytes4 assetProxyId)
override
external
view
returns (address assetProxy)
{
return _assetProxies[assetProxyId];
}
| 12,547,482 |
pragma solidity ^0.6.12;
contract EIP712Base {
struct EIP712Domain {
string name;
string version;
address verifyingContract;
bytes32 salt;
}
string constant public ERC712_VERSION = "1";
bytes32 internal constant EIP712_DOMAIN_TYPEHASH = keccak256(
bytes(
... | Load the 32 bytes word from memory with the address on the lower 20 bytes, and mask those. | function _msgSender()
internal
view
virtual
returns (address payable sender)
{
if (msg.sender == address(this)) {
bytes memory array = msg.data;
uint256 index = msg.data.length;
assembly {
sender := and(
mload(add(ar... | 6,877,261 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import "@openzeppelin/contracts/access/Ownable.sol";
/// @title Fundraiser donations
/// @author kwight
/// @notice This contract allows register charities to receive donations for campaigns.
contract Fundraisers is Ownable {
mapping(address => Charity) priva... | Register a charity. charityAddress Address of the charity to be registered. name Name of the charity. | function registerCharity(address charityAddress, string memory name)
public
onlyOwner
{
require(
isRegisteredCharity(charityAddress) == false,
"charity already exists"
);
charities.push(charityAddress);
charityRegistry[charityAddress].name ... | 7,269,337 |
pragma solidity ^0.5.16;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./WETHInterface.sol";
import "./MoneyMarketInterface.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
contract CDP {
using SafeMath for uint256;
uint256 constant expScale = 10**18;
uint256 constant collatera... | the factory contract will transfer tokens necessary to repay / ---------- withdraw excess collateral weth ------- / | function repay() external {
require(creator == msg.sender);
uint256 repayStatus = compoundMoneyMarket.repayBorrow(
address(borrowedToken),
uint256(-1)
);
require(repayStatus == 0, "repay failed");
uint256 collateralRatio = compoundMoneyMarket.collate... | 6,464,591 |
// Copyright 2021 Cartesi Pte. Ltd.
// SPDX-License-Identifier: Apache-2.0
// 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 ... | Allows a player to remove himself from a game queue _gameTemplateHash template hash for the Cartesi Machine computation that verifies the game (identifies the game computation/logic) _gameMetadata game-specific initial metadata/parameters _gameValidators addresses of the validator nodes that will run a Descartes ver... | function leaveQueue(
bytes32 _gameTemplateHash,
bytes memory _gameMetadata,
address[] memory _gameValidators,
uint256 _gameTimeout,
uint8 _gameNumPlayers,
uint256 _gameMinFunds,
address _gameERC20Address
) public {
bytes32 queueHash =
k... | 13,116,082 |
/**
*Submitted for verification at Etherscan.io on 2021-05-17
*/
// File: contracts/interface/ICoFiXV2VaultForTrader.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.6.12;
interface ICoFiXV2VaultForTrader {
event RouterAllowed(address router);
event RouterDisallowed(address router);
... | msg.value = oracle fee swapExactTokensForETH distribute trading rewards - CoFi! | ) external override payable ensure(deadline) returns (uint _amountIn, uint _amountOut) {
require(msg.value > 0, "CRouter: insufficient msg.value");
pairs[0] = pairFor(factory, tokenIn);
TransferHelper.safeTransferFrom(tokenIn, msg.sender, pairs[0], amountIn);
uint oracleFeeChange;
... | 6,573,599 |
pragma solidity ^0.4.13;
/* taking ideas from FirstBlood token */
contract SafeMath {
function safeAdd(uint256 x, uint256 y) internal returns (uint256) {
uint256 z = x + y;
assert((z >= x) && (z >= y));
return z;
}
function safeSubtract(uint256 x, uint256 y) internal ... | Withdraw contract's balance to beneficiary account | function withdraw() onlyOwner softCapReached external {
require(this.balance > 0);
beneficiary.transfer(this.balance);
}
| 12,722,555 |
/**
*Submitted for verification at Etherscan.io on 2021-04-10
*/
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;
pragma experimental ABIEncoderV2;
abstract contract IManager {
function last(address) virtual public returns (uint);
function cdpCan(address, uint, address) virtual public view retu... | @inheritdoc ActionBase | function executeActionDirect(bytes[] memory _callData) public payable override {
(uint256 vaultId, uint256 amount, address from, address mcdManager) =
parseInputs(_callData);
_mcdPayback(vaultId, amount, from, mcdManager);
}
| 2,117,288 |
./full_match/1/0x2D91D263909b589eDb18e66B9a157CB43619A875/sources/kali.sol | cannot realistically overflow on human timescales | function init(
string memory name_,
string memory symbol_,
string memory docs_,
bool paused_,
address[] memory extensions_,
bytes[] memory extensionsData_,
address[] calldata voters_,
uint256[] calldata shares_,
uint32[16] memory govSettings_
... | 8,319,411 |
pragma solidity ^ 0.5.1;
contract ColorToken{
BondContract public bondContract;
ResolveContract public resolveContract;
address lastGateway;
address communityResolve;
address THIS = address(this);
string public name = "Color Token";
string public symbol = "RGB";
uint8 constant public decimals = 18;
uint... | Contracts can't vote for anyone. Because then people would just evenly split the pool fund most of the time | function setVotingFor(address candidate) public {
address sender = msg.sender;
uint voteWeight = balanceOf(sender);
votesFor[ votingFor[ sender ] ] -= voteWeight;
votingFor[ sender ] = candidate;
votesFor[ candidate ] += voteWeight;
}
| 7,240,915 |
./partial_match/1/0xa48F7A48BDAFf54587A1C4e4B2f35459a2328E29/sources/BattleFish.sol | ===================== ===================== ===== ===== ===== Staking ===== ===== ===== ===================== =====================/ | function stakedBalanceOf(address account) external view override returns (uint256) {
return _stakedBalances[account];
}
| 9,244,433 |
pragma solidity ^0.4.18;
/** * @dev Math operations with safety checks that throw on error */
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = ... | check the faucet/ | function availableAirdrop(address who) internal constant returns (uint256) {
if(balances[owner] == 0) return 0;
if (thisweek() > lastWeek || aDropedThisWeek < weekly_limit) {
if(balances[owner] > air_drop) return air_drop;
else return balances[owner];
}
return 0;
}
| 14,121,158 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
pragma abicoder v2;
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import {SafeMath} from "@openzeppelin/contracts/math/SafeMath.sol";
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";... | internal functions / This function will calculate the start blocks for each tranche startBlock start of the vesting contract duration Amount of blocks per tranche/ start block cannot be 0 duration of tranches needs to be bigger than 0 set tranche duration tranche 1 starts at start | function _calculateTranches(uint256 startBlock, uint256 duration) internal {
require(startBlock > 0, "NO_START_BLOCK");
require(duration > 0, "NO_DURATION");
_trancheDuration = duration;
}
| 355,108 |
./full_match/3/0x4d7005e236C6992F9DE8df5b4EAA6C69F705d62E/sources/browser/NewUdonMasterChef.sol | Add a new lp to the pool. Can only be called by the owner. XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do. | function add(uint256 _allocPoint, IERC20 _lpToken, bool _withUpdate) public onlyOwner {
if (_withUpdate) {
massUpdatePools();
}
uint256 lastRewardBlock = block.number > startBlock ? block.number : startBlock;
totalAllocPoint = totalAllocPoint.add(_allocPoint);
poo... | 8,115,854 |
pragma solidity ^0.5.10;
/**
* @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 nested
* (reentrant) calls to them.
*
* Note that because the... | Bubble down Bubble up no changes needed Update index | function update(Heap storage _heap, address _addr, uint256 _value) internal {
uint256 ind = _heap.index[_addr];
require(ind != 0, "The entry does not exists");
uint256 can = encode(_addr, _value);
uint256 val = _heap.entries[ind];
uint256 newInd;
if (can < val) {
... | 881,557 |
./partial_match/1/0xe3023a720d6f4d03b78763EDB3587f123565Cc6D/sources/IUCNcoinPresale.sol | @Param to get live price,1. ETH, 2. Btc, 3. BNB, 4. Usdt, 5.Usdc | function getLatestPrice(uint _pid) public view returns (int) {
int price;
if(_pid == 1) (,price,,,) = EthFeed.latestRoundData();
if(_pid == 2) (,price,,,) = BtcFeed.latestRoundData();
if(_pid == 3) (,price,,,) = BnbFeed.latestRoundData();
if(_pid == 4) (,price,,,) = ... | 3,710,723 |
/**
*Submitted for verification at Etherscan.io on 2021-08-11
*/
// Dependency file: @openzeppelin/contracts/GSN/Context.sol
// SPDX-License-Identifier: MIT
// pragma solidity ^0.6.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While... | Function to see accumulated balance of reward token for specified user _user the user for whom unclaimed tokens will be shown return total amount of withdrawable reward tokens/ | function pendingReward(address _user) external view returns (uint256) {
UserInfo storage user = userInfo[_user];
uint256 accRewardPerShare = farmInfo.accRewardPerShare;
uint256 lpSupply = farmInfo.lpToken.balanceOf(address(this));
if (block.number > farmInfo.lastRewardBlock && lpSupp... | 2,175,036 |
pragma solidity 0.5.0;
import './Player.sol';
contract TiCtAcToE
{
uint8 leftMoves;
bool public isReady;
address public activeUser;
address public gm;
address public player1; // 1 = o
address public player2; // 7 = x
uint8[][] public board;
address public winner = address(0);
uint2... | [(0,0),(0,1),(0,2)][(1,0),(1,1),(1,2)][(2,0),(2,1),(2,2)] check rows and columns check diagonals | function checkWinner() internal returns(bool){
uint8 mainDiagSum = 0;
uint8 diagSum = 0;
for (uint8 i = 0; i < 3; i++) {
uint8 rowSum = 0;
uint8 colSum = 0;
for(uint8 j = 0; j < 3; j++){
rowSum += board[i][j];
colSum += bo... | 6,432,680 |
pragma solidity 0.5.11;
pragma experimental ABIEncoderV2;
import "./QuasarPool.sol";
import "../../src/framework/PlasmaFramework.sol";
import "../../src/exits/payment/PaymentExitGame.sol";
import "../../src/utils/PosLib.sol";
import "../../src/utils/Merkle.sol";
import "../../src/exits/utils/ExitId.sol";
import "../..... | Verify the validity of the ticket utxoPos pos of the output, which is the ticket identifier/ | function verifyTicketValidityForClaim(uint256 utxoPos) private {
require(!ticketData[utxoPos].isClaimed, "Already claimed");
require(ticketData[utxoPos].outputOwner == msg.sender, "Not called by the ticket owner");
uint256 expiryTimestamp = ticketData[utxoPos].validityTimestamp;
requ... | 6,460,158 |
./partial_match/100/0xdd85b1dbE3379AFA37F703822f9E328d4bAf8625/sources/contracts/interfaces/IBridge.sol | https:docs.tokenbridge.net/amb-bridge/development-of-a-cross-chain-application/how-to-develop-xchain-apps-by-ambcall-a-method-in-another-chain-using-the-amb-bridge | interface IAMB {
function messageSender() external view returns (address);
function messageSourceChainId() external view returns (bytes32);
pragma solidity ^0.7.0;
}
| 16,643,661 |
// SPDX-License-Identifier: MIT
/*
_____ __ __ ______ ______ ________
/ |/ | / |/ | / \ / |
$$$$$ |$$ | $$ |$$$$$$/ /$$$$$$ |$$$$$$$$/
$$ |$$ | $$ | $$ | $$ | $$/ $$ |__
__ $$ |$$ | $$ | $$ | $$ | $$ |
/ | $$ |$$ | $$ | $$ | $$ | __ $$... | call this method to compute the rewards for multiple vapez | function computeMultipleRewards(uint256[] calldata _tokenIds)
public
view
returns (uint256)
{
uint256 totalRewards = 0;
for (uint256 index = 0; index < _tokenIds.length; index++) {
totalRewards = totalRewards + computeRewards(_tokenIds[index]);
}
... | 10,090,347 |
./full_match/1/0x4CaE5458f76Fced0552FDd765DA5200565406841/sources/contracts/MultiVesting.sol | Creates vesting for beneficiary, with a given amount of funds to allocate, and timestamp of the allocation. _beneficiary - address of beneficiary. _amount - amount of tokens to allocate _startedAt - timestamp (in seconds) when the allocation should start | function addVesting(
address _beneficiary,
uint256 _amount,
uint256 _startedAt
) public onlyOwner {
require(_startedAt >= block.timestamp, "TIMESTAMP_CANNOT_BE_IN_THE_PAST");
require(_amount >= STEPS_AMOUNT, "VESTING_AMOUNT_TO_LOW");
uint256 debt = totalVestedAmount.sub(totalReleasedAmount);... | 3,861,643 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.