file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./SafeMath96.sol";
import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./spec_interfaces/ICommittee.sol";
import "./spec_interfaces/IProtoco... | Performs emergency withdrawal of the contract balance called with a token to withdraw, should be called twice with the fees and bootstrap tokens governance function called only by the migration manager erc20 is the ERC20 token to withdraw | function emergencyWithdraw(address erc20) external override onlyMigrationManager {
IERC20 _token = IERC20(erc20);
emit EmergencyWithdrawal(msg.sender, address(_token));
require(_token.transfer(msg.sender, _token.balanceOf(address(this))), "Rewards::emergencyWithdraw - transfer failed");
... | 6,441,212 |
./full_match/82/0xe3660C8FEC2d41A99273C705A8F272C87Ad48f54/sources/contracts/PermitRouter.sol | performs chained getAmountIn calculations on any number of pairs | function getAmountsIn(
address pair,
uint256 amountOut,
address[] memory path
) internal view returns (uint256[] memory amounts) {
require(path.length >= 2, "UniswapV2Library: INVALID_PATH");
amounts = new uint256[](path.length);
amounts[amounts.length - 1] = amou... | 7,093,589 |
./partial_match/1/0x271682DEB8C4E0901D1a1550aD2e64D568E69909/sources/src/v0.8/dev/VRF.sol | True if (gamma, c, s) is a correctly constructed randomness proof from pk and seed. zInv must be the inverse of the third ordinate from projectiveECAdd applied to cGammaWitness and sHashWitness. Corresponds to section 5.3 of the IETF draft. TODO(alx): Since I'm only using pk in the ecrecover call, I could only pass the... | function verifyVRFProof(
uint256[2] memory pk,
uint256[2] memory gamma,
uint256 c,
uint256 s,
uint256 seed,
address uWitness,
uint256[2] memory cGammaWitness,
uint256[2] memory sHashWitness,
uint256 zInv
) internal view {
unchecked {
require(isOnCurve(pk), "public key i... | 3,883,090 |
// File: @openzeppelin/contracts/access/IAccessControl.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControl {
/**
* @dev Emitt... | File: contracts/@rarible/contracts/RoyaltiesV2.sol | interface RoyaltiesV2 {
event RoyaltiesSet(uint256 tokenId, LibPart.Part[] royalties);
function getRaribleV2Royalties(uint256 id) external view returns (LibPart.Part[] memory);
}
| 12,104,818 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.6.8;
import "./ProtoBufRuntime.sol";
import "./GoogleProtobufAny.sol";
library NftTransfer {
//struct definition
struct Data {
string class;
string id;
string uri;
string sender;
string receiver;
bool awayFromOrigin;
string des... | The decoder for reading a field p The offset of bytes array to start decode bs The bytes array to be decoded r The in-memory struct counters The counters for repeated fields return The number of bytes decoded/ if `r` is NULL, then only counting the number of fields./ | function _read_sender(
uint256 p,
bytes memory bs,
Data memory r,
uint[8] memory counters
) internal pure returns (uint) {
(string memory x, uint256 sz) = ProtoBufRuntime._decode_string(p, bs);
if (isNil(r)) {
counters[4] += 1;
r.sender = x;
if (counters[4] > 0) counters[4]... | 14,019,327 |
/**
*Submitted for verification at Etherscan.io on 2021-05-04
*/
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.7.5;
interface IOwnable {
function manager() external view returns (address);
function renounceManagement() external;
function pushManagement( address newOwner_ ) external;
... | / calculate reductions from vesting store updated deposit info | function redeem() external returns ( uint ) {
Bond memory info = bondInfo[ msg.sender ];
uint percentVested = percentVestedFor( msg.sender );
delete bondInfo[msg.sender];
totalDebt = totalDebt.sub( info.valueRemaining );
IERC20( OHM ).transfer( msg.sender... | 7,971,190 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppe... | Function updating maximum minting amount per account - available to owner _newmaxMintAmount The maximum mint amount per account Requirements: - the newmaxMintAmount is greater than zero/ | function setmaxMintAmount(uint256 _newmaxMintAmount) public onlyOwner {
require(_newmaxMintAmount > 0, "Max mint amount entered is zero");
maxMintAmount = _newmaxMintAmount;
}
| 1,777,208 |
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
interface IGuardianStorage {
/**
* @notice Lets an authorised module add a guardian to a wallet.
* @param _wallet The target wallet.
* @param _guardian The guardian to add.
*/
function addGuardian(address _wallet, address _gu... | solhint-disable-next-line no-inline-assembly | function invoke(address _target, uint _value, bytes calldata _data) external moduleOnly returns (bytes memory _result) {
bool success;
if (!success) {
assembly {
returndatacopy(0, 0, returndatasize())
revert(0, returndatasize())
}
... | 7,506,294 |
./full_match/7700/0x4f07f0a2AE51ac40fb5FbdDaC242B5D22Cc0C992/sources/contracts/Plebness.sol | @inheritdoc IPlebness | function makeupTypesCount() external view override returns (uint256) {
return makeupAssets.length;
}
| 4,649,727 |
./full_match/4/0xDDF38E76F79794e7D17C221Cc19BAA12F497aE7B/sources/contracts/DefiYieldToken.sol | Returns the downcasted uint8 from uint256, reverting on overflow (when the input is greater than largest uint8). Counterpart to Solidity's `uint8` operator. Requirements: - input must fit into 8 bits./ | function toUint8(uint256 value) internal pure returns (uint8) {
require(
value <= type(uint8).max,
"SafeCast: value doesn't fit in 8 bits"
);
return uint8(value);
}
| 728,050 |
// SPDX-License-Identifier: CONSTANTLY WANTS TO MAKE THE WORLD BEAUTIFUL
// ///..//*..//..//,..////////#,,,,,,,,,,,,,,,,,&&&&&,**(*./,///*%(.%,,%*,#%/%#(///
// *#%%%%%%%%%%/%/////*&@@(*#(#,,,,,,,,,,,,,,,,,@@@@@/***,./,///%./%#(%.#%/.(.*////
// *******%%%%(/(/(/(/******#(#,,,,,,,,,,,,,,,,,********((#((@%%.........%@@@@... | Unique hash for token to generate the deterministic artwork./ | function tokenHash(uint256 tokenId) public view returns(bytes32){
require(_exists(tokenId), "DOES NOT EXIST");
return bytes32(keccak256(abi.encodePacked(address(this), creationDates[tokenId], creators[tokenId], tokenId)));
}
| 953,212 |
pragma solidity ^0.4.8;
contract Owned {
address public owner;
function Owned() {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) external onlyOwner {
owner = newOwner;
}
}
contract FidgetS... | Withdraws all the money from the contract/ | function withdrawAll() onlyOwner {
withdraw(address(this).balance);
}
| 12,894,103 |
./full_match/1/0xB09631CB29B982BC7B064BaB1167C1531f263812/sources/contracts/ExhibitionConsumer.sol | Peer whitelist required to be implemented. If no peers should be used, this can have an empty implementation. Example would be to vote for farms in the governance being included. Accepted peers can then be added to the consumer's internal whitelist and get further benefits like UNT. Must contain a check if the caller h... | function whitelistPeer(address _peer) override external lock{
require(IUniftyGovernance(msg.sender) == gov, "whitelistPeer: access denied.");
require(exhibition != _peer, "whitelistPeer: peer exists already.");
exhibition = _peer;
exhibitionStart = block.timestamp;
... | 2,971,436 |
./full_match/1/0xa40111994F44C8add82eF495269e19109c9A982A/sources/contracts/PriceProvidersRepository.sol | @inheritdoc IPriceProvidersRepository | function isPriceProvider(IPriceProvider _provider) external view override returns (bool) {
return _allProviders.contains(address(_provider));
}
| 16,593,261 |
./full_match/1/0x22F7145754ad116C406c0d5C6fA029f63537AE18/sources/contracts/token/ArcxRedemption.sol | Callable by anyone who supplies ARCx up until the cut off date _amount - How many ARCx tokens you'd like to redeem for USDC/ Check cut off date has not passed Transfer ARCx from user to contract Calculate how much USDC to give using exchange rate Send USDC to user | function redeem(
uint256 _amount
)
public
{
require(
currentTimestamp() <= cutoffDate,
"The cut off date to redeem has already passed"
);
arcxToken.safeTransferFrom(
msg.sender,
address(this),
_amount
... | 9,800,297 |
./partial_match/5/0x423DBa410C9d51fae8C34aFF803fbe1a356845dD/sources/lib/dss-exec-lib/src/DssExecLib.sol | / Constants /// Math Functions // | function wdiv(uint256 x, uint256 y) internal pure returns (uint256 z) {
z = (x * WAD + y / 2) / y;
}
| 16,837,986 |
pragma solidity ^0.4.19;
// Turn the usage of callcode
contract SafeMath {
function safeMul(uint a, uint b) internal returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function safeSub(uint a, uint b) internal returns (uint) {
assert(b <= a);
... | Each MNTP token holder gets a GOLD reward as a percent of all rewards proportional to his MNTP token stake | function calculateMyRewardMax(address _of) public constant returns(uint){
if (0 == mntpToMigrateTotal) {
return 0;
}
uint myCurrentMntpBalance = mntpToken.balanceOf(_of);
if (0 == myCurrentMntpBalance) {
return 0;
}
return (migrationRewardT... | 353,079 |
./full_match/3/0x546e15f2489048D9cE72558eF844F5C27926c615/sources/contracts/ERAC.sol | Mints a `tokenIds` list ERAC and transfers it to `to`. - `to` mint ERAC to 'to', cannot be the zero address. - `tokenIds` must not exist. Emits a {Transfer} event every tokenId minted./ | function mintBatch(address to, uint256[] memory tokenIds)
public
onlyOwner
returns (bool)
{
for (uint256 i = 0; i < tokenIds.length; ++i) {
mint(to, tokenIds[i]);
}
return true;
}
| 14,195,444 |
/**
* Rupiah Token Smart Contract
* Copyright (C) 2019 PT. Rupiah Token Indonesia <https://www.rupiahtoken.com/>.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3... | Finalize tx by _superOwner. transactionId Transaction ID./ | function finalizeTransaction(uint transactionId)
public
onlySuperOwner()
notExecuted(transactionId)
{
require(_requireFinalization[transactionId]);
require(isConfirmed(transactionId));
Transaction storage txn = transactions[transactionId];
txn.executed = tru... | 12,720,550 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
// Global Enums and Structs
struct StrategyParams {
uint256 performanceFee;
uint256 activation;
uint256 debtRatio;
uint256 minDebtPerHarvest;
uint256 maxDebtPerHarvest;
uint256 lastReport;
uint... | Estimates debt limit decrease. It is not accurate and should only be used for very broad decision makingsimplistic. not accurate | function _estimateDebtLimitDecrease(uint256 change) internal view returns (uint256) {
uint256 lowestApr = uint256(-1);
uint256 aprChoice = 0;
for (uint256 i = 0; i < lenders.length; i++) {
uint256 apr = lenders[i].aprAfterDeposit(change);
if (apr < lowestApr) {
... | 1,462,832 |
pragma solidity 0.4.24;
/**
* @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, ... | Create an invite using the signing model described in the contract description Recovers public key of invitation key pair using _sig Signature of one-time-use keypair generated for invite/ | function createInvite(bytes _sig) public onlyUser {
address inviteAddress = signingLogic.recoverSigner(keccak256(abi.encodePacked(msg.sender)), _sig);
require(!pendingInvites[inviteAddress]);
pendingInvites[inviteAddress] = true;
emit InviteCreated(msg.sender, inviteAddress);
}
| 7,640,183 |
./partial_match/42/0x2528aBc12A394fb45f870F518Ab4701371723976/sources/AssetsSnapshot.sol | insert datas to snapshots | function insert(address _addr,uint256 balance) public returns(bool success) {
require(owner == msg.sender,"Only the creator can do this");
require(syncFlag == 1,"Synchronization has not yet started or has ended");
require(syncCounter < totalUsers,"The amount of synchronized data exceeds expe... | 3,454,934 |
./full_match/41/0xA0D7E0EdCbce091D78a986154FB00848e31A5421/sources/TEST.sol | _tax[i].accounts = taxFeeSplit[i].accounts; _tax[i].fee = taxFeeSplit[i].fee; totalFee += taxFeeSplit[i].fee; | function setFee(uint256 _taxFee, Tax[] memory taxFeeSplit) external onlyOwner returns(bool) {
taxFee = _taxFee;
uint256 totalFee;
require(taxFeeSplit.length == 4, "fee length mismatch");
_tax[1] = taxFeeSplit[0];
_tax[2] = taxFeeSplit[1];
_tax[3] = taxFeeSplit[2];
... | 16,379,004 |
./partial_match/56/0xCb776D0a8b13bA79a33791079988a933096a00D3/sources/TestaToken.sol | Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair/ | function delegateBySig(
address delegatee,
uint nonce,
uint expiry,
uint8 v,
bytes32 r,
bytes32 s
)
external
{
bytes32 domainSeparator = keccak256(
abi.encode(
DOMAIN_TYPEHASH,
keccak256(bytes(name())... | 11,047,108 |
pragma solidity ^0.4.24;
/**
* @title It holds the storage variables related to ERC20DividendCheckpoint module
*/
contract ERC20DividendCheckpointStorage {
// Mapping to token address for each dividend
mapping (uint256 => address) public dividendTokens;
}
/**
* @title Holds the storage varia... | Called by the owner to unpause, returns to normal state/ | function _unpause() internal whenPaused {
paused = false;
emit Unpause(now);
| 926,197 |
/**
*
* Forked from SafeMoon
* DeFi rules.
:::::::: ::::::::::: ::: ::::::::: ::::::::::: :::::::: ::: ::: :::::::::: :::: :::
:+: :+: :+: :+: :+: :+: :+: :+: :+: :+: :+: :+: :+: ... | how much time did you spend looking at the stars?gives the multiplier for the fees | function lookingTime(address account) public view returns (uint256) {
uint256 starTime = _starTime[account];
if(starTime == 0)
uint256 numDays = ((block.timestamp).sub(starTime)).div(1 days);
uint256 maxDays = 9;
if(numDays>=maxDays)
return 1;
... | 1,569,786 |
//Part of this contract is from the solidity documentation
pragma solidity ^0.4.10;
/** Prepare for deployments:
*
* Add a *100 fee to askMembership()
* Switch fee to 0.01 ether
* Set voteLenght = 15 days
*
*/
/// @title Fund for donations.
contract Abie {
bytes32 public name;
bytes32 public statement;... | Count all the votes. You can call this function if gas limit is not an issue. proposalID ID of the proposal to count votes from./ | function countAllVotes (uint proposalID) public{
countVotes (proposalID,uint(-1));
}
| 12,762,589 |
./full_match/5/0x6848066d174FE57bfcb3f46A9853f02AdF2cA29F/sources/contracts/Contract.sol | require(products[_id].quantity == 0, "The product is out of stock"); | function buyProductsID(uint256 _id) external payable {
products[_id].quantity = products[_id].quantity - 1;
ownedProducts.push(
Product({
id: products[_id].id,
name: products[_id].name,
price: products[_id].price,
quantity:... | 1,872,865 |
./partial_match/1/0x436aAd97C5C4298521a1295F5e55c7BD9ab090c3/sources/FundRequestPrivateSeed.sol | low level token purchase function calculate token amount to be created | function buyTokens(address beneficiary) payable whenNotPaused {
require(validBeneficiary(beneficiary));
require(validPurchase());
require(validPurchaseSize());
bool existing = deposits[beneficiary] > 0;
uint weiAmount = msg.value;
uint updatedWeiRaised = weiRaised.add(weiAmount);
uint toke... | 4,463,728 |
pragma solidity ^0.4.18;
/**
* @title Registry
* @dev This contract implements a fast lookup table for keys.
*/
contract Registry {
uint8[256] private hBytes; // Do not plan on supporting more than 2^16 entries
// The values stored in here are 1 based, not 0 based.
uint256[]... | Get the number of entries in the registry. return The number of entries./ | function size() public constant returns (uint _count) {
_count = lBytes.length;
}
| 15,788,943 |
./partial_match/7700/0xdE2213F774668579E6005EF4AA7011E502aA1B4E/sources/contracts/lib/LibLinearVRGDA.sol | Given a number of tokens sold, return the target time that number of tokens should be sold by. sold A number of tokens sold, scaled by 1e18, to get the corresponding target sale time for. perTimeUnit The number of tokens to target selling in 1 full unit of time, scaled by 1e18. return The target time the tokens shoul... | function getTargetSaleTime(int256 sold, int256 perTimeUnit) public pure returns (int256) {
return unsafeWadDiv(sold, perTimeUnit);
}
| 3,509,508 |
/**
*Submitted for verification at Etherscan.io on 2021-10-21
*/
// SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.6;
library AddressUtils {
/**
* Returns whether the target address is a contract
* @dev This function will return false if invoked during the constructor of a contract,
* as the c... | Returns the address of the owner of the NFT. NFTs assigned to the zero address are considered invalid, and queries about them do throw. _tokenId The identifier for an NFT. return _owner Address of _tokenId owner./ | function ownerOf(
uint256 _tokenId
)
external
override
view
returns (address _owner)
{
_owner = idToOwner[_tokenId];
require(_owner != address(0), NOT_VALID_NFT);
}
| 2,252,113 |
/**
*Submitted for verification at Etherscan.io on 2020-01-30
*/
// File: contracts/math/SafeMath.sol
pragma solidity 0.5.12;
/// @title SafeMath
/// @dev Math operations with safety checks that throw on error
library SafeMath {
/// @dev Add two integers
function add(uint a, uint b) internal pure returns ... | Distribute tokens purchased off-chain via public sale Note: additional requirements are enforced in internal function. beneficiaries List of recipients' Ethereum addresses amounts List of token units each recipient will receive | function distributeTokensViaPublicSale(
address[] memory beneficiaries,
uint[] memory amounts
)
public
{
tokenRemainingForPublicSale =
distributeTokens(tokenRemainingForPublicSale, beneficiaries, amounts, true);
}
| 1,786,985 |
pragma solidity 0.6.4;
pragma experimental ABIEncoderV2;
/**
@title Interface for handler contracts that support deposits and deposit executions.
@author ChainSafe Systems.
*/
interface IDepositExecute {
/**
@notice It is intended that deposit are made using the Bridge contract.
@param de... | bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value)); | function safeTransferFrom(address token, address from, address to, uint value) internal {
bytes4 SELECTOR = bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(SELECTOR, from, to, value));
require(success &&... | 1,713,995 |
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not... | Takes actions on contribution TODO: add impl | function onContribution(address _contributor, uint256 _weiAmount, uint256 _tokens, uint256 _bonus)
public onlyCrowdsale() {
_contributor = _contributor;
_weiAmount = _weiAmount;
_tokens = _tokens;
_bonus = _bonus;
}
| 5,374,353 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./MagicLampWalletBase.sol";
import "./MagicLampWalletEvents.sol";
import "./IERC721Receiver.sol";
import "./IERC1155Receiver.sol";
import "./ERC165.sol";
import "./IERC20.sol";
import "./IERC721.sol";
import "./IERC1155.sol";
contract MagicLampWallet i... | Gets tokens for wallet/ | function getTokens(address host, uint256 id)
external view returns (uint8[] memory tokenTypes, address[] memory tokenAddresses) {
Token[] memory tokens = _tokens[host][id];
tokenTypes = new uint8[](tokens.length);
tokenAddresses = new address[](tokens.length);
for (uint256 i; ... | 252,703 |
// File: contracts/StringBuffer.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @notice Holds a string that can expand dynamically.
*/
struct StringBuffer {
string[] buffer;
uint numberOfStrings;
uint totalStringLength;
}
library StringBufferLibrary {
/**
* @dev Copies 32 byte... | Mint for a giveaway./ | function giveawayMint(address[] memory winners) external onlyAdmin {
Rng memory rn = rng;
for (uint i = 0; i < winners.length; ++i) {
bitMonsters.createBitMonster(BitMonsterGen.generateUnspecialBitMonster(rn), winners[i]);
}
rng = rn;
}
| 5,812,212 |
pragma solidity ^0.4.24;
/**
* @title Proxy
* @dev Implements delegation of calls to other contracts, with proper
* forwarding of return values and bubbling of failures.
* It defines a fallback function that delegates all calls to the address
* returned by the abstract _implementation() internal function.
*/
con... | Sets the necessary permissions for a "nonlisted" user. Nonlisted users can trade tokens, but cannot burn them (and therefore cannot convert them into fiat.) _who The address of the account that we are setting permissions for./ | function setNonlistedUser(address _who) public onlyValidator {
_setNonlistedUser(_who);
}
| 1,273,888 |
./partial_match/1/0x843bD7a811DC26874Cb2ad9F4A04a8652F65d8e6/sources/contracts/liquidity-protection/LiquidityProtection.sol | returns custom input for the `removeLiquidity` converter function/ | function _removeLiquidityInput(IReserveToken reserveToken1, IReserveToken reserveToken2)
private
pure
returns (IReserveToken[] memory, uint256[] memory)
{
IReserveToken[] memory reserveTokens = new IReserveToken[](2);
uint256[] memory minReturns = new uint256[](2);
... | 3,560,958 |
./full_match/43113/0xb28F38C955163b5a5B311027621be480240Bcc7e/sources/dailysettest.sol | (bool success, ) = msg.sender.call.value(tmp)("");require(success, "The transaction has failed"); | function exit(uint _id) public planexists(_id){
uint tmp = plans[_id].members[msg.sender];
plans[_id].members[msg.sender] == 0;
plans[_id].usercount--;
plans[_id].maxusers--;
msg.sender.transfer(tmp);
}
| 13,179,170 |
/*
* Team Proof of Long Hodl presents... v2
*/
pragma solidity ^0.4.21;
contract ProofOfLongHodl {
using SafeMath for uint256;
event Deposit(address user, uint amount);
event Withdraw(address user, uint amount);
event Claim(address user, uint dividends);
event Reinvest(address user, uint dividend... | weekly and daily pool ADD DAILY TICKETS If we need to reset tickets from a previous lotteryRound Store new ticket purchase If we need to reset tickets from a previous lotteryRound Store new ticket purchase | function depositHelper(uint _amount) private {
require(_amount > 0);
uint _tax = _amount.div(depositTaxDivisor);
uint _lotteryPool = _amount.div(lotteryFee);
uint _amountAfterTax = _amount.sub(_tax).sub(_lotteryPool);
uint weeklyPoolFee = _lotteryPool.div(5);
uint daily... | 2,241,969 |
./full_match/80001/0x35264CD5f2f09a8719b02fc18c717Ca8F09a19a1/sources/contracts/Crowd_Funding.sol | campaign.myAmountRefunded.push(0); | function donateToCampaign(uint256 _id) external payable {
uint256 amount = msg.value;
Campaign storage campaign = campaigns[_id];
campaign.donators.push(msg.sender);
campaign.donations.push(amount);
campaign.donation_date.push(block.timestamp);
campaign.myTransacti... | 5,620,621 |
./full_match/5/0x8988AE9571085ef9B1AC17FD116F85601b03b54f/sources/contracts/CrowdFunding.sol | payable(campaign.owner).transfer(amount); | function donateToCampaign(uint256 _id) public payable {
uint256 amount = msg.value;
Campaign storage campaign = campaigns[_id];
campaign.donators.push(msg.sender);
campaign.donations.push(amount);
campaign.amountCollected += amount;
}
| 7,064,865 |
./full_match/4/0xc113B51d535DbBc5E37d12c55a62FAB4DaCF2086/sources/contracts/Flower.sol | IF ELSE STATEMENTS FOR EACH MUTATIONNORMAL flower.mutation = mutation;SKETCHEDSKEWNOISELONGBOIINFECTED | function getMutation(uint256 tokenId, string memory seed) internal pure returns (string memory) {
uint256 rand = random(string(abi.encodePacked(seed, toString(tokenId))));
string memory feTurbulance;
string memory feDisplacementMap;
string memory xOffset = '0';
string memory ... | 12,318,225 |
./partial_match/56/0x77c84e4d4f050B6784900b526799b4E32B8CfFc3/sources/MasterRobot.sol | Safe bots transfer function, just in case if rounding error causes pool to not have enough BOTSs. | function safeBotsTransfer(address _to, uint256 _amount) internal {
uint256 botsBal = bots.balanceOf(address(this));
if (_amount > botsBal) {
bots.transfer(_to, botsBal);
bots.transfer(_to, _amount);
}
}
| 11,142,786 |
pragma solidity 0.5.11;
library IsDeposit {
struct Predicate {
uint256 childBlockInterval;
}
/**
* @notice test whether the given block number belongs to a deposit block or not
*/
function test(Predicate memory _predicate, uint256 _blockNum) internal pure returns (bool) {
ret... | test whether the given block number belongs to a deposit block or not/ | function test(Predicate memory _predicate, uint256 _blockNum) internal pure returns (bool) {
return _blockNum % _predicate.childBlockInterval != 0;
}
| 12,899,045 |
./full_match/1/0x25c8f450afe471B5238245140024cBFd9d86F868/sources/contracts/SaltyPowerCabins.sol | Verifies that the sender is whitelisted | function _verifySignature(address sender, bytes memory signature) internal view returns (bool) {
return keccak256(abi.encodePacked(sender))
.toEthSignedMessageHash()
.recover(signature) == _signer;
}
| 3,852,419 |
pragma solidity 0.7.4;
import "../interfaces/IERC1271Wallet.sol";
import "../utils/LibBytes.sol";
// Constructor of this LibEIP712 takes domain hash of mock ERC-1155
contract LibEIP712 {
/***********************************|
| Variables |
|__________________________________*/
// kecc... | Gets the memory address for the contents of a byte array. input Byte array to lookup. return memoryAddress Memory address of the contents of the byte array./ | {
function contentAddress(bytes memory input) internal pure returns (uint256 memoryAddress)
assembly {
memoryAddress := add(input, 32)
}
return memoryAddress;
}
| 969,319 |
./full_match/43113/0xdEC8B2F80064CB368a95da37C5d41e5161a4522A/sources/docs.chain.link/samples/PriceFeeds/PriceConsumerMuliple.sol | Returns the latest price/ | function getLatestPrice(uint8 decimal) public view returns (priceStrut[] memory) {
priceStrut[] memory prices = new priceStrut[](5);
prices[0] = priceStrut("AVAX/USD", getPrice(avalance_avax_usd_price_feed, decimal));
prices[1] = priceStrut("AVAX/BTC", getDerivedPrice(avalance_avax_usd_price... | 13,154,115 |
pragma solidity ^0.4.24;
contract Owned {
/// 'owner' is the only address that can call a function with
/// this modifier
address public initOwner;
address[] public owner;
address internal newOwner;
///@notice The constructor assigns the message sender to be 'owner'
co... | This owner allocate token for candy airdrop _owners The address of the account that owns the token _values The amount of tokens | function allocateToken(address[] _owners, uint256[] _values) public onlyOwners(msg.sender) {
require (_owners.length == _values.length);
for(uint i = 0; i < _owners.length ; i++){
uint256 value = _values[i] * 10 ** decimals;
require(ERC20Token(USEAddr).transferFrom(allocTokenHolder, _o... | 14,018,366 |
pragma solidity ^0.4.21;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import {Token} from './Token.sol';
import {Exchange} from './Exchange.sol';
import {ReentrancyGuard} from './ReentrancyGuard.sol';
contract IndexContract is Ownable, Reen... | return weight that we'd like to achieve | function token_quantities() external view returns (uint256[]){
uint256[] memory quantities = new uint256[](_tokens.length);
for (uint256 i = 0; i < _tokens.length; i++) {
quantities[i] = _tokens[i].curr_quantity;
}
return quantities;
}
| 5,405,992 |
./partial_match/1/0x37c8B836eA1b89b7cC4cFdDed4C4fbC454CcC679/sources/Pile.sol | set/change the interest rate of a rate category | function file(bytes32 what, uint rate, uint value) external auth note {
if (what == "rate") {
require(value != 0, "rate-per-second-can-not-be-0");
if (rates[rate].chi == 0) {
rates[rate].chi = ONE;
rates[rate].lastUpdated = uint48(now);
... | 2,638,288 |
./full_match/1/0xfd163422FAB44B8a58Cc8e201762D7d0CdF2E705/sources/GLINK.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("GLINK", "GLINK") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUnisw... | 3,867,910 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
import "@chainlink/contracts/src/v0.8/ChainlinkClient.sol";
import "./log.sol";
contract SimplePaymentChannel is ChainlinkClient, Console {
//chainlink init
using Chainlink for Chainlink.Request;
event taskCommit(string dockerImage, stri... | receive the response from above commitTask, need to check if it's correct response and change the state of this task find this transaction in customerToTransactionssend money to the cloud provider | function fulfillLivenessCheck(bytes32 _requestId, bytes32 flagMessage) public recordChainlinkFulfillment(_requestId)
{
finished = flagMessage;
uint tid = requestIdToTransactionId[_requestId];
Transaction storage transaction = tidToTransaction[tid];
Transaction[] memory transactio... | 12,606,636 |
./full_match/1/0x0bC24E61DAAd6293A1b3b53a7D01086BfF0Ea6e5/sources/contracts/WiseSecurity/WiseSecurityHelper.sol | Check function for withdraw flow. Tests if debt ratio is not greater than 100% after withdraw of {_poolToken} for {_amount}./ | function checkBorrowLimit(
uint256 _nftId,
address _poolToken,
uint256 _amount
)
public
view
{
uint256 borrowAmount = overallUSDBorrow(
_nftId
);
if (borrowAmount == 0) {
return;
}
uint256 withdrawValue... | 4,818,540 |
./partial_match/1/0x76Db75dc752305E2deBd44c479680352F3Bb766f/sources/src/PolygonStateBridge.sol | boilerplate function to satisfy FxBaseRootTunnel inheritance (not going to be used) | function _processMessageFromChild(bytes memory) internal override {
| 2,774,451 |
./full_match/80001/0x88517aB345F1e7492227E3515641B8b51019d7dd/sources/src/contracts/SignatureMintWithParamsUpgradeable.sol | Returns the address of the signer of the mint request. | function _recoverAddress(bytes memory _req, bytes calldata _signature) internal view returns (address) {
return _hashTypedDataV4(keccak256(_buildHashStruct(_req))).recover(_signature);
}
| 841,941 |
pragma solidity ^0.4.10;
contract UserStorage {
//用户结构体
struct User {
//用户名
string username;
//vhw地址
string vhwAddress;
//加密后的密码
string encryptedPassword;
//总贡献值
uint64 totalContribution;
//剩余贡献值
uint64 residualContribution;
... | 增加补丁打分情况判断用户是否存在判断该用户是否已经评价过该漏洞 | function addAssessPatchScore(string username, string assessor, uint8 score) public returns (bool) {
if (userExisted(username)) {
if (userMap[username].patchesScore[assessor] == 0) {
userMap[username].patchesScore[assessor] = score;
return true;
... | 1,010,965 |
// Copyright (c) 2019 The Perun Authors. All rights reserved.
// This file is part of go-perun. Use of this source code is governed by a
// MIT-style license that can be found in the LICENSE file.
pragma solidity ^0.5.13;
pragma experimental ABIEncoderV2;
import "./Channel.sol";
import "./App.sol";
import "./AssetHol... | ConcludeFinal can be used to immediately conclude a final state without registering it or waiting for a timeout. The caller has to provide n signatures on the final state. It can only be called if no other dispute for this channel was registered. If the call was successful, a FinalConcluded and Concluded event is emitt... | function concludeFinal(
Channel.Params memory params,
Channel.State memory state,
bytes[] memory sigs)
public
{
require(state.isFinal == true, "only accept final states");
bytes32 channelID = calcChannelID(params);
require(state.channelID == channelID, "tried registering invalid channelID");
require(di... | 12,925,089 |
pragma solidity ^0.5.0;
import './Ownable.sol';
contract ProofOfExistence is Ownable {
mapping (bytes32 => bool) public proofs;
// store a proof of existence in the contract state
function storeProof(bytes32 proof)
internal
{
proofs[proof] = true;
}
// calculate and store the proof for a docu... | check if a document has been notarized | function checkDocument(string memory document)
public
view
returns (bool)
{
bytes32 proof = proofFor(document);
return hasProof(proof);
}
| 2,474,659 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;
import "@violinio/defi-interfaces/contracts/IPancakeSwapReferralMC.sol";
import "./BaseStrategy.sol";
contract StrategyPancakeSwapReferral is BaseStrategy {
IPancakeSwapReferralMC public masterchef;
uint256 public pid;
address deployer;
Referr... | Pulls the reward token back to the strategy. All though a zap would be more transfer-tax efficient, we do a transfer to save on gas. | function pullRewardToken() external {
require(msg.sender == strategy);
uint256 balance = token.balanceOf(address(this));
if(balance > 0)
token.safeTransfer(strategy, balance);
}
| 5,467,044 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./ERC721Tradable.sol";
import "./IERC20.sol";
import "./openzeppelin-solidity/contracts/utils/math/SafeMath.sol";
import "./ICards.sol";
/**
* @title Cards
*/
contract Cards is ERC721Tradable, ICards {
using SafeMath for uint256;
// Name chan... | interface ICreature is IERC721Enumerable { | interface ICards is IERC721Enumerable{
function isMintedBeforeReveal(uint256 index) external view returns (bool);
function mintedTimestamp(uint256 index) external view returns (uint256);
}
| 13,383,561 |
./partial_match/97/0x052D64ECD1C8c30DDb7D91fa86b45de0CE86a9e1/sources/Comptroller.sol | Sets the collateralFactor for a market Admin function to set per-market collateralFactor vToken The market to set the factor on newCollateralFactorMantissa The new collateral factor, scaled by 1e18 return uint 0=success, otherwise a failure. (See ErrorReporter for details)/ Check caller is admin | function _setCollateralFactor(VToken vToken, uint newCollateralFactorMantissa) external returns (uint256) {
if (msg.sender != admin) {
return fail(Error.UNAUTHORIZED, FailureInfo.SET_COLLATERAL_FACTOR_OWNER_CHECK);
}
Market storage market = markets[address(vToken)];
if (... | 11,472,285 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "./L2BridgeLib.sol";
contract L2BridgeDestination {
using SafeERC20 for IERC20;
uint256 public transferCount;
mapping(b... | claim the transfer token at source by exchange the corresponding destination token./ TODO: add minimal buy fee to prevent dust attack. construct reward data and append it to onion save to history per 100 transfers | function claim(L2BridgeLib.TransferData memory transferData)
public
payable
{
bytes32 key = keccak256(abi.encode(transferData));
require(!claimedTransferHashes[key], "already bought");
claimedTransferHashes[key] = true;
uint256 amount = transferData.amount - getL... | 6,467,343 |
./partial_match/1/0x00000000000006c7676171937C444f6BDe3D6282/sources/contracts/lib/ConsiderationErrors.sol | Reverts execution with a "OfferAndConsiderationRequiredOnFulfillment" error message./ | function _revertOfferAndConsiderationRequiredOnFulfillment() pure {
assembly {
mstore(0, OfferAndConsiderationRequiredOnFulfillment_error_selector)
revert(
Error_selector_offset,
OfferAndConsiderationRequiredOnFulfillment_error_length
)
}
}
| 4,301,455 |
/*
Copyright 2022 dYdX Trading Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | Set the sale of the collection as finalized, preventing the baseURI from being updated again. Emits finalized event./ | function finalize()
external
uriNotFinalized
onlyRole(DEFAULT_ADMIN_ROLE)
{
_URI_IS_FINALIZED_ = true;
emit FinalizedUri();
}
| 1,063,352 |
./full_match/8453/0x5Ba641A1Fa1E6A7D033c9f6A8108d52B92b78257/sources/contracts/HATVaultsRegistry.sol | See {IHATVaultsRegistry-setClaimFee}. / | function setClaimFee(uint256 _fee) external onlyOwner {
generalParameters.claimFee = _fee;
emit SetClaimFee(_fee);
}
| 11,548,675 |
./full_match/1/0x27eE048B431d00d8f9fFC3Fe3B8e657efEb58538/sources/contracts/erc721/MemswapERC721.sol | Verify start and end times Ensure non-partially-fillable intents are fully filled When isBuy = true: amount = buy amount endAmount = sell end amount startAmountBps = sell start amount bps expectedAmountBps = sell expected amount bps (now() - startTime) maxAmount = st... | function _preProcess(
Intent memory intent,
TokenDetails[] memory tokenDetailsToFill
) internal returns (TokenDetails[] memory actualTokenDetailsToFill) {
bytes32 intentHash = getIntentHash(intent);
if (intent.startTime > block.timestamp) {
revert IntentIsNotStarted... | 3,102,051 |
/* Boilerplate for an ERC-721 Contract */
/* DEBUG - Remove for prod */
import "hardhat/console.sol";
/// @title The Dungeons ERC-721 token
/*****************************************************
0000000 0000000
0001100 Dungeons (for Adventurers) 0001100
0001100 ... | Allow a user to claim this token/ | function claim(uint256 tokenId) public nonReentrant {
require(tokenId > 0 && tokenId < 5, "Token ID must be between 1->4");
_safeMint(_msgSender(), tokenId);
}
| 2,498,787 |
./full_match/43114/0x3428aa6424E65a174bB78EDe122f39301c626a44/sources/Divident/WAVAX.sol | Update the withdrawal interval Only callable by owner. _interval: the withdrawal interval for staked token in seconds/ | function updateWithdrawalInterval(uint256 _interval) external onlyOwner {
require(_interval <= MAXIMUM_WITHDRAWAL_INTERVAL, "Invalid withdrawal interval");
withdrawalInterval = _interval;
emit NewWithdrawalInterval(_interval);
}
| 4,513,550 |
// File: @openzeppelin\upgrades\contracts\Initializable.sol
pragma solidity >=0.4.24 <0.7.0;
/**
* @title Initializable
*
* @dev Helper contract to support initializer functions. To use it, replace
* the constructor with a function that has the `initializer` modifier.
* WARNING: Unlike constructors, initializer... | return estimated KTY and SDAO rewards This function is only used for estimating rewards only/ | function estimateYields(uint256 startMonth, uint256 endMonth, uint256 lockedLP, uint256 startingLP, uint256 adjustedMonthlyDeposit)
internal view
returns (uint256, uint256)
{
(uint256 yields_part_1_KTY, uint256 yields_part_1_SDAO)= estimateYields_part_1(startMonth, startingLP, adjustedMo... | 617,084 |
./full_match/80001/0x053B3045552AEc792579A3dF4A17dC40E6617eDd/sources/contracts/EPMXPriceFeed.sol | Retrieves the latest timestamp of the round data. return The latest timestamp of when the round was updated, in seconds (UTC)./ | function latestTimestamp() external view override returns (uint256) {
return _latestRoundData.updatedAt;
}
| 844,986 |
./full_match/4/0xc7822400B1bA153F0D9B265583d58842058c3E2E/sources/Users/lugondev/DEV/truffle-sample/contracts/FundingMXC.sol | require(_totalFunding < _maxFunding); | function refund() public endFunding {
require(
_balancesETH[_msgSender()] > 0 || _balancesUSDT[_msgSender()] > 0
);
if (_balancesUSDT[_msgSender()] > 0) {
USDTaddress.transfer(_msgSender(), _balancesUSDT[_msgSender()]);
}
if (_balancesETH[_msgSender()]... | 822,459 |
pragma solidity ^0.5.11;
import "zos-lib/contracts/Initializable.sol";
import "openzeppelin-eth/contracts/token/ERC721/ERC721.sol";
import "./PoapRoles.sol";
contract VotePoap is Initializable, PoapRoles {
// -----------------------
// EVENTS:
// -----------------------
event _Activated(address accou... | Get voter data _voter Voter address/ | function getVote(address _voter) public view returns (uint, uint, uint) {
Voter memory addressVote = voters[_voter];
return (
addressVote.voteOption,
addressVote.tokens,
addressVote.weightedVote
);
}
| 12,894,066 |
./full_match/4/0x870F471A048a3E7748db666e0458beC5C003a24e/sources/Aff_flat.sol | Destroys `tokenId`. The approval is cleared when the token is burned. Requirements: - `tokenId` must exist. Emits a {Transfer} event./ | function _burn(uint256 tokenId) internal virtual override {
super._burn(tokenId);
if (bytes(_tokenURIs[tokenId]).length != 0) {
delete _tokenURIs[tokenId];
}
}
| 12,359,146 |
pragma solidity ^0.4.20;
// File: contracts/ERC20Token.sol
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
uint2... | INTERNALcounter +=1; | function executeVerdict(uint _disputeId, bool _verdictForInvestor) internal {
disputes[_disputeId].pending = false;
uint milestoneDispute = disputes[_disputeId].milestone;
AgileCycleWithAssistance cycle = AgileCycleWithAssistance(disputes[_disputeId].icoRoundAddress);
cycle.verdictEx... | 6,476,238 |
// Author: Eric Gao (@itsoksami, https://github.com/Ericxgao)
pragma solidity 0.8.10;
import "./BaseDutchAuctionERC721A.sol";
contract LevelingUpHeroesEpic is BaseDutchAuctionERC721A {
constructor(
address[] memory payees,
uint256[] memory shares,
string memory name,
... | Using Address.sendValue() here would mask the revertMsg upon reentrancy, but we want to expose it to allow for more precise testing. This otherwise uses the exact same pattern as Address.sendValue(). | function _nonReservedMintHelper(uint256 numberOfTokens) internal nonReentrant {
require(totalSupply() + numberOfTokens <= max, "Sold out.");
uint256 price = cost(numberOfTokens);
require(price <= msg.value, "Invalid amount.");
_safeMint(msg.sender, numberOfTokens);
if (msg.... | 6,485,756 |
./partial_match/5/0xdE4c870F36a614E44bd00f987B22F4c4D48718F3/sources/contracts/base/utils/Permutate.sol | Permutates a number (in range 0-9999). input Number to process./ | function shuffle(uint256 input) pure internal returns (uint256) {
uint256 a = input % 10;
uint256 b = (input % 100) / 10;
uint256 c = (input % 1000) / 100;
uint256 d = input / 1000;
return
getDigit(tableA, d) +
10 * getDigit(tableB, c) +
10... | 16,867,024 |
// SPDX-License-Identifier: AGPL-1.0
pragma solidity 0.8.9;
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/interfaces/IERC165.sol";
abstract contract ERC72... | Check if the contract supports an interface. 0x01ffc9a7 is ERC165. 0x80ac58cd is ERC721 0x5b5e139f is for ERC721 metadata id The id of the interface. return Whether the interface is supported. | function supportsInterface(bytes4 id) public pure virtual override returns (bool) {
return id == 0x01ffc9a7 || id == 0x80ac58cd || id == 0x5b5e139f;
}
| 7,301,996 |
// Voting.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;
import "@openzeppelin/contracts/access/Ownable.sol";
/// @title Voting contract
/// @author Grégory Seiller
/// @notice Voting contract for a small organization
contract Voting is Ownable {
// STATES VARIABLES
/// @notice Winning proposal... | Owner tallies the final votes Owner tallies the final votes. Current status must be VotingSessionEnded. Maximum 100 proposals (DoS). Emits WorkflowStatusChange | function tallyVotes() external onlyOwner withStatus(4) {
uint _winningProposalId;
for (uint256 p = 0; p < proposals.length; p++) {
if (proposals[p].voteCount > proposals[_winningProposalId].voteCount) {
_winningProposalId = p;
}
}
winningPropos... | 2,494,609 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./Neurons/Package.sol";
interface ERC721 {
function ownerOf(uint256 _tokenId) external view returns (address);
}
/**
* @title Neurons
*/
contract Neurons is NRN {
receive() external payable {}
fallback() external payable {}
mapping(u... | ERC173 Interface Interface of the ERC173 standard according to the EIP/ | interface ERC173 {
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
function owner() view external returns (address);
function transferOwnership(address _newOwner) external;
}
} | 13,638,530 |
./full_match/5/0xBA99256b6824695354824Bfc22816eCa733b4BFC/sources/project_/contracts/RealDigitalEnableAccount.sol | Disables the account of the sender by invoking the disableAccount function of CBDCAccessControl contract. | function disableAccount() public {
accessControl.disableAccount(msg.sender);
}
| 11,616,050 |
// SPDX-License-Identifier: MIT
/*
.___ ___. __ _______ ___ _______. _______ ______ __ _______
| \/ | | | | \ / \ / | / _____| / __ \ | | | \
| \ / | | | | .--. | / ^ \ | (----` | | __ | | | | | | | .--.... | Update reward variables for all pools. Be careful of gas spending! | function massUpdatePools() public checkHalving {
massUpdatePools(block.number);
}
| 5,461,425 |
/**
*Submitted for verification at polygonscan.com on 2022-02-12
*/
// Forge Auctions Contract
// Auctions Forge tokens every 3 days and users are able to withdraw anytime after!
//
// The 0xBitcoin tokens collected by Forge Auctions go to miners and liquidity providers!
//
// 10,500,000 Forge tokens are Auctione... | If there were 5% more blocks mined than expected then this is 5. If there were 100% more blocks mined than expected then this is 100.make it longer since we are not mining enoughmake it shorter since we are mining too many | function changeAuctionAmt() internal {
uint tokensMinted = ForgeMiningToken.getMiningMinted();
uint diff = tokensMinted - lastMinted;
uint expected = emission.mult(8*106).div(100);
if(diff != 0){
if( diff < expected )
{
uint excess_block... | 12,567,721 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
// File: contracts/lib/MathUint.sol
// Copyright 2017 Loopring Technology Limited.
/// @title Utility Functions for uint
/// @author Daniel Wang - <daniel@loopring.org>
library MathUint
{
function mul(
uint a... | Add the new guardian | function addGuardian(
address wallet,
address addr,
uint validSince,
bool alwaysOverride
)
external
onlyWalletModule(wallet)
returns (uint)
{
require(validSince >= block.timestamp, "INVALID_VALID_SINCE");
require(addr != addre... | 134,309 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
/**
* @title ZkBond
* @author Tanay Patil
* @dev An extension of the generic bond contract using zero-knowledge proofs. See "./Bond.sol" for info
* about generic conditional bonds.
*
* The generic version has been modified ... | Claimants settle debt by proving claim ownership and withdrawing tokens. Claim ownership is proven if the msg.sender == ownerOf(claimToken). Since claims are implemented as NFTs, they may be traded and the claim owner may not be the original lender who fulfilled the order. _withdrawProof - A proof generated by the cla... | function settle(TransferProof memory _withdrawProof, bytes32 _orderHash)
public
{
require(
!isSettled(_orderHash),
"The bond has already been settled and the account has been withdrawn from."
);
if (
BondClaim(claims).isClaimed(_orderHash) &&
... | 2,485,553 |
./partial_match/1/0x613011F70721573965515dC19360bff13C2cD5C3/sources/NewsTokenContract.sol | Public variables of the token / Private variables of the token / Returns total supply of issued tokens / | function totalSupply() constant public returns (uint256) {
return supply;
}
| 3,733,136 |
pragma solidity ^0.4.19;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
* @dev Based on: OpenZeppelin
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
... | Give a burn delegate permission to burn tokens. _burnDelegate The account to be approved./ | function approveBurnDelegate(address _burnDelegate) onlyOwner public returns (bool) {
bool delegateFound = false;
for(uint i=0; i<burnDelegates.length; i++) {
if(burnDelegates[i]==_burnDelegate) {
delegateFound = true;
break;
}
}
if(!delegateFound) {
burnDelegates.pu... | 290,966 |
pragma solidity ^0.4.21;
import "zos-lib/contracts/migrations/Migratable.sol";
import "zeppelin-solidity/contracts/math/SafeMath.sol";
import "zeppelin-solidity/contracts/ownership/Ownable.sol";
/**
* @title Vouching
* @dev This contract keeps track of all submitted vouches for stdlib releases
*/
contract Vouchin... | Retrieves the total vouched amount return the total vouched amount/ | function totalVouched() public view returns (uint256) {
return _totalVouched;
}
| 985,939 |
pragma solidity ^0.4.25;
import "./ParallelContract.sol";
//import "./Transaction.sol";
//不写注释的人都得被凌迟,nndx
//contract Transaction is ParallelContract{
// function makePurchase(address _buyer, address _seller, uint32 _price, uint _petId, string _time) external;
//}
//---------------------------------------... | require(msg.sender == admin, "require admin permission!"); | function setTranContAddr(address _transactionContract) public {
transactionContract = Transaction(_transactionContract);
}
| 972,507 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity =0.7.6;
import './interfaces/IUniswapV3Pool.sol';
import './NoDelegateCall.sol';
import './libraries/LowGasSafeMath.sol';
import './libraries/SafeCast.sol';
import './libraries/Tick.sol';
import './libraries/TickBitmap.sol';
import './libraries/Position.sol';
impo... | The interface for the Uniswap V3 Factory The Uniswap V3 Factory facilitates creation of Uniswap V3 pools and control over the protocol fees | interface IUniswapV3Factory {
event OwnerChanged(address indexed oldOwner, address indexed newOwner);
event PoolCreated(
address indexed token0,
address indexed token1,
uint24 indexed fee,
int24 tickSpacing,
address pool
);
event FeeAmountEnabled(uint24 indexed ... | 131,035 |
//SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable... | Assigns Reject permission to a list of users and proxies. Requirements: - the caller must be the owner. - All user addresses in `_usersProxies` should not be already rejected. - All proxy addresses in `_usersProxies` should not be already rejected. _usersProxies The addresses of the users and proxies. ... | function rejectUser(UserProxy[] memory _usersProxies) external onlyPermissionsAdmin {
for (uint256 i = 0; i < _usersProxies.length; i++) {
UserProxy memory userProxy = _usersProxies[i];
require(!isRejected(userProxy.user), "PermissionManager: Address is already rejected");
... | 11,684,334 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.4;
pragma experimental ABIEncoderV2;
import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol";
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/... | Mints tokens to a recipient. This function reverts if the caller does not have the minter role. recipient the account to mint tokens to. amount the amount of tokens to mint. | function mint(address recipient, uint256 amount) external onlyRole(MINTER_ROLE) {
_mint(recipient, amount);
}
| 357,100 |
./partial_match/44787/0x76Eb2820207313AFf098478A64996ca38C6052ff/sources/contracts/CarbonPathAdmin.sol | helper function to calculate cpFee amount base amount cpFeePercentage fee percentage return cpFee fee based on the cpFeePercentage | function _calculateCPFee(uint256 amount, uint256 cpFeePercentage) private pure returns (uint256) {
return (amount * cpFeePercentage) / BASE_PERCENTAGE;
}
| 16,956,775 |
pragma solidity ^0.4.15;
import "../Oracles/Oracle.sol";
/// @title Difficulty oracle contract - Oracle to resolve difficulty events at given block
/// @author Stefan George - <stefan@gnosis.pm>
contract DifficultyOracle is Oracle {
/*
* Events
*/
event OutcomeAssignment(uint difficulty);
/*
... | Sets difficulty as winning outcome for specified block Block number was reached and outcome was not set yet | function setOutcome()
public
{
require(block.number >= blockNumber && difficulty == 0);
difficulty = block.difficulty;
OutcomeAssignment(difficulty);
}
| 6,394,387 |
/**
*Submitted for verification at Etherscan.io on 2021-04-28
*/
// SPDX-License-Identifier: NONE
pragma solidity 0.6.12;
// Part: IGazeRewards
interface IGazeRewards {
function updateRewards() external returns (bool);
function LPRewards(uint256 _from, uint256 _to)
external
view
... | Wrapper function zapEth() for UI | function zapEth()
public
payable
{
uint256 startBal = IERC20(lpToken).balanceOf(address(this));
addLiquidityETHOnly(address(this));
uint256 endBal = IERC20(lpToken).balanceOf(address(this));
require(
endBal > startBal ,
"GazeStaking.zapE... | 2,323,859 |
// SPDX-License-Identifier: MIT AND AGPL-3.0-or-later
pragma solidity =0.8.9;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "../../shared/ProtocolConstants.sol";
import "../../interfaces/tokens/vesting/ILinearVesting.sol";
/**
* @dev Implemen... | Ensures that only converter is able to call a function./ | function _onlyConverter() private view {
require(
msg.sender == converter,
"LinearVesting::_onlyConverter: Only converter is allowed to call"
);
}
| 399,047 |
contract Foo {
/// #if_succeeds abi.encode(v).length > 0;
function foo(uint v) public {
}
/// #if_succeeds abi.encodePacked(v).length > 0;
function foo1(uint v) public {
}
/// #if_succeeds abi.encodeWithSelector(bytes4(hex"01020304"), v).length > 0;
function foo2(uint v) public {
}
/// #if_succeeds abi.enc... | if_succeeds abi.encodePacked(v).length > 0; | function foo1(uint v) public {
}
| 1,842,512 |
./partial_match/3/0x65B29b471f69400244Ffee30914745c88883810d/sources/option.sol | Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address./ | function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, rounds[round].allowances[_msgSender()][spender].add(addedValue));
return true;
}
| 5,236,942 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.10;
import "./ReentrancyGuard.sol";
contract TokenManagerHook is ReentracyGuard {
using UnstructuredStorage for bytes32;
/// @dev Hadcoded value of keccak256("hookedTokenManager.tokenManagerHook.tokenManager")
bytes32 private constant TOKEN_MANAGER_POS... | Override if necessary | function _onApprove(
address,
address,
uint256
) internal virtual returns (bool) {
return true;
}
| 12,610,163 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.