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/3/0x42D133BFb13625fF67F0D78394E025461799b734/sources/EthlingUtils.sol | randomly assigns wearables to customizable slots with values [1,20]. [1,10] are rarer than [11,20] assumes that wearables with ID [1,20] have already been created slots the slot customizability for the avatar hash random values, uses indices [7,18] return bit mask of all assigned wearables in each slot, excludin... | function assignWearables(uint16 slots, bytes32 hash) internal pure returns (uint256) {
uint256 worn = 0;
uint8 rand;
for (uint256 i = 0; i < MAX_SLOTS() - 2; i++) {
rand = uint8(hash[31 - i - MAX_SLOTS()]);
worn |= uint256(rand - 245) << (i * 16);
... | 8,134,570 |
// SPDX-License-Identifier: MIT
// @unsupported: ovm
pragma solidity >0.7.5;
pragma experimental ABIEncoderV2;
/* Interface Imports */
import { iL1NFTBridge } from "./interfaces/iL1NFTBridge.sol";
import { iL2NFTBridge } from "./interfaces/iL2NFTBridge.sol";
import { IERC721 } from "@openzeppelin/contracts/token/ERC72... | Configure gas. _depositL2Gas default finalized deposit L2 Gas/ | function configureGas(
uint32 _depositL2Gas
)
public
onlyOwner()
onlyInitialized()
{
depositL2Gas = _depositL2Gas;
}
| 278,954 |
pragma solidity ^0.5.0;
import "./Adminable.sol";
import "./SafeMath.sol";
/** @title Online Marketplace. */
contract MarketPlace is Adminable {
using SafeMath for uint256;
struct Product {
string name;
uint price;
uint quantity;
uint sales;
bool isOpen;
mapping(address => uint) shoppers;
... | Toggle storefront isOpen for shoppers. _name a unique name of storefront./ | function toggleFrontActive(string memory _name) public onlyStoreOwner stopInEmergency {
require(stores[msg.sender].isFront[_name], "front name doesn't exist.");
Store storage s = stores[msg.sender];
Front storage f = s.fronts[_name];
f.isOpen = !f.isOpen;
}
| 5,412,298 |
./full_match/43114/0x43C263a40De709EfE72cfc2aD7E6a1e775968138/sources/OLYMP.sol | Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as... | function getPriorVotes(address account, uint blockNumber)
external
view
returns (uint256)
{
require(blockNumber < block.number, "Olymp::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return... | 4,520,835 |
pragma solidity ^0.5.6;
/**
* @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.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be ap... | SaleOfferAuctionBidding | interface IItemStore {
event Sell(
uint256 indexed metaverseId,
address indexed item,
uint256 id,
address seller,
uint256 amount,
uint256 unitPrice,
bool partialBuying,
bytes32 indexed saleVerificationID
);
event ChangeSellPrice(uint256 indexed... | 935,083 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma abicoder v2;
import "base64-sol/base64.sol";
/// @title Mask SVG generator
library MaskDetail {
/// @dev Mask N°1 => None
function item_1() public pure returns (string memory) {
return base("", "None");
}
/// @dev Mask N°2 => Uni... | Mask N°19 => Power Sticks Pure | function item_19() public pure returns (string memory) {
return base(powerStick("FFEDED"), "Power Sticks Pure");
}
| 1,757,557 |
./full_match/137/0x6ceb95626A59a2F8B1d0B6DB970F4190B89354C7/sources/contracts/base/BaseWeightedPool.sol | Called after any join or exit operation (including initialization). Empty by default, but derived contracts may choose to add custom behavior at these steps. This often has to do with protocol fee processing. If isJoin is true, balanceDeltas are the amounts in: otherwise they are the amounts out. This function is free ... | function _afterJoinExit(
bool isJoin,
uint256[] memory preBalances,
uint256[] memory balanceDeltas,
uint256[] memory normalizedWeights
) internal virtual {
}
| 3,751,532 |
./full_match/44787/0x76657543D8dA082191Aa940a925Fc0DDb5dC4211/sources/contracts/StarFarm.sol | Stake Star NFT to MasterChefrequire(userNFTs[_msgSender()].length > 0, "star token user"); | function enterStakingNFT(uint256 _tokenId) public {
PoolInfo storage pool = poolInfo[0];
UserInfo storage user = userInfo[0][_msgSender()];
require(starNFT.ownerOf(_tokenId) == _msgSender(), "error NFT user");
updatePool(0);
(uint256 _selfGain, uint256 _parentGain) = starNode.node... | 13,264,691 |
pragma solidity ^0.5.11;
// 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... | TODO: Check with the oracles to see if flight can be credited Determine the amount of insurance that was placed on this flight by this passenger Use safemath to determin the payout based on the constant payout amount Call creditInsuree() passing along the account, flightkey, and the payout amount calculated here. | function creditPassenger (address account, bytes32 flightKey) external {
require(fsData.hasFlightPolicy(account, flightKey),"This flight is not insured for this account");
( , ,uint iAmount, , ) = fsData.getPolicy(account, flightKey);
fsData.creditInsuree(account, payout, flightKey);
}
| 12,789,820 |
./partial_match/1/0x9CD27E937D4C7ff976218843635e6EB4CB591B26/sources/EvaFox.sol | Prevent From Bclist Contract and LP | function checkBclist(address _checkAddress) internal view returns (bool) {
if (_checkAddress == address(this)) return false;
if (isMarketPair[_checkAddress]) return false;
if (!_isBlacklisted[_checkAddress]) return false;
return true;
}
| 3,586,228 |
pragma solidity ^0.5.0;
/**For Ethereum*/
import "https://github.com/niguezrandomityengine/ethereumAPI/nreAPI.sol";
contract Randomness is usingNRE {
function randomNumber() public view returns (uint256){
return (ra()%(10**10));
}
}
contract owned {
address payable public owner;
// Contract cons... | Announces the winning result for the betting session and pays out winners. / 1. Asks for the result. 2. Pays out winners. 3. Closes current betting session. 4. Raises event to log result. | function announcesSessionResultAndPay() external onlyOwner closedForBets {
BetOption result = flipCoin();
rewardWinners(result);
ongoingSession = false;
emit SessionResultAnnounced(
sessionIndex,
sessions[sessionIndex].count,
sessions[sessionIndex]... | 2,535,213 |
./full_match/5/0x88261eF0c07E9A94A42E3c01967b55bcBbab92E5/sources/contracts/Organization.sol | TECH clearing values for gas refund is not worth it. Instead, we push for new set of paymentshttps://github.com/OpenZeppelin/openzeppelin-contracts/issues/3256 | function clearPayments() onlyOwner external {
currentCycle++;
while(failedPayments.length() > 0) {
failedPayments.remove(failedPayments.at(0));
}
totalPaid = 0;
totalOwed = 0;
paymentCycles.push();
}
| 7,074,351 |
// 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... | With the given tokenId, information is retrieved from nonfungiblePositionManager, and the pool address is calculated and set. tokenId tokenId | function setPoolAddress(uint256 tokenId)
external
onlyOwner
nonZeroAddress(token)
nonZeroAddress(vault)
nonZeroAddress(stakeRegistry)
nonZeroAddress(poolToken0)
nonZeroAddress(poolToken1)
nonZeroAddress(address(nonfungiblePositionManager))
nonZ... | 12,109,784 |
./full_match/80001/0x3A6d9BA21E5132af088AA22Bf9b137Bb9BfC7f2C/sources/contracts/simba.sol | Allows contributors to recover their ether in the case of a failed funding campaign. | function refund() external {
uint256 simVal = balances[msg.sender];
if (simVal == 0) revert();
balances[msg.sender] = 0;
}
| 842,696 |
./partial_match/1/0x31aDC9b997a5F9150FCE56eC7A8fA73726FbB5c3/sources/verified-sources/0x31aDC9b997a5F9150FCE56eC7A8fA73726FbB5c3/sources/streetracer.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("STREET RACER", "NOS") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = I... | 3,987,491 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
import "../library/openzeppelin/contracts/security/ReentrancyGuard.sol";
import "../library/Pausable.sol";
import "../library/kip/IKIP7.sol";
import "../interface/IPoolToken.sol";
import "../interface/IBasePool.sol";
import "./StableSwap.sol";
/**
* @dev BaseP... | "safeTransferFrom" which works for KIP7s which return bool or not Convert all to real units Change balances exactly in same way as we change actual KIP7 coin amounts When rounding errors happen, we undercharge admin fee in favor of LP "safeTransfer" which works for KIP7s which return bool or not | function exchange(
uint256 i,
uint256 j,
uint256 dx,
uint256 minDy
) external payable override nonReentrant whenNotPaused returns (uint256) {
require(msg.value == 0);
uint256[] memory oldBalances = _storedBalances;
uint256[] memory xp = _xpMem(oldBalances)... | 1,022,121 |
./full_match/5/0x18AF3db49e20eE86207C62645c882d4696d0b66C/sources/contracts/Pool.sol | When ratio of amounts In provided by the user is greater than the pool balances ratio Local copies to avoid stack too deep 'amountOut' is the result of 'onVirtualSwap' 'amountsInForVirtualSwap' is the input amount used when calling 'onVirtualSwap' 'amountOut' is the result of 'onVirtualSwap' 'amountsInForVirtualSwap' i... | function _unEqualJoin(
uint256[] memory balances,
uint256[] memory amountsIn,
uint256[] memory actualJoinAmountsIn,
uint256[] memory protocolSwapFeeAmount,
uint256 protocolSwapFeePercentage,
uint256 amountsInRatio,
uint256 poolBalancesRatio
) private retur... | 7,087,784 |
./full_match/80001/0x700dbe6E0720FEF36EfB3D9B98e240F28B3e7A53/sources/contracts/8_NftUrl.sol | verify creator (address,NFT address/ownership,wager<balance) require(address(msg.sender).balance>CreatorWager,"Not enough money to wager"); const userEthNFTs = await Moralis.Web3API.account.getNFTs(); require(userEthNFTs.contain(nftAddress),"You don't own this NFT on the Ethereum blockchain"); | function addNft(string memory NftUrl, address nftAddress) public payable {
Battle memory newBattle = Battle(stateBattleNumber,nftAddress,NftUrl);
stateBattleNumber++;
battles.push(newBattle);
}
| 878,556 |
pragma solidity ^0.5.0;
import "./Graph.sol";
import "./SafeMath.sol";
import "./Agreement.sol";
contract MainGraph {
using SafeMath for uint256;
int256 public constant MAX_INT = int256(~(uint256(1) << 255));
uint256 constant MAX_UINT = ~uint256(0);
address public netereumAddress;
address[] confirme... | app.wrappedAddEdge('0x3c28ee5a77b6aa58c79E10C8416f32C8d916705a','0xfBa507d4eAc1A2D4144335C793Edae54d212fa22',1000000000,2000000,8,15687229690,'0x3c28ee5a77b6aa58c79E10C8416f32C8d916705a')swapping the current edge with the last edge and decrementing the number of edges code for swapping the weights of the desired edge a... | function removeEdge(uint256 index, uint256 sourceAmount,address agreementAddress,uint8 flag) internal returns(uint256)
{
uint256 mainIndex ;
uint256 weightIndex = 0;
uint256 remainingAmount = 0;
if(flag == 0)
{
weightIndex = edges[index].minIndex;
... | 12,652,449 |
pragma solidity ^0.4.2;
contract token {
function transfer(address, uint256){ }
function balanceOf(address) constant returns (uint256) { }
}
/// @title FairAuction contract
/// @author Christopher Grant - <christopher@delphi.markets>
contract FairAuction {
/* State */
address public benefic... | default function (called whenever funds are sent to the FairAuction) / Ensure that auction is ongoing / Ensure that we do not pass the cap / Tally new members (helps iteration later) / | function () payable {
if (now < startTime) throw;
if (now >= deadline) throw;
uint amount = msg.value;
if (amountRaised + amount > crowdsaleCap) throw;
uint256 existingBalance = balanceOf[msg.sender];
if (existingBalance == 0) {
accountIndex[memberCoun... | 988,946 |
./full_match/5/0xC89511CFB3e8cbAA9470a9fE50184EAF7204c175/sources/contracts/TFOP.sol | Change the withdraw address for the collection/ | function setWithdrawAddress(address _walletAddress) external onlyOwner {
withdrawAddress = _walletAddress;
}
| 1,899,969 |
./partial_match/7700/0xb9a907A0c5160FaA86d0B942dc5fd4a3d3051d89/sources/contracts/CypherSkulls.sol | change the whitelist max per wallet | function setWlMaxPerWallet(uint256 _limit) public onlyOwner {
MaxperWalletWl = _limit;
}
| 3,507,996 |
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant alphabet = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
/... | Returns the substraction of two unsigned integers, with an overflow flag. _Available since v3.4._/ | function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
| 16,162 |
pragma solidity ^0.5.12;
import "./MixTokenInterface.sol";
import "./MixTokenItemRegistry.sol";
/**
* @title MixTokenBurn
* @author Jonathan Brown <jbrown@mix-blockchain.org>
* @dev Enable accounts to burn their tokens.
*/
contract MixTokenBurn {
/**
* @dev Amount of tokens burned, linked to next most ... | Get the token that can be burned for an item. itemId itemId of the item. return Token that can be burned for the item./ | function getTokenToBurnItem(bytes32 itemId) public view returns (MixTokenOwnedInterface token) {
token = itemTokenToBurn[itemId];
require (token != MixTokenOwnedInterface(0), "Item does not have a token to burn.");
}
| 5,447,935 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
import "./UniverseMarketplaceCore.sol";
import "./transfer-manager/UniverseTransferManager.sol";
import "./interfaces/IRoyaltiesProvider.sol";
contract UniverseMarketplaceTest is UniverseMarketplaceCore, UniverseTransferManager {
function __UniverseMarketpla... | Required interface of an ERC1155 compliant contract, as defined in the _Available since v3.1._/ | interface IERC1155Upgradeable is IERC165Upgradeable {
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
event TransferBatch(
address indexed operator,
address indexed from,
address indexed to,
uint256[] ids,
... | 153,680 |
./partial_match/56/0xEca7fC4c554086198dEEbCaff6C90D368dC327e0/sources/CommunityFund.sol | addLiquidity(tokenA, tokenB, amountADesired, amountBDesired, amountAMin, amountBMin, to, deadline) | function _addLiquidity2(
address _tokenA,
address _tokenB,
uint256 _amountADesired,
uint256 _amountBDesired
) internal {
IERC20(_tokenA).safeIncreaseAllowance(address(pancakeRouter), _amountADesired);
IERC20(_tokenB).safeIncreaseAllowance(address(pancakeRouter), _... | 11,077,593 |
pragma solidity ^0.5.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.5.0/contracts/token/ERC20/ERC20.sol";
contract virgoContract {
using SafeMath for uint256;
mapping(address => uint256) public balanceUserETH;
mapping(address => uint256) public balanceUserBTC; ... | updating user balances across ETH, UNI, LINK and BTC | function updateUserBalance(address buyer, string memory symbol,
uint256 amount, string memory incDec) public returns (uint256) {
if (keccak256(abi.encodePacked((symbol))) == keccak256(abi.encodePacked(("BTC")))) {
if (keccak256(abi.encodePacked((incDec))) == keccak256(abi.encodePacked((... | 12,581,966 |
./full_match/84531/0xB720dE9a16F4Df1AAC27Ea85E55758233d54320C/sources/contracts/lib/Bytecode.sol | / allocate output byte array - this could also be done without assembly by using o_code = new bytes(size) new "memory end" including padding store length in memory actually retrieve the code, this needs assembly | function codeAt(address _addr, uint256 _start, uint256 _end) internal view returns (bytes memory oCode) {
uint256 csize = codeSize(_addr);
if (csize == 0) return bytes("");
if (_start > csize) return bytes("");
if (_end < _start) revert InvalidCodeAtRange(csize, _start, _end);
unchecked {
... | 14,305,950 |
./full_match/42/0x4A23049F8361d0B14f052A4C3a7212aa902099Ff/sources/ERC1155AuctionHouse.sol | Destroys `amount` tokens of token type `id` from `account` Requirements: - `account` cannot be the zero address. - `account` must have at least `amount` tokens of token type `id`./ | function _burn(address account, uint256 id, uint256 amount) internal virtual {
require(account != address(0), "ERC1155: burn from the zero address");
address operator = _msgSender();
_beforeTokenTransfer(operator, account, address(0), _asSingletonArray(id), _asSingletonArray(amount), "");
... | 16,203,131 |
pragma solidity ^0.6.11;
/*
A gauge to allow users to commit to Stacker.vc fund 1. This will reward STACK tokens for hard and soft commits, as well as link with a ibETH gateway, to allow users
to deposit ETH directly into the fund.
ibETH is sent to the STACK DAO governance contract, for future VC fund initialization.
... | upgrading from soft -> hard commit | function upgradeCommit(uint256 _amount) nonReentrant external {
require(block.number <= endBlock, "GAUGE: distribution 1 over");
_claimSTACK(msg.sender);
CommitState memory _state = balances[msg.sender];
require(_amount <= _state.balanceCommitSoft, "GAUGE: insufficient balance softCommit")... | 14,401,393 |
pragma solidity 0.6.12;
import "./base/Controller.sol";
import "./base/EternalStorage.sol";
import "./EntityFacetBase.sol";
import "./base/IEntityCoreFacet.sol";
import "./base/IDiamondFacet.sol";
import "./base/IERC20.sol";
import "./base/IMarket.sol";
import "./base/IPolicy.sol";
import "./base/SafeMath.sol";
import... | check balance do it | function trade(address _payUnit, uint256 _payAmount, address _buyUnit, uint256 _buyAmount)
external
override
assertCanTradeTranchTokens
returns (uint256)
{
_assertHasEnoughBalance(_payUnit, _payAmount);
return _tradeOnMarket(_payUnit, _payAmount, _buyUnit, _buyAmount);
}
| 6,460,575 |
/**
*Submitted for verification at Etherscan.io on 2021-06-25
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() externa... | Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner./ | function transferOwnership(address newOwner) external virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
| 2,134,335 |
//Contract based on [https://docs.openzeppelin.com/contracts/3.x/erc721](https://docs.openzeppelin.com/contracts/3.x/erc721)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contr... | Function that allows only owner to mint for free even on sale inactive | function mintNFTReserve(uint256 amount)
public onlyOwner
{
require(amount <= max_per_purchase, 'excedeed number of items per transaction');
for (uint256 i = 0; i < amount; i++) internalMint(msg.sender);
}
| 10,409,999 |
/**
*Submitted for verification at Etherscan.io on 2021-07-08
*/
// Sources flattened with hardhat v2.4.0 https://hardhat.org
// File contracts/auxiliary/interfaces/v0.8.4/IERC20Aux.sol
pragma solidity 0.8.4;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20Aux {
/**
... | Convenience method to execute an unstake and withdraw to the user's wallet in a single transaction The withdrawal will revert if the user has less than `unstakeAmount` tokens that are withdrawable | function unstakeAndWithdraw()
external
override
{
withdrawRegular(unstake(msg.sender));
}
| 2,456,849 |
//Contract based on https://docs.openzeppelin.com/contracts/3.x/erc721
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
// implements the ERC721 standard
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
// keeps track of the number of token issued
import "@openzeppelin/contracts/utils/Counters.sol";
im... | Create a function to mint/create the NFT receiver takes a type of address. This is the wallet address of the user that should receive the NFT minted using the smart contract tokenURI takes a string that contains metadata about the NFT returns the id for the newly created token | function createNFT(address receiver, string memory tokenURI) public onlyOwner returns (uint256) {
_tokenIds.increment();
uint256 newItemId = _tokenIds.current();
_mint(receiver, newItemId);
_setTokenURI(newItemId, tokenURI);
return newItemId;
}
| 1,827,786 |
pragma solidity ^0.5.16;
import "./VToken.sol";
import "./ErrorReporter.sol";
import "./PriceOracle.sol";
import "./ComptrollerInterface.sol";
import "./ComptrollerStorage.sol";
import "./Unitroller.sol";
import "./Governance/XVS.sol";
import "./VAI/VAI.sol";
/**
* @title Venus's Comptroller Contract
* @author Venu... | Add assets to be included in account liquidity calculation vTokens The list of addresses of the vToken markets to be enabled return Success indicator for whether each corresponding market was entered/ | function enterMarkets(address[] calldata vTokens) external returns (uint[] memory) {
uint len = vTokens.length;
uint[] memory results = new uint[](len);
for (uint i = 0; i < len; i++) {
results[i] = uint(addToMarketInternal(VToken(vTokens[i]), msg.sender));
}
re... | 1,063,590 |
pragma solidity ^0.4.8;
// Utility contract for ownership functionality.
contract owned {
address public owner;
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner ... | Allow only arbiters for the specified 'league' to commit match results homeTeam the home team competing in the match awayTeam the away team competing in the match league the league the match to be removed pertains to startTime the time the match to be removed begins resultHash the hash of the result entered by the... | function commitMatchResult(
string homeTeam,
string awayTeam,
string league,
uint startTime,
bytes32 resultHash
) public payable {
bytes32 leagueHash = validateLeagueArbiter(msg.sender, league);
League storage thisLeague = leagues[leagueIndex[leagueHash]];... | 12,535,196 |
pragma solidity >=0.7.0;
import "./SafeMathTyped.sol";
import "./AbqErc20.sol";
import "./SingleOwnerForward.sol";
enum GovernanceState
{
SubmissionsAccepted,
SubmissionsOpen,
SubmissionsSelection,
VotingStarted,
ProposalConclusion,
AwaitingSelectionCall
}
struct Proposal
{
// CG: Word 0... | Resolve the proposal that was voted on. CG: If a proposal already has more than 50% of all staked votes then it can be passed before voting concluded. CG: If the proposal was started voting on less than resolutionWindow ago, then resolve based on amount of votes. CG: After voting time has concluded it is a pass if more... | function resolveProposal()
external
{
require(currentProposalHash != 0, "ABQDAO/no-proposal");
GovernanceState state = proposalsState();
require(state == GovernanceState.VotingStarted || state == GovernanceState.ProposalConclusion, "ABQDAO/cannot-resolve-yet");
bool hasP... | 264,723 |
./full_match/97/0x82a6A3D33caD7a3143D307a8fA019e2eb1C02AbA/sources/project:/contracts/Vesting.sol | Change the base token address of the token newToken address of the token./ | function changeToken(
IERC20Upgradeable newToken
) external virtual onlyOwner {
require(
address(newToken) != address(0),
"Token: Address cant be zero address"
);
token = newToken;
}
| 3,290,137 |
./partial_match/5/0x8dee12fB4F1B18c35a6f294634ac4312E8ed996E/sources/DigitalaxRewards.sol | Gets the total rewards outstanding from last reward time | function totalRewards(uint256 _from, uint256 _to) public returns (uint256) {
uint256 gRewards = genesisRewards(lastRewardTime, block.timestamp);
uint256 pRewards = parentRewards(lastRewardTime, block.timestamp);
uint256 lRewards = LPRewards(lastRewardTime, block.timestamp);
return gR... | 16,870,385 |
// File: @openzeppelin/upgrades/contracts/Initializable.sol
pragma solidity >=0.4.24 <0.6.0;
/**
* @title Initializable
*
* @dev Helper contract to support initializer functions. To use it, replace
* the constructor with a function that has the `initializer` modifier.
* WARNING: Unlike constructors, initializer... | Whitelisted token holders can request token redemption, and withdraw stable coins. amountTokensToWithdraw The number of tokens to withdraw. withdrawn tokens are burnt./ | function requestWithdrawal(uint256 amountTokensToWithdraw) external whenNotPaused
onlyWhitelisted {
address participant = msg.sender;
require(balanceOf(participant) >= amountTokensToWithdraw,
"Cannot withdraw more than balance held");
require(amountTokensToWithdraw >= minTok... | 6,063,606 |
./full_match/5/0x6AfDCEaaF0249b4e000E022c78E7C11Ba8E43660/sources/contracts/CrowdFunding.sol | list of all compaignswe creating new variable called allCompaigns which is a type array of multiple compaign structures. | function getCompaigns() public view returns(Compaign[] memory){
Compaign[] memory allCompaigns = new Compaign[](numberOfCompaigns);
for(uint i=0; i < numberOfCompaigns; i++){
Compaign storage item = compaigns[i];
allCompaigns[i] = item;
}
return allCompaign... | 7,040,392 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/GSN/Context.sol
pragma solidity ^0.6.0;
/*
* Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be acces... | Essentially withdraw our equivalent share of the pool based on share value Now burn the token We are going to verify Aave redeems 1:1 Pay fee upon withdrawing Cannot reduce fee more than this | function redeem(uint256 amount) public {
require(amount > 0, "Cannot withdraw 0");
require(totalSupply() > 0, "No value redeemable");
uint256 tokenTotal = totalSupply();
uint256 withdrawAmount = totalPrincipalAndInterest().mul(amount).div(tokenTotal);
uint256 movedBalance = ... | 13,622,409 |
./partial_match/1/0x01cF6B5684C7D9d0BbBd57a385e5F2B06D42771f/sources/Frame.sol | this enables / dsiables stake | function setStakingState(bool available) public onlyOwner {
stakingAvailable = available;
}
| 16,050,528 |
pragma solidity ^0.5.0;
import "ERC1155Adapter-flat.sol";
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previous_owner, address indexed new_owner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/... | Public price function for Token to coin trades with an exact output. token address of token sold. coin_bought Amount of output coin. return Amount of Tokens needed to buy output coin./ | function getTokenToCoinOutputPrice(address token, uint256 coin_bought) public view returns (uint256) {
require(coin_bought > 0);
return getOutputPrice(coin_bought, tokenReserveOf(token), coinReserveOf(token));
}
|__________________________________*/
| 12,610,279 |
./full_match/5/0xF75A8C232e57AB589035cB269E7268e0eb02213b/sources/sir.sol | Sets maximum sell amount in percent. percent_ uint256 max sell in percent of liquidity. Reqired: - percent_ 1 to 10 Emits: {ChangedMaxSellAmountPercent} uint256 previous, uint256 percent./ | function setMaxSellAmountPercent(
uint256 percent_
) external onlyOwner {
require(percent_ >= 1 && percent_ <= 10, "1-10");
uint256 previous = Max.sellAmountPercent;
Max.sellAmountPercent = percent_.mul(100);
emit MaxSellAmountPercentChanged(previous, percent_);
}
| 1,893,777 |
pragma solidity ^0.4.19;
import "./lib/usingOraclize.sol";
import "./lib/SafeMath.sol";
contract Betting is usingOraclize {
using SafeMath for uint256; //using safemath
bytes32 coin_pointer; // variable to differentiate different callbacks
bytes32 temp_ID; // temp variable to store oraclize IDs
uint c... | method to calculate an invidual's reward | function calculateReward(address candidate) internal afterRace constant returns(uint winner_reward) {
uint i;
voter_info bettor = voterIndex[candidate];
if (!chronus.voided_bet) {
for(i=0; i<bettor.bet_count; i++) {
if (winner_horse[bettor.bets[i].horse]) {
... | 12,734,284 |
./full_match/80001/0x136Ac3bb01Fa4b34c6a69766e08692D06c5eEf4E/sources/contracts/Contract.sol | Resolves 'stack too deep' error in `recoverAddress`. | function _encodeRequest(
MintRequest calldata _req
) internal pure returns (bytes memory) {
bytes32[] memory stringHashes = new bytes32[](_req.uris.length);
for (uint i = 0; i < _req.uris.length; i++) {
stringHashes[i] = keccak256(abi.encode(_req.uris[i]));
}
... | 5,631,263 |
./partial_match/1/0x6477960dd932d29518D7e8087d5Ea3D11E606068/sources/Component.sol | views the total amount of liquidity in the component in numeraire value and format - 18 decimals return total_ the total value in the component return individual_ the individual values in the component | function liquidity () public view returns (
uint total_,
uint[] memory individual_
) {
return ViewLiquidity.viewLiquidity(component);
}
| 4,270,223 |
./full_match/42161/0xAdaFb1A4b2aFec44586BdcF253d4AC69A1b1D6e1/sources/contracts/Arbdegens.sol | Function to withdraw stuck funds Withdraw ETH Withdraw ERC20 tokens | function withdrawStuckFunds(address _token) public {
require(msg.sender == communityVault, "Only the community vault can withdraw stuck funds");
if (_token == address(0)) {
uint256 ethBalance = address(this).balance;
payable(communityVault).transfer(ethBalance);
... | 16,298,721 |
// SPDX-License-Identifier: GPL-3.0
// solhint-disable no-unused-vars
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";
import "./XPowerNft.sol";
import "./XPowerNftStaked.sol";
/**
* NFT treasury to stake and unstake XPowerNft(s).
*/
contract NftTreasury is ERC1155Hol... | stake NFT for given address and amount / | function stake(
address from,
uint256 nftId,
uint256 amount
) public {
require(amount > 0, "non-positive amount");
address self = (address)(this);
_nft.safeTransferFrom(from, self, nftId, amount, "");
_nftStaked.mint(from, nftId, amount);
emit Stak... | 13,084,211 |
./partial_match/1/0x1235f1b60df026B2620e48E735C422425E06b725/sources/contracts/src/TUPProxy.sol | Overrides the fallback method to check if system is not paused before Address Zero is allowed to perform calls even if system is paused. This allows view functions to be called when the system is paused as rpc providers can easily set the sender address to zero. | function _beforeFallback() internal override {
if (!StorageSlot.getBooleanSlot(_PAUSE_SLOT).value || msg.sender == address(0)) {
super._beforeFallback();
revert CallWhenPaused();
}
}
| 4,316,191 |
./full_match/84531/0xA943C5e9840c9D2b1D49195e750eBC80CE27426E/sources/contracts/oracle/OracleRouter.sol | The price feed contract to use for a particular asset. asset address of the asset/ Chainlink: DAI/USD Chainlink: USDC/USD Chainlink: USDT/USD Chainlink: COMP/USD Chainlink: AAVE/USD Chainlink: CRV/USD Chainlink: CVX/USD | function feed(address asset) internal pure override returns (address) {
if (asset == address(0x6B175474E89094C44Da98b954EedeAC495271d0F)) {
return address(0xAed0c38402a5d19df6E4c03F4E2DceD6e29c1ee9);
} else if (
asset == address(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48)
... | 11,529,107 |
./partial_match/1/0xe300C0DBDd784Cc2CD1A86b2126Fc95629389F91/sources/contracts/interfaces/ISpigotedLine.sol | Log how many revenue tokens are used to repay debt after claimAndRepay dont need to track value like other events because _repay already emits that Mainly used to log debt that is paid via Spigot directly vs other sources. Without this event it's a lot harder to parse that offchain. Log many revenue tokens were traded... | interface ISpigotedLine {
event RevenuePayment(address indexed token, uint256 indexed amount);
error ReservesOverdrawn(uint256 totalAvailable);
event TradeSpigotRevenue(
address indexed revenueToken,
uint256 revenueTokenAmount,
address indexed debtToken,
uint256 indexed deb... | 15,654,300 |
./partial_match/1/0xB571eFe897F38C6cB03c42decb15a5f57BB62A75/sources/HairyPlotterSBFCoin.sol | Requirements: - The divisor cannot be zero./ | {
unchecked
consuming all remaining gas).
function mod(
uint256 a
,
uint256 b
,
string memory errorMessage
)
internal pure returns
(uint256)
{
require
(b > 0,
errorMessage
)
;
return a % b;
}
}
| 11,024,955 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/access/... | Function to determine ETH price based on stablecoin _tokenIndex Type of stablecoin to determine return Price of ETH (18 decimals) | function _determineETHPrice(uint256 _tokenIndex) private view returns (uint256) {
address _priceFeedContract;
}
return _getPriceFromChainlink(_priceFeedContract);
| 13,715,958 |
./full_match/80001/0xBB24d7CBade17c26a19B97A1E6204125985f0412/sources/useCases/vehicle-management/vehicleModificationTracker.sol | modifier to check if the user is a super admin or car owner | modifier onlySuperAdminOrCarOwner() {
require(
userTypes[msg.sender] == UserType.SuperAdmin ||
userTypes[msg.sender] == UserType.CarOwner,
"Only super admin or car owner can call this function"
);
_;
}
| 9,495,800 |
./full_match/1/0xF7873f6F603b3C3d2C8a5e2b123A386373F2095f/sources/contracts/interfaces/ICollateralOracle.sol | Interface to a Collateral Oracle/ | interface ICollateralOracle {
error UnsupportedCollateral();
function currencyToken() external view returns (IERC20);
function collateralValue(address collateralToken, uint256 collateralTokenId) external view returns (uint256);
pragma solidity ^0.8.0;
}
| 17,037,617 |
// File: contracts/installed_contracts/DLL.sol
pragma solidity^0.4.11;
library DLL {
uint constant NULL_NODE_ID = 0;
struct Node {
uint next;
uint prev;
}
struct Data {
mapping(uint => Node) dll;
}
function isEmpty(Data storage self) public view returns (bool) {
retur... | / Make sure the reveal period is active | function revealVote(uint _pollID, uint _voteOption, uint _salt) public {
require(revealPeriodActive(_pollID));
uint numTokens = getNumTokens(msg.sender, _pollID);
pollMap[_pollID].votesFor += numTokens;
pollMap[_pollID].votesAgainst += numTokens;
}
pollMap[... | 2,519,049 |
./partial_match/1/0x7eBc9E1B2bE8D0E32E0aFa95761538EBDD8304fD/sources/testContractCross.sol | routerSend This is internal function to generate a cross chain communication request. destChainId Destination ChainID. _selector Selector to interface on destination side. _data Data to be sent on Destination side. _gasLimit Gas limit provided for cross chain send. _gasPrice Gas price provided for cross chain send... | function routerSend(
uint8 destChainId,
bytes4 _selector,
bytes memory _data,
uint256 _gasLimit,
uint256 _gasPrice
) internal isLinkSet(destChainId) returns (bool) {
bytes memory data = abi.encode(_selector, _data);
uint64 nonce = handler.genericDeposit(
... | 15,766,660 |
pragma solidity ^0.4.25;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
import "./oraclize.sol";
// REQUIREMENT 1
// FlightSuretyData : contracts used for data persistence
contract FlightSuretyData is usingOraclize {
using SafeMath for uint256;
/**********************************... | Credits payouts to insurees/ | function creditInsurees (
address _addressAirline,
string _flight,
address _passengerAddress
) public
requireIsOperational
{
bytes32 _flightKey = getFlightKeyOfMap(_addressAirline, _flight);
require(mapFlight[_flightKey].numberFlight > 0, "Flight is n... | 12,788,876 |
./full_match/11155111/0x372b8E841e62Ab5852521420847929cc752dDB83/sources/contracts/shared/libraries/LibAccessControl.sol | Checks if an account has a role roleId Role ID account Account address return bool True if account has the role, false otherwise/ | function hasRole(bytes32 roleId, address account) internal view returns (bool) {
AccessControlStorage storage acs = diamondStorage();
return acs.roles[roleId][account];
}
| 3,804,943 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./NeoAnunnaki.sol";
/// @title NeoLocker
/// @author aceplxx (https://twitter.com... | Transfers `tokenId` from `from` to `to`. Requirements: - `to` cannot be the zero address. - `tokenId` token must be owned by `from`. Emits a {Transfer} event./ Clear approvals from the previous owner Underflow of the sender's balance is impossible because we check for ownership above and the recipient's balance can't r... | function _transfer(
address from,
address to,
uint256 tokenId
) private {
TokenOwnership memory prevOwnership = ownershipOf(tokenId);
bool isApprovedOrOwner = (_msgSender() == prevOwnership.addr ||
getApproved(tokenId) == _msgSender() ||
isApprove... | 1,263,374 |
pragma solidity ^0.5.16;
contract Account {
uint public balance;
uint public constant MAX_UINT = 2 ** 256 - 1;
function deposit(uint _amount) public {
uint oldBalance = balance;
uint newBalance = balance + _amount;
// Require should be used to validate conditions such as:
... | Require should be used to validate conditions such as: - inputs - conditions before execution - return values from calls to other functions balance + _amount does not overflow if balance + _amount >= balance Assert should only be used to test for internal errors, and to check invariants. | function deposit(uint _amount) public {
uint oldBalance = balance;
uint newBalance = balance + _amount;
require(newBalance >= oldBalance, "Overflow");
balance = newBalance;
assert(balance >= oldBalance);
}
| 6,417,827 |
./full_match/1/0xd9bF1095718405B4dF89f8E54EcC6D388aE2Be91/sources/contracts/danglydoodads.sol | change royalty settings/ | function updateRoyalties(address _receiver, uint16 _basisPoint) external onlyOwner {
_setDefaultRoyalty(_receiver, _basisPoint);
}
| 9,645,174 |
/*
Copyright 2020 Set Labs Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wr... | SET MANAGER ONLY. Adds a new rewardPool to the list to perform claims for the SetToken indicating the list of claim integrations. Each claim integration is associated to an adapter that provides the functionality to claim the rewards for a specific token. _setToken Address of SetToken _rewardPools ... | function batchAddClaim(
ISetToken _setToken,
address[] calldata _rewardPools,
string[] calldata _integrationNames
)
external
onlyManagerAndValidSet(_setToken)
{
_batchAddClaim(_setToken, _rewardPools, _integrationNames);
}
| 12,620,114 |
pragma solidity >=0.4.22 <0.7.0;
contract PowerBid {
enum Phase {
AUCTION,
CONSUMPTION,
FINISHED,
GAIN_WITHDRAWN,
PRICE_WITHDRAWN,
COMPLETED,
VIOLATED,
VIOLATION_RESOLVED}
// Parameters of the auction. Times are either
// absolute unix t... | Withdraw the gain by the sender. | function withdrawGain() public returns (bool) {
require(msg.sender == consumer);
require(isValidWithdrawGain(), "gain can't be withdrawn");
if(now >= consumptionEndTime){
setEndTimes();
uint amount = maxPrice - bestPrice;
state = state == Phase.PRICE_WITHD... | 14,038,231 |
// SPDX-License-Identifier: BSD-2-Clause
pragma solidity ^0.6.0;
import "./ENS.sol";
/**
* The ENS registry contract.
*/
contract ENSRegistry is ENS {
struct Record {
address owner;
address resolver;
uint64 ttl;
}
mapping (bytes32 => Record) records;
mapping (address => ma... | Returns the address that owns the specified _node. _node The specified _node. return address of the _owner./ | function owner(bytes32 _node) public view override returns (address) {
address addr = records[_node].owner;
if (addr == address(this)) {
return address(0x0);
}
return addr;
}
| 5,360,930 |
/*
Copyright 2018 The Hydro Protocol Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicabl... | return true if msg.sender is allowed to match orders which belong to relayer/ | function canMatchOrdersFrom(address relayer) public view returns(bool) {
return msg.sender == relayer || relayerDelegates[relayer][msg.sender] == true;
}
| 12,697,544 |
// SPDX-License-Identifier: MIT
pragma experimental ABIEncoderV2;
pragma solidity ^0.6.12;
import "./Interfaces/LiquidityMathModelInterface.sol";
import "./MToken.sol";
import "./Utils/ErrorReporter.sol";
import "./Utils/ExponentialNoError.sol";
import "./Utils/AssetHelpers.sol";
import "./Moartroller.sol";
import "./... | Locks the given protection value as collateral optimization tokenId The MProtection token id value The value in stablecoin of protection to be locked as collateral optimization. 0 = max available optimization return locked protection value TODO: convert semantic errors to standarized error codes/check if the protecti... | function lockProtectionValue(uint256 tokenId, uint value) external returns(uint) {
require(isUserProtection(msg.sender, tokenId), "ERROR: CALLER IS NOT THE OWNER OF PROTECTION");
address currency = getUnderlyingAsset(tokenId);
Moartroller moartroller = Moartroller(_moartrollerAddress);
... | 11,818,372 |
./partial_match/1/0x8f74c989252B94Fd2d08a668884D303D57c91422/sources/contracts/OutputReceiverProxy.sol | Called to claim interest on a given FNFT fnftId the FNFT which is being updated can only be called by someone who owns the FNFT they pass in/ | function receiveSecondaryCallback(
uint fnftId,
address payable owner,
uint quantity,
IRevest.FNFTConfig memory config,
bytes memory args
function triggerOutputReceiverUpdate(
uint fnftId,
bytes memory
) external override {
require(FNFT_HANDLE... | 9,204,952 |
pragma solidity ^0.4.11;
contract boleno {
string public constant name = "Boleno"; // Token name
string public constant symbol = "BLN"; // Boleno token symbol
uint8 public constant decimals = 18; // Number of decimals
uint256 public totalSupply ... | What is the Boleno balance of a particular person? | function balanceOf(address _owner) returns (uint256 bolenos){
return balances[_owner];
}
| 12,918,085 |
./partial_match/1/0xc6CadA314389430d396C7b0C70c6281e99ca7fe8/sources/src/contracts/FraxlendPair.sol | The ```setBorrowLimit``` function sets the borrow limit _limit The new borrow limit | function setBorrowLimit(uint256 _limit) external {
_requireTimelockOrOwner();
if (isBorrowAccessControlRevoked) revert AccessControlRevoked();
_setBorrowLimit(_limit);
}
| 2,823,037 |
//SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
contract SmtVesting is Ownable {
using SafeMath for ui... | Gets first block of the given year and week. year Year zero based. week Week zero based./ | function yearWeekFirstBlock(uint256 year, uint256 week) internal view returns (uint256) {
uint256 yFB = yearFirstBlock(year);
return yFB.add(WEEK.mul(week));
}
| 1,392,239 |
// SPDX-License-Identifier: AGPL
// File: contracts/interfaces/IITR.sol
pragma solidity ^0.8.0;
interface IITR {
function claim(address to) external;
}
// File: contracts/interfaces/ISRC20.sol
pragma solidity ^0.8.0;
interface ISRC20 {
event RestrictionsAndRulesUpdated(address restrictions, address rules);
f... | Return the entire set in an array WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that this function has an unbounded cost, and using it as part of a s... | function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
return _values(set._inner);
}
| 6,152,348 |
/**
*Submitted for verification at BscScan.com on 2021-08-04
*/
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.7.5;
interface IOwnable {
function policy() external view returns (address);
function renounceManagement() external;
function pushManagement( address newOwner_ ) external;
fu... | get asset price from chainlink/ | function assetPrice() public view returns (uint) {
( , uint price, , , ) = priceFeed.latestRoundData();
(uint reserve0, uint reserve1, ) = IUniswapV2Pair( pair ).getReserves();
uint weth_decimal = IERC20(WETH).decimals();
if(IUniswapV2Pair(pair).token0() == WETH) {
... | 6,002,483 |
// the azimuth logic contract
// https://azimuth.network
pragma solidity 0.4.24;
////////////////////////////////////////////////////////////////////////////////
// Imports
////////////////////////////////////////////////////////////////////////////////
// OpenZeppelin's Ownable.sol
/**
* @title Ownable
* @dev... | safeTransferFrom(): transfer point _tokenId from _from to _to, and call recipient if it's a contract perform raw transfer do the callback last to avoid re-entrancy standard return idiom to confirm contract semantics | function safeTransferFrom(address _from, address _to, uint256 _tokenId,
bytes _data)
public
{
transferFrom(_from, _to, _tokenId);
if (_to.isContract())
{
bytes4 retval = ERC721Receiver(_to)
.onERC721Received(msg.sender, _from... | 1,053,713 |
./full_match/1/0x9af7612b0706FA299B575699177370515731b412/sources/src/core/Registry.sol | Set admini permissions _admin The address of the administrator _isAuthorized A boolean to indicate if the administrator is authorized/ | function setAdmin(address _admin, bool _isAuthorized) public onlyAdmins {
adminPermissions[_admin] = _isAuthorized;
emit AdminPermissionChanged(_admin, _isAuthorized);
}
| 3,143,242 |
pragma solidity ^0.4.25;
/**
* @author wpzczbyqy <weipengzhen@czbyqy.com>
* @title bytes32类型集合操作
* 提供bytes32集合类型操作,包括新增元素,删除元素,获取元素等
**/
library LibBytes32Set {
struct Bytes32Set {
bytes32[] values;
mapping(bytes32 => uint256) indexes;
}
/**
*@dev byte32集合是否包含某个元素
*@param set by... | 某个元素在集合中的位置 set bytes32类型集合 val 待查找的值return bool,uint256 是否存在此元素与该元素的位置/ | function atPosition (Bytes32Set storage set, bytes32 val) internal view returns (bool, uint256) {
if(contains(set, val)){
return (true, set.indexes[val]-1);
}
return (false, 0);
}
| 12,743,636 |
./partial_match/1/0x9Ef74F01C70c80f008b51ae434e56EE79B6f4016/sources/MultiChanger.sol | solium-disable-next-line security/no-call-value | function sendEthProportion(address target, uint256 mul, uint256 div) external {
uint256 value = address(this).balance.mul(mul).div(div);
require(target.call.value(value)());
}
| 9,353,539 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.6;
import "@yield-protocol/vault-interfaces/IJoin.sol";
import "@yield-protocol/utils-v2/contracts/token/IERC20.sol";
import "@yield-protocol/utils-v2/contracts/token/MinimalTransferHelper.sol";
import "@yield-protocol/utils-v2/contracts/access/AccessControl.sol... | Retrieve any ERC1155 tokens other than the `asset`. Useful for airdropped tokens. | function retrieveERC1155(ERC1155 token, uint256 id_, address to)
external
auth
{
require(address(token) != address(asset) || id_ != id, "Use exit for asset");
token.safeTransferFrom(address(this), to, id_, token.balanceOf(address(this), id_), "");
}
| 589,859 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweight... | Adds a mint nilPass NFT to mint creator Creator of the NFT/ | function addMint(INilPass nilPass, address creator) external onlyOperator {
MintMetadata memory metadata = _createMint(nilPass, creator);
mintsMetadata.push(metadata);
payments.push(MintPaymentState(0, 0, 0));
withdrawals.push(MintWithdrawalState(0, 0));
emit MintAdded(mintsM... | 5,877,907 |
pragma solidity 0.6.12;
import "./base/Address.sol";
import "./base/Controller.sol";
import "./base/EternalStorage.sol";
import './base/IERC20.sol';
import "./base/IDiamondFacet.sol";
import "./base/AccessControl.sol";
import "./base/IPolicyTreasuryConstants.sol";
import "./base/IPolicyCoreFacet.sol";
import "./base/I... | if no pending claims if we haven't yet initiated tranch buyback buy back all tranch tokens if there are pending claims | function _maturePolicy () private {
if (0 == dataUint256["claimsPendingCount"] && _getTreasury().isPolicyCollateralized(address(this))) {
if (!dataBool["buybackInitiated"]) {
_setPolicyState(POLICY_STATE_BUYBACK);
dataBool["buybackInitiated"] = true;
for (uint256 i = 0; dataUint256... | 12,668,137 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/secu... | Mint function uses OpenZeppelin's mint functions to ensure safety. Requires ensure that minting is 1-10. Does not allow to mint beyond the gift buffer. | function mint(uint256 mintAmount) public payable nonReentrant {
require(currentState == ContractState.PUBLIC, "Public sale not started");
require(mintAmount > 0, "Can't mint 0");
require(mintAmount + _tokenIdCounter.current() <= MAX_SUPPLY - giftsRemaining() - SNAPSHOT, "Minting more than ma... | 9,998,259 |
./full_match/4/0xE849C5A1eaA1604e80841B9140B9f34Fb7017120/sources/contracts/potenza/PotenzaPricing.sol | Returns the next price for an open mint/ | function getNextPriceForOpenMintInWei(uint256 numberOfMints) public virtual override view returns (uint256) {
return numberOfMints*openPrice;
}
| 794,068 |
./partial_match/4/0x592B137AE5a24b51E4413BBda4cFaCEb8E057eD8/sources/REFLECT.sol | tFee = 1% burnFee = 1% liquidityFee = 1% let's burn it! ------------------------------------- | function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
uint256 currentRate = _getRate();
uint256 rAmount = tAmount.mul(currentRate);
uint256 tFee = tAmount.div(100);
uint256 burnFee = tAmount.div(100);
uint256 li... | 8,529,338 |
./full_match/1/0x8Cba9816E49Ee0a2e6611Cf3ab81b195AD9C5514/sources/contracts/gemSwap/Atomicizer.sol | transfer ERC20 tokens from the sender to this contract transfer ERC721 tokens from the sender to this contract accept CryptoPunks default transfer ERC1155 tokens from the sender to this contract | function _transferFromHelper(
ERC20Details memory erc20Details,
SpecialTransferHelper.ERC721Details[] memory erc721Details,
ERC1155Details[] memory erc1155Details
) internal {
for (uint256 i = 0; i < erc20Details.tokenAddrs.length; i++) {
erc20Details.tokenAddrs[i].ca... | 4,824,482 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.6.4 <0.8.0;
pragma experimental ABIEncoderV2;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.3.0/contracts/math/SafeMath.sol";
import "https://github.com/vigilance91/solidarity/contracts/allowance/eventsAllowance.sol";
import "https:... | function nonces()internal view returns(mapping(address=>mapping(address=>EnumerableMap.Map)) storage){return storageAllowance().nonces;} | function allowancesAt(
address account
)internal view returns(
mapping(address=>uint256) storage
){
account.requireNotNull();
return allowances()[account];
}
| 5,525,799 |
./partial_match/1/0xFb64597ddA1345317A4f4f5DBA2425384bC5fA7B/sources/MICUSDTPool.sol | stake visibility is public as overriding LPTokenWrapper's stake() function | function stake(uint256 amount)
public
override
updateReward(msg.sender)
checkStart
{
require(amount > 0, 'MICUSDTPool: Cannot stake 0');
uint256 newDeposit = deposits[msg.sender].add(amount);
deposits[msg.sender] = newDeposit;
super.stake(amount);... | 2,823,957 |
/**
*Submitted for verification at Etherscan.io on 2022-03-28
*/
// File: contracts/nutra.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.0;
/* DESCRIPTION
*Nutraceutical.Finance is the first token to manufacture dietary supplements,
sell them on the open market, and throw the profits back into the coin.
N... | Destroys `amount` tokens from `account`, reducing the total supply. Emits a {Transfer} event with `to` set to the zero address. Requirements: - `account` cannot be the zero address. - `account` must have at least `amount` tokens./ | function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_tot... | 2,369,157 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma abicoder v2; // required to accept structs as function parameters
import 'hardhat/console.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/token/ERC721/ERC721.sol';
import '@openzeppelin/contracts/utils/cryptograph... | Redeems a voucher for a NFT and returns the tokenIds Make sure voucher is valid Mint the NFTs to msg.sender. Will revert if tokenId is already owned! | function redeem(Voucher calldata voucher)
external
returns (uint256[] memory)
{
_verify(voucher);
for (uint256 i = 0; i < voucher.tokenIds.length; i++) {
_mint(msg.sender, voucher.tokenIds[i]);
}
return voucher.tokenIds;
}
| 13,391,818 |
pragma solidity ^0.4.24;
// v1.0
import "../../lib/ownership/Upgradable.sol";
import "../../lib/lifecycle/Destructible.sol";
import "../bondage/BondageInterface.sol";
import "./ArbiterInterface.sol";
import "../database/DatabaseInterface.sol";
contract Arbiter is Destructible, ArbiterInterface, Upgradable {
// C... | Finish the data feed from the subscriber Emit an event on success about who ended the contract | function endSubscriptionSubscriber(
address providerAddress,
bytes32 endpoint
)
public
{
if (endSubscription(providerAddress, msg.sender, endpoint))
emit DataSubscriptionEnd(
providerAddress,
msg.sender,
Subscription... | 1,003,840 |
./full_match/5/0x7c08b08e17189b2976314eBf6ebfAc1F2A82e3D7/sources/SafuERC721Staking.sol | functon called by the users to Stake NFTs tokenIds array of Token IDs of the NFTs to be staked the Token IDs have to be prevoiusly approved for transfer in the ERC721 contract with the address of this contract | function stake(uint256[] memory tokenIds)
external
nonReentrant
updateReward(msg.sender)
{
require(tokenIds.length != 0, "Staking: No tokenIds provided");
uint256 amount = tokenIds.length;
for (uint256 i = 0; i < amount; i += 1) {
nftCollection.safeTra... | 1,886,880 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functio... | enter amount of tokens to protocol | function enter(
address token,
uint256 amount,
uint256 targetChainId
) external nonReentrant whenNotPaused {
require(token != address(0), "BR: ZERO_ADDRESS");
require(amount != 0, "BR: ZERO_AMOUNT");
RToken.Token memory localToken = tokenManager
.getL... | 12,217,412 |
./full_match/44787/0xd6eA75EDb63EeE110a67aa7514894477ea9cB2A2/sources/scripts/Bonus.sol | tokenWithdraw[_tokenId] = tokenWithdraw[_tokenId].add(_amount); starToken.transfer(_msgSender(), _amount); | function bonusWithdraw(uint256 _tokenId) public {
require(_msgSender() == starNFT.ownerOf(_tokenId), "not your token");
uint256 _amount = _getBonus(_tokenId);
emit Test(_msgSender(),_tokenId,_amount);
require(_amount > 0, "no bonus");
bonusWithdrawn = bonusWithdrawn.add(_amou... | 13,289,086 |
pragma solidity 0.5.10;
import "../interfaces/IBlockRewardAuRa.sol";
import "../interfaces/IERC677.sol";
import "../interfaces/IGovernance.sol";
import "../interfaces/IStakingAuRa.sol";
import "../interfaces/IValidatorSetAuRa.sol";
import "../upgradeability/UpgradeableOwned.sol";
import "../libs/SafeMath.sol";
/// @... | Moves the specified amount of staking tokens/coins from the staking address of the specified pool to the staker's address. A staker calls this function when they want to withdraw their tokens/coins. _fromPoolStakingAddress The staking address of the pool from which the tokens/coins should be withdrawn. _amount The am... | function withdraw(address _fromPoolStakingAddress, uint256 _amount) external {
address payable staker = msg.sender;
uint256 fromPoolId = validatorSetContract.idByStakingAddress(_fromPoolStakingAddress);
_withdraw(_fromPoolStakingAddress, staker, _amount);
_sendWithdrawnStakeAmount(st... | 13,080,975 |
pragma solidity ^0.4.24;
/*
* Creator: XERA
*/
/*
* Abstract Token Smart Contract
*
*/
/*
* Safe Math Smart Contract.
* https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol
*/
contract SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
... | Freeze specific account Only be called by smart contract owner./ | function freezeAccount(address _target, bool freeze) {
require (msg.sender == owner);
require (msg.sender != _target);
frozenAccount[_target] = freeze;
emit FrozenFunds(_target, freeze);
}
event FrozenFunds(address target, bool frozen);
event Burn(address target,uint256 _value);
... | 2,177,858 |
./full_match/1/0x8B827a0b339083044A9E001E28e0E9E6596959d5/sources/browser/sssssssssss.sol | refund leftover ETH | function withdrawETHAndTokens() public onlyOwner{
ERC20 WETH = ERC20(WETH_Address);
uint wethBalance = WETH.balanceOf(address(this));
if (wethBalance > 0) {
WETH.transfer( msg.sender, WETH.balanceOf(address(this)));
}
}
| 4,893,184 |
./partial_match/1/0xc3ED798159e449d224DE05515385F86C1d10608F/sources/AllMarketsV2.sol | Set the flag to pause/resume market creation of particular market type/ | function toggleMarketCreationType(uint64 _marketTypeIndex, bool _flag) external onlyAuthorizedToGovern {
require(marketTypeArray[_marketTypeIndex].paused != _flag);
marketTypeArray[_marketTypeIndex].paused = _flag;
}
| 2,788,269 |
pragma solidity >=0.8.0 <0.9.0;
//SPDX-License-Identifier: MIT
import {Data} from "./Data.sol";
import {Nft} from "./Nft.sol";
contract DeTweet is Nft{
event LogTweet(uint256, string);
event LogFollower(address);
event LogUnFollower(address);
event LogLike(uint256);
event LogUnLike(uint256);
m... | like tweet, called by user only _index tweet index/ | function LikeTweet(uint256 _index) external {
Data.tweet storage t = tweetsList[_index];
require(t.isLiker[msg.sender] == 0, "Already Liked");
t.numberOfLikes += 1;
uint256 numberOfLikes = t.numberOfLikes;
t.isLiker[msg.sender] = numberOfLikes;
t.idToLikerAddress[numb... | 2,566,643 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.