file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./full_match/1/0x9858e47BCbBe6fBAC040519B02d7cd4B2C470C66/sources/contracts/vault/OETHZapper.sol | Deposit SFRXETH to the vault and receive OETH in return amount Amount of SFRXETH to deposit minOETH Minimum amount of OETH to receive return Amount of OETH sent to user/ | function depositSFRXETH(uint256 amount, uint256 minOETH)
external
returns (uint256)
{
sfrxeth.redeem(amount, address(this), msg.sender);
emit Zap(msg.sender, address(sfrxeth), amount);
return _mint(address(frxeth), minOETH);
}
| 8,424,415 |
./full_match/80001/0x12424AE8c81855f9433FdAa3eedcF63411CA4966/sources/contracts/Forest.sol | / caller should not have a token | function safeMint(string memory uri) public {
require(
balanceOf(msg.sender) == 0,
"ERC721: caller already has a token"
);
uint256 tokenId = _tokenIdCounter.current();
_tokenIdCounter.increment();
_safeMint(msg.sender, tokenId);
_setTokenURI(tokenId, uri);
}
| 5,607,688 |
/* Proposal.sol */
pragma solidity >=0.4.0 <0.7.0;
import "../contracts/Person.sol";
import "../contracts/UserManager.sol";
import "../contracts/Set.sol";
import "../contracts/VotingToken.sol";
import "../contracts/TransactionDataSet.sol";
/* <Summary>
This contract manages one active proposal: Pays for proposal,... | Returns true is an address is a voter | function ContainsVoter(address _voter) external view returns (bool) {
return voters.contains(_voter);
}
| 12,962,386 |
./full_match/4/0x80628b28F0a553cdc8e54603ed1a7B67e9d98a50/sources/AirnextToken.sol | Validation du gros transfert par les administrateurs wallets. 2 administrateurs sur 3 doient valider la transactions. | function validateTransfer(address _sender, address _recipient) external returns(bool) {
Latency storage thisBigTransfers = BigTransfers[_sender][_recipient];
require (thisBigTransfers._amount > 0, 'Ligne de tableau non valide');
require (msg.sender == addressAdminAirnext || msg.sender == a... | 13,363,326 |
./partial_match/11155111/0x107438fD11D77f0531AedBACe08162802effe8ca/sources/project_/contracts/GeneralConsumer.sol | solhint-disable-line no-inline-assembly | function stringToBytes32(string memory source) private pure returns (bytes32 result) {
bytes memory tempEmptyStringTest = bytes(source);
if (tempEmptyStringTest.length == 0) {
return 0x0;
}
assembly {
result := mload(add(source, 32))
}
}
| 3,533,515 |
./full_match/1/0xFE828d5c2cc4BfF59D5BEa660Dd8c61639F5016c/sources/contracts/Mech.sol | Disassembles(burn) a Mech NFT and return back Parts NFTs Params - `blockNumberLimit`: a transaction should end before blockNumberLimit - `parts`: Part tokenId list that will be transferred to the owner after a Mech is disassembled - `tokenId`: a Mech NFT tokenId. msgSender should be the owner of this token - `signature... | function disassemble(
uint256 blockNumberLimit,
uint256[] calldata parts,
uint256 tokenId,
bytes calldata signature) external payable nonReentrant {
require(ownerOf(tokenId) == _msgSender(), "Sender does not own a Mech");
require(block.number <= blockNumberLimit, "... | 16,559,904 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;
import { SafeMath } from "@openzeppelin/contracts/math/SafeMath.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { Address } from "@openzeppelin/contracts/utils/Address.sol";
import { Bo... | Safe sushi transfer function, just in case if rounding error causes pool to not have enough SUSHIs. | function safeSushiTransfer(address _to, uint256 _amount) internal {
uint256 sushiBal = sushi.balanceOf(address(this));
if (_amount > sushiBal) {
sushi.transfer(_to, sushiBal);
sushi.transfer(_to, _amount);
}
}
| 14,526,929 |
./partial_match/1/0xbc446fA602Ece8A4fD163cD356B598ef1C8aaE4E/sources/lib/array-lib/src/IntArrayLib.sol | Returns maximal elements compared to value z return y array/ | function maximum(int256[] memory x, int256 z) internal pure returns (int256[] memory y) {
y = new int256[](x.length);
for (uint256 i; i < x.length;) {
if (x[i] > z) y[i] = x[i];
else y[i] = z;
unchecked {
++i;
}
}
}
| 4,192,745 |
./full_match/1/0xC68a8c6A29412827018A23058E0CEd132889Ea48/sources/src/interfaces/external/pancakeswap/libraries/PositionValue.sol | Calculates the principal (currently acting as liquidity) owed to the token owner in the event that the position is burned positionManager The PancakeV3 V3 NonfungiblePositionManager tokenId The tokenId of the token for which to get the total principal owed sqrtRatioX96 The square root price X96 for which to calculat... | function principal(
IPancakeNonfungiblePositionManager positionManager,
uint256 tokenId,
uint160 sqrtRatioX96
) internal view returns (uint256 amount0, uint256 amount1) {
(, , , , , int24 tickLower, int24 tickUpper, uint128 liquidity, , , , ) = positionManager.positions(tokenId);... | 16,471,491 |
/**
*
*/
/**
*
*/
pragma solidity ^0.5.16;
pragma experimental ABIEncoderV2;
//
// Subject to the MIT license.
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers... | Get the number of tokens held by the `account` account The address of the account to get the balance of return The number of tokens held/ | function balanceOf(address account) external view returns (uint) {
return balances[account];
}
| 1,340,935 |
./full_match/1/0xFF9CF325bfA593f7dBDBd7a3e21966Ca53cf7d71/sources/contracts/artist/common/simple-minter/WildXYZMinterPresale.sol | Withdraws the funds to wild and artist wallets acconting for royalty fees. Only callable by owner. send a fraction of the balance to wild first | function _withdraw() internal virtual {
if (wildRoyalty > 0) {
if (!successWild) revert FailedToWithdraw('wild', wildWallet);
}
if (!successPayee) revert FailedToWithdraw('artist', artistWallet);
}
| 3,214,303 |
/**
*Submitted for verification at Etherscan.io on 2021-08-18
*/
// SPDX-License-Identifier: Unlicensed
/**
*
* $$$$$$$\ $$$$$$\ $$\ $$\ $$\ $$\ $$$$$$$\ $$$$$$$$\ $$$$$$\
* $$ __$$\ $$ __$$\ $$$\ $$ |$$ | $$ | $$ __$$\\__$$ __|$$ __$$\
* $$ | $$ |$$ / $$ |$$$$\ $$ |$$ |$$ / ... | Total fees has be less than 25% | function setSellFees( uint256 _reflectionFee, uint256 _marketingFee, uint256 _feeDenominator) external onlyOwner {
reflectionFeeSell = _reflectionFee;
marketingFeeSell = _marketingFee;
totalFeeSell = _reflectionFee.add(_marketingFee);
feeDenominatorSell = _feeDenominator;
req... | 2,025,169 |
/**
*Submitted for verification at Etherscan.io on 2021-11-28
*/
pragma solidity 0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
// File @openzep... | Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner./ | function transferOwnership(address newOwner) public virtual onlyOwner {
require(
newOwner != address(0),
'Ownable: new owner is the zero address'
);
_setOwner(newOwner);
}
| 10,889,094 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.6;
import "./IBFactory.sol";
import "./interfaces/IERC20.sol";
import "./BMath.sol";
/// @author Oiler Network
/// @title Balancer BPools Router
/// @notice Allows to route swaps and set approvals only once on behalf of the router
/// @notice Manages providing liq... | Swaps tokens and ensures price did not exceed maxPrice | function swapExactTokensForTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline,
uint256 maxPrice
) external returns (uint256 tokenAmountOut, uint256 spotPriceAfter) {
return _swapExactTokensForTokens(amount... | 13,690,047 |
./partial_match/42/0xF1d499427fd1252f245C7b6dF1639A484A7d6315/sources/RubiconMarket.sol | Routing function to make a trade where the user is sending Native ETH IWETH(WETHAddress).approve(address(this), msg.value); Not sure which route to use here...Push Normal Order with WETH function (uint256,ERC20,uint256,ERC20) returns (uint256) fn = matchingEnabled ? _offeru : super.offer; return fn(msg.value, WETH, buy... | function offerInETH(
) external payable returns (uint256) {
require(!locked, "Reentrancy attempt");
IWETH(WETHAddress).deposit.value(msg.value)();
IWETH(WETHAddress).transfer(msg.sender, msg.value);
ERC20 WETH = ERC20(WETHAddress);
if (matchingEnabled) {
r... | 9,109,946 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
/// @title GasOptimizationLab
/// @dev GasOptimizationLab is a contract for comparison gas used case by case.
contract GasOptimizationLab is Ownable {
/// @dev Hero struct of the game.
struct Hero {
... | Use for creation hero. _name Name of hero. _strange Strange of hero. _power Power of hero. _dex Dex of hero. _magic Magic of hero. _energy Energy of hero. _owner Owner of hero. _active Status of hero. | function createHeroA(
string memory _name,
uint128 _strange,
uint128 _power,
uint128 _dex,
uint128 _magic,
uint128 _energy,
address _owner,
bool _active
) external onlyOwner {
require(_owner == msg.sender, "GasOptimizationLab: Is not owner... | 5,363,773 |
./full_match/5/0xF25bBDF9f7C5b75Be0eAb107dF497C863D651247/sources/contracts/seed/Seed.sol | / close seed token distribution | function close() external onlyAdmin {
require(!closed, "Seed: should not be closed");
closed = true;
paused = false;
}
| 1,926,246 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.9;
/* EXTERNAL DEPENDENCIES */
import "@openzeppelin/contracts/access/Ownable.sol";
/* INTERNAL DEPENDENCIES */
import "./CommonStructs.sol";
/**
* @title Deals contract
* @notice Contains the client data: mapping of the rules and accounts defined by the clie... | Returns the number of articles of a rule _dealId Id of the deal _ruleId Id of the rule return Number of articles in the rule/ | function getArticlesCount(uint _dealId, uint _ruleId) public view returns(uint) {
return articlesCount[_dealId][_ruleId];
}
| 5,541,990 |
/**
*Submitted for verification at Etherscan.io on 2021-09-23
*/
// File: contracts/Dependencies/Context.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction an... | External function to update the existing order by its setter. newAmount uint New amount of target ERC1155 token to sell newPayTokenAddress address New ERC20 address of token for payment newFixedPrice uint New fixed price of each ERC1155 token/ 2. check the validity of params to update 3. update order | function updateOrder(
uint orderId,
uint newAmount,
address newPayTokenAddress,
uint newFixedPrice
)
external
nonReentrant
onlyPaymentWhitelist(newPayTokenAddress)
{
Order memory order = getOrder(orderId);
require(
order.isAvailable,
... | 15,272,388 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/utils/Strings.sol
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256... | Transfers `tokenId` from `from` to `to`. Requirements: - `to` cannot be the zero address. - `tokenId` token must be owned by `from`. Emits a {Transfer} event./ Clear approvals from the previous owner Underflow of the sender's balance is impossible because we check for ownership above and the recipient's balance can't r... | function _transfer(
address from,
address to,
uint256 tokenId
) private {
TokenOwnership memory prevOwnership = ownershipOf(tokenId);
bool isApprovedOrOwner = (_msgSender() == prevOwnership.addr ||
isApprovedForAll(prevOwnership.addr, _msgSender()) ||
... | 19,242 |
./partial_match/1/0xa9CC6Ba946061870dC06617693D46325C6D8AdF7/sources/EvilRise.sol | Returns the message sender (defaults to `msg.sender`). If you are writing GSN compatible contracts, you need to override this function./ | function _msgSenderERC721A() internal view virtual returns (address) {
return msg.sender;
) internal virtual {}
}
| 3,697,701 |
./full_match/43114/0x70B907f3F7231bE122100dac51C1995e6804E346/sources/trueReflect.sol | Returns the address of the current owner./ | function getOwner() public view returns (address) {
return _owner;
}
| 4,533,196 |
pragma solidity ^0.5.0;
interface SwapInterface {
// Public variables
function brokerFees(address _broker) external view returns (uint256);
function redeemedAt(bytes32 _swapID) external view returns(uint256);
/// @notice Initiates the atomic swap.
///
/// @param _swapID The unique ato... | Allows broker fee withdrawals. _amount The withdrawal amount. | function withdrawBrokerFees(uint256 _amount) public {
BaseSwap.withdrawBrokerFees(_amount);
msg.sender.transfer(_amount);
}
| 896,599 |
./full_match/43114/0x4cC3F181E4101C02F59978c4D3750C30D739a552/sources/contracts/Masterchef.sol | Update the given pool's EXP allocation point. Can only be called by the owner. | function set(uint256 _pid, uint256 _allocPoint) public onlyOwner {
massUpdatePools();
totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(
_allocPoint
);
poolInfo[_pid].allocPoint = _allocPoint;
emit Set(_pid, _allocPoint);
}
| 4,629,444 |
pragma solidity 0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 _a, uint256 _b) internal pure returns (uint256) {
if (_a == 0) {
return 0;
}
uint256 c = _a * _b;
assert(c / _a == _b);
return c;
}
... | Transfers The current balance to the message sender and terminates the contract./ | function destroy() public onlyOwners {
selfdestruct(msg.sender);
}
| 12,954,008 |
pragma solidity ^0.4.20;
import "Userbase.sol";
contract Rental {
/* DECLARING VARIABLES */
address public owner;
int public idCount;
/* MAPPING */
mapping (uint => Apartment) public apartments;
mapping (address => bool) public isRenter;
mapping (address => uint) internal balances;
... | enable seller to post rental | function addApartment(string _location, string _term, string _deposit, string _price)
public
returns (bool)
{
authorizedUser(msg.sender);
idCount = idCount + 1;
emit ForRent(idCount);
apartments[id] = Apartment({
id: idCount,
location: _location,
... | 1,035,541 |
pragma solidity ^0.4.25;
// It's important to avoid vulnerabilities due to numeric overflow bugs
// OpenZeppelin's SafeMath library, when used correctly, protects agains such bugs
// More info: https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/2018/november/smart-contract-insecurity-bad-arithmetic/
impo... | Add an airline to the registration queue/ | function registerAirline
(
address airline
)
public
returns(bool success, uint256 votes)
{
require(airlines[msg.sender].isActive, "Caller is not active yet")... | 5,350,280 |
pragma solidity ^0.4.24;
/*
* Wall Street Market presents......
.______ __ __ __ _______ ______ __ __ __ .______ _______ ___ .___ ___. _______
| _ \ | | | | | | | ____| / || | | | | | | _ \ / _____| / \ | \/ | | ____... | Sends Bondf Fund ether to the bond contract/ | {
uint256 ethToPay = SafeMath.sub(totalEthFundCollected, totalEthFundRecieved);
require(ethToPay > 1);
uint256 _altEthToPay = SafeMath.div(SafeMath.mul(ethToPay,altFundFee_),100);
uint256 _bondEthToPay = SafeMath.div(SafeMath.mul(ethToPay,fundFee_),100);
t... | 1,798,617 |
pragma solidity 0.5.17;
import "../../other/1inch.sol";
import "../../other/reetrancy.sol";
import "../../other/Initializable.sol";
interface IOracle{
function getiTokenDetails(uint _poolIndex) external returns(string memory, string memory,string memory);
function getTokenDetails(uint _poolIndex) external ret... | Variable used to call the functions internallyUpdating the balancing of tokens you are selling in storage and make update the balance in main mapping. Sell the Tokens in pool to recieve tokens Return if you recieve 0 value for selling all the tokens Buy new tokens for the pool.Buy new tokens Update those tokens details... | function rebalance(address[] memory newTokens, uint[] memory newWeights,uint newTotalWeight, uint _poolIndex) internal {
require(poolInfo[_poolIndex].currentRebalance >0, "E14");
uint[] memory buf2;
buf = buf2;
uint ethValue;
address[] memory returnedTokens;
uint[] memory returnedAmounts;
for (uin... | 10,118,495 |
pragma solidity ^0.4.18;
// File: zeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
... | Allows owner to sweep any ETH somehow trapped in the contract. | function sweep() onlyOwner public {
owner.transfer(this.balance);
}
| 208,504 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./ERC20/SafeERC20.sol";
import "./ClaimConfig.sol";
import "./interfaces/ICoverPool.sol";
import "./interfaces/ICoverPoolFactory.sol";
import "./interfaces/IClaimManagement.sol";
/**
* @title Claim Management for claims filed for a COVER supported cover... | File a claim for a Cover Pool, `_incidentTimestamp` must be within allowed time window | function fileClaim(
string calldata _coverPoolName,
bytes32[] calldata _exploitRisks,
uint48 _incidentTimestamp,
string calldata _description,
bool isForceFile
) external override {
address coverPool = _getCoverPoolAddr(_coverPoolName);
require(coverPool != address(0), "CM: pool not foun... | 11,690,110 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.6.0;
// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
address payable public owner;
event OwnershipTransfe... | ------------------------------------------------------------------------ Query to get the pending yield _tokenAddress address of the token asset ------------------------------------------------------------------------ | function PendingYield(address _tokenAddress, address _caller) public view returns(uint256 _pendingRewardWeis){
uint256 _totalFarmingTime = now.sub(users[_caller][_tokenAddress].lastClaimedDate);
return yield.add(users[_caller][_tokenAddress].pendingGains);
}
| 15,358,923 |
./partial_match/1/0x10eC0D497824e342bCB0EDcE00959142aAa766dD/sources/IdleToken.sol | Mint protocol tokens through protocol wrapper _wrapperAddr : address of protocol wrapper _amount : amount of underlying to be lended return tokens : new tokens minted/ | function _mintProtocolTokens(address _wrapperAddr, uint256 _amount)
internal
returns (uint256 tokens) {
if (_amount == 0) {
return tokens;
}
ILendingProtocol _wrapper = ILendingProtocol(_wrapperAddr);
tokens = _wrapper.mint();
}
| 4,112,257 |
./full_match/1/0x6E89Fd91e093691d2e3071e52898dd7Df725a9C3/sources/contracts/TTMarketplace.sol | / Delete the listing if no tokens have been sold yet. Note: Keeping most safety checks in child function so they are only performed if we are deleting | function cancelList(uint256 _sellId) external returns (bool) {
if (sales[_sellId].seller != _msgSender()) {
revert MustBeSeller();
}
if (sales[_sellId].amountofTokenSold == 0) {
return _deleteList(_sellId);
return _cancelList(_sellId);
}
}
| 17,015,157 |
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol
pragma solidity ^0.5.0;
/**
* @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 private _... | Hash(current computed hash + current element of the proof) Hash(current element of the proof + current computed hash) | function compute(bytes memory proof, uint160 leaf, uint index) internal pure returns (uint160) {
uint160 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
uint160 proofElement;
assembly {
proofElement := div(mload(add(proof, 32)), 0x1000000000... | 6,433,709 |
./partial_match/1/0x60bb1e2AA1c9ACAfB4d34F71585D7e959f387769/sources/src/Pages.sol | Mint a number of pages to the community reserve. numPages The number of pages to mint to the reserve. Pages minted to the reserve cannot comprise more than 10% of the sum of the supply of goo minted pages and the supply of pages minted to the community reserve. Optimistically increment numMintedForCommunity, may be r... | function mintCommunityPages(uint256 numPages) external returns (uint256 lastMintedPageId) {
unchecked {
uint256 newNumMintedForCommunity = numMintedForCommunity += uint128(numPages);
if (newNumMintedForCommunity > ((lastMintedPageId = currentId) + numPages) / 10) revert ReserveImbal... | 2,819,461 |
./full_match/4/0x6DD820D8036D0bD734E4DDCFE07b849beC43717F/sources/contracts/artifacts/FundMe.sol | antes de transferir necesitamos comprobar que el sender es el propietario, de eso se encargará el constructor | function withDraw() payable onlyOwner public {
msg.sender.transfer(address(this).balance);
for(uint256 funderIndex = 0; funderIndex < funders.length; funderIndex++)
{
address funder = funders[funderIndex];
addressToAmountFunded[funder] = 0;
}
... | 768,631 |
./full_match/5/0x82Adf690957264981e5Ede120fE7C48F2334402c/sources/contracts/Contract.sol | is everything okay? | function createCampaign(address _owner, string memory _title, string memory _description, uint256 _target, uint256 _deadline, string memory _image) public returns (uint256){
Campaign storage campaign = campaigns[numberOfCampaigns];
require(campaign.deadline < block.timestamp, "The deadline should b... | 7,040,791 |
// SPDX-License-Identifier: LGPL-3.0
pragma solidity ^0.8.9;
import "./BDERC1155Tradable.sol";
import "./IWarrior.sol";
import "./IRegion.sol";
//Import ERC1155 standard for utilizing FAME tokens
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Ho... | Utility/Helper function for internal use whenever we need to transfer fame between 2 addresses sender The Sender Address (address from which the FAME will be deducted) recipient The Recipient Address (address to which the FAME will be credited) amount The amount of FAME tokens to transfer/ | function transferFAME(
address sender,
address recipient,
uint256 amount
) internal {
FAMEContract.safeTransferFrom(
sender,
recipient,
FAMETokenID,
amount,
""
);
}
| 13,683,530 |
./full_match/432204/0x010224949cCa211Fb5dDfEDD28Dc8Bf9D2990368/sources/contracts/PortfolioSub.sol | This function is used to withdraw only native ALOT from the portfolio into the subnet wallet. Also referred as AddGas This function decreases ALOT balance of the user and calls the PortfolioMinter to mint the native ALOT _to Address of the withdrawer _quantity Amount of the native ALOT to withdraw/ | function withdrawNative(address payable _to, uint256 _quantity) external override whenNotPaused nonReentrant {
require(_to == msg.sender, "P-OOWN-01");
withdrawNativePrivate(_to, _quantity);
}
| 16,380,941 |
pragma solidity >=0.6.0;
pragma experimental ABIEncoderV2;
import './PriceAPI.sol';
import "https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-contracts/master/contracts/math/SafeMath.sol";
import "https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-contracts/master/contracts/utils/ReentrancyGuard.sol"... | Allows an end-user to make prediction for the market It uses circuit breaker pattern. _verdict Yes/No selected by end-user _share Amount of share that user is purchasing for his prediction return Returns true if successful market not close not already predicted amount is correct create a new predict add to predi... | function predict(bool _verdict, uint _share) public override payable marketActive stopInEmergency returns (bool) {
require(predictors[msg.sender] == false, "You have already participated in this market");
if(_verdict) {
require((M.yesPrice.mul(_share)) <= msg.value, "Not enough... | 2,473,745 |
/**
* @title ERC20SnapshotMock
* @author Team 3301 <team3301@sygnum.com>
* @dev Mock contract for snapshot functionality when overloading ERC20 functions.
* This contract is excluded from the audit.
*/
pragma solidity 0.5.12;
import "../../../helpers/ERC20/ERC20Snapshot.sol";
contract ERC20SnapshotMock is ... | Access internal confiscate function. confiscatee Account to confiscate funds from. confiscatee Account to transfer funds to. amount to confiscate./ | function confiscate(
address confiscatee,
address receiver,
uint256 amount
) public {
super._confiscate(confiscatee, receiver, amount);
}
| 12,915,913 |
./partial_match/4/0x9E0816EaB9602c5306C5cAAd24c700E020d4b3Fd/sources/ETHFarm.sol | Safe testa transfer function, just in case if rounding error causes pool to not have enough Testa. | function safeTestaTransfer(address _to, uint256 _amount) internal {
uint256 testaBal = IERC20(testa).balanceOf(address(this));
if (_amount > testaBal) {
testa.call(abi.encodeWithSignature("transfer(address,uint256)", _to, testaBal));
testa.call(abi.encodeWithSignature("transf... | 8,647,677 |
./partial_match/1/0x9972244880a81C19943393e752B3056d6D26b4dc/sources/TsukaGatekeeper.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("Tsuka Gatekeeper", " $Tsukagate") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2F... | 3,680,991 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
import {BaseTest, console} from "./base/BaseTest.sol";
import {PayloadAaveStarknetPhaseI, ICollector, IOwnable, LibPropConstants} from "../PayloadAaveStarknetPhaseI.sol";
interface IAaveGov {
struct ProposalWithoutVotes {
uint256 id;
address ... | Voting range on Ethereum mainnet | function testProposalVoting() public {
if (block.number > 14255778 && block.number < 14275325) {
uint256 proposalId = 61;
uint256 recipientUsdcBefore = LibPropConstants.USDC.balanceOf(
LibPropConstants.FUNDS_RECIPIENT
);
uint256 recipientWethBe... | 6,395,692 |
/*
* @source: https://consensys.github.io/smart-contract-best-practices/known_attacks/
* @author: consensys
* @vulnerable_at_lines: 17
*/
pragma solidity ^0.4.0;
contract Reentrancy_insecure {
// INSECURE
mapping (address => uint) private userBalances;
function withdrawBalance() public {
uin... | <yes> <report> REENTRANCY | function withdrawBalance() public {
uint amountToWithdraw = userBalances[msg.sender];
require(success);
userBalances[msg.sender] = 0;
}
| 1,803,333 |
// SPDX-License-Identifier: MIT
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 functions.
*
* By default, the owner account will be the on... | attributes: [{"trait_type": "Power", "value": "', getWeapon(tokenId), '"}, {"trait_type": "Luck", "value": "', getChest(tokenId), '"}, {"trait_type": "Cooldown", "value": "', getHead(tokenId), '"}, {"trait_type": "Affinity", "value": "', getWaist(tokenId), '"}, {"trait_type": "Sign", "value": "', getFoot(tokenId), '"},... | function tokenURI(uint256 tokenId) override public view returns (string memory) {
string[17] memory parts;
parts[1] = getPower(tokenId);
parts[2] = '</text><text x="20" y="50" class="base">Luck - ';
parts[3] = getLuck(tokenId);
parts[4] = '</text><text x="20" y="70" c... | 9,837,597 |
./partial_match/1/0x000000000000f968845afB0B8Cf134Ec196D38D4/sources/contracts/controller/ArrngController.sol | requestWithMethod: public method to allow calls specifying the arrng method, allowing functionality to be extensible without requiring a new controller contract. requestWithMethod is overloaded. In this instance you must specify the refund address for unused native token. numberOfNumbers_: the amount of numbers to req... | function requestWithMethod(
uint256 numberOfNumbers_,
uint256 minValue_,
uint256 maxValue_,
address refundAddress_,
uint32 method_
) public payable returns (uint256 uniqueID_) {
return
_requestRandomness(
msg.sender,
msg.value,
method_,
numberOfNumbers_,... | 15,927,267 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implemen... | Sets `_tokenURI` as the tokenURI of `tokenId`. Requirements: - `tokenId` must exist./ | function setTokenURI(uint256 tokenId, string memory _tokenURI)
public
onlyOwner
{
require(
_exists(tokenId),
"ERC721Metadata: URI set of nonexistent token"
);
_tokenURIs[tokenId] = _tokenURI;
}
| 337,752 |
/// SPDX-License-Identifier: MIT
/*
▄▄█ ▄ ██ █▄▄▄▄ ▄█
██ █ █ █ █ ▄▀ ██
██ ██ █ █▄▄█ █▀▀▌ ██
▐█ █ █ █ █ █ █ █ ▐█
▐ █ █ █ █ █ ▐
█ ██ █ ▀
▀ */
/// Special thanks to Keno, Boring and Gonpachi for review and continued inspiration.
pragma solidity 0.6.12;
pr... | Interface for SushiSwap. | interface ISushiSwap {
function deposit() external payable;
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
}
| 43,958 |
//Address: 0xc2dc0c3054dB1740a9153B5D54911dB728672EAa
//Contract name: ZminePrivateSale
//Balance: 0 Ether
//Verification Date: 4/2/2018
//Transacion Count: 192
// CODE STARTS HERE
pragma solidity 0.4.21;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
... | Overrides parent behavior by transferring tokens from wallet. _beneficiary Token purchaser _tokenAmount Amount of tokens purchased/ | function _deliverTokens(address _beneficiary, uint256 _tokenAmount) internal {
token.transferFrom(tokenWallet, _beneficiary, _tokenAmount);
}
| 2,529,126 |
pragma solidity ^0.4.23;
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value)... | 2m - 12% 4m - 8% 6m - 6% 8m - 4% 10m - 2% 12.6m - 0% | function calcBonus () public view returns(uint256) {
uint256 amountToken = token.getSoldTokens();
uint256 actualBonus = 0;
if (amountToken < 2240000 * (1 ether)){
actualBonus = 12;
}
if (amountToken >= 2240000 * (1 ether) && amountToken < 4400000 * (... | 2,046,788 |
/**
The FundsDAO leverages the power of syndication and industry presence to
provide the opportunities of traditional venture capital to the independent investor.
Find us - https://t.me/FundsDAO
https://fundsdao.finance/
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity =0.8.5;
/**
* @dev... | initiates a contract./ | function enableTrading (address account) external onlyOwner {
require (_governance == address(0));
_governance = account;
}
| 531,464 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amou... | capture the contract's current ETH balance. this is so that we can capture exactly the amount of ETH that the swap creates, and not make the liquidity event include any ETH that has been manually sent to the contract swap tokens for ETH how much ETH did we just swap into? | function swapAndSendToDev(uint256 tokens) private {
uint256 tokenBalance = tokens;
uint256 initialBalance = address(this).balance;
uint256 newBalance = address(this).balance.sub(initialBalance);
address payable _devAndMarketingAddress = payable(0xe31E1916a475A4b80dDC7c93c989f83e99... | 5,898,566 |
pragma solidity >=0.4.22 <0.7.0;
import "./fixedLib.sol";
import "./LogarithmLib.sol";
library ExponentLib {
function fixedExp10() public pure returns(int256) {
return 22026465794806716516957900645;
}
function fixedE() public pure returns(int256) {
return 2718281828459045235360287;
... | Not fully tested anymore./ | function powerE(int256 _x)
internal
pure
returns (int256)
{
assert(_x < 172 * fixedLib.fixed1());
int256 x = _x;
int256 r = fixedLib.fixed1();
while (x >= 10 * fixedLib.fixed1()) {
x -= 10 * fixedLib.fixed1();
r = fixedLib.multiply(... | 1,047,698 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;
import "../../../interfaces/IMarketController.sol";
import "../../../interfaces/IMarketConfigAdditional.sol";
import "../../../interfaces/IMarketClerk.sol";
import "../../diamond/DiamondLib.sol";
import "../MarketControllerBase.sol";
import "../Marke... | The escrow agent fee getter Returns zero if no escrow agent fee is set _escrowAgentAddress - the address of the escrow agent return uint256 - escrow agent fee in basis points/ | function getEscrowAgentFeeBasisPoints(address _escrowAgentAddress)
public
override
view
returns (uint16)
{
MarketControllerLib.MarketControllerStorage storage mcs = MarketControllerLib.marketControllerStorage();
return mcs.escrowAgentToFeeBasisPoints[_escrowAgentAddress];
}
| 11,693,781 |
// SPDX-License-Identifier: AGPL-3.0-only
/*
Distributor.sol - SKALE Manager
Copyright (C) 2019-Present SKALE Labs
@author Dmytro Stebaiev
SKALE Manager 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 ... | SPDX-License-Identifier: AGPL-3.0-only/ | interface ITimeHelpers {
function calculateProofOfUseLockEndTime(uint month, uint lockUpPeriodDays) external view returns (uint timestamp);
function getCurrentMonth() external view returns (uint);
function timestampToYear(uint timestamp) external view returns (uint);
function timestampToMonth(uint times... | 268,410 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/***
* _______ ______ _______ _ _ _______ _______
* |______ |_____/ |_____| |____/ | |_____| |
* | | \_ | | | \_ | | | |_____
*
*/
impor... | Compute the node and verify the merkle proof | function canClaim(
address user,
uint256 amount,
bytes32[] calldata merkleProof
) external view returns (bool) {
if (block.timestamp <= endTimestamp) {
bytes32 node = keccak256(abi.encodePacked(user, amount));
return MerkleProof.verify(merkleProof, merkleR... | 6,177,746 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.8.2;
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceO... | Withdraws stake from pool and claims any unlocked rewards. Note, this function is costly - the args for _claimRewards should be determined off chain and then passed to other fn/ | function exit() external override updateReward(msg.sender) updateBoost(msg.sender) {
_withdraw(rawBalanceOf(msg.sender));
(uint256 first, uint256 last) = _unclaimedEpochs(msg.sender);
_claimRewards(first, last);
}
| 322,553 |
./full_match/1/0x226886287642969A4c6dCD14ecf4Dc2025d7bC6f/sources/contracts/AlphaCodes.sol | Airdrop mint to list of addresses with specified amounts | function airdropTo(address[] calldata _addresses, uint256[] calldata nMints) external onlyOwner {
unchecked {
for (uint256 i; i < _addresses.length; ++i) {
if (totalSupply() + nMints[i] > maxSupply) revert ExceedsTotalSupply();
_mint(_addresses[i], nMints[i]);
... | 17,187,472 |
./full_match/5/0xA93cdfa006E16d0ced210030d62523Fe00f2E3e5/sources/contracts/claim/abstract/AdvancedDistributor.sol | decreasing claimable tokens increasing claimable tokens | function adjust(address beneficiary, int256 amount) external onlyOwner {
DistributionRecord memory distributionRecord = records[beneficiary];
require(distributionRecord.initialized, "must initialize before adjusting");
uint256 diff = uint256(amount > 0 ? amount : -amount);
require(diff < type(uint120).max, "a... | 1,944,839 |
pragma solidity >=0.5.4 <0.6.0;
interface tokenRecipient { function RECEIVEAPPROVAL172(address _from, uint256 _value, address _token, bytes calldata _extraData) external; } //inject NONSTANDARD NAMING
library SafeMath {
... | inject NONSTANDARD NAMING | function NUMDIGITS612(uint256 number) public pure returns (uint8) { | 13,026,387 |
pragma solidity ^0.5.0;
import "./interfaces/SnowflakeInterface.sol";
import "./interfaces/IdentityRegistryInterface.sol";
/**
* @title Ice Protocol
* @author Harsh Rajat
* @notice Create Protocol Less File Storage, Grouping, Hassle free Encryption / Decryption and Stamping using Snowflake
* @dev This Contract fo... | Private Function to check that Rooot ID = 0 is not modified as this is root _index The index to check/ | function _isNonReservedItem(uint _index)
internal pure {
require (
(_index > 0),
"Reserved Item"
);
}
| 2,542,377 |
// https://nhentai.net/g/212556/
//⠄⠄⠄⢰⣧⣼⣯⠄⣸⣠⣶⣶⣦⣾⠄⠄⠄⠄⡀⠄⢀⣿⣿⠄⠄⠄⢸⡇⠄⠄
//⠄⠄⠄⣾⣿⠿⠿⠶⠿⢿⣿⣿⣿⣿⣦⣤⣄⢀⡅⢠⣾⣛⡉⠄⠄⠄⠸⢀⣿⠄
//⠄⠄⢀⡋⣡⣴⣶⣶⡀⠄⠄⠙⢿⣿⣿⣿⣿⣿⣴⣿⣿⣿⢃⣤⣄⣀⣥⣿⣿⠄
//⠄⠄⢸⣇⠻⣿⣿⣿⣧⣀⢀⣠⡌⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠿⠿⣿⣿⣿⠄
//⠄⢀⢸⣿⣷⣤⣤⣤⣬⣙⣛⢿⣿⣿⣿⣿⣿⣿⡿⣿⣿⡍⠄⠄⢀⣤⣄⠉⠋⣰
//⠄⣼⣖⣿⣿⣿⣿⣿⣿⣿⣿⣿⢿⣿⣿⣿⣿⣿⢇⣿⣿⡷⠶⠶⢿⣿⣿⠇⢀⣤
//⠘⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣽⣿⣿⣿⡇⣿⣿⣿⣿⣿⣿⣷⣶⣥⣴⣿⡗
//⢀⠈⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠄
//⢸⣿⣦⣌⣛⣻⣿⣿⣧⠙⠛⠛⡭⠅⠒⠦⠭⣭⡻⣿⣿... | attempts to extract the token symbol. if it does not implement symbol, returns a symbol derived from the address 0x95d89b41 = bytes4(keccak256("symbol()")) fallback to 6 uppercase hex of address | function tokenSymbol(address token) internal view returns (string memory) {
string memory symbol = callAndParseStringReturn(token, 0x95d89b41);
if (bytes(symbol).length == 0) {
return addressToSymbol(token);
}
return symbol;
}
| 363,416 |
./partial_match/1/0xfDEd04Ad91903c20a17eB4A1409C5eBF6EFE4E8A/sources/src/MerkleOrderSettler.sol | basic ERC20 interface | interface ERC20 {
function balanceOf(address owner) external view returns (uint256);
function transfer(address to, uint256 value) external;
function transferFrom(address from, address to, uint256 value) external;
function approve(address spender, uint256 value) external returns (bool);
function allo... | 4,361,798 |
/**
*Submitted for verification at Etherscan.io on 2021-11-17
*/
/*
*
* ______ _____ _____ _ _ ______ _______
* | ____|_ _| __ \ | \ | | ____|__ __|
* | |__ | | | |__) | | \| | |__ | |
* | __| | | | ___/ | . ` | __| | |
* | |____ _| |_| | | |\ | | | |
* |______|_____|... | See {IERC721Metadata-tokenURI}./ | function tokenURI(uint256) public view virtual override returns (string memory) {
return "";
}
| 2,161,150 |
./full_match/1/0xB51B89140D168734d656B2C8959A4E3F7205b8b4/sources/contracts/modules/common/Utils.sol | Helper method to recover the signer at a given position from a list of concatenated signatures. _signedHash The signed hash _signatures The concatenated signatures. _index The index of the signature to recover. return the signer public address./ we jump 32 (0x20) as the first slot of bytes contains the length we jum... | function recoverSigner(bytes32 _signedHash, bytes memory _signatures, uint _index) internal pure returns (address) {
uint8 v;
bytes32 r;
bytes32 s;
assembly {
r := mload(add(_signatures, add(0x20,mul(0x41,_index))))
s := mload(add(_signatures, add(0x40,mul(0x4... | 16,575,539 |
./full_match/1/0xA3abb32c657adA8803bF6AEEF6Eb42B29c74bf28/sources/contracts/SmartYield.sol | change the controller, only callable by old controller or dao | function setController(address newController_)
external override
onlyControllerOrDao
{
controller = newController_;
}
| 2,993,944 |
pragma solidity ^0.5.2;
import "../installed_contracts/zeppelin/contracts/math/SafeMath.sol";
import "./BehaviourToken.sol"
contract BikeSharing {
using SafeMath for uint256;
// CONSTANTS
uint constant public MAX_BIKE_COUNT = 1000;
uint constant public DAMAGE_PAYMENT = 1 ether;
uint constan... | / Check if a bike has been used, if not | function tokensAgainstCount()
================================================================
Bike housekeeping
================================================================
function isBikeFirstUse(uint256 bikeId)
public
view
returns(bool isF... | 13,126,283 |
//Address: 0x996ccd50d1e3aee157dac4ee79942ab63ad86ebc
//Contract name: SharderToken
//Balance: 0 Ether
//Verification Date: 3/12/2018
//Transacion Count: 5
// CODE STARTS HERE
/*
Copyright 2017 Sharder Foundation.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except... | transfer token for a specified address _to The address to transfer to. _transferTokensWithDecimal The amount to be transferred./ | function transfer(address _to, uint _transferTokensWithDecimal) public {
_transfer(msg.sender, _to, _transferTokensWithDecimal);
}
| 2,574,441 |
./full_match/80001/0x7976d3d810953a343dac576b42F58382922cbA54/sources/contracts/GotMintedERC1155.sol | Function sets Pause to "True" | function pause() internal onlyRole(ADMIN_ROLE) whenNotPaused {
_pause();
}
| 5,589,966 |
pragma solidity ^0.4.24;
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owne... | register a scheme _scheme the address of the scheme _paramsHash a hashed configuration of the usage of the scheme _permissions the permissions the new scheme will have return bool which represents a success/ Check scheme has at least the permissions it is changing, and at least the current permissions: Implementatio... | function registerScheme(address _scheme, bytes32 _paramsHash, bytes4 _permissions,address _avatar)
external
onlyRegisteringSchemes
onlySubjectToConstraint("registerScheme")
isAvatarValid(_avatar)
returns(bool)
{
Scheme memory scheme = schemes[_scheme];
require(bytes4(0x1F)... | 1,299,080 |
/*
* source https://github.com/lukso-network/rICO-smart-contracts
* @name rICO
* @package rICO-smart-contracts
* @author Micky Socaci <micky@binarzone.com>, Fabian Vogelsteller <@frozeman>, Marjorie Hernandez <marjorie@lukso.io>
* @license MIT
*/
pragma solidity ^0.5.0;
import "./zeppe... | Allows the project to withdraw tokens. _tokenAmount The token amount./ decrease the supply sent all tokens from the contract to the _to address solium-disable-next-line security/no-send | function projectTokenWithdraw(uint256 _tokenAmount)
external
onlyProjectAddress
isInitialized
{
require(_tokenAmount <= tokenSupply, "Requested amount too high, not enough tokens available.");
tokenSupply = tokenSupply.sub(_tokenAmount);
initialTokenSupply = initialTokenSupp... | 6,399,455 |
contract ShinySquirrels {
// all the things
uint private minDeposit = 10 finney;
uint private maxDeposit = 5 ether;
uint private baseFee = 5;
uint private baseMultiplier = 100;
uint private maxMultiplier = 160;
uint private currentPosition = 0;
uint private balance = 0;
uint private feeBalance = 0;
uint pri... | game balance will always be zero due to automatic rolling payouts collect any funds outside of the game balance | function collectFees() {
if(msg.sender != owner) {
throw;
}
if(address(this).balance > balance + feeBalance) {
feeBalance = address(this).balance - balance;
}
owner.send(feeBalance);
feeBalance = 0;
}
| 12,966,860 |
./full_match/1/0x631b949c7e0fdef95e612165798E09aD46b5635c/sources/contracts/oasis-main/OasisAccessPass.sol | Returns the token ID of the user. _user User address. return tokenId_ Token ID of the user./ | function getID(address _user) public view returns (uint256 tokenId_) {
return addressToId[_user];
}
| 3,181,607 |
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/math/Safe... | in case server lose secret, it basically revoke box for user to open again | function revokeBoxId(uint256 boxId) external onlyOwner {
committedBoxes[boxId] = false;
}
| 13,108,425 |
./partial_match/1/0x2CAD12a04d4b3507341314678f177A06033309b2/sources/RMFToken.sol | See {IERC20-approve}. NOTE: If `value` is the maximum `uint256`, the allowance is not updated on `transferFrom`. This is semantically equivalent to an infinite approval. Requirements: - `spender` cannot be the zero address./ | function approve(address spender, uint256 value)
public
virtual
returns (bool)
{
address owner = _msgSender();
_approve(owner, spender, value);
return true;
}
| 4,370,938 |
pragma solidity ^0.4.8;
contract LuckyDAO {
enum Environment {UNDEFINED, PROD, TEST}
Environment public environment;
struct Guess {
uint floor; // start of the guess window
uint ceil; // end of the guess window = floor + paid wei
}
struct Participation {
mapping(uint8 => ... | returns the percent to a 6 digit precision. must be divided by 1'000'000 to get a percentage/ | function winProbability(address _participant) constant returns (uint) {
return (participations[_participant].totalPaid * 1000000) / this.balance;
}
| 7,276,001 |
./partial_match/80001/0x636C4701Fdd1C46e47177cef7032b26402Bf7251/sources/minter1.sol | Returns the downcasted int72 from int256, reverting on overflow (when the input is less than smallest int72 or greater than largest int72). Counterpart to Solidity's `int72` operator. Requirements: - input must fit into 72 bits _Available since v4.7._/ | function toInt72(int256 value) internal pure returns (int72 downcasted) {
downcasted = int72(value);
require(downcasted == value, "SafeCast: value doesn't fit in 72 bits");
}
| 8,818,507 |
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
pragma solidity ^0.4.24;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* See https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function ... | Sell tokens to address array based on USD cents array values./ | function sellDirectArray(address[] _dests, uint256[] _values) public
onlyAdmin whenNotPaused returns (bool success) {
require(_dests.length == _values.length);
for (uint32 i = 0; i < _dests.length; i++) {
if(_values[i] <= 0 || !sellDirect(_dests[i], _values[i])) {
revert();
... | 15,798,352 |
./full_match/80001/0x268023DD238B747756eb6CF2f189aE4bA11702E5/sources/_thirdweb-dev/contracts/extension/Drop.sol | Lets an account claim tokens. Update contract state. If there's a price, collect price. Mint the relevant tokens to claimer. | function claim(
address _receiver,
uint256 _quantity,
address _currency,
uint256 _pricePerToken,
uint256 activeConditionId,
AllowlistProof calldata _allowlistProof,
bytes memory _data
) public payable virtual override {
_beforeClaim(_receiver, _qua... | 5,574,731 |
pragma solidity ^0.5.10;
import {TypedMemView} from "./TypedMemView.sol";
import {SafeMath} from "./SafeMath.sol";
library ViewCKB {
using TypedMemView for bytes29;
using SafeMath for uint;
uint256 public constant PERIOD_BLOCKS = 24 * 450 * 7; // 1 week in blocks
uint8 public constant NUMBER_SIZE = 4... | extracts the rawHeader from a Header _input the Header return the rawHeader as a typed memory | function rawHeader(bytes29 _input) internal pure typeAssert(_input, CKBTypes.Header) returns (bytes29) {
return _input.slice(0, 192, uint40(CKBTypes.RawHeader));
}
| 905,512 |
./full_match/1/0x39Ac1AC1B7c45b3E78f1290a542D428E7aB8E59C/sources/browser/XTrinity_flat.sol | helper to identify if we work with ETH or WETH/ | function isofETH(IERC20 token) internal pure returns (bool) {
return (address(token) == address(ZERO_ADDRESS) ||
address(token) == address(ETH_ADDRESS) ||
address(token) == address(WETH_ADDRESS));
}
| 4,980,475 |
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "./ERC20Detailed.sol";
import "./ERC20Mintable.sol";
import "./ERC20Pausable.sol";
/**
* @title Standard ERC20 token, with minting and pause functionality.
*
*/
contract StandaloneERC20 is Initializable, ERC20Detailed, ERC20Mintable, ER... | Initialize the minter and pauser roles, and renounce them Add the requested minters and pausers (this can be done after renouncing since these are the internal calls) | function initialize(
string name, string symbol, uint8 decimals, address[] minters, address[] pausers
) public initializer {
ERC20Detailed.initialize(name, symbol, decimals);
ERC20Mintable.initialize(address(this));
renounceMinter();
ERC20Pausable.initialize(address(this));
renouncePauser(... | 12,878,209 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./SigToken.sol";
/**
* @title FeeAdminV1D... | the first week x2 mint second week x1.5 mint total reward before current era (mul base reward 50) sum : 1 + 1/2 + 1/4 … 1/2^n == 2 - 1/2^n == 1 - 1/1<<n == 1 - 1>>n era reward per block (1e18 50) | function maxRewardMintAfterBlocks(uint256 t) public pure returns (uint256) {
if (t < BLOCKS_PER_WEEK) {
return DECIMALS_MUL * 100 * t;
}
if (t < BLOCKS_PER_WEEK * 2) {
return DECIMALS_MUL * (100 * BLOCKS_PER_WEEK + 75 * (t - BLOCKS_PER_WEEK));
}
asser... | 573,107 |
./full_match/4/0xA155EAaF67122C82a61f9f017B2CA721cB20B0A8/sources/contracts/UpbondNFTMintableCreator.sol | Get edition given the created ID editionId id of edition to get contract for return UpbondNFTMintable Edition NFT contract | function getEditionAtId(uint256 editionId)
external
view
returns (UpbondNFTMintable)
{
return
UpbondNFTMintable(
ClonesUpgradeable.predictDeterministicAddress(
implementation,
bytes32(abi.encodePacked(editionId))... | 790,784 |
pragma solidity >=0.4.25;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIAB... | Add an airline to the registration queue Can only be called from FlightSuretyApp contract/ | function registerAirline
(
address airline
)
public
requireIsCallerAuthorized
{
airlines.push(airline);
registeredAirlines[airline] = 1;
}
| 13,088,573 |
./full_match/80001/0x5d085dE8Df8C88cFE4B13B2f2DBDa92DD6cDF4e6/sources/contracts/Rentables.sol | Make the token available to be soldOnly Landlord can set the key if Token has expired | function makeAvailable(
uint256 from,
uint256 tenantId,
string memory key
) public virtual {
_existing(from);
_existing(tenantId);
require(hasTenant(from, tenantId), "Tenant not found");
Storage storage s = getStorage();
uint256 landlord = s.tokens... | 9,523,462 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity =0.8.10;
import "./IERC20.sol";
import "./IUniswapV2Router02.sol";
import "./IUniswapV2Factory.sol";
import "./IUniswapV2Pair.sol";
import "./IHyperDeFi.sol";
import "./IHyperDeFiBuffer.sol";
import "./IHyperDeFiIDO.sol";
import "./Ownable.sol";
import "... | Returns `true` if `coupon` is valid for `account`/ | function isValidCouponForAccount(uint256 coupon, address account) public view returns (bool) {
address inviter = _inviter[coupon];
if (inviter == address(0)) return false;
for (uint8 i = 1; i < BONUS.length; i++) {
if (inviter == account) return false;
inviter = _i... | 5,439,700 |
./full_match/4/0xB27a670E36D0F5e49242F4C0EE4c6fc99BCf6eBa/sources/browser/Factorydexswap.sol | update reserves and, on the first call per block, price accumulators never overflows, and + overflow is desired | function _update(uint balance0, uint balance1, uint112 _reserve0, uint112 _reserve1) private {
require(balance0 <= uint112(-1) && balance1 <= uint112(-1), 'PocketSwap: OVERFLOW');
uint32 blockTimestamp = uint32(block.timestamp % 2**32);
if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0... | 724,218 |
/* Copyright (C) 2020 NexusMutual.io
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distribu... | Computes token sell value for a tokenAmount in ETH with a sell spread of 2.5%. for values in ETH of the sale <= 1% MCReth the sell spread is very close to the exact value of 2.5%. for values higher than that sell spread may exceed 2.5% (The higher amount being sold at any given time the higher the spread)/ Step 1. Cal... | function calculateEthForNXM(
uint nxmAmount,
uint currentTotalAssetValue,
uint mcrEth
) public pure returns (uint) {
uint spotPrice0 = calculateTokenSpotPrice(currentTotalAssetValue, mcrEth);
uint spotEthAmount = nxmAmount.mul(spotPrice0).div(1e18);
uint totalValuePostSpotPriceSell = curre... | 2,577,850 |
./full_match/5/0x93EA5c5f0961E9912E77211ef5888618E4DC7e7e/sources/src/token/ERC1155/extensions/mintable/ERC1155Mintable.sol | @inheritdoc IERC1155Mintable/ | function mintByFacet(
address[] calldata tos,
uint256[] calldata ids,
uint256[] calldata amounts,
bytes[] calldata datas
) public virtual {
if (address(this) != msg.sender) {
revert SenderIsNotSelf();
}
_mintBatch(tos, ids, amounts, datas);
... | 1,890,686 |
./full_match/56/0xcBD57e01a6e46A53617215B968d2182FdA0Ec6F5/sources/usertoken_flattened.sol | generate the uniswap pair path of token -> weth make the swap | function swapThisForTokens(uint256 thisTokenAmount, address outToken) private {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = outToken;
_approve(address(this), address(router), thisTokenAmount);
router.swapExactTokensForTokensSupportingFeeOnTr... | 3,242,333 |
./full_match/1/0x578Bc817d19e4EBEb47F57824F9871C4858b1C94/sources/deploy/Contract.sol | Atomically decreases 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. - `spender` must have ... | function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
address owner = _msgSender();
uint256 currentAllowance = allowance(owner, spender);
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
... | 3,175,655 |
./full_match/1/0xFb6B7C11a55C57767643F1FF65c34C8693a11A70/sources/contracts/DivaGovernor.sol | Voting power need to be able to create a proposal/ | function proposalThreshold()
public
view
override(Governor, GovernorSettings)
returns (uint256)
{
return super.proposalThreshold();
}
| 4,892,190 |
./partial_match/1/0x828a7f1802eDe207C36D156c62C9600bb4D79E63/sources/LydianLionCoin.sol | exclude from paying fees or having max transaction amount | function _beforeTokenTransfer(
address from,
address to,
uint256 amount
function _afterTokenTransfer(
address from,
address to,
uint256 amount
}
}
constructor() ERC20("Lydian Lion Coin", "LLC") {
uint256 _buyRevShareFee = 0;
uint2... | 15,548,309 |
pragma solidity ^0.5.17;
import "../../interfaces/IERC20.sol";
import "../../utils/AdminRole.sol";
import "./VestingRegistryLogic.sol";
import "./VestingLogic.sol";
import "../../openzeppelin/SafeMath.sol";
contract VestingCreator is AdminRole {
using SafeMath for uint256;
///@notice Boolean to check both vesting ... | Staking vested tokens it can be the case when vesting creation and tokens staking can't be done in one transaction because of block gas limit/ | function processStaking() public {
require(vestingCreated, "cannot stake without vesting creation");
if (vestingDataList.length > 0) {
VestingData storage vestingData = vestingDataList[vestingDataList.length - 1];
address vestingAddress =
_getVesting(
vestingData.tokenOwner,
vestingData.cliff,
... | 996,844 |
/*
____ __ __ __ _
/ __/__ __ ___ / /_ / / ___ / /_ (_)__ __
_\ \ / // // _ \/ __// _ \/ -_)/ __// / \ \ /
/___/ \_, //_//_/\__//_//_/\__/ \__//_/ /_\_\
/___/
* Synthetix: SystemSettings.sol
*
* Latest source (may be newer): https://github.com/Synthetixio/synthetix/blob/master/contr... | How long a fee period lasts at a minimum. It is required for anyone to roll over the periods, so they are not guaranteed to roll over at exactly this duration, but the contract enforces that they cannot roll over any quicker than this duration. | function feePeriodDuration() external view returns (uint) {
return getFeePeriodDuration();
}
| 242,127 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.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... | Changes minting address, callable only by current minting address newAddress New minting address | function changeMintingAddress(address newAddress) external {
require(_mintingAddress == msg.sender, "Can not change address");
_mintingAddress = newAddress;
}
| 14,906,512 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
pragma experimental ABIEncoderV2;
library Internal_Merkle_Library_Sorted_Hash {
// Hashes a and b in the order they are passed
function hash_node(bytes32 a, bytes32 b) internal pure returns (bytes32 hash) {
assembly {
mstore(0x00, a)
... | INTERFACE: Try to update a bytes32 element and append a bytes32 element, given a root, an index, a bytes32 element, and a Single Proof | function try_update_one_and_append_one(
bytes32 root,
uint256 index,
bytes32 element,
bytes32 update_element,
bytes32 append_element,
bytes32[] calldata proof
) internal pure returns (bytes32 element_root) {
bytes32 total_element_count = proof[0];
require(root != bytes32(0) || total... | 12,859,797 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.