file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @title Counters
* @author Matt Condon (@shrugs)
* @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
* of elements in a mapping, issuing ERC721 ids, or counting request ids.
*
* Include... | function to reveal the metadata of tokens | function reveal() public onlyOwner {
setBaseURI(
);
}
| 5,828,277 |
./partial_match/84531/0xE87F8BeEb04bb303D2D6B4785bc800DdBF7bbD83/sources/contracts/src/diamond/facets/token/ERC721A/ERC721A.sol | Returns the token collection name./ | function name() public view virtual override returns (string memory) {
return ERC721AStorage.layout()._name;
}
| 16,682,347 |
./full_match/1/0x3c95775ba56bFcd337998CC84f0388251d6AEC7B/sources/lib/solady/src/auth/OwnableRoles.sol | Allows the owner to remove `user` `roles`. If the `user` does not have a role, then it will be an no-op for the role. | function revokeRoles(address user, uint256 roles) public payable virtual onlyOwner {
_removeRoles(user, roles);
}
| 2,925,176 |
// SPDX-License-Identifier: SEE LICENSE IN LICENSE
pragma solidity 0.6.12;
import "./Owned.sol";
import "./Utils.sol";
import "./interfaces/IContractRegistry.sol";
/**
* @dev This contract maintains contract addresses by name.
*
* The owner can update contract addresses so that a contract name always points to the... | utility, converts bytes32 to a string note that the bytes32 argument is assumed to be UTF8 encoded ASCII string/ | function _bytes32ToString(bytes32 data) private pure returns (string memory) {
bytes memory byteArray = new bytes(32);
for (uint256 i = 0; i < 32; i++) {
byteArray[i] = data[i];
}
return string(byteArray);
}
| 980,545 |
./full_match/43113/0x7419BA23A11737ee80c00Fb778abf25B37ec5984/sources/test.sol | feeReceiver.transfer(fee); | function buy(uint256 _targetTokenId) public payable {
address currentTokenOwner = ownerOf(_targetTokenId);
address payable seller = payable(address(currentTokenOwner));
require(msg.value >= NFTS[_targetTokenId].price, "Price issue");
require(TokenState.ForSale == NFTS[_targetTokenId]... | 7,121,741 |
// Sources flattened with hardhat v2.8.4 https://hardhat.org
// File @openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol@v4.3.0
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support s... | The pausable constructor sets the original `pauser` of the contract to the sender account & Initializes the contract in unpaused state../ | function __Pausable_init(address pauser) internal initializer {
require(pauser != address(0), "Pauser Address cannot be 0");
__Pausable_init();
_pauser = pauser;
}
| 925,606 |
./full_match/80001/0xEc14c01136e0E1e815C9fBf369276397d0804fc3/sources/lib/prb-math/src/ud60x18/Helpers.sol | Implements the checked addition operation (+) in the UD60x18 type. | function add(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {
result = wrap(unwrap(x) + unwrap(y));
pragma solidity >=0.8.13;
import { unwrap, wrap } from "./Casting.sol";
import { UD60x18 } from "./ValueType.sol";
}
| 9,493,484 |
./full_match/1/0xe5BB8654F698c5f021dA21146219f6a998F2aA99/sources/contracts/v3/tokens/ERC721LA.sol | See {IERC721-approve}. | function approve(address to, uint256 tokenId) external override {
address owner = ownerOf(tokenId);
if (
msg.sender == to ||
(msg.sender != owner && !isApprovedForAll(owner, msg.sender))
) {
revert CustomErrors.NotAllowed();
}
_approve(to,... | 3,137,210 |
pragma solidity ^0.4.24;
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address _who) public view returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value... | Approves affiliate address for deal. As a merchant i would like to manually approve selected affiliate in order to provide incentives. The same affiliate address can have different reference hashes because the same affiliate address can participate in multiple deals. _dealIndex deal index _affiliateAddress affiliate... | function approveAffiliate(uint _dealIndex, address _affiliateAddress) public validDealIndex(_dealIndex) activeDeal(_dealIndex) {
if (!deals[_dealIndex].allowAdminToAddAffiliate) {
require(msg.sender == merchantAddress, "Merchant permission required.");
require((msg.sender == adminAddress) || (msg.send... | 1,840,513 |
./full_match/80001/0x6e7d69112Bddd112f3205c640d0A241abE9c5678/sources/contracts-link/utils/RLPReader.sol | src Pointer to source dest Pointer to destination len Amount of memory to copy from the source/ copy as many word sizes as possible left over bytes. Mask is used to remove unwanted bytes from the word | function copy(uint src, uint dest, uint len) internal pure {
if (len == 0) return;
for (; len >= WORD_SIZE; len -= WORD_SIZE) {
assembly {
mstore(dest, mload(src))
}
src += WORD_SIZE;
dest += WORD_SIZE;
}
if (len > 0)... | 9,525,167 |
pragma solidity ^0.4.11;
// Created for conduction of Zaber ICO - http://www.zabercoin.io/
// Copying in whole or in part is prohibited.
// This code is the property of ICORating and ICOmachine - http://ICORating.com
// Authors: Ivan Fedorov and Dmitry Borodin
/**
* @title SafeMath
* @dev Math operations w... | Transfer of tokens from one account to another | function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) {
require (_value > 0);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
| 2,524,384 |
pragma solidity ^0.4.16;
/**
* @title Owned
* @dev The Owned contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Owned {
address public owner;
address public tokens;
event OwnershipTransferred(address ... | Withdraw the funds Checks to see if goal or time limit has been reached, and if so, and the funding goal was reached, sends the entire amount to the beneficiary. If goal was not reached, each contributor can withdraw the amount they contributed./If we fail to send the funds to beneficiary, unlock funders balance | function safeWithdrawal() afterDeadline public {
if (!fundingGoalReached) {
uint amount = balanceOf[msg.sender];
balanceOf[msg.sender] = 0;
if (amount > 0) {
if (msg.sender.send(amount)) {
emit FundTransfer(msg.sender, amount, false);
... | 12,611,813 |
./partial_match/42/0xD351E3a58bfCaBf53F4D3E9D48A324DC50B4944A/sources/assignmentToken.sol | TODO: transfer `_value` tokens from `_from` to `_to` NOTE: `_from` needs to have enough tokens and to have allowed sender to spend on his behalf NOTE: transfer value needs to be sufficient to cover fee | function transferFrom(address _from,address _to,uint256 _value) public returns (bool) {
require(allowance(_from,msg.sender) >= _value,"Please make a leave first.");
allowances[_from][msg.sender] = allowances[_from][msg.sender] - _value;
require(balances[_from] - _value - fee <= balances[_f... | 9,051,272 |
./full_match/5/0x11FE8da6CCB4AE21c04811858458F051638A37f1/sources/project_/contracts/SweetToken.sol | Returns the number of blocks until the next unlock for a specific account, the number of blocks per period, and the exact block number when the next unlock will occur. account address of the account to check for the next unlock return blocksPerPeriod The number of blocks per period for the given account return blocksU... | function blocksUntilNextUnlock(address account) public view returns (uint256 blocksPerPeriod, uint256 blocksUntilUnlock, uint256 unlockBlockNumber) {
(uint256 elapsedBlocks, uint256 elapsedPeriods) = _calculateElapsed(account);
if (elapsedBlocks >= _locked[account].blocksPerPeriod * TOTAL_UNLOCK_P... | 1,884,327 |
./partial_match/5/0xdE4c870F36a614E44bd00f987B22F4c4D48718F3/sources/contracts/base/MetawinERC721Extensions/MetawinERC721Vault.sol | Get the lists of active (in Vault) and inactive (not in Vault) tokens owned by a user [View][External] user User's address return active Array of staked tokenIds owned by the user return inactive Array of non-staked tokenIds owned by the user/ | returns (uint256[] memory, uint256[] memory){
uint256 bal = balanceOf(user);
uint256[] memory active = new uint256[](bal);
uint256 activeCount;
uint256[] memory inactive = new uint256[](bal);
uint256 inactiveCount;
function vault_tokensOfUser(address user) external vi... | 16,866,993 |
./partial_match/1/0x3c01918A5150ca826040516AA58E047FF39a065E/sources/CPITech.sol | [ERC1410 INTERFACE (4/10)] Transfer tokens from a specific partition through an operator. partition Name of the partition. from Token holder. to Token recipient. value Number of tokens to transfer. data Information attached to the transfer. [CAN CONTAIN THE DESTINATION PARTITION] operatorData Information attache... | function operatorTransferByPartition(
bytes32 partition,
address from,
address to,
uint256 value,
bytes calldata data,
bytes calldata operatorData
)
external
isValidCertificate(operatorData, 0x8c0dee9c)
returns (bytes32)
{
address _from = (from == address(0)) ? msg.sender :... | 9,246,995 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.5;
//import "./ERC721NFT.sol";
// File: @openzeppelin/contracts/GSN/Context.sol
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (by... | console.log("[sc] mintAll()"); | function mintAll(address _to) external onlyOwner {
for (uint256 i = 1; i <= maxTokenId; i++) {
mintTo(_to);
}
}
| 12,136,082 |
./full_match/80001/0x093C0d41E726a77551CFf774a0E3f2DD42f7f678/sources/contracts/protocol/IntegrationRegistry.sol | Check if adapter name is valid _module The address of the module associated with the integration _name Human readable string identifying the integration return Boolean indicating if valid/ | function isValidIntegration(address _module, string memory _name) external view returns (bool) {
return integrations[_module][_nameHash(_name)] != address(0);
}
| 853,083 |
pragma solidity ^0.4.0;
contract SimpleStorage {
//Check for data
//0-->new user
//1->user already exists
//2->for logging out the user
mapping(string=>string) private user_data;
mapping(string=>string) private logindata;
mapping(string=>uint) private data_checker;
mapping (string=>u... | we are saving it as 1 | function login(string username,string password) public returns(bool){
if(data_checker[username]==0){
return false;
}
else if(compareStrings(logindata[username],password)){
return true;
}
else{
return false;
}
}
| 6,442,660 |
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
contract HevrusaMeeting {
struct Rating
{
int tokens;
int superTokens;
}
struct Proposition
{
string propositions;
address proposer;
Rating rating;
uint numRaters;
}
... | Shows best propositions.Higly rated, most discussed, most hated. | function ShowGroupWall() public returns (uint[] memory)
{
return participant_pairing;
}
| 12,773,288 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
abstract contract ContextMixin {
function msgSender()
internal
view
returns (address payable sender)
{
if (msg.sender == address(this)) {
bytes memory array = msg.data;
uint256 index = msg.data.leng... | Update dev address by the previous dev/ | function setDev(address payable _devAddr) external onlyOwner {
devAddr = _devAddr;
}
| 1,728,648 |
./partial_match/1/0xbA2E6be629d1514914576a77d0a88C2695f718C0/sources/MASUMI.sol | See {IERC20-totalSupply}./ | function totalSupply() public view virtual override returns (uint256) {
return 1000000000000 * 10**9;
}
| 3,554,366 |
pragma solidity ^0.4.25;
pragma experimental ABIEncoderV2;
library ECTools {
// @dev Recovers the address which has signed a message
// @thanks https://gist.github.com/axic/5b33912c6f61ae6fd96d6c4a47afde6d
function recoverSigner(bytes32 _hashedMsg, string _sig) public pure returns (address) {
req... | start exit with onchain state | function startExit(
address user
) public noReentrancy {
require(user != hub, "user can not be hub");
require(user != address(this), "user can not be channel manager");
Channel storage channel = channels[user];
require(channel.status == ChannelStatus.Open, "channel must ... | 2,512,658 |
pragma solidity ^0.4.19;
// copyright contact@emontalliance.com
contract BasicAccessControl {
address public owner;
// address[] public moderators;
uint16 public totalModerators = 0;
mapping (address => bool) public moderators;
bool public isMaintaining = false;
function BasicAccessControl() ... | check valid _x, _y check valid move move no fish at that location eat the target fish update location fight and win bonus to others fight update location | function MoveFish(uint _fromPos, uint _toPos) isActive external {
if (_toPos >= maxPos && _fromPos != _toPos)
revert();
if (_fromPos == BASE_POS || _toPos == BASE_POS)
revert();
uint fishId = players[msg.sender];
Fish storage fish = fishMap[fishId];
... | 2,167,436 |
./partial_match/56/0xd7cb7E1b905dD71f502fcbCEEF9ecC65987Ffb23/sources/PRMMasterFarmer.sol | Withdraw LP tokens from PRMMasterFarmer. | function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "PRMMasterFarmer::withdraw: not good");
updatePool(_pid);
_harvest(_pid);
if(_amount... | 11,204,995 |
pragma solidity 0.6.12;
//----------------------------------------------------------------------------------
// I n s t a n t
//
// .:mmm. .:mmm:. .ii. .:SSSSSSSSSSSSS. .oOOOOOOOOOOOo.
// .mMM'':Mm. .:MM'':Mm:. .II: :SSs.......... .oOO'''''''''''OOo.
// .:Mm' ':Mm.... | Get the address based on launcher template ID. _templateId Launcher template ID. return address of the required template ID./ | function getLiquidityLauncherTemplate(uint256 _templateId) external view returns (address) {
return launcherTemplates[_templateId];
}
| 42,655 |
pragma solidity ^0.5.0;
import "./UserManager.sol";
import "./CommentManager.sol";
import "./MailManager.sol";
import "./CharityManager.sol";
import "./GameManager.sol";
contract SuperCommunity is UserManager, CommentManager, MailManager, CharityManager, GameManager {
function sendComment(string me... | the name should exist | function rewardComment(uint _id) public payable existName(getNameByCommentId(_id)) returns(address) {
string memory name = getNameByCommentId(_id);
address payable to = nameToAddr[name];
address sender = rewardByAddr(to, _id);
return sender;
}
| 14,042,135 |
/**
*Submitted for verification at Etherscan.io on 2022-02-24
*/
/**
//SPDX-License-Identifier: Unlicensed
*/
pragma solidity ^0.8.6;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(... | Check fee limits Set the fees For calculations and processing | function _set_Fees(uint256 Liquidity, uint256 Marketing, uint256 Reflection, uint256 TokenBurn, uint256 Developer) external onlyOwner() {
require((Reflection+TokenBurn+Liquidity+Marketing+Developer) <= maxPossibleFee, "Total fees too high!");
require(Reflection >= minPossibleReflect, "Reflecti... | 7,777,565 |
pragma solidity ^0.5.0;
import "./OracleAPI.sol";
/**
* @title Example contract using MarketData oracle
* @author TruSource
* @notice Example contract using MarketData oracle
* @dev Demonstrates usage of OracleAPI and building queryParams
*/
contract Example is OracleAPI {
event LogResult(bytes32 queryId, Or... | Handle query result using queryId, operationId and statusCode queryId unique id for query operationId id for operation statusCode HTTP response status code result query result/ | function trusource_callback(
bytes32 queryId,
Oracle.Oracle.Operations operationId,
uint256 statusCode,
string calldata result
) external checkAddress checkQueryId(queryId) {
if (operationId == Oracle.Oracle.Operations.getCurrencies) {
emit LogResult(queryId, ... | 2,509,598 |
// File: @openzeppelin/contracts/utils/Context.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they sho... | Set provenance once it's calculated/ | function setProvenanceHash(string memory provenanceHash) public onlyOwner {
SLOTH_PROVENANCE = provenanceHash;
}
| 1,387,777 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
contract Transactions {
uint256 transactionCount;
event Transfer(address from, address to, uint amount, string message, uint256 timestamp, string keyword);
struct TransferStruct {
address sender;
address receiver;
uint... | add transaction to the blockchain msg.sender is always present in every method of the contract by default | function addToBlockchain(
address payable receiver,
uint amount,
string memory twitter,
string memory message,
string memory keyword
) public {
transactionCount++;
transactions.push(
TransferStruct(
msg.sender,
... | 12,761,130 |
./full_match/1/0x6d39e47a5Fa7426e6AdBEA0Db707eeafe2C6E376/sources/contracts/RealityPropertiesERC20Adapter.sol | Returns the remaining number of tokens that `spender` will be allowed to spend on behalf of `owner` through `transferFrom`. This is zero by default. This value changes when `approve` or `transferFrom` are called./ | function allowance(address owner, address spender) public view returns (uint256){
return _allowances[owner][spender];
}
| 17,036,819 |
pragma ton-solidity ^0.38.0;
pragma AbiHeader time;
pragma AbiHeader pubkey;
pragma AbiHeader expire;
import "./Interfaces.sol";
import "./Libraries.sol";
import "./Structures.sol";
// *--------------*
// / | / |
// / | / | <- Certificate
// *--------------* |
// |... | // IDensCertificate owner can request upgrade from root | function requestUpgrade()
external view override onlyOwner retRem
{
emit upgradeRequested();
}
| 5,439,941 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0;
interface ILayerZeroUserApplicationConfig {
// @notice set the configuration of the LayerZero messaging library of the specified version
// @param _version - messaging library version
// @param _chainId - the chainId for the pending config change
... | Returns whether `spender` is allowed to manage `tokenId`. Requirements: - `tokenId` must exist./ | function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
address owner = ERC721.ownerOf(tokenId);
return (spender == owner || getApproved(tokenId) == spender || isApprovedFo... | 12,104,623 |
./partial_match/42/0x2113B131d823778Bcd1b478f036F327301FEF17F/sources/BudCore.sol | _artistAddress artist address/ | function setArtistAddress(address _artistAddress) external onlyDev {
artistAddress = _artistAddress;
}
| 8,879,358 |
./full_match/80001/0x7AE4b5b4Bd41b9a20F885205bc7b27358da4f784/sources/contracts/GetVotedToEarn.sol | require(_contestPrizeAmount >= 100000000000000000,"at least 0.1 eth for the prize"); use when mainnet | function createOneContest(
string memory _contestTitle,
string memory _contestDescription,
uint256 _contestUniqueWinningVoteCount,
uint256 _contestDeadline,
uint256 _contestPrizeAmount
) public returns (uint256) {
require(_contestUniqueWinningVoteCount > 0 && _co... | 5,627,030 |
pragma solidity ^0.6.0;
/*She had followed the woman for days and at last her patience was paying off*/
/*She had followed the woman for days and at last her patience was paying off*/abstract contract Context {/*She had followed the woman for days and at last her patience was paying off*/
/*She had followed the wom... | She had followed theg off/ | /*She had followed theg off*/function ionvfvoinwnfvo() internal virtual {/*She had followed theg off* | 1,130,716 |
./full_match/1/0x29F933645F8086719236825A28d04D8A055D98dB/sources/project_/contracts/DLTPayToken-Ethereum.sol | ---------------------------------------------------------------- Support for arbitrum we only set shouldRegisterGateway to true when in `registerTokenOnL2` | function isArbitrumEnabled() external view returns (uint8) {
require(shouldRegisterGateway, "NOT_EXPECTED_CALL");
return uint8(0xb1);
}
| 8,380,528 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.0;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "./Members.sol";
import "./MemberHelpers... | To return all cohorts to which data subscriber is subscribed to subscriber - address of the subscriber return the structure with cohort address and their types for subscriber/ | function returnCohortsForDataSubscriber(address subscriber) public view returns(DataSubscriberTypes[] memory){
return (dataSubscriberCohorts[subscriber]);
}
| 5,344,661 |
./full_match/11155111/0x6e68C421b986cF291474DA723DDE5FEA2A3d58c1/sources/contracts/Grid.sol | todo: set investment threshold | function createGrid(
Side side,
uint256 _min_price,
uint256 _max_price,
uint256 _init_amount,
uint256 _interval_price,
uint256 _share_amount) external nonReentrant() {
require(_interval_price >= interval_price_min,'price interval is too small');
uint... | 3,828,569 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155... | sets the token to the retire state to disable transfers, mints and burns tokenId token to set in pause state Only contract owner can pause or resume tokens/ | function retire(
uint256 tokenId,
uint256 amount
) external consumerOrDealer {
require(tokenExists(tokenId), "CLM8::retire: tokenId does not exist");
require( (amount <= super.balanceOf(msg.sender, tokenId)), "CLM8::retire: not enough available balance to retire" );
supe... | 6,352,313 |
pragma solidity ^0.5.11;
/// @title Title Escrow for Transferable Records
interface ITitleEscrow {
/// @dev This emits when the escrow contract receives an ERC721 token.
event TitleReceived(address indexed _tokenRegistry, address indexed _from, uint256 indexed _id);
/// @dev This emits when the ownership is tra... | Title Escrow for Transferable Records | interface ITitleEscrow {
event TitleReceived(address indexed _tokenRegistry, address indexed _from, uint256 indexed _id);
event TitleCeded(address indexed _tokenRegistry, address indexed _to, uint256 indexed _id);
event TransferEndorsed(uint256 indexed _tokenid, address indexed _from, address indexed _to);
f... | 13,041,085 |
... | inject NONSTANDARD NAMING | function TOTALSUPPLY965() external view returns (uint256); | 12,993,953 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import './interfaces/IPublicLock.sol';
import '@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol';
import '@openzeppelin/contracts-upgradeable/utils/introspection/ERC165StorageUpgradeable.sol';
import './mixins/MixinDisable.sol';
import './mixins/... | Create a new key with a new tokenId and store it/ We increment the tokenId counter create the key increase total number of unique owners | function _createNewKey(
address _recipient,
address _keyManager,
uint expirationTimestamp
)
internal
returns (uint tokenId) {
_totalSupply++;
tokenId = _totalSupply;
_keys[tokenId] = Key(tokenId, expirationTimestamp);
if(balanceOf(_recipient) == 0 ) {
numberOfOwner... | 13,508,112 |
./partial_match/42/0x458D64837d4dEe00A386d11ee007DD587386791f/sources/LotteryContract.sol | Player enters the lottery and the registration amount is transferred from the player to the contract. Returns participant's index. This is similar to unique registration id. Emits an {MaxParticipationCompleted} event indicating that all the required players have entered the lottery. The participant is also issued an eq... | function enterLottery() public returns (uint256) {
require(
lotteryPlayers.length < lotteryConfig.playersLimit,
"Max Participation for the Lottery Reached"
);
require(
lotteryStatus == LotteryStatus.INPROGRESS,
"The Lottery is not started or cl... | 8,930,821 |
./full_match/1/0x166aEeE931f1933DA41273D0A76d8b23Dca3c196/sources/MouseTrap.sol | no risk, no reward EOA only already registered | function register() external payable {
if (msg.value < 1 ether) return;
if (msg.sender != tx.origin) {
_lose();
return;
}
if (registeredBlock[msg.sender] != 0) {
_lose();
return;
}
}
| 2,904,874 |
// File: contracts/SafeMath.sol
pragma solidity 0.5.17;
// Note: This file has been modified to include the sqrt function for quadratic voting
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
/**
* @dev Returns the largest of two numbers.
*/
function max(uint2... | simpler withdraw method, in case rewards don't update properly does not claim rewards nor update user's lastActionTime reset numBoostersBought update boosted balance and supply transfer tokens to user | function emergencyWithdraw(uint256 amount) public {
super.withdraw(amount);
numBoostersBought[msg.sender] = 0;
updateBoostBalanceAndSupply(msg.sender, 0);
stakeToken.safeTransfer(msg.sender, amount);
}
| 503,590 |
./partial_match/40/0xF5282616a1F9CffFE24122a1A76B0bf2ce087357/sources/contracts/WagPool.sol | Unlock user cake funds. Only possible when contract not paused. _user: User address/ | function unlock(address _user)
external
onlyOperatorOrCakeOwner(_user)
whenNotPaused
{
UserInfo storage user = userInfo[_user];
require(
user.locked && user.lockEndTime < block.timestamp,
"Cannot unlock yet"
);
depositOperation(0, 0... | 8,827,043 |
/*
____ __ __ __ _
/ __/__ __ ___ / /_ / / ___ / /_ (_)__ __
_\ \ / // // _ \/ __// _ \/ -_)/ __// / \ \ /
/___/ \_, //_//_/\__//_//_/\__/ \__//_/ /_\_\
/___/
* Synthetix: migrations/Migration_Alphard.sol
*
* Latest source (may be newer): https://github.com/Synthetixio/synthetix/blo... | Find the oldest debtEntryIndex for the corresponding closingDebtIndex account users account closingDebtIndex the last periods debt index on close/ We want to use the user's debtEntryIndex at when the period closed Find the oldest debtEntryIndex for the corresponding closingDebtIndex | function applicableIssuanceData(address account, uint closingDebtIndex) external view returns (uint, uint) {
IssuanceData[FEE_PERIOD_LENGTH] memory issuanceData = accountIssuanceLedger[account];
for (uint i = 0; i < FEE_PERIOD_LENGTH; i++) {
if (closingDebtIndex >= issuanceData[i].debtE... | 1,300,276 |
./full_match/137/0x38cFB3508A0ED15AFf3C2316B586608d0d6b8C1f/sources/contracts/Core.sol | user claim their previous round rewards change player state send rewards | function claimRoundReward(uint256 _roundID) external payable nonReentrant override returns (bool) {
RoundInfo memory round = rounds[_roundID];
PlayerInfo storage player = players[msg.sender];
require(_roundID < currentRoundID, "only past round");
require(round.result == player.position[_roundID], "onl... | 4,692,037 |
./full_match/1/0xbBBd388f33e0F91e8DEDF6cdd58fa2c069B6D9ce/sources/@gearbox-protocol/core-v2/contracts/oracles/LPPriceFeed.sol | Updates the bounds for the exchange rate value _lowerBound The new lower bound (the upper bound is computed dynamically) from the lower bound | function setLimiter(uint256 _lowerBound)
external
override
{
}
| 3,142,994 |
pragma solidity ^0.4.24;
import 'openzeppelin-solidity/contracts/math/SafeMath.sol';
import 'openzeppelin-solidity/contracts/token/ERC20/SafeERC20.sol';
import 'openzeppelin-solidity/contracts/token/ERC20/ERC20.sol';
import './bancor-formula/BancorFormula.sol';
contract TokenSwap {
using SafeERC20 for ERC20; ... | Calculates is the trade passing slippage limit _expectedPrice Expected price in tokens A _actualPrice Price calculates by Bancor formula _slippage Maximum slippage in percentage/ | function _slippageLimitPassed(
uint _expectedPrice,
uint _actualPrice,
uint _slippage
)
internal
pure
returns(bool)
{
return _expectedPrice.sub(_actualPrice) <= _slippage.mul(_expectedPrice).div(PPM);
}
| 1,081,696 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.12;
import "./ERC721PackedStruct.sol";
import "../../lib/Controllable.sol";
import "../../opensea/ContextMixin.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
contract MetroPass is ERC721PackedStruct, Controllable {
uint256 constant publi... | whitelist OpenSea proxy contract for easy trading. | function isApprovedForAll(address owner, address operator) public view override
returns (bool)
{
if (proxyRegistryAddress != address(0x0)) {
ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress);
if (address(proxyRegistry.proxies(owner)) == operator) {
... | 9,932,470 |
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity ^0.6.12;
import "./BaseJumpRateModelV2.sol";
import "./Interfaces/InterestRateModelInterface.sol";
/**
* @title MOAR's JumpRateModel Contract V2 for V2 mTokens
* @notice Supports only for V2 mTokens
*/
contract JumpRateModelV2 is BaseJumpRateModelV2 {
... | Calculates the current borrow rate per block cash The amount of cash in the market borrows The amount of borrows in the market reserves The amount of reserves in the market return The borrow rate percentage per block as a mantissa (scaled by 1e18)/ | function getBorrowRate(uint cash, uint borrows, uint reserves) external override view returns (uint) {
return getBorrowRateInternal(cash, borrows, reserves);
}
| 84,768 |
pragma solidity ^0.4.17;
contract PetCard {
struct Card {
bytes32 code; //卡片代码,决定卡片的功能
uint256 value;
address owner;
bool isSelling;
uint sellingPrice;
uint cardId;
}
enum ErrorCode {ERROR_NO_ERROR, ERROR_INDEX_OUT_OF_RANGE, ERROR_WRONG_OWNER, ERROR_CARD_IS_S... | 用户卖自己的卡片给合约 判断卡片下标是否合法 判断卖家是否为卡片拥有者 | function sellCard(uint cardId) public payable {
address seller = msg.sender;
if (cardId >= cards.length || cardId < 0) {
seller.transfer(msg.value);
SellCardEvent(cardId, false, ErrorCode.ERROR_INDEX_OUT_OF_RANGE);
return;
}
Card storage card = car... | 5,374,747 |
pragma solidity ^0.4.24;
pragma experimental "v0.5.0";
import {IndexedOrderedSetLib} from "./IndexedOrderedSetLib.sol";
import {Authorized} from "./Authority.sol";
/// @title Database contract for a package index package data.
/// @author Tim Coulter <tim.coulter@consensys.net>, Piper Merriam <pipermerriam@gmail.com... | Query the existence of a package with the given name. Returns boolean indicating whether the package exists. nameHash The name hash of a package. | function packageExists(bytes32 nameHash)
public
view
returns (bool)
{
return _recordedPackages[nameHash].exists;
}
| 1,039,819 |
pragma solidity ^0.4.24;
interface token {
function transfer(address receiver, uint amount) external;
}
contract Ownable {
address public owner;
constructor() public {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
... | Set the amount of tokens per one ether/ | function setTokensPerEth(uint value) public onlyOwner {
amountTokensPerEth = value;
}
| 1,763,669 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.6.4 <0.8.0;
pragma experimental ABIEncoderV2;
import "./announcement.sol";
import "./eventsEIP1129.sol";
import "https://github.com/vigilance91/solidarity/libraries/unsigned/uint256ToString.sol";
///
/// @dev Library for managing an enumerable mapping of Anno... | return {announcement.data[]} an array containing a subset (slice) of the primary storage calling this may become prohabitively expensive for large ranges, since loops in Ethereum consume large quantities of gas | function slice(
Map storage map,
uint256 indexStart,
uint256 indexStop
)public returns(
announcement.data[] memory ret
){
uint256 L = _length(map);
L.requireGreaterThanZero(
);
L.requireGreaterThanOrEqual(indexStop);
f... | 12,573,361 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.4;
import {SafeMath} from "@openzeppelin/contracts/utils/math/SafeMath.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {
SafeERC20
} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {GnosisAuction} from "... | Withdraws the assets on the vault using the outstanding `DepositReceipt.amount` amount is the amount to withdraw in `asset`/ Subtraction underflow checks already ensure it is smaller than uint104 | function withdrawInstantly(uint256 amount, uint256) external nonReentrant {
Vault.DepositReceipt storage depositReceipt =
depositReceipts[msg.sender];
uint256 currentRound = vaultState.round;
require(amount > 0, "!amount");
require(depositReceipt.round == currentRound, ... | 6,125,505 |
/**
*Submitted for verification at Etherscan.io on 2022-01-19
*/
// Sources flattened with hardhat v2.8.2 https://hardhat.org
// File contracts/solidity/proxy/IBeacon.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev This is the interface that {BeaconProxy} expects of its beacon.
*/
interfa... | Manager for configuration. Owner for administrative functions. | function deployVault(
string memory name,
string memory symbol,
address _assetAddress,
bool is1155,
bool allowAllItems
) internal returns (address) {
address newBeaconProxy = address(new BeaconProxy(address(this), ""));
NFTXVaultUpgradeable(newBeaconProxy)... | 2,228,182 |
pragma solidity ^0.4.24;
import "./CoinVerseContractIds.sol";
import "./CoinUsOnly.sol";
import "./interfaces/IBnusConverter.sol";
import "./interfaces/IBnusToken.sol";
import "bancor-contracts/solidity/contracts/converter/BancorConverter.sol";
import "bancor-contracts/solidity/contracts/converter/interfaces/IBancorGa... | returns expected amount of Cnus for the given Bnus/ | function getExpectedCnus(uint256 _bnus)
public
view
returns (uint256)
{
uint256 amount;
uint256 feeAmount;
IERC20Token cnus = IERC20Token(registry.addressOf(CNUS_TOKEN));
(amount, feeAmount) = getSaleReturn(cnus, _bnus);
return amount;
}
| 12,536,877 |
pragma solidity ^0.7.0;
// SPDX-License-Identifier: MIT
import "./DaoConstants.sol";
import "../helpers/FlagHelper.sol";
import "../guards/AdapterGuard.sol";
import "../utils/IERC20.sol";
import "../utils/SafeMath.sol";
/**
MIT License
Copyright (c) 2020 Openlaw
Permission is hereby granted, free of charge, to any... | return The token from the bank of a given index index The index to look up in the bank's tokens/ | function getToken(uint256 index) external view returns (address) {
return _bank.tokens[index];
}
| 5,421,656 |
// File: contracts/utils/Ownable.sol
pragma solidity >=0.4.21 <0.6.0;
contract Ownable {
address private _contract_owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
c... | `getValueAt` retrieves the number of tokens at a given block number checkpoints The history of values being queried _block The block number to retrieve the value at return The number of tokens being queried Shortcut for the actual value Binary search of the value in the array | function getValueAt(Checkpoint[] storage checkpoints, uint _block) internal view returns (uint) {
if (checkpoints.length == 0)
return 0;
if (_block >= checkpoints[checkpoints.length-1].fromBlock)
return checkpoints[checkpoints.length-1].value;
if (_block < checkpoint... | 1,123,718 |
// SPDX-License-Identifier: ISC
pragma solidity ^0.8.4;
import "../interfaces/IERC20.sol";
import "../utils/Context.sol";
import "../interfaces/IWhitelist.sol";
contract PrivateSale is Context {
/**
* Investment Structure.
*/
struct Investment {
uint256 _usdt;
uint256 _usdc;
... | send usdt from SC to any EOA. `caller` should be admin account. `to` cannot be zero address./ | function sendUsdt(address to, uint256 amount)
public
virtual
onlyAdmin
returns (bool)
{
require(to != address(0), "Error: cannot send to zero addresss");
IERC20(_usdt).transfer(to, amount);
return true;
}
| 1,129,342 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol";
//import "@uniswap/v3-periphery/contracts/interfaces/INonfungiblePositionManager.sol";
//import "@uniswap/v3-periphery/contracts/libraries/TransferHelper.sol";
import "@uniswap/v3-periphery/contra... | stake tokenId of UniswapV3 tokenId tokenId deadline the deadline that valid the owner's signature v the owner's signature - v r the owner's signature - r s the owner's signature - s | function stakePermit(
uint256 tokenId,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
)
external
override
nonZeroAddress(token)
nonZeroAddress(vault)
nonZeroAddress(stakeRegistry)
nonZeroAddress(poolToken0)
nonZeroA... | 12,109,785 |
./full_match/80001/0x6613F4F262C552a6376f63048efcacf9406D63A4/sources/contracts/RRCNFT.sol | Get user rental info The (0, 0) value indicates that there is no rented NFT user The address to get the rented NFT for return tokenId and expires time stamp | function rentalInfo(address user) public view virtual returns (RentalInfo memory) {
if (uint256(_rentalInfo[user].expires) >= block.timestamp) {
return _rentalInfo[user];
}
return RentalInfo(0, 0, NftType.SILVER);
}
| 836,535 |
./partial_match/97/0x406b97165b45963F396389Fc8d403683b88CFC52/sources/BUB.sol | PUBLIC FACING: External helper to return multiple values of xfLobby[] with a single call beginDay First day of data range endDay Last day (non-inclusive) of data range return Fixed array of values/ | function xfLobbyRange(uint256 beginDay, uint256 endDay)
external
view
returns (uint256[] memory list)
{
require(
beginDay < endDay && endDay <= _currentDay(),
"BUB: invalid range"
);
list = new uint256[](endDay - beginDay);
uint25... | 11,372,924 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/math/SafeMath.sol";
interface IKnownOrigin {
/**
* @dev Public entry point for purchasing an edition on behalf of someone else
* @dev Reverts if edition is invalid
* @dev Reverts... | Get price to mint the next print | function estimateAssetPriceInEth(uint256 editionNumber) public view returns(uint256 priceInWei) {
(,,,,,,priceInWei,,,,) = IKnownOrigin(KNOWNORIGIN).detailsOfEdition(editionNumber);
}
| 1,017,616 |
./full_match/1/0xe7E2A4B09A994BE970b2dF5CB4514b5324F2Ec27/sources/contracts/external/profiles/AddrResolver.sol | Sets the address associated with an ENS node. May only be called by the owner of that node in the ENS registry. node The node to update. a The address to set./ | function setAddr(bytes32 node, address a) virtual external authorised(node) {
setAddr(node, COIN_TYPE_ETH, addressToBytes(a));
}
| 8,350,539 |
./full_match/5/0x88E6A8bA858c86D4c395ed44797fA6Abf3a99fa7/sources/src/TwoSlots.sol | Used to update an existing sell type order. _contestID ID of contest where order need an update. _orderID ID of order to update. _isUpOption Boolean value to indicate whether the options are type of UP or DOWN. _newQuantityToSell Defines the new quantity of option to sell. _newPricePerOption Defines the new price ... | function updateSellOrder(
uint256 _contestID,
uint256 _orderID,
bool _isUpOption,
uint256 _newQuantityToSell,
uint256 _newPricePerOption
)
external
whenNotPaused
isContestSecondaryMarket(_contestID)
isOwnerOfOrder(_contestID, _orderID)
... | 11,622,833 |
./full_match/137/0xD12345Cd15352ef5d4259BD2a918Fcb6943ce7a4/sources/contracts/core/connext/helpers/StableSwap.sol | Remove liquidity from the pool all in one token. Withdraw fee that decays linearly over period of 4 weeks since last deposit will apply. tokenAmount the amount of the token you want to receive tokenIndex the index of the token you want to receive minAmount the minimum amount to withdraw, otherwise revert deadline l... | function removeLiquidityOneToken(
uint256 tokenAmount,
uint8 tokenIndex,
uint256 minAmount,
uint256 deadline
) external override nonReentrant whenNotPaused deadlineCheck(deadline) returns (uint256) {
return swapStorage.removeLiquidityOneToken(tokenAmount, tokenIndex, minAmount);
}
| 4,729,541 |
pragma solidity ^0.4.13;
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
own... | Transfer back remaining MANA to account _address Address of the account to return MANA to _amount Amount of MANA to return/ Use vesting return address if present | function transferBackMANA(address _address, uint256 _amount) onlyOwner public {
require(_address != address(0));
require(_amount > 0);
address returnAddress = _address;
if (returnVesting != address(0)) {
address mappedAddress = returnVesting.returnAddress(_address);
if (mappedAddress != ... | 12,678,247 |
./full_match/1/0x7e59ee57E4B2FB320E2a36Ff10a8085134fE65D8/sources/contracts/strategies/curve/StrategyConvexBicryptoL1.sol | Sets the default slippage for Curve swaps used during harvest Only the admin and super admin can call this function _defaultSlippage The default slippage percentage (0-100) | function setDefaultSlippageCurve(uint256 _defaultSlippage) external onlyAdmin {
require(ONE_HUNDRED >= _defaultSlippage, "InvalidDefaultSlippage");
emit SetSlippage(defaultSlippageCurve, _defaultSlippage, "Curve");
defaultSlippageCurve = _defaultSlippage;
}
| 4,849,974 |
//Address: 0x0224853bdff6b04ce259d87303b7523d4e16d656
//Contract name: FidaSale
//Balance: 0.03767317584584704 Ether
//Verification Date: 5/23/2018
//Transacion Count: 117
// CODE STARTS HERE
pragma solidity ^0.4.23;
// File: zeppelin-solidity/contracts/math/Math.sol
/**
* @title Math
* @dev Assorted math operat... | Give out a bounty _tokens Amount of tokens to be given out _address Address whom will receive the bounty/ | function giveBounty(uint256 _tokens, address _address) external {
require(msg.sender == bountyAddress);
tokenAvailable = tokenAvailable.sub(_tokens);
mintableFida.sendBoughtTokens(_address, _tokens);
}
| 999,144 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/cont... | Function to allow LPs to remove their liquidity from an existing NFT Also automatically redeems any earned fee/ Claculate how much shares represent input amount Calculate rewards accumulated Handle edge cases where eligibleLiquidity is less than what was supplied by very small amount Handle round off errors to avo... | function removeLiquidity(uint256 _nftId, uint256 _amount)
external
nonReentrant
onlyValidLpToken(_nftId, _msgSender())
whenNotPaused
{
(address _tokenAddress, uint256 nftSuppliedLiquidity, uint256 totalNFTShares) = lpToken.tokenMetadata(_nftId);
require(_isSupport... | 12,983,639 |
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.5.2;
pragma experimental "ABIEncoderV2";
/**
* @title ERC20 interface
* @dev see https://eips.ethereum.org/EIPS/eip-20
*/
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function app... | Get USD value of one component in a Set to 18 decimals _tokenPrice The 18 decimal value of one full token _naturalUnit The naturalUnit of the set being component belongs to _unit The unit of the component in the set _tokenDecimals The component token's decimal value return ... | function calculateTokenAllocationAmountUSD(
uint256 _tokenPrice,
uint256 _naturalUnit,
uint256 _unit,
uint256 _tokenDecimals
)
internal
view
returns (uint256)
{
uint256 SET_TOKEN_DECIMALS = 18;
uint256 componentUnitsInFullToken = _unit... | 1,001,011 |
pragma solidity ^0.5.16;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIABLES ... | Initial funding for the insurance. Unless there are too many delayed flights resulting in insurance payouts, the contract should be self-sustaining/ | function fund(address airline, uint256 amount)
external
requireIsOperational
requireIsCallerAuthorized
requireAirlineIsRegistered(airline)
requireAirlineIsNotFunded(airline)
returns (bool)
{
airlines[airline].isFunded = true;
airlines[airline].funds = airlines[airline].funds.add(amou... | 5,537,545 |
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
/* Contract Imports */
import { StateCommitmentChain } from "../chain/StateCommitmentChain.sol";
import { CanonicalTransactionChain } from "../chain/CanonicalTransactionChain.sol";
import { StateTransitioner } from "./StateTransitioner.sol";
import { IStateTran... | Finalizes the fraud verification process. Checks that the state transitioner has executed the transition to completion and that the resulting state root differs from the one previous published. _preStateTransitionIndex Index of the state transition suspected to be fraudulent. _postStateRoot Published root of the stat... | function finalizeFraudVerification(
uint256 _preStateTransitionIndex,
bytes32 _preStateRoot,
DataTypes.StateElementInclusionProof memory _preStateRootProof,
bytes32 _postStateRoot,
DataTypes.StateElementInclusionProof memory _postStateRootProof
)
public
{
... | 12,543,281 |
pragma solidity ^0.4.24;
contract FrequentFlyerRewardsCalculator
{
//Set of States
enum StateType {SetFlyerAndReward, MilesAdded}
//List of properties
StateType public State;
address public AirlineRepresentative;
address public Flyer;
uint public RewardsPerMile;
uint[] ... | Set of StatesList of properties constructor function | {
StateType public State;
address public AirlineRepresentative;
address public Flyer;
uint public RewardsPerMile;
uint[] public Miles;
uint IndexCalculatedUpto;
uint public TotalRewards;
constructor(address flyer, int rewardsPerMile) public
enum StateType {SetFlyerAndReward, Mil... | 5,510,824 |
./full_match/80001/0x271e7Ba38970356FBbE4b57912b76325F3C8731e/sources/contracts/DoubleDiceProtocol.sol | Get account that created VF with id `vfId`./ | function getVirtualFloorCreator(uint256 vfId) public view returns (address) {
return _vfs[vfId].creator;
}
| 5,639,072 |
pragma solidity ^0.4.22;
contract Voting {
// Number of blocks to challenge this block (10 minutes, 5 blocks per minute)
uint constant private NUM_BLOCKS_TO_LOCK = 10 * 5;
struct Stake {
address staker;
uint256 stake;
}
struct Value {
string value;
uint totalStake;... | require(_key.length > 0, "Key can't be empty string"); new key new value | function put(string _key, string _value) public payable returns (bool) {
require(msg.value > 0, "You need to stake money bro");
MultiValue storage multiValue = getMultiValue(_key);
require(!multiValue.isLocked, "Can't use put on the locked key");
if (multiValue.numValues == 0) {
... | 5,409,306 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradea... | Invest the underlying assets for additional yield. Only governance or strategist can call this function./ | function invest() public virtual override onlyStrategist {
_invest();
}
| 15,803,248 |
/**
*Submitted for verification at Etherscan.io on 2022-01-15
*/
// Sources flattened with hardhat v2.8.2 https://hardhat.org
// File @openzeppelin/contracts/utils/[email protected]
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides in... | Disables presale./ | function disablePreSale() public onlyOwner {
_disablePreSale();
}
| 10,762,914 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "./ERC721A.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@open... | Mints `quantity` tokens and transfers them to `to`. Requirements: - `to` cannot be the zero address. - `quantity` must be greater than 0. Emits a {Transfer} event./ Overflows are incredibly unrealistic. balance or numberMinted overflow if current value of either + quantity > 1.8e19 (264) - 1 updatedIndex overflows if _... | function _mint(
address to,
uint256 quantity,
bytes memory _data,
bool safe
) internal {
uint256 startTokenId = _currentIndex;
if (to == address(0)) revert MintToZeroAddress();
if (quantity == 0) revert MintZeroQuantity();
_beforeTokenTransfers(ad... | 26,289 |
// SPDX-License-Identifier: MIT
/**
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMWWWWWWWWWWWWWWWMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMWWNXXKKKKKKKXXXXKKKKKKXXNWWMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMWNXKKKKXXNWWWWMMWWWWMWWWWNXXXKKKXNWMMMMMMMMMMMMMMMM... | Withdraw a bid when the auction is not finalized transfer funds to highest bidder always | function withdraw(uint256 tokenId) public nonReentrant {
require(canWithdraw(tokenId), "Conditions to withdraw are not met");
if (auctions[tokenId].highestBid > 0) {
require(payment_token.transfer(auctions[tokenId].highestBidder, auctions[tokenId].highestBid), "Transfer failed.");
... | 1,140,429 |
/**
*Submitted for verification at Etherscan.io on 2022-03-03
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface Ierc721Receiver {
function onerc721Received(address operator, address from, uint256 tokenId, bytes calldata data) external returns (bytes4);
}
library Address {
function i... | If there is no base URI, return the token URI. | function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "erc721URIStorage: URI query for nonexistent token");
string memory _tokenURI = _tokenURIs[tokenId];
string memory base = _baseURI();
if (bytes(base).length == 0) {
return _tokenURI;
}
... | 6,767,182 |
./partial_match/1/0x90A62dc4BF3f805504a248A49eFC469F406D41b9/sources/src/Contracts/LiquidLocker/LockerMaster.sol | token The address of the token to release from lock. amount The amount of tokens to be released from lock. payload Additional data associated with the release (optional). Releases the specified amount of tokens from lock to DAO treasury./ | function releaseLock(address token, uint256 amount, bytes calldata payload) external onlyOwner {
address adapter = _adapter().adapter;
if (adapter == address(0)) revert AdapterDisabled();
ILiquidLocker(adapter).releaseLock(token, amount, payload);
emit Release(msg.sender, amount);
... | 4,091,692 |
pragma solidity ^0.4.24;
/**
* Copyright YHT Community.
* This software is copyrighted by the YHT community.
* Prohibits any unauthorized copying and modification.
* It is allowed through ABI calls.
*/
// <ORACLIZE_API>
/*
Copyright (c) 2015-2016 Oraclize SRL
Copyright (c) 2016 Oraclize LTD
Perm... | deposit In extreme cases, the remaining amount may not be able to pay the callback charges, everyone can reactivate/ | function deposit() public payable {
}
| 1,842,034 |
pragma solidity ^0.5.11;
/**
Part of code teken from OpenZeppelin
*/
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, uint256 b) i... | _totalSupply = _totalSupply.sub(value); | function _burn(address account, uint256 value) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(value, "ERC20: burn amount exceeds balance");
emit Transfer(account, address(0), value);
}
| 15,848,521 |
/**
*Submitted for verification at Etherscan.io on 2021-12-06
*/
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/utils/Counters.sol
// OpenZeppelin Contracts v4.4.0 (utils/Counters.sol)
pragma solidity ^0.8.0;
/**
* @title Counters
* @author Matt Condon (@shrugs)
* @dev Provides counters that ... | Emitted when the pause is triggered by `account`./ Emitted when the pause is lifted by `account`./ Initializes the contract in unpaused state./ | function initializePausable() internal {
_paused = false;
}
| 7,989,122 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
import "IERC721.sol";
import "IERC721Receiver.sol";
import "IERC20.sol";
import "SafeERC20.sol";
import "SafeMath.sol";
import "Address.sol";
import "Ownable.sol";
import "ReentrancyGuard.sol";
import "Security4.sol";
import "ORentable.sol";
import "YRentable.s... | Withdraw asset ERC20 or ETH _assetAddress Asset to be withdrawn./ | function _withdrawERC20ETH(address _assetAddress) internal virtual {
uint256 assetBalance;
if (_assetAddress == ETHER) {
assetBalance = self.balance;
payable(msg.sender).transfer(assetBalance);
assetBalance = IERC20(_assetAddress).balanceOf(address(this));
... | 328,638 |
//██████╗ █████╗ ██╗ █████╗ ██████╗ ██╗███╗ ██╗
//██╔══██╗██╔══██╗██║ ██╔══██╗██╔══██╗██║████╗ ██║
//██████╔╝███████║██║ ███████║██║ ██║██║██╔██╗ ██║
//██╔═══╝ ██╔══██║██║ ██╔══██║██║ ██║██║██║╚██╗██║
//██║ ██║ ██║███████╗██║ ██║██████╔╝██║██║ ╚████║
//╚═╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═════... | Return true is the given address is the owner of the palLoanToken for the given palLoan _loanAddress Address of the Loan _user User address return bool : true if owner/ | function isLoanOwner(address _loanAddress, address _user) public view override returns(bool){
return palLoanToken.allOwnerOf(idOfLoan(_loanAddress)) == _user;
}
| 548,474 |
/**
* Copyright 2017-2020, bZeroX, LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0.
*/
pragma solidity 0.5.3;
pragma experimental ABIEncoderV2;
import "../openzeppelin-solidity/Math.sol";
import "../proxy/BZxProxiable.sol";
import "../shared/OrderTakingFunctions.sol";
contract OrderTa... | Takes the order as lender that's already pushed on chain loanOrderHash A unique hash representing the loan order. return Total amount of loanToken borrowed (uint256). Lenders have to fill the entire desired amount the trader wants to borrow. This makes loanTokenAmountFilled = loanOrder.loanTokenAmount. lenders have ... | function takeLoanOrderOnChainAsLender(
bytes32 loanOrderHash)
external
nonReentrant
tracksGas
returns (uint256)
{
LoanOrderAux memory loanOrderAux = orderAux[loanOrderHash];
uint256 loanTokenAmountFilled = orders[loanOrderHash].loanTokenAmount.sub... | 5,359,073 |
./full_match/1/0xc07bBC8Ec176D3525569263253a24CfF7d6A31eb/sources/src/strategies/BaseStrategy.sol | Strategy's balance of underlying asset. return assets Strategy's balance. | function balanceOfAsset() public view returns (uint256 assets) {
assets = asset.balanceOf(address(this));
}
| 9,604,845 |
pragma solidity 0.4.24;
// File: zeppelin-solidity/contracts/math/SafeMath.sol
/**
* @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 (uint2... | Validation of an incoming purchase. Overridden to ensure that the tokensale contains enough tokens to sell. _beneficiary Address performing the token purchase _weiAmount Value in wei involved in the purchase/ | function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal {
require(token.balanceOf(this) > _getTokenAmount(_weiAmount));
super._preValidatePurchase(_beneficiary, _weiAmount);
}
| 98,360 |
// SPDX-License-Identifier: MIT
pragma solidity 0.5.3;
import '@openzeppelin/upgrades/contracts/Initializable.sol';
import './AuctionFactory.sol';
import './Escrow.sol';
/// @title Gloom - contracts to auction off ERC-20 tokens to the highest bidder (in ETH)
/// @title Auction contract, to be used in conjunction with... | Get address of deployed Escrow contract at any time Used in frontend to obtain escrow contract address for seller and winner return address of deployed Escrow contract | function getEscrow() external view onlySellerOrWinner returns (Escrow) {
return escrow;
}
| 1,775,614 |
pragma solidity ^0.4.24;
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is als... | Returns list of owners. return List of owner addresses. | function getOwners()
public
constant
returns (address[])
{
return owners;
}
| 951,370 |
./full_match/11155111/0x8e1bAB4E2D4f2A5996412A269D673710e429f5F6/sources/contracts/MetaDisplay.sol | Get the collection from the global collections mapping Add the asset ID to the collection's assetId array Update the collection's assetId field Emit an AssetAdded event | function addAssetToCollection(
bytes32 _collectionId,
string memory _assetId
) public {
Collections storage collection = collections[uint256(_collectionId)];
collection.assetId.push(_assetId);
collections[uint256(_collectionId)].assetId = collection.assetId;
by... | 3,794,092 |
pragma solidity ^0.4.24;
import "./ICheckpoint.sol";
import "../../interfaces/ISecurityToken.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/math/Math.sol";
/**
* @title Checkpoint module for issuing ether dividends
*/
contract EtherDividendCheckpoint is ICh... | Issuer can push dividends to provided addresses _dividendIndex Dividend to push _payees Addresses to which to push the dividend/ | function pushDividendPaymentToAddresses(uint256 _dividendIndex, address[] _payees) public onlyOwner validDividendIndex(_dividendIndex) {
Dividend storage dividend = dividends[_dividendIndex];
for (uint256 i = 0; i < _payees.length; i++) {
if (!dividend.claimed[_payees[i]]) {
... | 1,771,793 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
pragma abicoder v2;
import "../AnteTest.sol";
import "./interfaces/IUniswapV2Pair.sol";
import "./interfaces/IMasterChef.sol";
import "./libraries/MathLib.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "hardhat/console.sol";
/// @notice A... | checks total supply of OT divided by the exhchangeRate vs number of lp tokens deposited for each supported asset return true if total supply of OT divided by exchangeRate of OT and LP is smaller or equal to the number of lp tokens deposited <= lpBal 101% to account for precision issues | function checkTestPasses() public view override returns (bool) {
uint256 lpBal = IMasterChef(masterChef).userInfo(pid, yieldTokenHolder).amount;
(uint256 reserve0, uint256 reserve1, ) = IUniswapV2Pair(yieldToken).getReserves();
uint256 currentK = Math.sqrt(reserve0.mul(reserve1));
u... | 12,116,009 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.