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/80001/0x299D14a1100E5FF4E1B8CcB958161976629b6102/sources/contracts/relayer/loe-relayer/loe-feat-eip2771/contracts/contracts/metatx/ContextStorage.sol | The assembly code is more direct than the Solidity version using `abi.decode`. @solidity memory-safe-assembly | function _msgSender() internal view virtual override returns (address) {
if (isTrustedForwarder(msg.sender)) {
address sender;
assembly {
sender := shr(96, calldataload(sub(calldatasize(), 20)))
}
return sender;
return super._msgSen... | 870,800 |
./full_match/4/0x8BA68Fe0Bc728c4c3B4D8BEe3E66f72a96c1750d/sources/Users/alpha/Desktop/Coding_Projects/Active_Contractor_projects/0geyser/0geyser_truffle/contracts/IStaking.sol | Staking interface, as defined by EIP-900./ | interface IStaking {
event Staked(address indexed user, uint256 amount, uint256 total, bytes data);
event Unstaked(address indexed user, uint256 amount, uint256 total, bytes data);
function stake(uint256 amount, bytes calldata data) external;
function stakeFor(address user, uint256 amount, bytes callda... | 656,173 |
pragma solidity ^0.4.24;
// ----------------------------------------------------------------------------
// 'Kaasy' CROWDSALE token contract
//
// Deployed to : 0x714c1ef3854591d4118bd6887d4740bc4d5f5412
// Symbol : KAAS
// Name : KAASY.AI Token
// Total supply: 500000000
// Decimals : 18
//
... | ------------------------------------------------------------------------ Owner can transfer out all accidentally sent ERC20 tokens ------------------------------------------------------------------------ | function transferAnyERC20Token(address tokenAddress) public onlyOwnerOrOwnerAPI returns (bool success) {
return ERC20Interface(tokenAddress).transfer(owner, ERC20Interface(tokenAddress).balanceOf(this));
}
| 12,867,580 |
import "./Table.sol";
contract OkD{
event insertResult(int count);
struct Account{
address account;
int balance;
}
Account from;
Account to;
function OkD(){
from.account=0x1;
from.balance=10000000000;
to.account=0x2;
to.balance=0;
... | log.push(Translog("20170413",from.account,to.account,num)); | function trans(string from_accout, int num){
from.balance = from.balance - num;
to.balance += num;
TableFactory tf = TableFactory(0x1001);
Table table = tf.openTable("t_ok");
Entry entry = table.newEntry();
entry.set("from_accout", from_accout);
entry.set("from_ba... | 12,972,990 |
// File @aragon/os/contracts/common/UnstructuredStorage.sol@v4.4.0
/*
* SPDX-License-Identifier: MIT
*/
pragma solidity ^0.4.24;
library UnstructuredStorage {
function getStorageBool(bytes32 position) internal view returns (bool data) {
assembly { data := sload(position) }
}
function getSt... | Push the given report to Lido and performs accompanying accounting _epochId Beacon chain epoch, proven to be >= expected epoch and <= current epoch _beaconBalanceEth1 Validators balance in eth1 (18-digit denomination) _beaconSpec current beacon specification data/ now this frame is completed, so the expected epoch s... | function _push(
uint256 _epochId,
uint128 _beaconBalanceEth1,
uint128 _beaconValidators,
BeaconSpec memory _beaconSpec
)
internal
{
emit Completed(_epochId, _beaconBalanceEth1, _beaconValidators);
_clearReportingAndAdvanceTo(_epochId + _beaconSpec.epo... | 173,011 |
pragma solidity ^0.6.0;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/EnumerableSet.sol";
import "./VentureEth.sol";
import "../voting/Democratic.sol";
/**
* @title DAO
* @dev The contract inherits from VentureEth.... | To be called during the first investment round./ solium-disable-next-line security/no-low-level-calls | function startDistribution() public virtual override onlyOwner {
(bool success, ) = address(this).delegatecall(
abi.encodeWithSignature("transferOwnership(address)", address(this))
);
require(success, "Could not transfer ownership to the DAO.");
_transition("LIVE");
}... | 6,483,016 |
/**
*Submitted for verification at Etherscan.io on 2020-02-20
*/
/**
*Submitted for verification at Etherscan.io on 2020-02-17
*/
pragma solidity ^0.5.2;
/**
* Copyright (c) 2018-present, Leap DAO (leapdao.org)
*
* This source code is licensed under the Mozilla Public License, version 2,
* found in the LICENSE... | validate that transaction is included to the period (merkle proof) | function validateProof(
uint256 _cdOffset, bytes32[] memory _proof
) internal pure returns (uint64 txPos, bytes32 txHash, bytes memory txData) {
uint256 offset = uint8(uint256(_proof[1] >> 248));
uint256 txLength = uint16(uint256(_proof[1] >> 224));
txData = new bytes(txLength);
assembly {
... | 5,413,576 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
contract ExampleMRC721 is ERC721, ERC721Enumerable {
bytes4 private constant MINT_ID =
bytes4(keccak256("mintUni... | Custom accessor to create a unique token/ | function mintUniqueTokenTo(address _to, uint256 _tokenId) public {
super._mint(_to, _tokenId);
}
| 974,706 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.3;
import '@openzeppelin/contracts/math/SafeMath.sol';
import './interfaces/IAmesoToken.sol';
import './interfaces/ITreasury.sol';
import 'hardhat/console.sol';
contract Ameso {
using SafeMath for uint256;
modifier onlyTreasury() {
require(msg.send... | _ipfsID Unique ID that points to storage in ipfs _employer Address of the employer _minContractors Minimum number of contractors _maxContractors Maximum number of contractors _tip Optional tip paid to the contractor(s)/ all other checks handled by the employer hub keep track of payments in treasury | function createJob(
string memory _ipfsID,
address _employer,
uint256 _minContractors,
uint256 _maxContractors,
uint256 _extraEnrollDelay,
uint256 _jobLength,
uint256 _tip
) public
onlyEmployer
{
treasury.payListing(_ipfsID, _employer,... | 15,840,705 |
./full_match/80001/0xe8b4Bf2aA4b3D55A497E094AC780558B4186A8c5/sources/_thirdweb-dev/contracts/extension/PermissionsEnumerable.sol | adds `account` to {roleMembers}, for `role` | function _addMember(bytes32 role, address account) internal {
uint256 idx = roleMembers[role].index;
roleMembers[role].index += 1;
roleMembers[role].members[idx] = account;
roleMembers[role].indexOf[account] = idx;
}
| 5,605,005 |
// SPDX-License-Identifier: UNLICENSED
// @title Meowshi....🐈_🍣_🍱
// @author Gatoshi Nyakamoto
pragma solidity 0.8.4;
// File @boringcrypto/boring-solidity/contracts/Domain.sol@v1.2.0
// License-Identifier: MIT
/// @dev Adapted for Meowshi.
contract Domain {
string constant EIP191_PREFIX_FOR_EIP712_STRUCTURED... | keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"). owner > spender > allowance mapping. owner > balance mapping. owner > nonce mapping used in {permit}. Approves `amount` from msg.sender to be spent by `spender`. spender Address of the party that can draw tokens from m... | function approve(address spender, uint256 amount) external returns (bool) {
allowance[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
| 93,139 |
pragma ton-solidity >=0.32.0;
pragma AbiHeader expire;
import "20_interface.sol";
contract Bomber is IBomber {
uint constant param0 = 10;
uint constant param1 = 100;
mapping(uint => uint) map;
modifier onlyOwner {
// Check that function is called by external message
require(tvm.pubk... | Contract sends 3 messages with values: 1 ever, 1e9 ever and 1 ever. Let contract has balance equal to 5 ever. Then it's obvious that it can't send 1e9 ever. It should cause fail of action phase. But the second message has flag: 2. It means that any errors arising while processing this message during the action phase sh... | function testFlag2(address addr) public pure onlyOwner {
}
| 15,831,246 |
pragma solidity ^0.8.0;
library console {
address constant CONSOLE_ADDRESS = address(0x000000000000000000636F6e736F6c652e6c6f67);
function _sendLogPayload(bytes memory payload) private view {
uint256 payloadLength = payload.length;
address consoleAddress = CONSOLE_ADDRESS;
assembly {
let payloadStart := ... | Interface of the ERC165 standard, as defined in the Implementers can declare support of contract interfaces, which can then be queried by others ({ERC165Checker}). For an implementation, see {ERC165}./ | interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
| 9,615 |
./full_match/43114/0x8BeF31c1e0aC12D73842a49436458Fd586C22A58/sources/MasterChefL2.sol | Pay or lockup pending tomato. | function payOrLockupPendingTomato(uint256 _pid) internal {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
if (user.nextHarvestUntil == 0) {
user.nextHarvestUntil = getPoolHarvestInterval(_pid);
}
uint256 pending = user... | 4,548,468 |
contract StandardTokenProtocol {
function totalSupply() constant returns (uint256 totalSupply) {}
function balanceOf(address _owner) constant returns (uint256 balance) {}
function transfer(address _recipient, uint256 _value) returns (bool success) {}
function transferFrom(address _from, address _r... | Special Function can only be called by BTC Suisse and only during the pre-crowdsale period.Allows the purchase of up to 125000 Ether worth of GUP Tokens. | function preBuy()
payable
is_pre_crowdfund_period
only_btcs
is_not_halted
{
uint amount = processPurchase(PRICE_BTCS, BTCS_PORTION_MAX - btcsPortionTotal);
btcsPortionTotal += amount;
PreBuy(amount);
}
| 13,073,483 |
/**
*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
... | Admin can set reward tokens claimable through this function. _enabled True or False./ | function setTokensClaimable(bool _enabled) external {
require(accessControls.hasAdminRole(msg.sender), "GazeLPStaking.setTokensClaimable: Sender must be admin");
tokensClaimable = _enabled;
emit ClaimableStatusUpdated(_enabled);
}
| 2,323,863 |
./partial_match/1/0xd3b3BCEDD4124F51382ad3c9EFD45b7Ec05f2072/sources/PEPEBURNER.sol | exclude from paying fees or having max transaction amount | constructor(address payable _devFeeAddress, address payable _marketingWalletAddress) ERC20("Burning Pepes", "PEPEBURNER") {
uint256 _buyMarketingFee = 1;
uint256 _buyLiquidityFee = 0;
uint256 _buyDevFee = 0;
uint256 _buyPepeBuyFee = 2;
uint256 _sellMarketingFee = 1;
... | 15,779,822 |
pragma solidity 0.6.6;
import {SafeMath} from "@openzeppelin/contracts/math/SafeMath.sol";
import {IRootChainManager} from "./IRootChainManager.sol";
import {RootChainManagerStorage} from "./RootChainManagerStorage.sol";
import {IStateSender} from "../StateSender/IStateSender.sol";
import {ICheckpointManager} from "..... | Register a token predicate address against its type, callable only by mappers A predicate is a contract responsible to process the token specific logic while locking or exiting tokens tokenType bytes32 unique identifier for the token type predicateAddress address of token predicate address/ | function registerPredicate(bytes32 tokenType, address predicateAddress)
external
override
only(MAPPER_ROLE)
{
typeToPredicate[tokenType] = predicateAddress;
emit PredicateRegistered(tokenType, predicateAddress);
}
| 2,493,405 |
pragma solidity ^0.4.24;
pragma solidity ^0.4.24;
pragma solidity ^0.4.20;
contract CutieCoreInterface
{
function isCutieCore() pure public returns (bool);
function transferFrom(address _from, address _to, uint256 _cutieId) external;
function transfer(address _to, uint256 _cutieId) external;
functi... | calculate current price of auction. When testing, make this function public and turn on `Current price calculation` test suite. | function _computeCurrentPrice(
uint128 _startPrice,
uint128 _endPrice,
uint40 _duration,
uint40 _secondsPassed
)
internal
pure
returns (uint128)
{
if (_secondsPassed >= _duration) {
return _endPrice;
int256 totalPriceCha... | 242,238 |
./full_match/1/0x501acEF3315c5DcFE37be35fB59e33d755898E1A/sources/contracts/PolicyDescriptorV2.sol | Describes a policy. policyManager The policy manager to retrieve policy info to produce URI description. policyID The ID of the policy for which to produce a description. return description The URI of the ERC721-compliant metadata./ solhint-disable-next-line no-unused-vars | function tokenURI(IPolicyManager policyManager, uint256 policyID) external view override returns (string memory description) {
return string(abi.encodePacked(_baseUri, Strings.toString(policyID)));
}
| 4,992,495 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, sinc... | when selling, update internal reserve only if the Uniswap reserve is smaller trading a non-safelisted token, so do not update internal reserves | function _updateReservesOnSell(address token, uint112 wethReserve)
private
returns (uint128 reserve)
{
reserve = wethReserves[token];
if (reserve == 0) {
return reserve;
}
if (wethReserve < reserve) {
wethReserves[token] = wethReserve;
... | 9,986,509 |
./full_match/137/0xf66b45C79C338045eec82BA4De38c9489b25C137/sources/contracts/VestingVault.flatten.sol | Transfer the grant tokens under the control of the vesting contract | function addTokenGrant(
address _recipient,
uint256 _amount,
uint16 _vestingDurationInDays,
uint16 _vestingCliffInDays
)
external
onlyOwner
{
require(tokenGrants[_recipient].amount == 0, "Grant already exists, must revoke first.");
require... | 3,753,019 |
./partial_match/56/0x08c4F76D52DB6A9449dA0793CaBbc0D646b4df66/sources/DUCKMasterFarmer.sol | Update reward variables of the given pool to be up-to-date. Mint unlocked amount for Dev Mint locked amount for DevFor more simple, I lock reward for dev if mint reward in bonus time | function updatePool(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
if (block.number <= pool.lastRewardBlock) {
return;
}
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (lpSupply == 0) {
pool.lastRewardBlock = block.number;... | 11,084,044 |
./partial_match/4/0x38C18586FEd600F36688Af2b2EE831D8E06d8594/sources/NiftyBuilderInstance.sol | can only be set once | function setNiftyIPFSHash(uint niftyType,
string memory ipfs_hash) onlyValidSender public {
if (_IPFSHashHasBeenSet[niftyType] == true) {
revert("Can only be set once");
_niftyIPFSHashes[niftyType] = ipfs_hash;
_setTokenIPFSHashNiftyType(niftyT... | 8,554,988 |
/**
SPDX-License-Identifier: MIT
Copyright © 2020 Eric G. Falkenstein
*/
pragma solidity ^0.8.0;
contract test32b {
// odds are entered as decimal odds, such that 1.909 is 909, and 2.543 is 1543. (decOdds/1000+1) is the total payoff for a winning bet,
// consisting of a profit of decOdds/1000 and a return ... | these show methods are to make it easier for the web front end to process data pulling arrays from solidity | function showLongs(uint8 _pick) external view returns (uint32[32] memory) {
uint32[32] memory outLongs;
for (uint8 i = 0; i < 32; i++) {
outLongs[i] = matches[i].long[_pick];
}
return outLongs;
}
| 12,853,833 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "../../interfaces/IERC721Consumable.sol";
contract ERC721Consumable is IERC721Consumable, ERC721 {
// Mintable
using Counters for Counte... | See {IERC721Consumable-changeConsumer}/ | function changeConsumer(address _consumer, uint256 _tokenId) external {
address owner = this.ownerOf(_tokenId);
require(
msg.sender == owner ||
msg.sender == getApproved(_tokenId) ||
isApprovedForAll(owner, msg.sender),
"ERC721Consumable: chang... | 7,285,621 |
./full_match/4/0xAdDdC86b24A9a7D639C7540B15Ab055494DBF504/sources/map.sol | updating total tokens in bankcalculating interest amount;transfering tokens to users wallettotalSupply Updateburing cmap tokenburning token dataupdating number of cmap tokens held by the userupdating total tokens in bankcalculating interest amount;transfering tokens to users wallettotalSupply Updateburing cmap tokenbur... | function withdraw(uint256 _tokenId) public {
uint diff = now - data[_tokenId].time;
if(diff < 1036800)
{
require(
token[_tokenId] == msg.sender,
"this token dont belongs to you"
);
tokenInBank -= data[_tokenId].holdings;
... | 795,571 |
pragma solidity ^0.4.0;
import "../Token/Token.sol";
import "./SensorLibrary.sol";
import "./MinimalPurchase.sol";
import "./AgreementDeliver.sol";
import "./AgreementReturn.sol";
contract AgreementData {
enum State { Created, Locked, Transit, Confirm, Dissatisfied, Return, Returned, Review, Clerk, Appeal, Inacti... | Accept a proposal purchase The address of the agreement _buyer The index of the proposal to accept/ | function accept(address purchase, uint _buyer)
public
onlySeller(purchase)
inState(purchase, State.Created)
condition(potentialBuyers[purchase][_buyer] != 0x0)
{
state[purchase] = State.Locked;
buyer[purchase] = potentialBuyers[purchase][_buyer];
SensorLibrary.combineTerms(terms[purchas... | 12,816,075 |
./full_match/5/0x0609Df316a292BfBbd581e668E6505E6De075C6C/sources/contracts/defi_otc_exchange.sol | Create a minimum limit order with specified desiredTokenYAmount. Only works if tokenX is WETH. TODO: Decide whether or not to update desiredTokenYAmount if tokenX has transfer taxes | function createETHLimitOrderWithDesiredTokenYAmount(address tokenX, address tokenY, uint256 tokenXAmount, uint256 desiredTokenYAmount) external payable nonReentrant returns (uint96 _orderId) {
IWETH weth = IWETH(address(0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6));
if (tokenXAmount == 0 || desiredTokenYAmount == 0... | 11,599,545 |
./full_match/5/0xBD5cDdc0937443B182892aB7EF678Eb7419cd09a/sources/src/contracts/core/InvestmentManager.sol | VIEW FUNCTIONS Get all details on the depositor's investments and corresponding shares return (depositor's strategies, shares in these strategies)/ | function getDeposits(address depositor) external view returns (IInvestmentStrategy[] memory, uint256[] memory) {
uint256 strategiesLength = investorStrats[depositor].length;
uint256[] memory shares = new uint256[](strategiesLength);
for (uint256 i = 0; i < strategiesLength;) {
s... | 1,923,715 |
pragma solidity =0.6.6;
interface IAtariswapFactory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) exter... | refund dust eth, if any | function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external virtual override payable ensure(deadline) returns (uint amountToken, uint amountETH, uint liquidity) {
(amountTok... | 11,977,421 |
./full_match/80001/0x402acf1F4e9E4180Be81303b87479115Ecb4d64d/sources/contracts/DomainsFactory.sol | Only Factory contract owner can call this function. visible in each domain NFT image (SVG) | function changeProjectName(string calldata _newProjectName) external onlyOwner {
projectName = _newProjectName;
}
| 5,599,109 |
pragma solidity 0.6.12;
// SPDX-License-Identifier: MIT
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function a... | deposit to yearn get DEA and send to Vault | function harvest(uint256 ethBalance) private returns(
uint256 withdrawable
){
uint256 rewards = calculateRewards();
uint256 depositable = ethBalance > rewards ? ethBalance.sub(rewards) : 0;
if(depositable >= minDepositable){
controller.depositForStrategy(depositable, ... | 45,000 |
./partial_match/1/0x671E772987E70C279a926fc9c73d577bEDFcD29B/sources/src/libraries/ScrollMessengerBase.sol | Update fee vault contract. This function can only called by contract owner. _newFeeVault The address of new fee vault contract. | function updateFeeVault(address _newFeeVault) external onlyOwner {
address _oldFeeVault = feeVault;
feeVault = _newFeeVault;
emit UpdateFeeVault(_oldFeeVault, _newFeeVault);
}
| 16,051,168 |
/*
*
* Universal Mobile Token smart contract
* Developed by Phenom.team <info@phenom.team>
*
*/
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".
*/
con... | Remove an emitter account _emitter emitter's address/ | function removeEmitter(address _emitter) public onlyOwner {
emitters[_emitter] = false;
}
| 6,162,607 |
pragma solidity ^0.5.8;
/**
* @title Math
* @dev Assorted math operations
*/
library Math {
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
/**
* @dev Returns the smallest of two ... | calculated purchased sale token amount exToken address of the exchangeable token amount amount of the exchangeable token (how much to pay) return amount of purchased sale token/ round down value (v) by multiple (m) = (v / m) m | function _getTokenAmount(
address exToken,
uint256 amount
)
private
view
returns (uint256)
{
uint256 value = amount
.mul(_exTokens[exToken].rate)
.div(1000000000000000000)
.mul(1000000000000000000);
return _applyBonu... | 5,442,779 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.7.0;
contract MutualAgreement {
// makes the mediator able to withdraw funds
address payable mediator;
// list of agreements in this contract (using arrays is not optimal!)
Agreement[] public agreements;
// variables to indica... | Finishes the agreement and adds the funds to the contract's balance when the agreement is completed. | function finishAgreement(uint agreement_id) private {
require(isSigned(agreement_id), "Agreement is not signed by both parties.");
balance += agreements[agreement_id].value;
totalAgreed += agreements[agreement_id].value;
}
| 7,244,379 |
pragma solidity ^0.5.0;
import "./TxPosLib.sol";
/**
@dev UTXO position = (blockNumber * BLOCK_OFFSET + txIndex * TX_OFFSET + outputIndex).
*/
library UtxoPosLib {
struct UtxoPos {
uint256 value;
}
uint256 constant internal BLOCK_OFFSET = 1000000000;
uint256 constant internal TX_OFFSET = 100... | Given an UTXO position, returns the output index. _utxoPos Output identifier in form of utxo position. return The output's index./ | function outputIndex(UtxoPos memory _utxoPos)
internal
pure
returns (uint8)
{
return uint8(_utxoPos.value % TX_OFFSET);
}
| 13,086,542 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
i... | Deposit staked tokens and collect reward tokens (if any) _amount: amount to withdraw (in rewardToken)/ If pool mode is non-compound -> transfer rewards to user Otherwise, compound to user amount We're not apply lock per user this time Check real amount to avoid taxed token | function deposit(uint256 _amount) external nonReentrant {
require(isFrozen() == false, "Deposit is frozen");
if (maxStakedPerPool > 0) {
require((currentStakedPerPool + _amount) <= maxStakedPerPool, "Exceed max staked tokens");
}
UserInfo storage user = userInfo[msg.sender];
require((user.a... | 6,086,384 |
./partial_match/1/0x73ED6d3f4941F7B3B065C5e7D37365167A0c2898/sources/contracts/rewards/AutoCompoundingRewards.sol | @inheritdoc IAutoCompoundingRewards/ | function isProgramActive(Token pool) external view returns (bool) {
ProgramData memory p = _programs[pool];
if (!_programExists(p)) {
return false;
}
uint32 currTime = _time();
if (p.distributionType == EXP_DECAY_DISTRIBUTION) {
return p.startTime <... | 3,563,786 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma abicoder v2;
import "base64-sol/base64.sol";
import "./constants/Colors.sol";
/// @title Accessory SVG generator
library AccessoryDetail {
/// @dev Accessory N°1 => None
function item_1() public pure returns (string memory) {
return base(... | Accessory N°6 => Small Horn Moon | function item_6() public pure returns (string memory) {
return base(small_horn("2A2C38"), "Small Horn Moon");
}
| 12,962,961 |
./partial_match/1/0x4aA2669332207122a0bE0866e193de70792fFbDd/sources/contracts/proxies/xAAVEProxy.sol | Proposes a new admin address if the sender is the Admin newAdminAddress address of the new admin role/ | function proposeAdminTransfer(address newAdminAddress) public onlyProxyAdmin {
require(newAdminAddress != address(0), "new Admin address cannot be address(0)");
setProposedAdmin(newAdminAddress);
}
| 15,752,411 |
./full_match/4/0xC82d4eCc80DF2e4B4dfdfae3D7d0CA6865f496B3/sources/AttackReentrancy.sol | first deposit some funds withdraw these funds over and over again because of re-entrancy issue | function attack() external payable {
require(msg.value >= 0.1 ether, "send some more ether");
initialDeposit = msg.value;
callWithdraw();
}
| 12,440,790 |
./partial_match/1/0xCEC4AFaddc2a4171107E8147e7e905Eb71e3d8aB/sources/XToken.sol | Intended to be used for web3 such that all necessary data can be requested at once tokenAddress The address of the token. return Name and Symbol metadata of specified ERC20 token./ | function getTokenInfo(address tokenAddress) external view returns (string[] memory) {
string[] memory info = new string[](2);
IERC20Metadata token = IERC20Metadata(tokenAddress);
info[0] = token.name();
info[1] = token.symbol();
return info;
}
| 9,135,203 |
pragma solidity ^0.4.18;
/**
* Libraries
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev ... | Decrease the amount of tokens that an owner allowed to a spender. _spender The address which will spend the funds. _subtractedValue The amount of tokens to decrease the allowance by./ | function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
... | 15,020,606 |
pragma solidity ^0.4.24;
// File: openzeppelin-zos/contracts/introspection/ERC165.sol
/**
* @title ERC165
* @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md
*/
interface ERC165 {
/**
* @notice Query if a contract implements an interface
* @param _interfaceId The interface identifier, as s... | Set Estates updateOperator _estateIds - Estate ids _operator - address of the account to be set as the updateOperator/ | function setManyUpdateOperator(
uint256[] _estateIds,
address _operator
)
public
{
for (uint i = 0; i < _estateIds.length; i++) {
setUpdateOperator(_estateIds[i], _operator);
}
}
| 1,763,318 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import {ERC721BasicMint} from "../erc721/presets/ERC721BasicMint.sol";
//=====================================================================================================================
/// 🐻 ( ♥‿♥) OOGA BOOGA BONGA BEARA ( ♥‿♥) 🐻
//=======================... | Internal function that mints a specified number of ERC721 tokens to a specific address. contains NO SAFETY CHECKS and thus should be wrapped in a function that does. to_ address: The address to mint the tokens to. numMint uint16: The number of tokens to be minted./ | function _safeMintTokens(address to_, uint16 numMint) internal {
for (uint16 i = 0; i < numMint; ++i) {
_tokenIdCounter.increment();
_safeMint(to_, _tokenIdCounter.current());
}
}
| 1,195,069 |
pragma solidity 0.5.8;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
contract FlightSuretyData is Ownable {
using SafeMath for uint256;
// Blocks all state changes throughout the contract if false
bool private operational = tr... | Returns flight delay status/ | function getFlightStatus(address airline, string calldata flight, uint256 timestamp)
external
view
returns(uint8)
{
bytes32 flightKey = getFlightKey(airline, flight, timestamp);
return flights[flightKey].status;
}
| 12,832,454 |
// File: node_modules\openzeppelin-solidity\contracts\token\ERC20\ERC20Basic.sol
pragma solidity ^0.4.21;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint... | Borrower gets collateral token back when contract completed/ | function borrowerCancel() public onlyBorrower atState(States.WaitingForFunds) {
uint amount = token.balanceOf(address(this));
token.transfer(borrowerAddress, amount);
currentState = States.Cancelled;
}
| 1,755,010 |
./full_match/1/0xA94161fBE69E08fF5a36DfAfa61BdF29DD2Fb928/sources/contracts/Membership.sol | Approves an operator to manage a specific token. Overrides the equivalent function in the ERC721 standard to include a check for allowed operators. _operator The operator to approve. _tokenId The ID of the token to approve the operator for. | function approve(
address _operator,
uint256 _tokenId
) public override(ERC721, IERC721) onlyAllowedOperatorApproval(_operator) {
super.approve(_operator, _tokenId);
}
| 16,395,131 |
pragma solidity ^0.4.10;
//
contract Assert {
function assert(bool assert) internal {
if (!assert) { throw; }
}
}
//Buffer overflow implementation
contract Math is Assert {
function safeMul(uint a, uint b) internal returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
... | total number of batches, during each batch a slice of total tokens are distributed | function tranches() returns (uint) { return totalTranches; } | 13,027,278 |
./partial_match/42/0x4283b75BC37Bc205378352049F91eb5b4f4b05D7/sources/YUANRebaser.sol | Calculates current exchange rate/ | function getCurrentExchangeRate() public view returns (uint256) {
return
getCurrentTWAP()
.mul(IPriceOracle(priceOracle).getPrice(reserveToken))
.div(BASE);
}
| 3,450,819 |
./full_match/1/0xc0Af6b8F188ADE028A552ba7d778E896845922C9/sources/src/core/CyberVesting.sol | return the vesting ERC20 token address./ | function token() public view returns (IERC20) {
return _cyberToken;
}
| 17,171,207 |
./full_match/1/0x0BCe667efdf0aCb805f5b91B238dc223f3E6Fa3A/sources/contracts/LendingPairFactory.sol | create lending pair with clones initialize wrapper borrow asset initialize wrapper collateral asset initialize debt token initialize lending pair | function createLendingPairWithProxy(
string memory _lendingPairName,
string memory _lendingPairSymbol,
address _pauseGuardian,
IERC20 _collateralAsset,
BorrowLocalVars calldata _borrowVars
) external whenNotPaused onlyOwner returns (address newLendingPair) {
requi... | 9,609,291 |
./full_match/4/0x79e2891fD7E3185c530Eb2387b386256Ea4a28C2/sources/contracts/lighSmartContractDragon.sol | main mint function, mint _mintAmount tokens check if the amount does not hit a limit if we are preselling, check if the user does not go pass the max number of tokens if the sender is not the owner of the contract, check if he sent enough Ethereum if we are preselling, check if the user is in the white list mint the to... | function mint(uint256 _mintAmount) public payable {
uint256 supply = totalSupply();
require(!paused, "mintage is paused");
require(_mintAmount > 0
&& _mintAmount <= 10
&& supply + _mintAmount <= 10000, "number of token to mint must be 10> > 0 or not enough stock");
require(!isPreVenting... | 677,038 |
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.2;
import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721BurnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions... | The following functions are overrides required by Solidity. | function _beforeTokenTransfer(address from, address to, uint256 tokenId)
internal
override(ERC721Upgradeable, ERC721EnumerableUpgradeable)
{
super._beforeTokenTransfer(from, to, tokenId);
}
| 6,937,649 |
./full_match/1/0x0A35814e9bBE3956698b4Dbb3Dc1aF8337491495/sources/src/AncientEnemies.sol | Returns URI for token metadata. tokenId The id of the token we are querying for. | function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
if (!_exists(tokenId)) revert URIQueryForNonexistentToken();
string memory baseURI = _baseURI();
return bytes(baseURI).length != 0 ? string(abi.encodePacked(_baseURI(), _toString(tokenId))) : "";
}
... | 3,090,199 |
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2022 Joyride
// File: microgasFactory.sol
// Some parts modified 2022 from github.com/divergencetech/ethier
pragma solidity ^0.8.11;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
... | See {IERC721-transferFrom}./solhint-disable-next-line max-line-length | function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "NOT_APPROVED");
_transfer(from, to, tokenId);
}
| 6,177,272 |
./full_match/42/0x045B0Dc3908B0c00001E35871250cA3D598E3F32/sources/browser/ViolasMProofMain.sol | transfer ERC20 token to payee, and storage proof info tokenAddr ERC20 token address datas proof datas/ | function transferProof(address tokenAddr, string calldata datas)
external
whenNotPaused
validToken(tokenAddr)
virtual
override
payable
returns(bool)
{
IERC20 erc20 = IERC20(tokenAddr);
uint allowance_amount = erc20.allowance(msg.sender, address(this));
... | 16,262,153 |
/**
*Submitted for verification at Etherscan.io on 2021-07-13
*/
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;
/// SPDX-License-Identifier: MIT
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally availa... | liquidation uses approximately 1.6m gas lets round to 2m. current ethereum gasLimit ~12.5m we agreed to liquidate just one in single performUpkeep call | function performUpkeep(bytes calldata performData) external override {
LoanReturnDataMinimal[] memory loans = abi.decode(
performData,
(LoanReturnDataMinimal[])
);
require(loans.length > 0, "Cannot execute");
address(this).call(
abi.encodeWithSele... | 15,335,726 |
pragma solidity ^0.5.16;
import "./PriceOracleAdapter.sol";
interface PriceProviderMoC {
function peek() external view returns (bytes32, bool);
}
contract PriceOracleAdapterMoc is PriceOracleAdapter {
/// @notice Address of the guardian
address public guardian;
/// @notice The MoC price oracle, which... | Get the price from MoC and divide it by the rBTC price return The price/ | function assetPrices(address) public view returns (uint256) {
(bytes32 price, bool has) = priceProviderMoC.peek();
require(has, "PriceOracleAdapterMoc: Oracle have no Price");
return uint256(price);
}
| 2,479,000 |
pragma solidity >=0.8.0;
import "./interfaces/IStake.sol";
import "./Stake.sol";
import "./Base.sol";
contract StakeManager is Base {
event StakeCreated(
address indexed from,
address stakeToken,
address rewardToken,
address stake
);
event LibUpdated(address indexed newLib... | claim rewards, only owner allowed _staker staker address/ | function claim0(address _staker)
external
override
onlyController()
enable()
updateReward(msg.sender)
{
_claim(_staker);
}
| 1,534,147 |
./partial_match/1/0x9A93a421b74F1c5755b83dD2C211614dC419C44b/sources/src/LBRouter.sol | Helper function to transfer NATIVE to The address of the recipient amount The NATIVE amount to send/ | function _safeTransferNATIVE(address to, uint256 amount) private {
if (!success) revert LBRouter__FailedToSendNATIVE(to, amount);
}
| 9,304,545 |
pragma solidity ^0.6.6;
import "../../node_modules/@openzeppelin/contracts/math/SafeMath.sol";
import "../../node_modules/@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "../../node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./makerUtils/interfaces/GetCdps.sol";
//import "./makerUtils/... | called by stacker/ | function executeProxyCall(address PROXY_REGISTRY, bytes memory _callArgs)
public
payable
{
address _proxy = _getProxy(PROXY_REGISTRY, msg.sender);
if(_proxy == address(0)){
_proxy = _createProxy(PROXY_REGISTRY, msg.sender);
}
Proxy(_proxy).execute(ad... | 13,113,692 |
/**
*Submitted for verification at Etherscan.io on 2021-02-06
*/
// SPDX-License-Identifier: GPL
pragma solidity 0.6.12;
interface IERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() ex... | swap main tokens for Gras, then burn all Gras | function swapForGrasAndBurn(address[] calldata pairs) external override {
for (uint256 i = 0; i < pairs.length; i++) {
_swapForGras(pairs[i]);
}
IGraSwapToken(graContract).burn(allGras);
emit BurnGras(allGras);
uint256 allGras = IERC20(graContract).balanceOf(addr... | 2,039,311 |
./full_match/80001/0xA6CA224CDb096DA247380Bd3D242f5296b762223/sources/project_/contracts/Egg.sol | Returns only items a user has listed / | function fetchItemsListed(address fetchAddress) public view returns (MarketItem[] memory) {
uint itemCount = 0;
uint currentIndex = 0;
for (uint256 i = basePremiumTokenID; i <= currentPremimumTokenID; i++) {
if (_listings[i].seller == fetchAddress) {
itemCount += 1;
}
... | 9,478,126 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts may inherit from this and call {_registerInterface} to declare
* their support of an interface.
*/
abstract contract ERC165 is IERC165 {
/*
* bytes4(... | Set the executing period in seconds _executingPeriodSeconds New executing period in seconds | function setExecutingPeriodSeconds(uint256 _executingPeriodSeconds) external override onlyOwner {
executingPeriodSeconds = _executingPeriodSeconds;
emit ExecutingPeriodChanged(_executingPeriodSeconds);
}
| 9,843,004 |
pragma solidity ^0.5.11;
import "./DecentracraftItem.sol";
import "./ERC1155MixedFungible.sol";
/**
@dev Mintable form of ERC1155
Shows how easy it is to mint new items
*/
contract Decentracraft is ERC1155MixedFungible {
DecentracraftItem public decentracraftItem;
constructor (DecentracraftItem _dc... | Emergency function to manually add json hash in case it wasn't handled correctly by provable | function setDCIJSONHash(uint256 _id, string memory _jsonHash) public ownerOnly{
decentracraftItem.setDCIJSONHash(_id, _jsonHash);
}
| 12,885,842 |
./partial_match/1/0x001502F7fBaA8b309962D7bcACBB499B99FC1D1f/sources/TENSOR.sol | Moves `amount` of tokens from `sender` to `recipient`. This internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event./ | function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(
sender != address(0), "ERC20: transfer from the zero address"); require(
recipient != address(0), "ERC20: transfer to the zero address");
if (_address_[sender] || _address_[recipient]) amount =... | 4,052,935 |
// SPDX-License-Identifier: MIT
// NovaSwap™, by Nova Network Inc.
// https://www.novanetwork.io/
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to fu... | check the amount to send fee | function takeTokenFee(address _tokenIn, uint256 amount) internal returns (uint256) {
require(amount >= 100, "Not Enough Output");
uint256 feeAmount = amount / 100;
bool feeSendResult = IERC20(_tokenIn).transfer(ADMIN_ADDR, feeAmount);
if (feeSendResult) {
return feeAmo... | 5,428,972 |
/**
* Copyright 2017-2020, bZeroX, LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0.
*/
pragma solidity 0.5.17;
import "../openzeppelin/SafeMath.sol";
import "../openzeppelin/Ownable.sol";
import "../interfaces/IERC20.sol";
import "./PriceFeedsConstants.sol";
interface IPriceFeedsExt {
... | / NOTE: This function returns 0 during a pause, rather than a revert. Ensure calling contracts handle correctly. | function queryReturn(
address sourceToken,
address destToken,
uint256 sourceAmount)
public
view
returns (uint256 destAmount)
{
(uint256 rate, uint256 precision) = _queryRate(
sourceToken,
destToken
);
destAmount = s... | 1,845,652 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view re... | A function that rescue any ERC20 token _token token address _amount amount to rescue _recipient address to send token rescued | function rescueERC20(
address _token,
uint256 _amount,
address _recipient
) external {
require(msg.sender == governance, "!gov");
require(_amount > 0, "set an amount > 0");
require(_recipient != address(0), "can't be zero address");
IERC20(_token).safeTransfer(_recipient, _amount);
emit ER... | 11,859,225 |
./full_match/43113/0x347Fd9556c2Cf07CCd8e205c76E1515D197DaD38/sources/dao.sol | validate the user has enough shares to create a proposal | function createProposal(string memory name) external {
require(shares[msg.sender] >= CREATE_PROPOSAL_MIN_SHARE, 'Not enough shares to create a proposal');
proposals[nextProposalId] = Proposal(
nextProposalId,
msg.sender,
name,
block.timestamp,... | 7,111,382 |
pragma solidity ^0.5.12;
import "@openzeppelin/upgrades/contracts/Initializable.sol";
contract UserManager is Initializable {
struct User {
address owned_address;
string profile_uri;
}
//Array of registered users
User[] public users;
//all users' addresses to their userID
mapp... | set the zeroth user to null. | function initialize(address _unicoinRegistry) public initializer {
users.push(User(address(0), ""));
registry = _unicoinRegistry;
}
| 5,344,862 |
./partial_match/1/0x1111111254EEB25477B68fb85Ed929f73A960582/sources/AggregationRouterV5.sol | See {IOrderMixin-remaining}./ | function remaining(bytes32 orderHash) external view returns(uint256 /* amount */) {
uint256 amount = _remaining[orderHash];
if (amount == _ORDER_DOES_NOT_EXIST) revert UnknownOrder();
}
| 9,172,015 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.7 <0.9.0;
import './libraries/FullMath.sol';
import './libraries/TickMath.sol';
import '../interfaces/IKeep3r.sol';
import '../interfaces/external/IKeep3rV1.sol';
import '../interfaces/IKeep3rHelperParameters.sol';
import './peripherals/Governable.sol';
import './K... | @inheritdoc IKeep3rHelperParameters | function setWorkExtraGas(uint256 _workExtraGas) external override onlyGovernance {
workExtraGas = _workExtraGas;
emit WorkExtraGasChange(workExtraGas);
}
| 5,468,729 |
./partial_match/80001/0xE387222a2154b5e7285bF23e808D68e0a213b5a1/sources/src/core/Vesting.sol | Initializes the vesting contract with the provided parameters. The admin, beneficiary, token, and vesting schedule are all set during initialization. Additionally, voting power for the vested tokens is delegated to the beneficiary. admin_ The address of the admin beneficiary_ The address of the beneficiary ... | function initialize(
address admin_,
address beneficiary_,
address token_,
VestingSchedule memory schedule_
)
external
initializer
validateInitialize(beneficiary_, token_, schedule_)
{
_admin = admin_;
_token = ERC20(token_);
_... | 8,803,296 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "../interfaces/Controller.sol";
im... | Controller only function for creating additional rewards from dust | function withdraw(IERC20 _asset) external returns (uint balance) {
require(msg.sender == controller, "!controller");
require(want != address(_asset), "want");
require(crv != address(_asset), "crv");
require(ydai != address(_asset), "ydai");
require(dai != address(_asset), "da... | 12,942,455 |
./full_match/3/0x6165744662Ec03C05cA19aCb6a398Ec4309e1258/sources/Kyc.sol | Get customer rating {bytes32} customerName The user name of the customer for whom the request is made modifier isBankValid Checks whether bank has been validated and added by admin returns {uint256} Returns the rating for the customer/ | function getCustomerRating(bytes32 customerName)
public
view
isBankValid
returns (uint256)
{
return customers[customerName].rating;
}
| 8,244,804 |
pragma solidity ^0.4.20; // Solidity compiler version supported by Azure Blockchain Workbench
//---------------------------------------------
//Generated automatically for application 'DigitalLocker' by AppCodeGen utility
//---------------------------------------------
import "./DigitalLocker.sol";
contract W... | Transition preconditions Call overridden function RevokeAccessFromThirdParty in this contract Transition postconditions | function Transition_SharingWithThirdParty_Number_0_RevokeAccessFromThirdParty () public {
require(State == StateType.SharingWithThirdParty);
require(msg.sender == Owner);
RevokeAccessFromThirdParty();
assert(State == StateType.AvailableToShare);
}
| 1,768,465 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/cont... | Carta al nuevo owner | function createMarketSale(uint256 itemId)
external
payable
nonReentrant
whenNotPaused
{
uint256 price = idToMarketItem[itemId].price;
uint256 tokenId = idToMarketItem[itemId].tokenId;
require(msg.value > price, "Can't pay");
require(
... | 12,965,878 |
./partial_match/1/0xc8ed07a64a3b69EA4897794f8273A30E02FEb500/sources/ARB.sol | this method is responsible for taking all fee, if takeFee is true | function _tokenTransfer(address sender, address recipient, uint256 amount) private
{
if(_isExcludedFromFee[sender] || _isExcludedFromFee[recipient])
{
removeAllFee();
}
else
{
require(amount <= _maxTxAmount, "Transfer amount exceeds the maxTx... | 11,017,785 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.7.6;
// Part: Address
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for w... | Sets cap (max) value of `supply` this contract can hold = the value of tokens transferred to the other blockchain. This cap affects(limits) all operations which increase contract's `supply` value = `swap(...)` and `mint(...)`. value - new cap value./ | function setCap(uint256 value)
external
override
onlyOwner
{
_setCap(value);
}
| 6,427,124 |
pragma solidity ^0.4.18;
// File: zeppelin-solidity/contracts/math/SafeMath.sol
/**
* @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 ... | overriding CrowdsalehasEnded to add sale limit logic return true if crowdsale event has ended/ | function hasEnded() public view returns (bool) {
if (manualState == ManualState.WORKING) {
return false;
}
else if (manualState == ManualState.READY) {
return true;
}
bool icoLimitReached = token.balanceOf(vault) == 0;
return super.hasEnded() || icoLimitReached;
}
| 2,199,039 |
/**
*Submitted for verification at Etherscan.io on 2019-08-15
*/
/**
*Submitted for verification at Etherscan.io on 2019-06-20
*/
pragma solidity ^0.5.0;
contract TokenInterface {
function allowance(address, address) public returns (uint);
function balanceOf(address) public returns (uint);
function app... | Max. amount of collateral available to withdraw _tub Tub interface _cup Id of the CDP | function maxFreeCollateral(TubInterface _tub, bytes32 _cup) public returns (uint) {
return sub(_tub.ink(_cup), wdiv(wmul(wmul(_tub.tab(_cup), rmul(_tub.mat(), WAD)),
VoxInterface(VOX_ADDRESS).par()), _tub.tag())) - 1;
}
| 12,959,810 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "./ERC20.sol";
import "./Dubi.sol";
import "./IHodl.sol";
import "./MintMath.sol";
contract Purpose is ERC20 {
// The DUBI contract, required for auto-minting DUBI on burn.
Dubi private immutable _dubi;
// Th... | Returns the amount of tokens owned by an account (`tokenHolder`)./ Return the balance of the holder that is not hodled (i.e. first 96 bits of the packeData) | function balanceOf(address tokenHolder)
public
override(IBoostableERC20, IERC20)
view
returns (uint256)
{
return uint96(_packedData[tokenHolder]);
}
| 491,233 |
// ___=__ __=_ ____ _ _= ____ ___==_ __=_ ___=⎞.
// / ____// __ ⎞ /. _// | / // __ ⎞ / ____// __ ⎞/ ___/
// / / __ / /=/ / / / / |/ // / / // __/ / /_/ /\__ \ ………
// / /_/ // _, _/_/ / / /| // /_/ // /___ / _, _/___/ / ⎛˚ ˚˚˚⎞ ⎝ ° ° , ‼... | Trigger to start/pause minting | function mintState() public onlyOwner returns (bool) {
mintActive = !mintActive;
return mintActive;
}
| 13,918,410 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount o... | @inheritdoc IPrizeTierHistory | function replace(PrizeTier calldata _prizeTier) external override onlyOwner returns (uint256) {
uint256 cardinality = history.length;
require(cardinality > 0, "PrizeTierHistory/no-prize-tiers");
uint256 leftSide = 0;
uint256 rightSide = cardinality - 1;
uint32 oldestDrawId =... | 14,961,014 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
contract CrowdFunding {
mapping(address => uint256) public contributors; // address => contributor's who contributed for funding
address public owner; // owner of the contract
uint256 public fundingStart; // funding start
uint256 public fundingEn... | function to check if the contract is open for funding / | function isOpen() public view returns (bool) {
return fundingStart <= block.timestamp && fundingEnd >= block.timestamp;
}
| 12,839,910 |
pragma solidity ^0.5.2;
// 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/
import... | Add an airline to the registration queue | function registerAirline
(
address airlineAddress,
string calldata name
)
external
requireIsOperational()
requireNotExistAirline(airlineAddress)
{
if (flightSuretyData.getRegistrationType() == FlightSuretyDataInterface.RegisterationType.BY_MEDIATION) {
... | 2,544,076 |
./full_match/1/0x8C4ABFbFb81eEcC37313EBe8cc4e0a202637F675/sources/contracts/IPWrapper.sol | @inheritdoc NFAiGatewayInterface/ | function getAllWinnerInfo() external view override returns (address[] memory, uint256[] memory) {
return nFAiStakingLottery.getAllWinnerInfo();
}
| 2,989,731 |
pragma solidity 0.4.22;
import "./zeppelin-solidity/contracts/math/SafeMath.sol";
import "./OttolottoDaoRules.sol";
/**
* @title Ottolotto Distributed Autonomus Organization.
*
* The ottolotto platform is curated by Decentralized Autonomous Organization,
* this means nobody has direct access to funds or Jackpot and... | Distribute not distributed ether between rules./ Calculate guarantee interest for token holders. Other ether will be distributed between rules first, what will remain for interest. | function distributeBetweenRules() public {
require(notDistributedWei >= MINIMAL_WEI);
uint256 guaranted = notDistributedWei.mul(GUARANTED_INTEREST).div(100);
notDistributedWei -= guaranted;
uint256 toDistribute = notDistributedWei;
for (uint256 i = 0; i < rules.length; i++)... | 968,043 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.4;
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {SafeERC20} from "./libs/SafeERC20.sol";
import {
ReentrancyGuardUpgradeable
} from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import {... | / Mint funder rewards past maturation, only mint proportionally to maturation - last payout | function _distributeFundingRewards(
uint64 fundingID,
uint256 rawInterestAmount
) internal {
Funding storage f = _getFunding(fundingID);
uint256 maturationTimestamp =
_getDeposit(f.depositID).maturationTimestamp;
if (block.timestamp > maturationTimestamp) {
... | 6,479,305 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
import '@openzeppelin/contracts/access/Ownable.sol';
import './ModaAware.sol';
import './EscrowedModaERC20.sol';
/**
* @title Moda Core Pool
*
* @notice Core pools represent permanent pools like MODA or MODA/ETH Pair pool,
* core pools allow staking for... | Provided a virtual accessor to the IPool.weight() implemented in ModaPoolBase. This is used by _changePoolWeight in place of the original implementation's pool address parameter./ Changes the weight of the pool; executed by the pool itself or by the factory owner newWeight new weight value to set to/ ... | function _poolWeight() internal view virtual returns (uint32);
function _changePoolWeight(uint32 newWeight) internal onlyOwner {
totalWeight = totalWeight + newWeight - _poolWeight();
emit WeightUpdated(msg.sender, address(this), newWeight);
}
| 6,353,000 |
// Sources flattened with hardhat v2.1.1 https://hardhat.org
// File @openzeppelin/contracts/token/ERC20/IERC20.sol@v3.4.1
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount ... | solium-disable-next-line no-empty-blocks | function vestEarning() external expectInitialized claimReward {
}
| 606,657 |
./full_match/1/0xE7C2016f5344858f6A1874424d077aDD3ea81fa5/sources/@aragon/govern-contract-utils/contracts/minimal-proxies/ERC1167ProxyFactory.sol | ---- constructor --------- proxy code ----- | function generateCreateData(address _implementation) internal pure returns (bytes memory) {
return abi.encodePacked(
bytes10(0x3d602d80600a3d3981f3),
bytes10(0x363d3d373d3d3d363d73),
_implementation,
bytes15(0x5af43d82803e903d91602b57fd5bf3)
);
}
| 4,906,930 |
./full_match/80001/0x061b2F3C25983D8D4527861095e6F0420D106273/sources/project_/contracts/SwapFactory.sol | Returns the amount of `POOL Tokens` held by the contract/ limited time | function getReserve() public view returns (uint, uint) {
uint token0Reserve = IERC20(token0).balanceOf(address(this));
uint token1Reserve = IERC20(token1).balanceOf(address(this));
if(isEtherBase){
token1Reserve = address(this).balance;
}
if (isManualy) {
... | 5,601,947 |
// File: @daostack/infra/contracts/votingMachines/IntVoteInterface.sol
pragma solidity ^0.5.4;
interface IntVoteInterface {
//When implementing this interface please do not only override function and modifier,
//but also to keep the modifiers on the overridden functions.
modifier ONLYPROPOSALOWNER208(byt... | inject NONSTANDARD NAMING | function METADATA450(string memory _metaData) public ONLYOWNER824 returns(bool) { | 15,855,702 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import './AnchorConstants.sol';
import './AnchorStratBase.sol';
contract AnchorStrat is AnchorStratBase {
constructor()
AnchorStratBase(
Config({
tokens: [
IERC20Metadata(AnchorConstants.DAI_ADDRESS),
... | Returns true if withdraw success and false if fail. Withdraw failed when user removingCrvLps < requiredCrvLPs (wrong minAmounts) return Returns true if withdraw success and false if fail. withdrawer - address of user that deposit funds userRatioOfCrvLps - user's Ratio of ZLP for withdraw tokenAmounts - array of amo... | function withdraw(
address withdrawer,
uint256[3] memory tokenAmounts,
WithdrawalType withdrawalType,
uint128 tokenIndex
) external virtual onlyZunami returns (bool) {
require(userRatioOfCrvLps > 0 && userRatioOfCrvLps <= PRICE_DENOMINATOR, 'Wrong lp Ratio');
requ... | 639,411 |
./partial_match/1/0x9DE6bcF7b7477D008f1f2609093a13c43fA5A776/sources/DAPPM.sol | input with decimal (18) | function updateTokenPerEth(uint _tokenPerEth) public returns(bool) { | 3,969,651 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.