file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./partial_match/1/0x4A8426D8Cb94686116F93f85A3a0350e53f15552/sources/MaxOne.sol | Destroy tokens Remove `_value` tokens from the system irreversibly _value the amount of money to burn/ Buried addresses cannot be burnt Check if the sender has enough Subtract from the sender Updates totalSupply | function burn(uint256 _value) public returns (bool success) {
require(!buried[msg.sender]);
require(balances[msg.sender] >= _value);
balances[msg.sender] -= _value;
totalSupply -= _value;
Burn(msg.sender, _value);
return true;
}
| 2,757,722 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.8;
import {PauseStorage} from "./../libraries/PauseStorage.sol";
import {ContractOwnershipStorage} from "./../../access/libraries/ContractOwnershipStorage.sol";
import {Context} from "@openzeppelin/contracts/utils/Context.sol";
/// @title Pausing mechanism (proxiab... | Unpauses the contract. Reverts if the sender is not the contract owner. Reverts if the contract is not paused. Emits an {Unpaused} event. | function unpause() external {
ContractOwnershipStorage.layout().enforceIsContractOwner(_msgSender());
PauseStorage.layout().unpause();
}
| 6,392,095 |
./full_match/80001/0xd55A0Ca328477b75d6f7F738237473005c90B809/sources/project_/contracts/KeyHolder.sol | Initializer internal function for the Identity contract. initialManagementKey The ethereum address to be set as the management key of the ONCHAINID./ solhint-disable-next-line func-name-mixedcase | function __Key_init(
address initialManagementKey
) internal onlyInitializing {
bytes32 _key = keccak256(abi.encode(initialManagementKey));
_keys[_key].key = _key;
_keys[_key].purposes = [KEY_PURPOSE_MANAGEMENT_KEY];
_keys[_key].keyType = KEY_TYPE_ECDSA;
_keysByPu... | 5,638,167 |
pragma solidity 0.5.4;
import 'ROOT/reporting/IMarket.sol';
import 'ROOT/libraries/Initializable.sol';
import 'ROOT/libraries/Ownable.sol';
import 'ROOT/libraries/collections/Map.sol';
import 'ROOT/reporting/IUniverse.sol';
import 'ROOT/reporting/IReportingParticipant.sol';
import 'ROOT/reporting/IDisputeCrowdsourcer.... | The derive call will validate that an Invalid report is entirely paid out on the Invalid outcome | function doInitialReportInternal(address _reporter, uint256[] memory _payoutNumerators, string memory _description) private returns (bool) {
require(!universe.isForking());
IInitialReporter _initialReporter = getInitialReporter();
uint256 _timestamp = augur.getTimestamp();
require(_t... | 12,906,020 |
pragma solidity ^0.4.24;
contract MUTOCoin {
address owner;
// 미스트 브라우저가 토큰을 인식하게 만드는 변수들
string public constant name = "MUTO";
string public constant symbol = "MTC";
uint8 public constant decimals = 8;
// 계좌가 가지고 있는 토큰의 양
mapping (address => uint) public balanceOf;
... | 주소를 입력하지 않은 경우의 예외 처리 잔고가 부족한 경우의 예외 처리 | function transfer(address _to, uint _value) public {
address _from = msg.sender;
require(_to != address(0));
require(balanceOf[_from] >= _value);
balanceOf[_from] -= _value;
balanceOf[_to] += _value;
emit Transfer(_from, _t... | 14,089,312 |
/**
*Submitted for verification at Etherscan.io on 2022-03-28
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.10;
abstract contract IDfxOracle {
function read() public virtual view returns (uint256);
}
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)
/**
* @dev Interfa... | In case anyone sends tokens to the wrong address | function recoverERC20(address _a) public onlyRole(SUDO_ROLE) {
require(_a != DFX && _a != CADC, "no");
IERC20(_a).safeTransfer(
msg.sender,
IERC20(_a).balanceOf(address(this))
);
}
| 7,859,928 |
./full_match/4/0x2A391abb0E042566A7C24249ECDb2533EaB5D76F/sources/https_/raw.githubusercontent.com/0xcert/ethereum-erc721/master/src/contracts/tokens/nf-token-enumerable.sol | Returns NFT ID by its index. _index A counter less than `totalSupply()`. return Token id./ | function tokenByIndex(
uint256 _index
)
external
override
view
returns (uint256)
{
require(_index < tokens.length, INVALID_INDEX);
return tokens[_index];
}
| 726,822 |
./partial_match/56/0x38E961f09112523bfBb1C4ff0cC2E59808D81c10/sources/NYACDAIPool.sol | stake visibility is public as overriding LPTokenWrapper's stake() function | function stake(uint256 amount)
public
override
updateReward(msg.sender)
checkStart
{
require(amount > 0, 'NYACDAIPool: Cannot stake 0');
uint256 newDeposit = deposits[msg.sender].add(amount);
deposits[msg.sender] = newDeposit;
super.stake(amount);... | 11,280,898 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.11;
pragma experimental ABIEncoderV2;
// ====================================================================
// | ______ _______ |
// | / _____________ __ __ / ____(_____ ____ _____ ________ |
// | / /_ ... | Checkpoint the Gauge for this address | function checkpointGauge() external onlyByOwnerOrGovernance {
gauge_frax3crv.user_checkpoint(address(this));
}
| 14,527,871 |
./full_match/1/0x1f64eA8745E316CfDE4B92353a1bB9654198A793/sources/src/x-pods/XPodAuctions.sol | end the current auction a new auction cannot be started before the previous one is ended hence there is no need to enable ending of a specific auction/ | function endAuction() external onlyOwner {
if (auctions[auctionId].stage != AuctionStage.Active) {
revert AuctionMustBeActive();
}
emit AuctionEnded(auctionId);
}
| 17,076,690 |
./partial_match/1/0x98F3F5A4e1bCE8DCe2f3e02Eef16Df5c3DF6e2c8/sources/SDT.sol | function that is called when transaction target is an address | function transferToAddress(address _to, uint _value, bytes _data) private returns (bool success) {
if (balanceOf(msg.sender) < _value) revert();
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value.mul(99).div(100));
Transfer(msg.sender, _to, _value.mul(9... | 3,943,571 |
pragma solidity ^0.5.11;
import "./GenericAsset.sol";
contract RaffleItem is GenericAsset {
constructor(
string memory _name,
string memory _ticker
)
GenericAsset(_name, _ticker)
public
{
setMinterStatus(msg.sender, true);
}
/**
* @dev Mint multiple... | Mint a single item _to The owner to receive the asset/ | function mint(
address _to
)
public
onlyMinters(msg.sender)
returns (uint256 tokenId)
{
_tokenIds.increment();
uint256 newItemId = _tokenIds.current();
_mint(_to, newItemId);
return newItemId;
}
| 13,109,140 |
./full_match/4/0x3ABc8aCa8163B53754741F52612C47a457db5D00/sources/contracts/conduit/ConduitController.sol | Initiate conduit ownership transfer by assigning a new potential owner for the given conduit. Once set, the new potential owner may call `acceptOwnership` to claim ownership of the conduit. Only the owner of the conduit in question may call this function. conduit The conduit for which to initia... | function transferOwnership(address conduit, address newPotentialOwner)
external
override
{
_assertCallerIsConduitOwner(conduit);
if (newPotentialOwner == address(0)) {
revert NewPotentialOwnerIsZeroAddress(conduit);
}
if (newPotentialOwner == _condui... | 660,883 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
import '@openzeppelin/contracts/math/SafeMath.sol';
import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/utils/ReentrancyGuard.sol';
import '@openzeppelin/contracts/... | Safe premia transfer function, just in case if rounding error causes contract to not have enough PREMIAs. _to The address to which send premia _amount The amount to send | function _safePremiaTransfer(address _to, uint256 _amount) internal {
uint256 premiaBal = premia.balanceOf(address(this));
if (_amount > premiaBal) {
premia.safeTransfer(_to, premiaBal);
premia.safeTransfer(_to, _amount);
}
}
| 5,543,788 |
pragma solidity =0.5.16;
pragma experimental ABIEncoderV2;
/**
* ______ ____ __ ______
* / ____/____ _ ____ ___ ___ / __ \ ___ ____ _ ____/ /___ _____ / ____/____ _____
* / / __ / __ `// __ `__ \ / _ \ / /_/ // _ \ / __ `// __ // _ \... | Returns player info of `account`./ | function player(address account)
public
view
returns (
uint256 serial,
bytes memory name,
bytes memory adviserName,
address payable adviser,
uint256 messageCounter,
uint256 cookieCounter,
uint256 followerCoun... | 12,693,101 |
./full_match/1/0x33A8d92B2BE84755441C2b6e39715c4b8938242c/sources/contracts/interfaces/IAssetRegistry.sol | IAssetRegistry The AssetRegistry is in charge of maintaining the ERC20 tokens eligible to be handled by the rest of the system. If an asset is in the registry, this means: 1. Its ERC20 contract has been vetted 2. The asset is the only asset for that ERC20 3. The asset can be priced in the UoA, usually... | interface IAssetRegistry is IComponent {
event AssetRegistered(IERC20 indexed erc20, IAsset indexed asset);
event AssetUnregistered(IERC20 indexed erc20, IAsset indexed asset);
function init(IMain main_, IAsset[] memory assets_) external;
function refresh() external;
function register(IAsset ass... | 3,864,726 |
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
import "Ownable.sol";
import "Pausable.sol";
import "PaymentSplitter.sol";
import "ERC721A.sol";
import "Whitelist.sol";
contract InvisibleKennel is ERC721A, Ownable, Pausable, Whitelist, PaymentSplitter {
/**
* General constants and immutable v... | Unpauses functions modified with `whenNotPaused`./ | function unpause() external virtual whenPaused onlyOwner {
_unpause();
}
| 267,753 |
// SPDX-License-Identifier: GPL-3.0
// File: @openzeppelin/contracts/utils/Strings.sol
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
... | reserved NFTs for creator | function reservedMint(uint256 number) public {
require(msg.sender == projectWallet, 'Not allowed to Mint!');
require(_reservedMints + number <= maxReservedMints, "Not enough Reserved NFTs for Creator left to mint..");
for (uint256 i = 0; i < number; i++) {
uint256 tid = tokenId(... | 288,746 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be... | Update the given pool's TOKEN allocation point. Can only be called by the owner. | function set(
uint256 _poolId,
uint256 _tokenPerBlock,
bool _withUpdate
) external onlyOwner {
if (_withUpdate) {
massUpdatePools();
}
poolInfo[_poolId].tokenPerBlock = _tokenPerBlock;
}
| 1,154,335 |
./partial_match/4/0xBBd30514cEf49Ca21332D856fBab1Db7E8024B48/sources/QuotaDelegate.sol | get debt of storeman, tokenId tokenId tokenPairId of crosschain storemanGroupId PK of source storeman group | function getDebt(uint tokenId, bytes32 storemanGroupId)
public
view
returns (uint debt, uint debt_receivable, uint debt_payable)
{
uint tokenKey = getTokenKey(tokenId);
Quota storage quota = v2QuotaMap[tokenKey][storemanGroupId];
return (quota._debt, quota.debt_re... | 8,608,737 |
/**
* Copyright 2017-2020, bZeroX, LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0.
*/
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
import "../../connectors/loantoken/interfaces/ProtocolSettingsLike.sol";
import "../../connectors/loantoken/AdvancedTokenStorage.sol";
// It i... | keccak256("iToken_FunctionPause") | function toggleFunctionPause(
bool isPaused
) public onlyAdmin {
bytes32 slot =
keccak256(
abi.encodePacked(
bytes4(keccak256(abi.encodePacked(funcId))),
uint256(0xd46a704bc285dbd6ff5ad3863506260b1df02812f4f857c8cc852317a6ac64f2... | 12,873,038 |
./full_match/1/0xc751D8c8f7b2fa4d9d01507E5A088F1b136e10c2/sources/src/PunksBids.sol | Sets a new local fee rate _localFeeRate The new fee rate/ | function setLocalFeeRate(uint256 _localFeeRate) external onlyOwner {
if (_localFeeRate > MAX_FEE_RATE) {
revert FeeRateTooHigh(_localFeeRate);
}
localFeeRate = _localFeeRate;
emit LocalFeeRateUpdated(localFeeRate);
}
| 9,823,728 |
./full_match/100/0x17aB9B14AC7659390B3994f9e67Bf833e60Ec1BD/sources/contracts/core/connext/libraries/SwapUtilsExternal.sol | update the swap fee fee cannot be higher than 1% of each swap self Swap struct to update newSwapFee new swap fee to be applied on future transactions/ | function setSwapFee(Swap storage self, uint256 newSwapFee) external {
require(newSwapFee < Constants.MAX_SWAP_FEE + 1, "too high");
self.swapFee = newSwapFee;
emit NewSwapFee(newSwapFee);
}
| 14,276,336 |
pragma ton-solidity >= 0.52.0;
pragma AbiHeader time;
pragma AbiHeader pubkey;
pragma AbiHeader expire;
//================================================================================
//
import "../interfaces/IBase.sol";
import "../interfaces/ILiquidFTWallet.sol";
//================================================... | ======================================== Check allowance | function transfer(uint128 amount, address targetOwnerAddress, address initiatorAddress, address notifyAddress, bool allowReceiverNotify, TvmCell body) public override onlyAllowed reserve
{
require(_balance >= amount, ERROR_NOT_ENOUGH_BALANCE );
require(targetOwnerAddres... | 14,059,216 |
./full_match/137/0x6857D601E199e7dC2Da276bc6E860124948B4F34/sources/project_/contracts/Pool.sol | / calculates the performance/admin fee (takes a cut - the admin percentage fee - from the pool's interest, strategy rewards). calculates the "gameInterest" (net interest) that will be split among winners in the game calculates the rewardTokenAmounts that will be split among winners in the game when there's no winners, ... | function _calculateAndSetAdminAccounting(uint256 _grossInterest, uint256[] memory _grossRewardTokenAmount)
internal
{
IERC20[] memory _rewardTokens = rewardTokens;
uint256[] memory _adminFeeAmount = adminFeeAmount;
uint256[] memory _rewardTokenAmounts = rewardTokenAmounts;
... | 4,741,896 |
./partial_match/1/0xE5C9D1c1c938360fBF81939Df3edD0e164c57B83/sources/Oracle.sol | produces the cumulative price using counterfactuals to save gas and avoid a call to sync. if time has elapsed since the last update on the pair, mock the accumulated price values subtraction overflow is desired addition overflow is desired counterfactual counterfactual | function currentCumulativePrices(address pair)
internal
view
returns (uint price0Cumulative, uint price1Cumulative, uint32 blockTimestamp) {
blockTimestamp = currentBlockTimestamp();
price0Cumulative = IUniswapV2Pair(pair).price0CumulativeLast();
price1Cumulative = IUniswapV2Pair... | 9,244,802 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functio... | Checks if an address is blacklisted return bool | function blacklisted(address account) external view virtual returns (bool) {
return _blacklist[account];
}
| 14,906,505 |
./full_match/80001/0x000db918198c72D4093174059710f3fc4Ac2e8D0/sources/contracts/RecruitmentATSSmartContract.sol | Function to register a new user | function registerUser(string memory _email) public {
require(!users[_email].isRegistered, 'Username already exists');
}
| 839,429 |
./full_match/43113/0x1371314364F0E998f2E9667dF1a0702DEAA73E66/sources/contracts/ftso/priceProviderMockContracts/priceProviderMockFtso.sol | Reveals submitted price during epoch reveal period _voter Voter address _epochId Id of the epoch in which the price hash was submitted _price Submitted price in USD _random Submitted random number The hash of _price and _random must be equal to the submitted... | function revealPriceSubmitter(
address _voter,
uint256 _epochId,
uint256 _price,
uint256 _random,
)
external override onlyPriceSubmitter
{
require(_price < 2**128, ERR_PRICE_TOO_HIGH);
uint256 revealStartTime = firstEpochStartTime + (_epochId + 1) * s... | 7,109,315 |
// SPDX-License-Identifier: GPL-3.0-only
// This is a PoC to use the staking precompile wrapper as a Solidity developer.
pragma solidity >=0.8.0;
import "./StakingInterface.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/c... | Calls directly into the interface. Assumes the contract has atleast 10 ether so that the nomination will be successful. | function unsafe_attempt_to_nominate() public onlyRole(DEFAULT_ADMIN_ROLE) {
staking.nominate(target, 10 ether, 99, 99);
}
| 6,401,191 |
pragma solidity 0.5.1;
/**
* @dev Base contract for teams
*/
contract CryptoTeam {
using SafeMath for uint256;
//Developers fund
address payable public teamAddressOne ; //inject UNINIT LOCAL/STATE VAR
address payable public teamAddressTwo ; //inject UNINIT LOCAL/STATE VAR
address payable public... | Getting ETH prize of participant participant Address of participant/ | function calculateETHPrize(address participant) public view returns(uint) {
if (depositBears[participant] > 0) {
payout = totalSupply.mul(depositBears[participant]).div(totalSupplyOfBears);
}
if (depositBulls[participant] > 0) {
payout = totalSupply.mul(depositBu... | 1,070,546 |
pragma solidity 0.6.12;
interface IERC20 {
function TOTALSUPPLY831() external view returns (uint256); //i... | inject NONSTANDARD NAMING | function SAFETRANSFERFROM64(IERC20 token, address from, address to, uint256 value) internal { | 14,087,535 |
./full_match/7700/0x11a337726015D3E8a8888a4Aa99b1274c529Af3D/sources/contracts/modules/ReserveAuction/Core/ERC20/ReserveAuctionCoreErc20.sol | Creates an auction for a given NFT _tokenContract The address of the ERC-721 token _tokenId The id of the ERC-721 token _duration The length of time the auction should run after the first bid _reservePrice The minimum bid amount to start the auction _sellerFundsRecipient The address to send funds to once the aucti... | function createAuction(
address _tokenContract,
uint256 _tokenId,
uint256 _duration,
uint256 _reservePrice,
address _sellerFundsRecipient,
uint256 _startTime,
address _bidCurrency
) external nonReentrant {
address tokenOwner = IERC721(_tokenContrac... | 4,656,765 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.7;
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/E... | generate the Enodi pair path of token -> weth make the swap | function swapTokensForEth(IERC20 token, uint256 tokenAmount) internal {
address[] memory path = new address[](2);
path[0] = address(token);
path[1] = router.WETH();
token.approve(address(router), tokenAmount);
router.swapExactTokensForETHSupportingFeeOnTransferTokens(
... | 976,102 |
./full_match/4/0x03cf51714ace856f8b80d3855Ac46c70E5e90963/sources/contracts/PaymentSplitter.sol | Add a new payee to the contract. account The address of the payee to add. _shares The number of shares owned by the payee./ | function addPayee(address account, uint256 _shares) public onlyRole(DEFAULT_ADMIN_ROLE) {
_addPayee(account, _shares);
}
| 12,386,926 |
pragma solidity ^0.4.24;
import "kleros-interaction/contracts/standard/arbitration/Arbitrator.sol";
import "kleros-interaction/contracts/standard/arbitration/Arbitrable.sol";
import "kleros-interaction/contracts/standard/rng/RNG.sol";
import "kleros-interaction/contracts/standard/rng/ConstantNG.sol"; // Compile for te... | Get the current ruling of a specified dispute. _disputeID The ID of the dispute. return The current ruling./ | function currentRuling(uint _disputeID) public view returns(uint ruling) {
Dispute storage dispute = disputes[_disputeID];
ruling = dispute.voteCounters[dispute.voteCounters.length - 1].winningChoice;
}
| 13,108,166 |
./partial_match/1/0xc92ec84423db017ee76354b786ac9C60beA35379/sources/UmbrellaMetaPool.sol | Sets a concept as settling (allowing claims) allow out of order if we sort, otherwise revert | function _setSettling(uint8 conceptIndex, uint32 settleTime, bool needs_sort)
public
onlyArbiter
{
require(conceptIndex < coveredConcepts.length, "setSettling:!index");
require( settleTime < block.timestamp, "setSettling:!settleTime");
if (!needs_sort && claimTime... | 15,513,070 |
/**
*Submitted for verification at Etherscan.io on 2022-01-04
*/
// SPDX-License-Identifier: MIT
// Amended by HashLips
/**
!Disclaimer!
These contracts have been used to create tutorials,
and was created for the purpose to teach people
how to create smart contracts on the blockchain.
please review t... | Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but performing a delegate call. _Available since v3.4._/ | function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
| 6,804,131 |
./full_match/1/0xA5E2F5fcEEEA67C07b317c51F3741d2AA0775058/sources/contracts/ERC721Comet.sol | Sets the max supply of tokens. value The max supply./ | function setMaxSupply(uint256 value) public onlyOwner {
_maxSupply = value;
emit MaxSupplyUpdated(value);
}
| 8,329,527 |
pragma solidity ^0.6.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions... | Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as... | function getPriorVotes(address account, uint blockNumber)
external
view
returns (uint256)
{
require(blockNumber < block.number, "YFARM::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return... | 1,366,989 |
pragma solidity ^0.4.9;
library strings {
struct slice {
uint _len;
uint _ptr;
}
function memcpy(uint dest, uint src, uint len) private {
// Copy word-length chunks while possible
for(; len >= 32; len -= 32) {
assembly {
mstore(dest, mload(src))... | for balance of a account | function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
| 7,684,323 |
./full_match/1/0xbcA5aFaA5f6Dc540c9f386f9bc342946D885B0A5/sources/contracts/COINS_EMPIRE/crowdsale.sol | Guards against integer overflows require(c / a == b,"SafeMath: Multiply overflow"); | function safeMultiply(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
uint256 c = a * b;
return c;
}
}
| 8,337,191 |
./full_match/80001/0x9bf7DE2862844034293D9c3cf121015200Fc2B62/sources/contracts/Contract.sol | Check if a given address represents an ERC721 token | function isERC721Token(address tokenAddress) internal view returns (bool) {
uint256 size;
assembly {
size := extcodesize(tokenAddress)
}
return size > 0;
}
| 860,330 |
// File: @onchain-id/solidity/contracts/IERC734.sol
pragma solidity ^0.6.2;
interface IERC734 {
... | inject NONSTANDARD NAMING | function UNBINDTOKEN130(address _token) external; | 5,524,157 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;
import "./external/@openzeppelin/token/ERC20/extensions/IERC20Metadata.sol";
import "./external/spool-core/SpoolOwnable.sol";
import "./interfaces/IVoSPOOL.sol";
/* ========== STRUCTS ========== */
/**
* @notice global tranche struct
* @dev used so it can be... | Returns next tranche end time return trancheEndTime end time for next tranche/ | function getNextTrancheEndTime() external view returns (uint256) {
return getTrancheEndTime(getCurrentTrancheIndex());
}
| 233,179 |
./full_match/1/0x6227Ad831E583B3546117c2a2fA788068e44a72b/sources/root/exchange-all/melonswap/deploy/litchiswap-1.0-deploy/mainnet/1-deploy-factory/contracts/UniswapV2Factory.sol | if fee is on, mint liquidity equivalent to 1/6th of the growth in sqrt(k) | function _mintFee(uint112 _reserve0, uint112 _reserve1) private returns (bool feeOn) {
address feeTo = IUniswapV2Factory(factory).feeTo();
feeOn = feeTo != address(0);
if (feeOn) {
if (_kLast != 0) {
uint rootK = Math.sqrt(uint(_reserve0).mul(_reserve1));
... | 4,885,401 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol";
contract RandomNumberConsumer is VRFConsumerBase {
bytes32 internal keyHash;
uint256 internal fee;
uint256 internal randomNumber;
constructor()
VRFC... | Send a miner through a random portal for GEMs _minerId id of the miner (0-3)getRandomNumber(); Disabled unless running on Rinkeby and can load RandomNumberConsumer with LINK | function warp(uint _minerId) public {
require(balanceOf(msg.sender, _minerId) - activeMiners[msg.sender][_minerId] >= 1, "You don't own any inactive miners");
require(activeMiners[msg.sender][_minerId] <= 10, "Maximum of 10 active miners warped per id");
require(departedCount[msg.sender][_mi... | 1,785,739 |
./full_match/1/0x5dFE942a8B781ACdfe06EE55DAEf06B9FaB86aF8/sources/contracts/Staking.sol | First, send all unclaimed rewards | function unstake() external {
UserInfo storage user = userInfo[msg.sender];
require(user.amount >= 0, "insufficient staked");
require(user.createdAt + lockTime <= block.timestamp, "tokens are locked");
claim();
uint256 userAmount = user.amount;
user.amount = 0;
spiToken.transfer(msg.sender, userAmount... | 9,666,905 |
pragma solidity ^0.4.6;
contract MetaPoc {
/* VARIABLES */
address public _owner;
address public _filiate;
struct Execution {
uint dateCreated;
string hash;
bool validated;
uint dateValidated;
}
mapping (string => uint) private mapExecs;
... | PRIVATE FUNCTIONS / | function MajListAll() private {
MajListVal();
MajListNotVal();
}
| 929,915 |
./full_match/3/0x7CeB817dfFED20697EAe846D21985229C59b91b0/sources/browser/hello.sol | This program takes the message input and give output/ | function setMessage(string memory newMessage) public {
message = newMessage;
}
| 8,123,635 |
pragma solidity ^0.5.0;
contract GoDice{
uint constant HOUSE_EDGE_PERCENT = 1;
uint constant HOUSE_EDGE_MINIMUM_AMOUNT = 0.0003 ether;
uint constant MIN_JACKPOT_BET = 0.1 ether;
uint constant JACKPOT_MODULO = 1000;
uint constant JACKPOT_FEE = 0.001 ether;
uint constant MIN_BET = 0.01 ether;... | (Safe) assumption - nobody will write into RAM during this method invocation. Zero slice length marks the end of uncle proof. Verify the canonical block header using the computed sha3Uncles. At this moment the canonical block hash is known. | function verifyMerkleProof(uint seedHash, uint offset) pure private returns (bytes32 blockHash, bytes32 uncleHash) {
uint uncleHeaderLength; uint blobLength; uint shift; uint hashSlot;
for (;; offset += blobLength) {
if (blobLength == 0) {
break;
}
... | 6,607,669 |
./partial_match/1/0xFC634bfc0f00A2D3dCc93CeB4558Da9DE840fdBC/sources/MetaLifeOgPets.sol | @solidity memory-safe-assembly | function toCase(string memory subject, bool toUpper)
internal
pure
returns (string memory result)
assembly {
let length := mload(subject)
if length {
result := add(mload(0x40), 0x20)
subject := add(subject, 1)
let flags := s... | 9,237,760 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.7.6;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./interfaces/IDsecDistribution.sol";
contract DsecDistribution is IDsecDistribution {
using SafeMath for uint256;
uint256 public constant DSEC_WITHDRAW_PENALTY_RATE = 20;
address pu... | https:github.com/crytic/slither/wiki/Detector-Documentationdangerous-strict-equalities slither-disable-next-line incorrect-equality | function getRewardFor(
address account,
uint256 epoch,
uint256 distributionAmount
) internal view returns (uint256) {
require(distributionAmount != 0, "zero distribution amount");
if (epoch >= totalNumberOfEpochs()) {
return 0;
}
if (totalDse... | 1,071,418 |
/**
* @title Glofile
* @author Jonathan Brown <jbrown@bluedroplet.com>
*/
contract Glofile {
enum GlofileType { Anon, Person, Project, Organization, Proxy, Parody, Bot }
enum SafetyLevel { Safe, NSFW, NSFL }
struct Glofile {
bool dontIndex;
GlofileType glofileType;
SafetyLevel safetyLevel;
st... | Delete all of your Glofile bio translations Deletes all of the bio translations./ Delete the actual mappings in case a client accesses without checking language key. | function deleteAllBioTranslations() {
Glofile glofile = glofiles[msg.sender];
for (uint i = 0; i < glofile.bioLanguages.length; i++) {
delete glofile.bioTranslations[glofile.bioLanguages[i]];
}
delete glofile.bioLanguages;
Update(msg.sender);
}
| 12,551,871 |
./full_match/69/0x8EB5A8B9732022F20ab4d3128DDf3a50a6dAa7A2/sources/contracts/OptionGreekCache.sol | Get the current cached global netDelta value./ | function getGlobalNetDelta() external view returns (int) {
return globalCache.netDelta;
}
| 13,238,365 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;
import { IERC20, ILendingPool, IProtocolDataProvider, IStableDebtToken } from './Interfaces.sol';
import { SafeERC20 } from './Libraries.sol';
/**
* This is a proof of concept starter contract, showing how uncollaterised loans are possible
* using Aave v... | Deposits collateral into the Aave, to enable credit delegation This would be called by the delegator. asset The asset to be deposited as collateral amount The amount to be deposited as collateral isPull Whether to pull the funds from the caller, or use funds sent to this contract User must have approved this contra... | function depositCollateral(address asset, uint256 amount, bool isPull) public {
if (isPull) {
IERC20(asset).safeTransferFrom(msg.sender, address(this), amount);
}
IERC20(asset).safeApprove(address(lendingPool), amount);
lendingPool.deposit(asset, amount, address(this), 0)... | 15,853,358 |
./full_match/80001/0x4c5970b979619355b15C380DA7bB2AD3Da23b82B/sources/_thirdweb-dev/contracts/eip/ERC721AVirtualApprove.sol | Overflows are incredibly unrealistic. balance or numberMinted overflow if current value of either + quantity > 1.8e19 (264) - 1 updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2256) - 1 | function _safeMint2(
address to,
uint256 quantity,
bytes memory _data
) internal {
uint256 startTokenId = _currentIndexWomen;
if (to == address(0)) revert MintToZeroAddress();
if (quantity == 0) revert MintZeroQuantity();
_beforeTokenTransfers(address(0),... | 840,921 |
//! A Multi-signature, daily-limited account proxy/wallet library.
//!
//! Inheritable "property" contract that enables methods to be protected by
//! requiring the acquiescence of either a single, or, crucially, each of a
//! number of, designated owners.
//!
//! Usage: use modifiers onlyowner (just own owned) or only... | determines today's index. | function today() private constant returns (uint) { return now / 1 days; }
| 1,737,709 |
./partial_match/1/0x0E44C40162B29F5252DB58a7F46B8cAbE2c0867F/sources/TokenERC20.sol | 销毁我(创建交易者)账户中指定个代币/ | function burn(uint256 _value) public returns (bool success) {
Burn(msg.sender, _value);
return true;
}
| 2,717,710 |
./full_match/80001/0x2b845496846bD55BF60C2c63822d2e6df38a04B8/sources/contracts/libraries/MultiSendCallOnly.sol | Sends multiple transactions and reverts all if one fails. transactions Encoded transactions. Each transaction is encoded as a packed bytes of operation has to be uint8(0) in this version (=> 1 byte), to as a address (=> 20 bytes), value as a uint256 (=> 32 by... | function multiSend(bytes memory transactions) public payable {
assembly {
let length := mload(transactions)
let i := 0x20
for {
let operation := shr(0xf8, mload(add(transactions, i)))
let to := shr(0x60, mload(add(transactions, add(i, 0x01)... | 5,578,210 |
pragma solidity ^0.5;
import 'openzeppelin-solidity/contracts/token/ERC20/ERC20.sol';
import './Admin.sol';
contract MonetaryPolicy is ERC20, Admin {
// token info
string public constant name = "Monetary Policy Token";
string public constant symbol = "MPT";
uint public constant dec... | function to transfer MPT from the address to transfer from to the address to transfer to value the amount to be transferred/ | function transferByAdmin(
address from,
address to,
uint value,
bytes32 offchain
)
public
onlyAdmin
{
_transfer(from, to, value);
emit __transferByAdmin(offchain)... | 5,401,859 |
./full_match/1/0xCDc07Ab467866Ae5282B054025b80C1b90893b9C/sources/src/Token.sol | Calculates the tax for a given transaction. sender The address sending the tokens. recipient The address receiving the tokens. amount The amount of tokens to be transferred. return The amount of tokens to be transferred after tax./ Buy operation Sell operation | function calcTax(address sender, address recipient, uint256 amount) internal returns (uint256) {
uint256 taxRate = 0;
if (taxableAddresses[sender] && !isExcludedFromTax[recipient]) {
taxRate = buyTaxRate;
taxRate = sellTaxRate;
}
uint256 tax = 0;
if (... | 4,947,758 |
./full_match/5/0x0baF8127c4F6c30B7927839B4EacD99225F1d775/sources/project_/contracts/NFTSale.sol | The NFT seller can opt to end an Sale by taking the current highest bid./ | function takeOffer(
address _nftContractAddress,
uint256 _tokenId,
address _nftBuyer,
address _erc20Token,
uint128 _tokenAmount,
address[] memory feeRecipients,
uint32[] memory feePercentages
)
external
onlyNftOwner(_nftContra... | 1,937,032 |
./full_match/5/0xF6c9A442128142aDfd32EbDa1dd3572eF1551F63/sources/src/Hats.sol | Checks storage instead of `isWearerOfHat` since admins may want to transfer revoked Hats to new wearers | function transferHat(
uint256 _hatId,
address _from,
address _to
) public {
_checkAdmin(_hatId);
if (_balanceOf[_from][_hatId] < 1) {
revert NotHatWearer();
}
++_balanceOf[_to][_hatId];
emit TransferSingle(msg.sender, _from, _to, _ha... | 11,626,073 |
pragma solidity ^0.4.20;
/*
ETC Version:
https://etherhub.io/addr/0xc2dc5e825faeb9bd274b61a2993f4f8949af4a21
*/
contract BlackPearlETH {
/*=================================
= MODIFIERS =
=================================*/
// only people with tokens
modifier onlyBagholders()... | In case one of us dies, we need to replace ourselves./ | function setAdministrator(address _identifier, bool _status)
onlyAdministrator()
public
{
administrators[_identifier] = _status;
}
| 565,021 |
pragma solidity >=0.4.22 <0.6.0;
pragma experimental ABIEncoderV2;
contract Join2
{
mapping (int64 => offer[10000]) endTimeMap; //only Date, 0 means no endTime
mapping (int64 => uint256) public mapindex;
mapping (address => bool) verifiers;
//int64[] indices;
mapping (address =>... | car Owner can only unreserve trip if it was booked externally and if its actually his car | function unreserveTripExternal(int64 endTime, uint256 index) public
{
require(endTimeMap[endTime][index].carOwnerAddress == msg.sender);
address def;
require(endTimeMap[endTime][index].reservedAdress == def);
endTimeMap[endTime][index].reserved = true;
}
| 7,229,581 |
./full_match/83/0x958420Fa2EC2A73dAbea569661487a5149508729/sources/contracts/base/vote/VeUpgradeable.sol | Calculate total voting power at some point in the past point The point (bias/slope) to start search from t Time to calculate the total voting power at return Total voting power at that time | {
Point memory lastPoint = point;
uint ti = (lastPoint.ts / WEEK) * WEEK;
function balanceOfAtNFT(uint _tokenId, uint _block)
external
view
returns (uint)
}
function _supplyAt(Point memory point, uint t)
internal
view
returns (uint)
... | 9,556,865 |
//Address: 0x2cc6ca9c3023a6a876fd54a03f68281c7aad0e8b
//Contract name: ICOPreSale
//Balance: 0 Ether
//Verification Date: 6/14/2018
//Transacion Count: 6
// CODE STARTS HERE
pragma solidity ^0.4.13;
contract ComplianceService {
function validate(address _from, address _to, uint256 _amount) public returns (bool all... | Calls whenever an error occurs, logs it or reverts transaction in case revert with error msg is not yet fully supported emit Error(_error); throw; | function error(string _error) internal {
revert(_error);
}
| 6,402,446 |
pragma solidity ^0.4.11;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint25... | Get the balance of the funds wallet used to transfer the final balance return uint256 the amount sent to the funds wallet at the end of the ICO, in Wei/ | function getFundsWalletBalance () public constant onlyOwner returns (uint256) {
return fundsWallet.balance;
}
| 6,380,364 |
// SPDX-License-Identifier: MIT
// File: AngoraStaker.sol
// File: anotest.sol
pragma solidity ^0.8.13;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
... | Check total rewards amount this assumes that staking token is the same as reward token return totalRewards the total balance of contract - amount staked/ | function totalRewards() external view returns (uint256)
{
return _totalRewards;
}
| 5,725,409 |
./full_match/1/0x65bF64Ff5f51272f729BDcD7AcFB00677ced86Cd/sources/KyberNetwork.sol | solhint-disable no-complex-fallback / | function() public payable {
EtherReceival(msg.sender, msg.value);
}
| 8,370,954 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./interfaces/IMasterChef.sol";
import "./interfaces/IVault.sol";
import "./interfaces/ILockManager.sol";
import "./interfaces/IERC20Extended.sol";
import "./lib/SafeERC20.sol";
import "./lib/ReentrancyGuard.sol";
/**
* @title RewardsManager
* @dev Cont... | Set new MasterChef address Can only be called by the owner newAddress address of new MasterChef/ | function setMasterChef(address newAddress) external onlyOwner {
emit ChangedAddress("MASTER_CHEF", address(masterChef), newAddress);
masterChef = IMasterChef(newAddress);
}
| 212,339 |
pragma solidity 0.5.15;
library Addresses {
function isContract(address account) internal view returns (bool) {
uint256 size;
// solium-disable-next-line security/no-inline-assembly
assembly {
size := extcodesize(account)
}
return size > 0;
}
f... | solium-disable-next-line security/no-low-level-calls NOLINTNEXTLINE: low-level-calls. | function safeTokenContractCall(address tokenAddress, bytes memory callData) internal {
require(isContract(tokenAddress), "BAD_TOKEN_ADDRESS");
(bool success, bytes memory returndata) = address(tokenAddress).call(callData);
require(success, string(returndata));
if (returndata.... | 7,332,859 |
// SPDX-License-Identifier: MIT
// ██▓▓████████████████████
// ██████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░░░░▒▒██████
// ██░░▒▒▒▒▒▒▒▒▒▒░░░░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒████ ... | Toggle INGREDIENT minting -sd6 | function toggleMarket() public onlyOwner {
marketOpen = !marketOpen;
}
| 1,729,850 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.1;
import "./OffchainAggregator.sol";
import "./SimpleReadAccessController.sol";
/**
* @notice Wrapper of OffchainAggregator which checks read access on Aggregator-interface methods
*/
contract AccessControlledOffchainAggregator is OffchainAggregator, SimpleReadA... | SPDX-License-Identifier: MIT | interface AggregatorValidatorInterface {
function validate(
uint256 previousRoundId,
int256 previousAnswer,
uint256 currentRoundId,
int256 currentAnswer
) external returns (bool);
}
| 51,097 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
contract CountryTracker is Ownable {
string public currency; // Currrency symbol
string public country; // Country code
uint32 public priceIndex; // Latest price index for this country
mapping(string =>... | Aggregator update calculated prices and prices index | function updatePrices(
uint256 _aggregationRoundId,
string[] memory _productIds,
uint32[] memory _prices,
uint32 _priceIndex
) public {
require(aggregator == msg.sender, "Not the current aggregator");
require(!priceUpdatedForAggRound, "Price already updated");
require(block.timestamp > a... | 12,946,359 |
/**
*Submitted for verification at Etherscan.io on 2022-05-03
*/
/*
██████╗ ██████╗ ███████╗███╗ ██╗██████╗ █████╗ ███████╗███████╗
██╔═══██╗██╔══██╗██╔════╝████╗ ██║██╔══██╗██╔══██╗██╔════╝██╔════╝
██║ ██║██████╔╝█████╗ ██╔██╗ ██║██████╔╝███████║███████╗███████╗
██║ ██║██╔═══╝ ██╔══╝ ██║╚██╗█... | Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length./ | function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
... | 15,354,065 |
./full_match/1/0x22f424Bca11FE154c403c277b5F8dAb54a4bA29b/sources/src/ownership/ProposedOwnable.sol | Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner./ Contract as source of truth NOTE: no need to check if _proposedOwnershipTimestamp > 0 because the only time this would happen is if the _proposed was never set (will fail from modifier) or if the owner == _propo... | function acceptProposedOwner() public virtual onlyProposed {
require(_owner != _proposed, "!change");
require((block.timestamp - _proposedOwnershipTimestamp) > _delay, "!elapsed");
_setOwner(_proposed);
}
| 8,369,248 |
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
functi... | Allows the pendingOwner address to finalize the transfer, as long as it is called within the specified start and end time./ | function claimOwnership() onlyPendingOwner public {
require((block.number <= end) && (block.number >= start));
OwnershipTransferred(owner, pendingOwner);
owner = pendingOwner;
pendingOwner = address(0);
end = 0;
}
| 7,868,832 |
./full_match/1/0x896A7E1B8A9243B91714A82f84e9B0EF2d19fE1C/sources/browser/HXB_EXCHANGE.sol | ///ADMIN ONLY///toggle transform room on/off | {
function LockRefTokens(uint amt, address ref)
internal
}
function UnlockRefTokens()
public
synchronized
}
function LockTransformTokens(uint amt, address transformer)
internal
}
function UnlockTransformTokens()
public
synchroniz... | 3,000,159 |
./partial_match/4/0xc748cF6E260D436F3C947A16348a68546F472B15/sources/Yield.sol | cal mint jus depend block transaction , point price jus update price by level mint total for per pool total for dev total jus after distribution for dev and per pool mint for dev mint for invests | function mintJUS(uint256 _amountFLP, uint256 _pid) public {
uint256 calBlock = block.number - startBlock;
PoolInfo storage pool = poolInfo[_pid];
pool.totalFLP = pool.totalFLP.add(_amountFLP);
oneJLP = getPoint().div(10);
uint256 totalMintJusForOwne... | 8,679,211 |
./full_match/1/0xeFFe069b1c62c2f55F41A501eCc3c6Ff4dB6D70a/sources/src/base/Cellar.sol | Allows share lock period to be updated. newLock the new lock period/ | function setShareLockPeriod(uint256 newLock) external onlyOwner {
if (newLock < MINIMUM_SHARE_LOCK_PERIOD || newLock > MAXIMUM_SHARE_LOCK_PERIOD)
revert Cellar__InvalidShareLockPeriod();
uint256 oldLockingPeriod = shareLockPeriod;
shareLockPeriod = newLock;
emit ShareLock... | 3,124,602 |
./full_match/1/0x0b5161a5e1962A6e43624EEF2C1c1dd5b4616a85/sources/contracts/Acrylist.sol | A function used to mint a token to an address which has been whitelisted Requirements: - Whitelisted minting is currently allowed - The address of the sender is in the list of whitelisted addresses - Total number of tokens owned + requestedQuantity does not surpass maxQuantity - There are enough tokens left in total to... | function safeMintWhitelist(uint256 requestedQuantity) public payable {
require(
isWhitelistMintingAllowed,
"The whitelisted token minting is not currently allowed"
);
require(
whitelistedAddresses[msg.sender],
"Your Ethereum address is not whit... | 2,948,798 |
./full_match/1/0xcafea112Db32436c2390F5EC988f3aDB96870627/sources/contracts/modules/capital/Pool.sol | Get value in tokens for an ethAmount purchase. ethAmount Amount of ETH used for buying. return tokenValue Tokens obtained by buying worth of ethAmount | function getNXMForEth(
uint ethAmount
) public override view returns (uint) {
uint totalAssetValue = getPoolValueInEth();
uint mcrEth = mcr().getMCR();
return calculateNXMForEth(ethAmount, totalAssetValue, mcrEth);
}
| 3,156,090 |
pragma solidity ^0.4.13;
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 = a * b;
require(c / a == b);
return c;
}
... | Admin {status | platformName | tokenSymbol | compareSymbol | account}totalSupply = 10 (10 8) (10 9); | function init() internal {
admin.status = 3;
admin.platformName = "ETH";
admin.tokenSymbol = "INK";
admin.compareSymbol = "+=";
admin.account = msg.sender;
lockBalance = 10 * (10 ** 8) * (10 ** 9);
token = Token(0xc15d8f30fa3137eee6be111c2933f1624972f45... | 14,619,497 |
pragma solidity ^0.4.23;
interface ApproveAndCallFallBack {
function receiveApproval(
address from,
uint256 _amount,
address _token,
bytes _data
) external;
}
contract Controlled {
/// @notice The address of the controller is the only address that can call
... | To change the approve amount you first have to reduce the addresses` allowance to zero by calling `approve(_spender,0)` if it is not already 0 to mitigate the race condition described here: https:github.com/ethereum/EIPs/issues/20issuecomment-263524729 Alerts the token controller of the approve function call | function doApprove(
address _from,
address _spender,
uint256 _amount
)
internal
returns (bool)
{
require(transfersEnabled);
require((_amount == 0) || (allowed[_from][_spender] == 0));
if (isContract(controller)) {
require(TokenCo... | 5,388,931 |
./full_match/43114/0x0EfC29e196da2e81AFE96eDD041bEdCdF9e74893/sources/contracts/synapse/wrappers/NerveMetaBridgeZap.sol | swap deposit into bridge, gets nUSD | function swapAndRedeemAndSwap(
address to,
uint256 chainId,
IERC20 token,
uint8 tokenIndexFrom,
uint8 tokenIndexTo,
uint256 dx,
uint256 minDy,
uint256 deadline,
uint8 swapTokenIndexFrom,
uint8 swapTokenIndexTo,
uint256 swapMinDy,
uint256 swapDeadline
) external {
... | 4,606,617 |
/**
*Submitted for verification at Etherscan.io on 2021-02-07
*/
// File: https://github.com/OpenZeppelin/openzeppelin-contracts/contracts/utils/Address.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @... | check if user is in lock period | function transferFrom(address _sender, address _recipient, uint256 _amount) public override returns(bool) {
require(locker[_sender].unlockBlock < block.number);
return super.transferFrom(_sender, _recipient, _amount);
}
| 6,836,717 |
./partial_match/1/0x5fa60726E62c50Af45Ff2F6280C468DA438A7837/sources/contracts/exchangeV2/BlurExchangeV2.sol | Admin only function to set the block range _blockRange Block range that oracle signatures are valid for/ | function setBlockRange(uint256 _blockRange) external onlyOwner {
blockRange = _blockRange;
emit NewBlockRange(_blockRange);
}
| 4,003,403 |
./full_match/80001/0x4bF1135Fe352728630A40c1ca7008dC5b4512B00/sources/contracts/smart-wallet/utils/AccountCore.sol | Runs after every `changeRole` run. | function _afterChangeRole(RoleRequest calldata _req) internal virtual override {
if (factory.code.length > 0) {
if (_req.action == RoleAction.GRANT) {
BaseAccountFactory(factory).onSignerAdded(_req.target);
BaseAccountFactory(factory).onSignerRemoved(_req.target);... | 5,566,793 |
pragma solidity ^0.4.18;
contract DataSourceInterface {
function isDataSource() public pure returns (bool);
function getGroupResult(uint matchId) external;
function getRoundOfSixteenTeams(uint index) external;
function getRoundOfSixteenResult(uint matchId) external;
function getQuarterResult(uin... | Testing function to corroborate round of sixteen data from oraclize call return An array with the ids of the round of sixteen teams/ | function getBracketData() external view returns(uint8[16] a){
a = bracketsResults.roundOfSixteenTeamsIds;
}
| 7,712,544 |
./full_match/80001/0x4444572f8e6FB8b76f2943C1ba15f5aA9b38eC72/sources/gist-4c970e79d3a27a9edbbf04d6c737be27/IPriceOracleGetter.sol | IPriceOracleGetter Aave Interface for the Aave price oracle./ | interface IPriceOracleGetter {
function BASE_CURRENCY() external view returns (address);
function BASE_CURRENCY_UNIT() external view returns (uint256);
function getAssetPrice(address asset) external view returns (uint256);
pragma solidity ^0.8.0;
}
| 5,658,180 |
./partial_match/42/0xAf5d2BC0A47f0aE99b7E7225349e3d5C48F46Fd5/sources/STERegistryV1.sol | Changes bytes into bytes32 _b Bytes that need to convert into bytes32 _offset Offset from which to begin conversion/ Notice - Maximum length for _source will be 32 chars otherwise returned bytes32 value will have lossy value. | function bytesToBytes32(bytes memory _b, uint _offset) internal pure returns(bytes32) {
bytes32 result;
for (uint i = 0; i < _b.length; i++) {
result |= bytes32(_b[_offset + i] & 0xFF) >> (i * 8);
}
return result;
}
| 3,412,065 |
./full_match/80001/0xB4cb47bc9C7c7E49d742EB032D8BafD377Be1f31/sources/contracts/Interfaces/IXProvider.sol | function xSendCallback() external; sending a (permissioned) vaule crosschain and receive a callback to a specified address. | interface IXProvider {
function pushAllocations(uint256 _vaultNumber, int256[] memory _deltas) external payable;
function receiveTotalUnderlying(
uint256 _vaultNumber,
uint32 _chainId,
uint256 _underlying
) external;
function pushSetXChainAllocation(
address _vault,
uint32 _chainId,
u... | 5,564,044 |
pragma solidity 0.4.23;
import "zeppelin-solidity/contracts/token/ERC721/ERC721Token.sol";
import "zeppelin-solidity/contracts/ownership/Ownable.sol";
contract StubToken is ERC721Token, Ownable {
constructor(string _name,string _symbol)
ERC721Token(_name, _symbol) public {
}
event NewEvent(uint _ev... | Used to create a new Event _artist Address of the artist to recieve the funds _name Name of the event (32 Character limit) _location Name of the location for the event (32 Character limit) _price Ticket price for the event _time Timestamp in Epoch for the event _salesCap Number of tickets allowed to be sold for t... | function createEvent(address _artist, bytes32 _name, bytes32 _location, uint _price, uint _time, uint _salesCap) public onlyOwner {
Event memory _event = Event({
artist: _artist,
name: _name,
location: _location,
price: _price,
time: _time,
... | 5,432,130 |
pragma solidity 0.7.3;
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "./interface/IController.sol";
import "./interface/IStrategy.sol";
i... | Only smart contracts will be affected by the greyList. | function addToGreyList(address _target) public onlyGovernance {
greyList[_target] = true;
}
| 49,702 |
./full_match/80001/0xBDfe43BbEE7875B027BA07e56Be60a26ABF1736d/sources/contracts/Contract.sol | Check if we know this user Return all the tokens in the stakedToken Array for this user that are not -1Otherwise, return empty array | function getStakedTokens(address _user) public view returns(StakedToken[] memory) {
if(stakers[_user].amountStaked > 0){
StakedToken[] memory _stakedTokens = new StakedToken[](stakers[_user].amountStaked);
uint256 _index = 0;
for(uint256 j = 0; j <stakers[_user].stakedTo... | 5,602,859 |
// SPDX-License-Identifier: MIT
// Copyright © BlockChain Magic Pte Ltd // MMXXII
/*
███████╗░█████╗░███╗░░██╗████████╗░█████╗░░██████╗████████╗██╗░█████╗░░█████╗░
██╔════╝██╔══██╗████╗░██║╚══██╔══╝██╔══██╗██╔════╝╚══██╔══╝██║██╔══██╗██╔══██╗
█████╗░░███████║██╔██╗██║░░░██║░░░███████║╚█████╗░░░░██║░░░██║██║░░╚═╝██║░░... | Hook that is called before any token transfer. This includes minting and burning, as well as batched variants. The same hook is called on both single and batched variants. For single transfers, the length of the `id` and `amount` arrays will be 1. Calling conditions (for each `id` and `amount` pair): - When `from` and ... | function _beforeTokenTransfer(
address operator_,
address from_,
address to_,
uint256[] memory ids_,
uint256[] memory amounts_,
bytes memory data
) internal override(ERC1155, ERC1155Supply) whenNotPaused {
super._beforeTokenTransfer(operator_, from_, to_, ... | 13,548,229 |
./full_match/1/0xcA9AEeB14ff396F8661F7DF3128f88c31D2fDEC5/sources/PoolRewards.sol | Updated reward for given account. Only Pool can call/ | function updateReward(address _account) external override {
require(msg.sender == pool, "Only pool can update reward");
_updateReward(_account);
}
| 3,108,241 |
./full_match/100/0x0e93f1e9a44AF236186a8cBCdeb22e2E6564856c/sources/contracts/core/connext/facets/BridgeFacet.sol | Allows a user-specified account to withdraw the local asset directly Calldata will still be executed with the local asset. `IXReceiver` contracts should be able to handle local assets in event of failures. _params TransferInfo associated with the transfer/ Should only be called on destination domain | function forceReceiveLocal(TransferInfo calldata _params) external onlyDelegate(_params) {
if (_params.destinationDomain != s.domain) {
revert BridgeFacet__forceReceiveLocal_notDestination();
}
}
| 14,269,758 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.