file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./full_match/1/0xf6df3c0C0dEc730846F76207EAb0aA4c916d0419/sources/src/Oiran.sol | Set the merkle root for the allow list mint/ | function setMerkleRoot(
bytes32 _merkleRoot,
OiranTicketID ticket
) external onlyRole(DEFAULT_ADMIN_ROLE) {
merkleRoot[ticket] = _merkleRoot;
}
| 3,173,377 |
./partial_match/4/0xFD08F9d24c673216663928acb6BF5Ac1c09FEd0C/sources/YVAULTMASTER.sol | Safe yvault transfer function, just in case if rounding error causes pool to not have enough YVAULTs. | function safeYvaultTransfer(address _to, uint256 _amount) internal {
uint256 yvaultBal = yvault.balanceOf(address(this));
if (_amount > yvaultBal) {
yvault.transfer(_to, yvaultBal);
yvault.transfer(_to, _amount);
}
}
| 8,687,362 |
./full_match/137/0x606df21fF6f5Cb55A6B6EF3d960cc6C15820581c/sources/contracts/campaign/NFTRewardCampaign.sol | Function to participate in a campaign Verify the token is part of the campaign If it's FCFS, distribute reward immediately Check if the campaign has enough rewards left Transfer the NFT to the claimer Remove the token from the campaign Check if the campaign has enough rewards left Transfer the tokens to the claimer Upd... | function participate(ClaimData calldata data, bytes calldata signature) public whenStarted nonReentrant {
require(!finished, "Campaign finished");
require(!isParticipant[msg.sender], "Already participated");
require(verifySignature(data, signature), "Invalid signature");
to... | 4,697,139 |
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `accou... | get offset of current block from beginning | function totalReleased() public view returns (uint256) {
if (block.number < miningBeginBlock) return 0;
uint256 currentOffset = block.number.sub(miningBeginBlock);
uint256 sum = 0;
for (uint256 idx = periodes.length - 1; ; --idx) {
PeriodeReleases memory onePeriode = peri... | 13,446,551 |
./partial_match/3/0x2C02cD8a2645D97977E7ffE74Ed21a943ba465E0/sources/option.sol | set highest claimed round for account/ | function setClaimedRound(uint r, address account) external override onlyPool {
claimedRounds[account] = r;
}
| 5,241,110 |
pragma solidity ^0.4.8;
/**
* @title KittyItemToken interface
*/
contract KittyItemToken {
function transfer(address, uint256) public pure returns (bool) {}
function transferAndApply(address, uint256) public pure returns (bool) {}
function balanceOf(address) public pure returns (uint256) {}
}
/**
... | Buy item from the market and apply to kittyId _itemName Name of item to buy _kittyId KittyId to apply the item/ NOTE - can only be used to buy and apply 1 item emit events | function buyItemAndApply(string _itemName, uint256 _kittyId) public payable {
require(paused == false);
item.totalFunds += msg.value;
KittyItemToken kit = KittyItemToken(item.itemContract);
kit.transferAndApply(msg.sender, _kittyId);
Buy(_itemName);
}
| 6,477,569 |
./full_match/43113/0xE5788C63c789984e9F686500bc06F36C27756A61/sources/MasterChef.sol | Safe fd transfer function, just in case if rounding error causes pool to not have enough fds. | function safefdTransfer(address _to, uint256 _amount) internal {
uint256 fdBal = fd.balanceOf(address(this));
bool transferSuccess = false;
if (_amount > fdBal) {
transferSuccess = fd.transfer(_to, fdBal);
transferSuccess = fd.transfer(_to, _amount);
}
... | 13,179,059 |
pragma solidity 0.5.16;
... | inject NONSTANDARD NAMING | function SUSPENDISSUANCE45() external ONLYOWNER801 { | 12,757,125 |
./full_match/1/0x91C1842E87dE6fCc81b2a83e31Da00345e95059D/sources/contracts/PartyBidRA.sol | Returns boolean status of if DAO has won NFT/ Check if owner of NFT(auctionID) is contract address | function NFTWon() public view returns (bool) {
return IERC721(NFTAddress).ownerOf(auctionID) == address(this);
}
| 3,220,150 |
pragma solidity ^0.4.18;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 v... | register the addresses for token sale _addrs address[] The addresses to register for token sale/ | function registerByList(address[] _addrs)
public
onlyAdmin
{
for(uint256 i = 0; i < _addrs.length; i++) {
require(_addrs[i] != address(0) && registeredAddress[_addrs[i]] == false);
registeredAddress[_addrs[i]] = true;
Registered(_addrs[i]);
}
}
| 1,076,087 |
pragma solidity 0.4.18;
// File: zeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
... | overriding CrowdsalevalidPurchase to add capped sale logic return true if the transaction can buy tokens | function validPurchase(uint256 tokens) internal view returns (bool) {
bool withinPeriod = now >= startTime && now <= endTime;
bool withinCap = soldTokens.add(tokens) <= hardCap;
bool withinTotalSupply = soldTokens.add(tokens) <= totalTokenSupply;
bool nonZeroPurchase = msg.value != 0... | 15,171,696 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
library ArrayUtils {
/**
* @notice get minimum value in given array
* @param array array to search
* @return minimum value
*/
function min(bytes32[] memory array) internal pure returns (bytes32) {
bytes32 minValue = bytes32(ty... | get minimum value in given array array array to search return minimum value/ | function min(address[] memory array) internal pure returns (address) {
address minValue = address(type(uint160).max);
unchecked {
for (uint256 i; i < array.length; i++) {
if (array[i] < minValue) {
minValue = array[i];
}
}
... | 1,036,441 |
./full_match/1/0x0BbE1D2c0BB0a2b7F2E3c3D59358193C9d2b0301/sources/contracts/staking/ResourceFieldV2.sol | See {IResourceField-enable}./ | function enable() external override onlyOwner {
_enabled = true;
}
| 4,829,581 |
./partial_match/1/0x382BE1C7248E48E25169D17E981F4bF03E576534/sources/ERC721UpgradeableProxy.sol | Perform implementation upgrade Emits an {IERC1967-Upgraded} event./ | function upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
| 15,659,215 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import {
Lib_PredeployAddresses
} from "@eth-optimism/contracts/libraries/constants/Lib_PredeployAddresses.sol";
import { StandardBridge } from "../universal/StandardBridge.sol";
/**
* @title L1StandardBridge
* @dev The L1 ETH and ERC20 Bridge is a contrac... | Deposit an amount of ETH to a recipient's balance on L2. _to L2 address to credit the withdrawal to. _minGasLimit Gas limit required to complete the deposit on L2. _data Optional data to forward to L2. This data is provided solely as a convenience for external contracts. Aside from enforcing a maximum ... | function depositETHTo(
address _to,
uint32 _minGasLimit,
bytes calldata _data
) external payable {
_initiateETHDeposit(msg.sender, _to, _minGasLimit, _data);
}
| 7,266,017 |
./full_match/137/0x350c116680b8556D04a57A5a96baa4f375325197/sources/contracts/MainV2Beta.sol | Purchase index with ERC20 token | function purchaseIndexViaERC20(
address[] calldata _tokenAddresses,
uint256[] calldata _tokenAmounts,
address _tokenIn,
uint256 _amountTotal,
uint256 _amountWithFee
) external payable {
uint256[] memory _tokenAmountsReceived = uniHelper
.ERC20ToMultiSw... | 4,672,948 |
pragma solidity ^0.5.0;
contract GameManager {
// one simple gamble game
uint rand; // a number to guess
uint constant ticket = 1 ether; // the gamble fee
uint constant duration = 20 seconds; // duration of the game
uint endTime;
// top three participants, who guess most clo... | return the positive distance between _num1 and _num2 | function distance(uint _num1, uint _num2) private pure returns(uint) {
if (_num1 > _num2) {
return _num1 - _num2;
}
else {
return _num2 - _num1;
}
}
| 12,775,255 |
pragma solidity ^0.4.24;
// File: openzeppelin-zos/contracts/introspection/ERC165.sol
/**
* @title ERC165
* @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md
*/
interface ERC165 {
/**
* @notice Query if a contract implements an interface
* @param _interfaceId The interface identifier, as s... | Transfer a LAND owned by an Estate to a new owner estateId Current owner of the token landId LAND to be transfered destinatary New owner/ | function transferLand(
uint256 estateId,
uint256 landId,
address destinatary
)
external
canTransfer(estateId)
{
return _transferLand(estateId, landId, destinatary);
}
| 1,763,308 |
./full_match/1/0x4f4fFE6f397F5BC985F4dc1EB5a0eB2D9B93D12D/sources/contracts/V3/LandingPage.sol | Allows the owner to change the price of 1 token in USDT. _price The new price of 1 token in USDT. | function changePriceInUsdt(uint256 _price) external onlyOwner {
uint256 oldPrice = priceInUsdt;
priceInUsdt = _price;
emit PriceInUsdtChanged(oldPrice, _price);
}
| 3,146,067 |
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not... | update crowdsale agent | function setCrowdsaleAgent(CrowdsaleAgent _crowdsaleAgent) public onlyOwner {
crowdsaleAgent = _crowdsaleAgent;
}
| 5,374,376 |
//Address: 0x3c159c0b03974f4b2befdde6f9f4ef09fd8d697b
//Contract name: CulturalCoinToken
//Balance: 0 Ether
//Verification Date: 2/26/2018
//Transacion Count: 61
// CODE STARTS HERE
pragma solidity ^0.4.18;
/// @title Ownable contract
library SafeMath {
function mul(uint256 a, uint256 b) internal constant return... | Mapping for balances Mapping for allowance Any unsold tokens from ICO will be sent to owner address and burned _amount Amount of tokens to be burned from owner address return True if successfully burned | function burn(uint _amount) public onlyOwner returns (bool) {
require(balances[msg.sender] >= _amount);
balances[msg.sender] = balances[msg.sender].sub(_amount);
totalSupply = totalSupply.sub(_amount);
Burn(msg.sender, _amount);
return true;
}
| 5,380,063 |
./full_match/80001/0xfFB09dc5BDaf689D7D00B71e76030B8FEA0a13E2/sources/src/dev/functions/Functions.sol | Initializes a Chainlink Functions Request Sets the codeLocation and code on the request self The uninitialized request location The user provided source code location language The programming language of the user code source The user provided source code or a url/ | function initializeRequest(
Request memory self,
Location location,
CodeLanguage language,
string memory source
) internal pure {
if (bytes(source).length == 0) revert EmptySource();
self.codeLocation = location;
self.language = language;
self.sou... | 9,515,326 |
pragma solidity ^0.4.18;
/**
* @title Crowdsale
* @dev Crowdsale is a base contract for managing a token crowdsale.
* Crowdsales have a start and end timestamps, where investors can make
* token purchases and the crowdsale will assign them tokens based
* on a token per ETH rate. Funds collected are forward... | tokens not to be sent to 0x0the purchase should be within duration and non zero amount sent by the user calculate token amount to be soldDetermine bonuscan't sale tokens more than 52500000000 tokens30% of the tokens being sold are being accumulated for the etheera team | function buyTokens(address beneficiary) public payable {
require(beneficiary != 0x0);
if(hasEnded() && !isHardCapReached)
{
if (!isSoftCapReached)
refundToBuyers = true;
burnRemainingTokens();
beneficiary.transfer(msg.value);
}
else
{
require(validPurchase());
... | 969,240 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
import '../utils/EnumerableSet.sol';
import '../utils/Address.sol';
import '../utils/Context.sol';
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms.
*
* Roles are referred to by their `bytes32` identifier. T... | See {IERC1155-setApprovalForAll}. Override setApprovalForAll to be able to restrict to known operators./ Validate access Call ancestor | function setApprovalForAll(address operator, bool approved)
public
virtual
override
{
require(
!_tradingRestricted || hasRole(OPERATOR_ROLE, operator),
'forbidden'
);
super.setApprovalForAll(operator, approved);
}
| 389,957 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma abicoder v2;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "./libraries/Recoverable.sol";
import "./interfaces/ITokenStake.sol";
/**
* @title MetaPopitStaking
* @notice MetaPopit Stakin... | Close the staking only callable by owner/ | function closeStaking() external onlyOwner {
require(!isStakingClosed, "MetaPopitStaking: staking already closed");
isStakingClosed = true;
emit StakingClosed();
}
| 6,930,027 |
pragma solidity ^0.6.0;
interface ERC20 {
function totalSupply() external view returns (uint256 supply);
function balanceOf(address _owner) external view returns (uint256 balance);
function transfer(address _to, uint256 _value) external returns (bool success);
function transferFrom(address _from, a... | Gets CDP ratio _cdpId Id of the CDP _ilk Ilk of the CDP | function getRatio(uint _cdpId, bytes32 _ilk) public view returns (uint) {
uint price = getPrice( _ilk);
(uint collateral, uint debt) = getCdpInfo(manager, _cdpId, _ilk);
if (debt == 0) return 0;
return rdiv(wmul(collateral, price), debt);
}
| 337,190 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.25 <0.7.0;
/** OpenZeppelin Dependencies */
// import "@openzeppelin/contracts-upgradeable/contracts/proxy/Initializable.sol";
import '@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol';
/** Local Interfaces */
import './interfaces/IAuctionManager.... | Main public manager functions / | function sendToAuction(uint256 daysInFuture, uint256 amount)
external
onlyManager
{
_sendToAuction(daysInFuture, amount);
}
| 2,509,316 |
// Voting.sol
// SPDX-Licence-Identifier: MIT
pragma solidity 0.6.11;
pragma experimental ABIEncoderV2; //to make the getProposals() works, however might not be a safe solution
//import "https://github.com/OpenZeppelin/openzeppelin-contracts/contracts/access/Ownable.sol"; // does not work using truffle
//import "https... | Etape 9 - L'administateur indique "VotesTallied" | function votesTallied() public inState(WorkflowStatus.VotingSessionEnded) onlyOwner returns(uint)
{
currentWorkflowStatus = WorkflowStatus.VotesTallied;
emit VotesTallied();
emit WorkflowStatusChange(WorkflowStatus.VotingSessionEnded, WorkflowStatus.VotesTallied);
}
| 14,097,883 |
./partial_match/1/0x8ABb6cc2810c22Df468E5fC491AB693F0901c927/sources/PriceOracle.sol | Set `paused` to the specified state. Admin function to pause or resume the contract. requestedState Value to assign to `paused`. return uint 0=success, otherwise a failure./ Check caller = anchorAdmin | function _setPaused(bool requestedState) public returns (uint256) {
if (msg.sender != anchorAdmin) {
return
failOracle(
address(0),
OracleError.UNAUTHORIZED,
OracleFailureInfo.SET_PAUSED_OWNER_CHECK
);
... | 3,661,648 |
pragma solidity ^0.5.17;
import "./SafeMath.sol";
import "./RANCEToken.sol";
import "./Iupgradable.sol";
import "./ClaimsData.sol";
import "./Exchange.sol";
import "./Governed.sol";
import "./IGovernance.sol";
import "./IPooledStaking.sol";
import "./QuotationData.sol";
import "./TokenController.sol";
impo... | Iupgradable Interface to update dependent contract address/ | function changeDependentContractAddress() public onlyInternal {
tk = RANCEToken(ms.tokenAddress());
td = TokenData(ms.getLatestAddress("TD"));
tf = TokenFunctions(ms.getLatestAddress("TF"));
tc = TokenController(ms.getLatestAddress("TC"));
p1 = Pool1(ms.getLatestAddress("P1")... | 12,555,706 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
pragma abicoder v2;
import "@uniswap/v3-periphery/contracts/libraries/OracleLibrary.sol";
contract UniswapV3Helper {
address public immutable uniswapV3Factory;
bytes4 public constant SYMBOL_SELECTOR = bytes4(keccak256("symbol()"));
bytes4 public cons... | _tokenA address _tokenB address _fee fee, based on which we can resolve a pool _periodForAvgPrice Number of seconds in the past to start calculating time-weighted average in our case it might be the best, to set it to the Chain.padding | function getPrice(
address _tokenA,
address _tokenB,
uint24 _fee,
uint32 _periodForAvgPrice
) public view returns (bool success, uint256 price) {
bytes memory data;
(success, data) = _tokenA.staticcall(abi.encode(DECIMALS_SELECTOR));
if (!success) return ... | 1,707,245 |
./full_match/4/0x8542E1ddE76E7725DF3ff3C7829DC07229998333/sources/temp-contracts/SaltyLib.sol | Computes the create2 address for a one-to-one proxy deployed by `deployer` (the factory) when requested by `originator` using `suppliedSalt`. deployer Address of the proxy factory. originator Address of the account requesting deployment. suppliedSalt Salt provided by the account requesting deployment./ | function computeProxyAddressOneToOne(
address deployer,
address originator,
bytes32 suppliedSalt
)
internal
pure
returns (address)
{
bytes32 salt = deriveOneToOneSalt(originator, suppliedSalt);
return Create2.computeAddress(salt, CodeHashes.ONE_TO_ONE_CODEHASH, deployer);
}
| 647,959 |
./full_match/5/0xdEA5DDa469e0c8d4193545cA6AaAaeD24F1CeF3b/sources/contracts/core/BaseAccount.sol | validate the signature is valid for this message. userOp validate the userOp.signature field userOpHash convenient field: the hash of the request, to check the signature against (also hashes the entrypoint and chain id) return validationData signature and time-range of this operation <20-byte> sigAuthor... | function _validateSignature(UserOperation calldata userOp, bytes32 userOpHash)
internal virtual returns (uint256 validationData);
function _validateNonce(uint256 nonce) internal view virtual {
}
| 1,894,923 |
pragma solidity ^0.5.12;
// ----------------------------------------------------------------------------
// Safe maths
// ----------------------------------------------------------------------------
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(u... | check if IPO is active update Investorbook for sender update Investorbook for giftee | function giftAll(address payable _IPOidentifier) public payable updateAccount(playerId[msg.sender])updateAccount(playerId[_IPOidentifier]){
uint256 value = msg.value;
address payable sender = msg.sender;
if(playerId[sender] == 0){
playerId[sender] = nextPlayerID;
... | 7,311,893 |
pragma solidity ^0.5.0;
import 'openzeppelin-solidity/contracts/token/ERC20/ERC20Burnable.sol';
import 'openzeppelin-solidity/contracts/token/ERC20/SafeERC20.sol';
import 'openzeppelin-solidity/contracts/ownership/Ownable.sol';
/**
@dev Ambix contract is used for morph Token set to another
Token's by rule (recipe... | Static conversion Token count multiplier Burning run Transfer up Dynamic conversion Let source token total supply is finite and decrease on each conversion, just convert finite supply of source to tokens on balance of ambix. dynamicRate = balance(sink) / total(source) Is available for single source and sing... | function _run(uint256 _ix) internal {
require(_ix < A.length);
uint256 i;
if (N[_ix][0] > 0) {
uint256 mux = ERC20(A[_ix][0]).allowance(msg.sender, address(this)) / N[_ix][0];
require(mux > 0);
for (i = 0; i < A[_ix].length; ++i)
ERC20Bu... | 1,768,872 |
./full_match/80001/0x499a64DEc65436890916c08928c0939f35A39710/sources/contracts/test/test-mintable-token.sol | mints tokens to the recipient, to be called from owner recipient address to mint amount amount to be minted | function mint(address recipient, uint256 amount) public {
_mint(recipient, amount);
}
| 9,504,347 |
pragma solidity ^0.4.24;
contract owned {
address public owner;
function owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
}
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, byt... | Set the ICO_Contract. _ICO_Contract crowdsale contract address | function setICO_Contract(address _ICO_Contract) onlyOwner public {
ICO_Contract = _ICO_Contract;
}
| 368,681 |
./full_match/1/0xFB75f5e29231a27dD15f560234D8f7C2A3A0E6c8/sources/erc1155delta/contracts/ERC1155DeltaUpgradeable.sol | Destroys token of token type `id` from `from` Emits a {TransferSingle} event. Requirements: - `from` cannot be the zero address. - `from` must have the token of token type `id`./ | function _burn(
address from,
uint256 id
) internal virtual {
if(from == address(0)){
revert BurnFromZeroAddress();
}
address operator = _msgSender();
uint256[] memory ids = _asSingletonArray(id);
_beforeTokenTransfer(operator, from, address(... | 3,083,418 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./ERC721/ERC721Enumerable.sol";
import "./utils/Ownable.sol";
import "./utils/IERC2981.sol";
import "./utils/IERC20.sol";
import "./VRF/VRFConsumerBase.sol";
contract UniqDrop is ERC721Enumerable, IERC2981, Ownable, VRFConsumerBase {
uint256 interna... | emits Transfer event send back ETH if one overpay by accident | function mintUniqly(uint256 numUniqlies) external payable {
uint256 requiredValue = _calcEthForUniqs(numUniqlies);
require(msg.value >= requiredValue, "Not enough ether");
require(
numUniqlies <= 30 && numUniqlies > 0,
"You can buy minimum 1, maximum 30 Uniqs"
... | 13,818,938 |
./full_match/1/0xc9FfA23308D02DC9CfFE955FccE5ffD117A03B46/sources/contracts/periphery/tokens/VspMainnetOracle.sol | @inheritdoc IVspOracle | function update() external {
IPriceProvidersAggregator _aggregator = providersAggregator;
address _stableCoin = stableCoinProvider.getStableCoinIfPegged();
IUniswapV2LikePriceProvider _uniswapV2PriceProvider = IUniswapV2LikePriceProvider(
address(_aggregator.priceProviders(DataT... | 9,614,473 |
./partial_match/4/0x272B76ba0244321ebf7452c1b731f7Cc4cbec5dC/sources/dETH.sol | _oldSupply = _totalSupply; | function rebase(uint256 newSupply) external{
if(newSupply == _totalSupply){
}
else {
_totalSupply = newSupply;
}
emit Rebase(uint256(now), newSupply);
}
| 8,560,090 |
pragma solidity ^0.5.1;
library MatematicaSegura {
function multiplicar (uint256 p, uint256 s) internal pure returns(uint256){
if(p == 0 || s == 0) return 0;
uint256 c = p*s;
require (c/p == s);
return c;
}
function dividir (uint256 v, uint256 d) internal pure retu... | funcion que autoriza la nueva cantidad a transferir / | function approve( address _autorizado, uint256 _cantidad) public returns(bool) {
_approve(msg.sender, _autorizado, _cantidad);
return true;
}
| 12,845,689 |
./full_match/77/0x7F56aA5496a83331D0aa218eF5B77f60AEf6DEd2/sources/contracts/registries/ServiceProviderRegistry.sol | @inheritdoc IServiceProviderRegistry | function exists(bytes32 which) public view returns (bool) {
return (bytes(datastores[which]).length > 0);
}
| 5,047,925 |
./full_match/3/0x6122686324b3A715d73Ca40Bbf8BBE2D589E68FE/sources/contracts/RastaNFT.sol | _NFTs[tokenId].owner = _owner; _ownedNFTs[_owner].push(tokenId); _ownedNFTIndex[tokenId] = _ownedNFTs[_owner].length; | function sellNFT(uint256 tokenId) external {
require(_NFTs[tokenId].owner == msg.sender, "!not owner");
reduceNFT(tokenId, msg.sender);
uint256 amount = _NFTs[tokenId].price;
uint256 feeAmount = amount.mul(withdrawalFee).div(MAX_FEE);
if (feeAmount > 0) stakingToken.safe... | 14,231,070 |
contract MyEtherBank
{
/* LICENSE :
MIT License
Copyright (c) 2016 Consent Development
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including with... | Value sent? Check for overflow | function DepositToBankAccount() public
modifier_doesSenderHaveABankAccount()
returns (bool)
{
if (msg.value > 0)
{
uint32 accountNumber_ = _bankAccountAddresses[msg.sender].accountNumber;
if ((_bankAccountsArray[accountNumber_].balance + msg.value) < _ba... | 6,431,452 |
//Address: 0x35f2AA4E39514C763EB90a24396e2D2c028A19E3
//Contract name: initialLuckyTokenSale
//Balance: 0 Ether
//Verification Date: 8/5/2017
//Transacion Count: 22
// CODE STARTS HERE
pragma solidity 0.4.14;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization c... | Allow owner to transfer out the ether in the contract _to address to transfer to _amount amount to transfer/ | function transferEtherOut(address _to, uint256 _amount) public onlyOwner {
assert(_to.send(_amount));
}
| 5,434,118 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./Nft.sol";
import "./Helper.sol";
/*
* @title Story Smart Contract
* @notice Primary smart contract for running Storyline operations.
*/
contract Story {
/*
* StoryElement Struct.
* A single piece of Storyline content, published by a writer.... | Initializes a new StoryElement struct and adds it to the story. This should populate the fresh struct with the given values. _content the text associated with the StoryElement _dateTime the date and time, in Moment.JS format, of publication return nothing/ Check if value is valid (not sure how to do within truffle at... | function createStoryElement(string memory _content) public payable {
StoryElement memory newElem;
newElem.id = nextElementId;
newElem.content = _content;
newElem.dateTime = block.timestamp;
newElem.author = msg.sender;
if (nextElementId > 1) {
newElem.nft = new NFT(msg.sender);
s... | 12,972,040 |
./partial_match/3/0x4E460B66063280B8e0F6226Ee4E3F892Bd7f27e9/sources/ERC20Pausable.sol | s(uint256 s1, uint256 s2, uint256 s3) = test(); | function test2(uint256 st, uint256 sa) public view returns (uint[] memory) {
uint[] memory da;
da[0] = st;
da[1] = sa;
return da;
}
| 16,625,646 |
./partial_match/4/0xf4692808249aED810850c44CDbecB527413333Bb/sources/BondlyStaking.sol | unstake current staking/ | function unstake() public onlyWhitelisted {
require(stakingBalance[_msgSender()].total > 0, "Not staking");
STAKE_DETAIL storage _stake = stakingBalance[_msgSender()];
uint256 reward = rewardOf(_msgSender());
uint256 totalAmount = _stake.total.add(reward);
require(
... | 8,553,777 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
contract Pool is Initializable {
string public constant name = "ETHPool";
bool private initialized;
bool private stopped;
address private owner;
uint256 private rewa... | return all deposit history | function depositHistory() external view isNotStopped returns(DepositData[] memory) {
return depositData;
}
| 12,873,789 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
import "./CyberGorillas.sol";
import "./GrillaToken.sol";
import "./ERC721.sol";
import "./Strings.sol";
import "./RewardBoostProvider.sol";
import "./Ownable.sol";
/*
______ __ ______ _ ____
/ ____/_ __/ /_ ___ ___... | Returns true if the requested address is staking normal gorillas, false otherwise. return Whether the requested address is staking normal gorillas. | function isStakingNormal(address account) public view returns (bool) {
return _balancesNormal[account] > 0;
}
| 11,678,894 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
/**
* @notice Simple multi-sig Wallet.
*/
contract Wallet {
bool isInit;
uint256 public threshold;
uint256 private transactionIndex;
uint256 private updatethresholdIndex;
uint256 private removeOwnerIndex;
... | return an array of the indexes of the pending remove owner transactions./ | function pendingRemoveOwnerIndex() private view returns (uint256[] memory) {
uint256 counter;
for (uint256 i = 0; i < removeOwner.length; i++) {
if (removeOwner[i].approved == false) {
counter += 1;
}
}
uint256[] memory result = new uint256[](c... | 1,795,469 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "../util/LibString.sol";
import "../v2/NFTV2.sol";
import "../v1/LinkKey.sol";
import "../v1/SNSResolver.sol";
cont... | NFT transferFrom from NFT owner address to NFT new owner address tokenId NFT tokenId/NFTENS | function transferFrom(address from, address to, uint256 tokenId) public virtual override {
super.transferFrom(from, to, tokenId);
require(_transferName(from, to, _nameOfTokenId[tokenId]), "010---transferName fail");
}
| 12,910,859 |
./full_match/4/0xC5292960b9A6282188086702C6F689CB743Ea5FA/sources/DUCKHUNTERSTEST.sol | See {IERC721-getApproved}./ | function getApproved(uint tokenId)
public
view
virtual
override
returns (address)
{
require(
_exists(tokenId),
"ERC721: approved query for nonexistent token"
);
return _tokenApprovals[tokenId];
}
| 736,259 |
./partial_match/1/0x9DAdbc52D12e24b7D7dE68477c8478Aed4468DA6/sources/contracts/LP/L1LiquidityPool.sol | Liquididity providers add liquidity _amount liquidity amount that users want to deposit. _tokenAddress address of the liquidity token./ check whether user sends ETH or ERC20 override the _amount and token address if the user has already deposited token, we move the rewards to pendingReward and update the reward debet... | function addLiquidity(
uint256 _amount,
address _tokenAddress
)
external
payable
nonReentrant
whenNotPaused
{
require(msg.value != 0 || _tokenAddress != address(0), "Amount Incorrect");
if (msg.value != 0) {
_amount = msg.value;
... | 3,712,508 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.6;
import "IERC20.sol";
import "SafeOwnable.sol";
import "Math.sol";
import "ReentrancyGuard.sol";
import "AddressLibrary.sol";
// veWILD is a non-transferrable governance token minted by locking up WILD
// The longer the lock period, the higher the reward
... | Claiming resets veWILD balance based on locked WILD and lock time remaining. | function claim() external nonReentrant {
_claim();
_checkReserves();
}
| 13,411,535 |
./partial_match/1/0xC08144Aa808c06A39b8ca1aFeAc3e737CFDf747A/sources/AquaCrowdsale.sol | called before withdraw is possible 30% of total supply 10% of total supply mint to vault remove crowdsale contract as minter, should be no more minters transfer from vault to treasury | function _finalization() internal {
uint256 treasuryLiquidityLock = token().totalSupply().mul(50).div(100);
uint256 treasuryAmount = token().totalSupply().mul(16).div(100);
ERC20Mintable(address(token())).mint(address(_vault), treasuryLiquidityLock);
ERC20Mintable(address(token())).... | 9,351,205 |
pragma solidity ^0.5.0;
import "./Algorithm.sol";
import "../BytesUtils.sol";
import "elliptic-solidity/contracts/curves/EllipticCurve.sol";
contract P256SHA256Algorithm is Algorithm {
using BytesUtils for *;
EllipticCurve public curve;
constructor(EllipticCurve _curve) public {
curve = _curve;... | Verifies a signature. key The public key to verify with. data The signed data to verify. signature The signature to verify. return True iff the signature is valid./ | function verify(bytes calldata key, bytes calldata data, bytes calldata signature) external view returns (bool) {
return curve.validateSignature(sha256(data), parseSignature(signature), parseKey(key));
}
| 1,763,081 |
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2; // solium-disable-line no-experimental
// ----------------------------------------------------------------------------
// Copyright (c) 2018,2019 OAX Foundation.
// https://www.oax.org/
// See LICENSE file for license details.
// -------------------------------... | Checks whether the dispute needs to be handled by the operator. This code was extracted from closeDispute to reduce compiler stack size. dispute Dispute object from storage. currentRound Current round./ Check it is the right moment to close the dispute | function hasValidOpenDispute(Dispute memory dispute, uint256 currentRound) public view returns (bool) {
require(dispute.open);
uint256 currentQuarter = getCurrentQuarter();
uint256 elapsedQuarters = (4 * currentRound + currentQuarter) - (4 * dispute.round + dispute.quarter);
require... | 6,459,102 |
./full_match/5/0x72225B12980BD8a6Acc8719caDfD1E04F567B500/sources/contracts/forked/DropSinglePhase.sol | ) internal virtual returns (uint256 totalPrice) { Logic borrowed From https://thirdweb.com/nach.eth/DynamicFreeMint thanks to Nacho Iacovino | function _beforeClaim(
address _receiver,
uint256 _quantity,
address _currency,
uint256 _pricePerToken,
AllowlistProof calldata _allowlistProof,
bytes memory _data
function _afterClaim(
address _receiver,
uint256 _quantity,
address _curren... | 1,922,436 |
//Address: 0x39685718663bf4ad2206f1baf7aadbca0e7d7f95
//Contract name: MetaDollar
//Balance: 0.0271 Ether
//Verification Date: 4/30/2018
//Transacion Count: 24
// CODE STARTS HERE
pragma solidity ^0.4.18;
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/issues/20
contract ERC20Interface {... | Destroy an amount of metadollars amount - token to destroy | function destroyToken(uint256 amount) isOwner {
require(amount > 0);
require(tokenBalanceOf[this] >= amount);
require(_totalSupply >= amount);
require(tokenBalanceOf[this] - amount >= 0);
require(_totalSupply - amount >= 0);
tokenBalanceOf[this] -= amount;
_totalSupply -= amount;
allowed[this][owner] =... | 7,290,337 |
pragma solidity ^0.4.18;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) pu... | 크라우드 세일 컨트렉트를 생성한다. _fundingGoalApis 판매하는 토큰의 양 (APIS 단위) _startTime 크라우드 세일을 시작하는 시간 _endTime 크라우드 세일을 종료하는 시간 _addressOfApisTokenUsedAsReward APIS 토큰의 컨트렉트 주소 _addressOfWhiteList WhiteList 컨트렉트 주소/ 토큰 스마트컨트렉트를 불러온다 화이트 리스트를 가져온다 | function ApisCrowdSale (
uint256 _fundingGoalApis,
uint _startTime,
uint _endTime,
address _addressOfApisTokenUsedAsReward,
address _addressOfWhiteList
) public {
require (_fundingGoalApis > 0);
require (_startTime > now);
require (_endTime > _star... | 10,884,602 |
./full_match/1/0x4f2aCdc74f6941390d9b1804faBc3E780388cfe5/sources/src/TokenBuyer.sol | Buy ETH from this contract in exchange for `paymentToken` tokens. The price is determined using `priceFeed` plus `botDiscountBPs` Immediately invokes `payer` to pay back outstanding debt Caps `tokenAmount` by the amount of tokens the contract needs tokenAmount the amount of ERC20 tokens msg.sender wishes to sell to t... | function buyETH(uint256 tokenAmount) external nonReentrant whenNotPaused {
uint256 amount = Math.min(tokenAmount, tokenAmountNeeded());
IPayer _payer = payer;
paymentToken.safeTransferFrom(msg.sender, address(_payer), amount);
_payer.payBackDebt(amount);
uint256 ethAmount... | 3,030,404 |
./full_match/3/0xd1cC73f50464607AfE48F4eF97FA414Da191a461/sources/browser/exchange.sol | TODO TEST THIS!transfer2 = Transfer2(tokenAddress);bool tr1; try { tr1 = true; } catch Error(string memory) { tr1 = false; } if (!tr1) { try transfer2.transfer(userAddress, amount) { tr1 = true; } catch Error(string memory) {} } transfer2 = Transfer2(0); | function withdrawAssets(address userAddress, address tokenAddress, uint amount) external virtual notPaused returns(bool success) {
require(msg.sender == adminAddress);
require(amount <= depositedTokens[userAddress][tokenAddress]);
require(amount <= tokenBalance[tokenAddress]);
require(lastBlock < bloc... | 8,104,410 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import {PercentageMath} from '../protocol/libraries/math/PercentageMath.sol';
import {SafeMath} from '../dependencies/openzeppelin/contracts/SafeMath.sol';
import {IERC20} from '../dependencies/openzeppelin/contracts/IERC20.... | Allows smartcontracts to access the liquidity of the pool within one transaction, as long as the amount taken plus a fee is returned. IMPORTANT There are security concerns for developers of flashloan receiver contracts that must be kept into consideration. receiverAddress The address of the contract receiving the fund... | function flashLoan(
address receiverAddress,
address[] calldata assets,
uint256[] calldata amounts,
uint256[] calldata modes,
address onBehalfOf,
bytes calldata params,
uint16 referralCode
) external override whenNotPaused {
FlashLoanLocalVars memory vars;
ValidationLogic.valida... | 1,226,579 |
./partial_match/1/0x409bf77A8E3Fe384497227eA508029B5364933DE/sources/contracts/test/TokenStakingTestSet.sol | to decrease size of test contract | function processSlashing(uint256 count) external override {}
| 2,587,020 |
/**
*Submitted for verification at Etherscan.io on 2020-07-08
*/
pragma solidity ^0.6.0;
interface TokenInterface {
function approve(address, uint256) external;
function transfer(address, uint) external;
function transferFrom(address, address, uint) external;
function deposit() external payable;
... | Sell ETH/ERC20_Token. buyAddr buying token address.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) sellAddr selling token amount.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) sellAmt selling token amount. unitAmt unit amount of buyAmt/sellAmt with slippage. getId Get token amount at this ID from `Ins... | function sell(
address buyAddr,
address sellAddr,
uint sellAmt,
uint unitAmt,
uint getId,
uint setId
) external payable {
uint _sellAmt = getUint(getId, sellAmt);
(TokenInterface _buyAddr, TokenInterface _sellAddr) = changeEthAddress(buyAddr, sellA... | 2,259,353 |
pragma solidity 0.5.9;
import "../BaseWithStorage/ERC721BaseToken.sol";
import "../Interfaces/LandToken.sol";
import "../contracts_common/Interfaces/ERC721MandatoryTokenReceiver.sol";
contract EstateBaseToken is ERC721BaseToken {
uint8 internal constant OWNER = 0;
uint8 internal constant ADD = 1;
uint8 in... | TODO check adjacency | function _addQuads(
address sender,
uint256 estateId,
uint256[] memory sizes,
uint256[] memory xs,
uint256[] memory ys,
uint256[] memory junctions,
bool justCreated
) internal {
_land.batchTransferQuad(sender, address(this), sizes, xs, ys, "");
... | 5,459,278 |
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
contract IERC20Token {
// solhint-disable no-simple-event-func-name
event Transfer(
address indexed _from,
address indexed _to,
uint256 _value
);
event Approval(
address indexed _owner,
address indexed _... | Decodes ERC721 assetData and transfers given amount to sender. assetData Byte array encoded for the respective asset proxy. amount Amount of asset to transfer to sender. Decode asset data. Perform transfer. | function transferERC721Token(
bytes memory assetData,
uint256 amount
)
internal
{
require(
amount == 1,
"INVALID_AMOUNT"
);
address token = assetData.readAddress(16);
uint256 tokenId = assetData.readUint256(36);
IERC721... | 1,277,114 |
pragma solidity >0.4.99 <0.6.0;
import "./CAT20Transfer.sol";
import "./CAT20Paused.sol";
import "./verify-transfer/ICAT20VerifyTransfer.sol";
import "../CAT20TokenStorage.sol";
import "../../../interfaces/ITxCheckpoints.sol";
import "../../../../../common/libraries/SafeMath.sol";
/**
* @title ERC-20 Token methods
... | Batch tokens transfer investors Array of the investors values Array of the numbers of the tokens for distribution/ | function batchTransfer(address[] calldata investors, uint[] calldata values) external {
for (uint i = 0; i < investors.length; i++) {
transfer(investors[i], values[i]);
}
}
| 2,490,879 |
pragma solidity ^0.5.0;
import "./interfaces/ISRStorage.sol";
import "./interfaces/ISymbolRegistry.sol";
import "./SymbolRegistryMetadata.sol";
import "../../common/libraries/BytesHelper.sol";
import "../../request-verification-layer/permission-module/Protected.sol";
import "../../common/component/SystemComponent.sol"... | Checks symbol in system/ | function symbolIsAvailable(bytes memory symbol)
public
verifySymbol(symbol)
view
returns (bool)
{
symbol = symbol.toUpperBytes();
address tokenAddress = SRStorage().getSymbolToken(symbol);
uint expiredAt = SRStorage().getSymbolExpiration(symbol);
... | 6,357,533 |
pragma solidity ^0.4.25;
// It's important to avoid vulnerabilities due to numeric overflow bugs
// OpenZeppelin's SafeMath library, when used correctly, protects agains such bugs
// More info: https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/2018/november/smart-contract-insecurity-bad-arithmetic/
impo... | Called by oracle when a response is available to an outstanding request For the response to be accepted, there must be a pending request that is open and matches one of the three Indexes randomly assigned to the oracle at the time of registration (i.e. uninvited oracles are not welcome) EMG - Operational control status... | function submitOracleResponse
(
uint8 index,
address airline,
string flight,
uint256 timestamp,
uint8 statusCode
)
... | 1,812,321 |
import './ERC721Enumerable.sol';
import './Ownable.sol';
import './interfaces/IERC20.sol';
pragma solidity ^0.8.6;
contract KeplerMultiVisa is ERC721Enumerable, Ownable {
using Strings for uint256;
using Counters for Counters.Counter; // Counters track total # of elements in mapping
Counters.Counter... | Returns baseURIWhitelist if specified ID was whitelisted(minted by owner), Returns baseURI otherwise (minted through mint() function) | function tokenURI(uint256 _id) public view virtual override returns (string memory) {
require(_id < _tokenIds.current(), "tokenId exceeds upper bound");
string memory URI;
URI = whitelisted[_id] ? baseURIWhitelist : baseURI;
return bytes(URI).length > 0 ? string(abi.encodePacked(URI,... | 11,974,216 |
./full_match/1/0xacBD0767418b8C00ff70df1fF9D5c317F4349384/sources/src/arbi-fed/AuraFarmer.sol | Deposits amount of dola tokens into balancer, before locking with aura amount Amount of dola token to deposit/ | function deposit(uint amount) onlyChair external {
dolaDeposited += amount;
_deposit(amount, maxLossExpansionBps);
booster.depositAll(pid, true);
}
| 17,101,155 |
pragma solidity ^0.4.23;
contract Reputation {
address owner;
mapping(address => bool) whitelist;
mapping(address => int) ratings;
constructor () public {
owner = msg.sender;
}
function addToWhitelist(address _contractAddress) public {
require(msg.sender == owner);
whitelist[_contractAddress... | ETH Owner refund money BTC Owner gets -1 reputation TODO it looks like ETH Owner can create as many swaps as possible and refund them to decrease someone reputation | function refund(address _participantAddress) public {
Swap memory swap = swaps[msg.sender][_participantAddress];
require(swap.balance > uint256(0));
require(swap.createdAt.add(SafeTime) < now);
ERC20(swap.token).transfer(msg.sender, swap.balance);
Reputation(ratingContractAddress).change(_pa... | 13,625,823 |
pragma solidity ^0.4.15;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner... | safeWithdrawal - get money by performer / return money for client if status closed and was not withdrawed if project closed calculating votes если уже время голосования закончилось меняем статус проекта | function safeWithdrawal(uint idProject) afterDeadline(idProject) public
{
Project storage p = projects[idProject];
require(p.status == Status.CLAIMED || p.status == Status.CLOSED && !p.withdrawed);
if (p.status == Status.CLOSED) {
if (msg.sender == p.performer && !p.withdrawed && msg.se... | 1,160,989 |
// SPDX-FileCopyrightText: 2021 ShardLabs
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.7;
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/I... | API for delegated restaking rewards to validatorShare _validatorShare - Address of validatorShare contract/ | function restake(address _validatorShare) private {
IValidatorShare(_validatorShare).restake();
}
| 5,895,460 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one... | Asset Pool upgrade interface Interface that has to be implemented by an Asset Pool accepting upgrades from another asset pool. | interface IAssetPoolUpgrade {
function depositFor(address underwriter, uint256 amount) external;
}
}
| 112,457 |
/**
* Copyright 2017-2019, 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/MiscFunctions.sol";
contract OrderHistory_M... | Returns a bytestream of loan data for a lender. loanParty The address of the lender in the loan. count The total amount of loans to return if they exist. Amount returned can be less. activeOnly A boolean indicating if inactive/expired loans should be excluded. return A concatenated stream of bytes. | function getLoansForLender(
address loanParty,
uint256 count,
bool activeOnly)
public
view
returns (bytes memory)
{
return _getLoanPositions(
loanParty,
count,
activeOnly,
);
}
| 12,963,234 |
/**
* OpenZepplin contracts contained within are licensed under an MIT License.
*
* The MIT License (MIT)
*
* Copyright (c) 2016-2021 zOS Global Limited
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), ... | Permanently stops minting. This cannot be reverted. Only can be triggered when forSale is false. | function permanentlyStopMinting() external onlyOwner {
require(forSale == false, "You must switch off mints before permanently disabling them manually.");
require(permanentlyStop == false, "Minting has already been permanently disabled.");
permanentlyStop = true;
}
| 14,111,466 |
./full_match/1/0x44cD00771f57488A1988136cC38EB03554db1f77/sources/browser/Wasabi.sol | if paid back. deal with if the offer expired. | function close(address _from, uint8 _state, address sushi) external returns (address tokenToOwner, address tokenToTaker, uint amountToOwner, uint amountToTaker) {
require(offerStats[msg.sender] != 0, "WASABI: CLOSE OFFER NOT FOUND");
OfferStruct storage offer = offers[msg.sender];
require(_s... | 3,085,249 |
./partial_match/56/0x7B9D43599AA3C5590CF068bE7BD67Ebf30462b47/sources/FeeProvider.sol | users can invoke this function to liquidate an undercollateralized position. _collateral the address of the collateral to liquidated _reserve the address of the principal reserve _user the address of the borrower _purchaseAmount the amount of principal that the liquidator wants to repay _receiveMToken true if the ... | function liquidationCall(
address _collateral,
address _reserve,
address _user,
uint256 _purchaseAmount,
bool _receiveMToken
)
external
payable
nonReentrant
onlyActiveReserve(_reserve)
onlyActiveReserve(_collateral)
{
ad... | 11,035,477 |
./full_match/44787/0x8C23aA5BA5e166124D7fe83bebB72141676fACA6/sources/contracts/Bonus.sol | return tokenWithdraw[_tokenId]; | function _getBonus(uint256 _tokenId) view public returns (uint256) {
uint256 _totalPrice = NFTLogic.totalPrice();
(, , uint256 _price, uint256 _multi) = NFTLogic.starMeta(_tokenId);
uint256 _ratio = _price.mul(_multi).div(100).mul(1e12).div(_totalPrice);
uint256 _availBonus = _balanc... | 13,244,184 |
// contracts/PMV.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./ERC721Optimized.sol";
import "./PMVMixin.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol";
... | Destroys `tokenId`. The approval is cleared when the token is burned. Requirements: - `tokenId` must exist. Emits a {Transfer} event./ Clear approvals | function _burn(uint256 tokenId) internal virtual {
address owner = ERC721Optimized.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
_approve(address(0), tokenId);
delete _owners[tokenId - 1];
emit Transfer(owner, address(0), tokenId);
_afterTok... | 10,190,941 |
pragma solidity ^0.4.21;
//(생략)
// (1) 에스크로
contract Escrow {
// (2) 상태변수
CeightToken public token; // 토큰
uint256 public salesVolume; // 판매량
uint256 public sellingPrice; // 판매 가격
uint256 public deadline; // 기한
bool public isOpened; // 에스크로 개시 플래그
// (3) 이벤트 알림
event EscrowStart(uint sa... | (8) 종료 토큰을 소유자에게 전송 계약을 파기 (해당 계약이 보유하고 있는 Ehter는 소유자에게 전송) | function close() public onlyOwner {
token.transfer(owner, token.balanceOf(this));
selfdestruct(owner);
}
| 12,653,376 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.7;
import "./strategy-base.sol";
import "../interfaces/fox-staking-rewards.sol";
abstract contract StrategyFoxFarmBase is StrategyBase {
// Token addresses
address public constant stakingRewards = 0xDd80E21669A664Bce83E3AD9a0d74f8Dad5D9E72;
address publ... | Collects FOX tokens 10% is locked up for future gov Donates DUST | function harvest() public override onlyBenevolent {
IFoxStakingRewards(stakingRewards).getReward();
uint256 _fox = IERC20(fox).balanceOf(address(this));
if (_fox > 0) {
uint256 _keepFOX = _fox.mul(keepFOX).div(keepFOXMax);
IERC20(fox).safeTransfer(
ICo... | 12,846,015 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.1;
import "./interfaces/ITransactionManager.sol";
import "./lib/LibAsset.sol";
import "./lib/LibERC20.sol";
import "./interpreters/MultisendInterpreter.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/... | Sender side --> funds go back to user Timeout has not expired and tx may only be cancelled by router Receiver side --> funds go back to router Timeout has not expired and tx may only be cancelled by user Validate signature | function cancel(TransactionData calldata txData, bytes calldata signature)
external
override
nonReentrant
returns (TransactionData memory)
if (txData.sendingChainId == chainId) {
if (txData.expiry >= block.timestamp) {
require(msg.sender == txData.router, "cancel: ROUTER_MUST_CANCEL"... | 13,017,935 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./interfaces/IHegicOptions.sol";
import "./../domain/OptionsModel.sol";
import "../../interfaces/IOptionsProtoco... | Create an option given details about its attributes tokenAddress of the option will be the Hegic poolAddress/ | function _createOptionFromAttributes(
address baseAsset,
OptionsModel.OptionAttributes memory optionDetails,
HegicPoolInfo memory poolInfo
) internal view returns (OptionsModel.Option memory) {
return
OptionsModel.Option(
OptionsModel.OptionMarket.HEGI... | 12,750,184 |
./full_match/97/0x8B4032b71C804517D54878d78730c230F768Ad57/sources/tests/BSC ChainLinkTests/CryptoVault.sol | A fallback function in case something is wrong with state of vault - only dev 0 - Created, 1 - Locked, 2 - Unlocked, 3 - Expired | function setState(State _state) public {
require(msg.sender == devWalletAddress, "Dev only");
state = State(_state);
}
| 5,018,578 |
// SPDX-License-Identifier: MIT
// File @openzeppelin/contracts/utils/Context.sol@v4.5.0
pragma solidity ^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 shoul... | Get the list of all whitelisted addresses/ | function getWhitelistedAddresses() public view returns (address[] memory) {
return whitelist;
}
| 13,604,441 |
pragma solidity >=0.5.0 <0.6.0;
import '../../libs/lifecycle/LockableDestroyable.sol';
import '../../libs/ownership/Administrable.sol';
import '../../libs/registry/InvestorData.sol';
import '../IRegistry.sol';
import './IInvestorRegistry.sol';
/**
* @title External Investor Registry
*
*/
contract ExternalInvest... | Removes an investor from the registry Upon successful removal, the contract must emit `InvestorRemoved(investor, brokerDealer)` THROWS if the address doesn't exist, or is zero investor The address of the investor/ | function remove(address investor)
onlyAdmins
external {
registry.removeAccount(investor);
emit InvestorRemoved(investor, msg.sender);
}
| 12,617,009 |
pragma solidity ^0.4.13;
/*
* ERC20 interface
* see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 {
uint public totalSupply;
function balanceOf(address who) constant returns (uint);
function allowance(address owner, address spender) constant returns (uint);
function transfer(address to, uint... | privileged transfer | function transferPrivileged(address _to, uint _value) onlyOwner returns (bool success) {
balances[msg.sender] = safeSub(balances[msg.sender], _value);
balances[_to] = safeAdd(balances[_to], _value);
previligedBalances[_to] = safeAdd(previligedBalances[_to], _value);
Transfer(msg.sender, _to, _value);
... | 6,697,117 |
/**
*Submitted for verification at Etherscan.io on 2022-04-22
*/
/**
_____ _ _ ___ _ ___ __ __ ___ _ _ _ ___ ___ ___ _____
|_ _|| || || __| _ | || __|\ \ / /| __|| | | || || __||_ _|/ __||_ _|
| | | __ || _| | || || _| \ \/\/ / | _| | |__ | __... | / exclude from paying fees or having max transaction amount | constructor() ERC20("The Jewellery Heist", unicode"JEWEL") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
u... | 10,484,042 |
pragma solidity ^0.4.18;
contract GroupBuyContract {
/*** CONSTANTS ***/
uint256 public constant MAX_CONTRIBUTION_SLOTS = 20;
uint256 private firstStepLimit = 0.053613 ether;
uint256 private secondStepLimit = 0.564957 ether;
/*** DATATYPES ***/
// @dev A Group is created for all the contributo... | Multiplies two numbers, throws on overflow./ | function approve(
address _to,
uint256 _tokenId
) public;
function balanceOf(address _owner) public view returns (uint256 balance);
function createPromoPerson(address _owner, string _name, uint256 _price) public;
function createContractPerson(string _name) public;
function getPerson(uint256 _tok... | 12,786,781 |
./full_match/42/0xa84322b9E6f143F1518CdB68647b796bEB414EbD/sources/browser/generalized_batching_solution.sol | require that data != transferFrom function signatureget the first four bytes emit SomeData(data.toAddress(16)); (bool success, ) = to.call.value(value)(data); | function _call(
address to,
uint256 value,
bytes memory data
) internal {
if (data.toBytes4(0) == IERC20(0).transferFrom.selector) {
require(
'transferFrom is not allowed if _msgsender() != from'
);
}
if (!success) {
... | 16,276,503 |
./full_match/4/0x357F0A97C5A59756684eEF9dcDE7Ee8F2F437E45/sources/contracts/InkTime.sol | Generate and save the token event Save the sate | function mint() public nonReentrant {
require(lastTokenId < 8000, "No more available tokens");
lastTokenId += 1;
_history[lastTokenId] = getCurrentEvent();
_safeMint(msg.sender, lastTokenId);
lastEventTime = block.number;
}
| 12,358,927 |
./partial_match/1/0x926C777c091a5A070dC24ac94fF498b5a556f92A/sources/contracts/periphery/libraries/PoolHelpers.sol | fetches the real and fictive reserves for a pair _factory the factory address _tokenA token to fetch fictive reserves _tokenB token to fetch fictive reserves return reserveA_ reserves of tokenA in the pair tokenA/TokenB return reserveB_ reserves of tokenB in the pair tokenA/TokenB return fictiveReserveA_ fictive res... | function getAllReserves(
address _factory,
address _tokenA,
address _tokenB
) internal view returns (uint256 reserveA_, uint256 reserveB_, uint256 fictiveReserveA_, uint256 fictiveReserveB_) {
(address _token0, ) = sortTokens(_tokenA, _tokenB);
ISmardexPair _pair = ISmard... | 4,280,051 |
./full_match/82/0xAF4889aa45Aee8Aa8BaE6e8dc5e26B62ba44250a/sources/MeterPandaArmy.sol | 5000-5999: 60 MTRG 4000-4999: 50 MTRG 2000-3999: 40 MTRG 1000-1999: 35 MTRG 0 - 999 25 MTRG | function priceTier() public view returns (uint256) {
uint currentSupply = totalSupply();
if (currentSupply >= 6000) {
return pandaPrice5;
return pandaPrice4;
return pandaPrice3;
return pandaPrice2;
return pandaPrice;
}
}
| 7,095,199 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
i... | Approve `to` to operate on `tokenId` Emits a {Approval} event./ | function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(FemPeak.ownerOf(tokenId), to, tokenId);
}
| 13,884,253 |
./full_match/80001/0x587F43D38ee1Ae04cf00090Fa0eb081Cd525b68A/sources/contracts/RaffleAutomated.sol | require(players.length >= 2 , "Not enough players in the lottery");selects the winner with random numbertransfers balance to winner | function pickWinner() internal {
require(block.timestamp >= raffleInfo.endTime, "Period has not ended yet");
address winner = address(0);
if(raffleInfo.players.length>=2){
winner = raffleInfo.players[random() % raffleInfo.players.length];
token.transfer(address(winner), (get... | 879,008 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.