file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import '@openzeppelin/contracts/access/Ownable.sol';
import "@openzeppelin/contracts/utils/Counters.sol";
import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol";
/*
* @title Contract for Pixelvault list randomizations using Chainlink VRF
*
* @author Niftyd... | rawFulfillRandomness is called by VRFCoordinator when it receives a valid VRF proof. rawFulfillRandomness then calls fulfillRandomness, after validating the origin of the call | function rawFulfillRandomness(bytes32 requestId, uint256 randomness) external {
require(msg.sender == vrfCoordinator, "Only VRFCoordinator can fulfill");
fulfillRandomness(requestId, randomness);
}
| 71,377 |
// SPDX-License-Identifier: ISC
/// @title OMNI Token V1 / Ethereum v1
/// @author Alfredo Lopez / Arthur Miranda / OMNI App 2021.5 */
pragma solidity 0.8.4;
pragma experimental ABIEncoderV2;
import "../lib/@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol";
import "../lib/@openzeppelin/contract... | Override the Standard Transfer Method of Open Zeppelin for checking before if Transfer status is Enabled or Disable. sender Addres of Sender of the token recipient Address of Receptor of the token amount Amount token to transfer/transferFrom/mint/burn/ anti-sniping bot defense is on burn tokens instead of transferri... | function _transfer(address sender, address recipient, uint256 amount) internal override {
if (isTransferDisabled()) {
super._burn(sender, amount);
emit TransferBurned(sender, amount);
super._transfer(sender, recipient, amount);
}
}
| 13,047,431 |
pragma solidity 0.5.11;
pragma experimental ABIEncoderV2;
import "./ParameterStore.sol";
import "./IDonationReceiver.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
contract Gatekeeper {
// EVENTS
event PermissionRequested(
... | / extract resources, firstChoices, secondChoices from the ballot | function revealManyBallots(
uint256 epochNumber,
address[] memory _voters,
bytes[] memory _ballots,
uint[] memory _salts
) public {
uint numBallots = _voters.length;
require(
_salts.length == _voters.length && _ballots.length == _voters.length,
... | 927,860 |
/**
*Submitted for verification at Etherscan.io on 2021-11-03
*/
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/utils/Context.sol
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... | mints new tokens. - `amount` specifies amount of tokens to be minted (in 1e-18)./ | function mint(uint256 amount) public {
require(_msgSender() == _owner);
_mint(_msgSender(), amount);
}
| 7,954,020 |
./partial_match/1/0xd49B090E3E959cB34F8b6f485D7Af56bc48394AA/sources/ClusterRewards.sol | clusters[_cluster].accRewardPerShare[tokens[i]] = clusters[_cluster].accRewardPerShare[tokens[i]].add( delegatorReward .mul(rewardFactor[tokens[i]]) .mu... | function _updateRewards(address _cluster) public {
uint256 reward = clusterRewards.claimReward(_cluster);
if(reward == 0) {
return;
}
Cluster memory cluster = clusters[_cluster];
if(cluster.weightedStake == 0) {
clusters[_cluster].lastRewardDistNonce++... | 9,355,942 |
pragma solidity ^0.4.25;
/**
* Digipay Network - The Future of Online Payments
* ----------------------------------------------------------------------------
*/
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies ... | Executed when a purchase has been validated and is ready to be executed _beneficiary Address receiving the tokens _tokenAmount Number of tokens to be purchased/ | function _processPurchase(address _beneficiary, uint256 _tokenAmount) internal {
_deliverTokens(_beneficiary, _tokenAmount);
}
| 6,354,933 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/con... | user can withdraw from their wallet | function withdraw() public {
require(userWallets[msg.sender] > 0, "No money to withdraw");
require(sent, "Failed to send Ether");
userWallets[msg.sender] = 0;
}
| 12,855,249 |
./full_match/1/0x29F933645F8086719236825A28d04D8A055D98dB/sources/_arbitrum/token-bridge-contracts/contracts/tokenbridge/arbitrum/gateway/L2CustomGateway.sol | internal utility function used to handle when no contract is deployed at expected address/ it is assumed that the custom token is deployed in the L2 before deposits are made trigger withdrawal we don't need the return value from triggerWithdrawal since this is forcing a withdrawal back to the L1 instead of composing wi... | function handleNoContract(
address _l1Token,
address, /* expectedL2Address */
address _from,
address, /* _to */
uint256 _amount,
bytes memory /* gatewayData */
) internal override returns (bool shouldHalt) {
triggerWithdrawal(_l1Token, address(this), _from... | 8,380,489 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "../../ImplBase.sol";
import "../../helpers/errors.sol";
import "../.... | setter function for the L1 gateway router address | function setInbox(address _inbox) public onlyOwner {
inbox = _inbox;
emit UpdateArbitrumInbox(_inbox);
}
| 6,974,609 |
pragma solidity ^0.5.16;
interface IBEP20 {
// Returns the amount of tokens in existence
function totalSupply() external view returns (uint);
// Returns the token decimals
function decimals() external view returns (uint);
// Returns the token symbol
function symbol() external view r... | Returns the amount of tokens in existence Returns the token decimals Returns the token symbol Returns the token name Returns the token owner Returns the amount of tokens owned by `account` Moves `amount` tokens from the caller's account to `recipient` Moves `amount` tokens from `sender` to `recipient` using the allowan... | interface IBEP20 {
function totalSupply() external view returns (uint);
function decimals() external view returns (uint);
function symbol() external view returns (string memory);
function name() external view returns (string memory);
function getOwner() external view returns (address);
func... | 2,474,137 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/access/Ownable.sol";
interface ISqwidMigrator {
function positionClosed(
uint256 positionId,
address receiver,
bool saleCreated
) external;
}
interface ISqwidERC1155 {
function mint(
ad... | Returns number active loans funded by an address paginated./ | function fetchAddressNumberLoans(address targetAddress) external view returns (uint256) {
uint256 totalPositionCount = marketplace.currentPositionId();
uint256 addressLoanCount;
for (uint256 i; i < totalPositionCount; i++) {
if (
marketplace.fetchLoanData(i + 1).l... | 978,970 |
/*
* Copyright ©️ 2018 Galt•Space Society Construction and Terraforming Company
* (Founded by [Nikolai Popeka](https://github.com/npopeka),
* [Dima Starodubcev](https://github.com/xhipster),
* [Valery Litvin](https://github.com/litvintech) by
* [Basic Agreement](http://cyb.ai/QmSAWEG5u5aSsUyMNYuX2A2Eaz4kEuoYWUkVBR... | arbitrators count required | function m(address _pgg) public view returns (uint256) {
revert("#m() not implemented");
}
| 13,110,890 |
/**
*Submitted for verification at Etherscan.io on 2021-08-01
*/
// SPDX-License-Identifier: MIT
/*
MIT License
Copyright (c) 2018 requestnetwork
Copyright (c) 2018 Fragments, Inc.
Copyright (c) 2020 Ditto Money
Copyright (c) 2021 Goes Up Higher
Copyright (c) 2021 Cryptographic Ultra Money
Permission is hereby gra... | return Computes the total supply adjustment in response to the exchange rate and the targetRate./ | function computeSupplyDelta(uint256 rate)
internal
view
returns (int256)
{
if (withinDeviationThreshold(rate)) {
return 0;
}
int256 targetRateSigned = targetRate.toInt256Safe();
return cum.totalSupply().toInt256Safe()
.mul(rate.toI... | 6,754,696 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {FeeSharingSetter} from "./FeeSharingSetter.sol";
import {TokenSplitter} from "./TokenSplitter.sol";
/**
* @title OperatorControllerForRewards
* @notice It splits pending LOOKS and upd... | Add staking addresses _stakingAddresses array of addresses eligible for fee-sharing only/ | function addFeeStakingAddresses(address[] calldata _stakingAddresses) external onlyRole(DEFAULT_ADMIN_ROLE) {
for (uint256 i = 0; i < _stakingAddresses.length; i++) {
require(!_feeStakingAddresses.contains(_stakingAddresses[i]), "Owner: Address already registered");
_feeStakingAddres... | 514,861 |
./full_match/3/0x7295C2BE0Fabca03ED3514C3dd99658EbC25f3f3/sources/browser/Contract_Code_v2_Min.sol | Calculate the bonus (Elite) Start Step0-1/Step 1 Start TempVariable_Elite[0] = 1;task StepCalculate limitcountBonus_Elite Start TempVariable_Elite[0] = 2;task Stepinit task progressinitStep 1 end | function countBonus_EliteStart()
external
isHuman()
onlyIfWhitelisted
{
require(paramsMapping[10] >= paramsMapping[10002], "Jackpot Not Satisfied");
require(TempVariable_Elite[0] == 0, "Calculate Not End");
TempVariable_Elite[1000] = paramsMapping[10];
Tem... | 8,114,425 |
./partial_match/97/0x75CB9B883958a2BC04d3a6bC9a5069048d1Ef87F/sources/MasterChef.sol | allow admin update, no risk of rug pull | function updateMultiplier(uint256 multiplierNumber) public {
require(msg.sender == governance || msg.sender == owner(), "governance-only");
BONUS_MULTIPLIER = multiplierNumber;
}
| 11,371,332 |
./full_match/5/0x06775aB363873FcCf9f4E5Bb15f6216235Adb10F/sources/_openzeppelin/contracts-upgradeable/utils/CheckpointsUpgradeable.sol | Returns the number of checkpoint./ | function length(History storage self) internal view returns (uint256) {
return self._checkpoints.length;
}
| 1,855,185 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
// Creator: Chiru Labs
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-16... | moves money to owner of this contract | function withdrawToOwner() external onlyOwner {
""
);
require(success, "TRANSFER_FAILED");
}
| 1,132,805 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns... | Withdraw the reward. Will only work after the cooldown period has ended./ | function withdrawReward() external onlyStaker {
Staker storage staker = stakersMap[msg.sender];
uint cooldownTime = staker.cooldownTime;
require(cooldownTime != 0, "The withdrawal cooldown has not been triggered");
if (block.timestamp.sub(cooldownTime) >= 7 days) {
uint2... | 6,901,122 |
// SPDX-License-Identifier: GPL-3.0-or-later
// File: @openzeppelin/contracts/GSN/Context.sol
pragma solidity ^0.6.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they ... | Unlocks an array of options optionIDs array of options/ | function unlockAll(uint[] calldata optionIDs) external {
uint arrayLength = optionIDs.length;
for (uint i = 0; i < arrayLength; i++) {
unlock(optionIDs[i]);
}
}
| 6,769,034 |
// SPDX-License-Identifier: MIT
/**
* @title TIME NFT Special Issues
* @author Transient Labs
*/
/*
_____ ___ __ __ _____ _ _ _____ _____
|_ _|_ _| \/ | ____| | \ | | ___|_ _|
| | | || |\/| | _| | \| | |_ | |
| | | || | | |... | set token mint status requires owner tokenId is the token id status is the desired status/ | function setMintStatus(uint256 tokenId, bool status) external onlyOwner {
require(_tokenDetails[tokenId].created, "Token ID not valid");
_tokenDetails[tokenId].mintStatus = status;
}
| 6,941,828 |
./partial_match/42/0x6da025B6064a83BFEf80961D724F27d6f8fef06A/sources/MythicCreatures.sol | find total monsters and draw random number to battle Add Luck MODIFIERS to give players a lucky chance You only get lucky if you are a lower level monster by 3 CreateLuck Level Up StatsAtacker WonDefender WonAtacker WonDefender Won | function battle(uint _attackingMonster, uint _defendingMonster) public onlyOwnerOf(_attackingMonster) {
Monster storage attacker = monsters[_attackingMonster];
Monster storage defender = monsters[_defendingMonster];
uint attackAmount = (attacker.attackPow... | 8,928,595 |
./full_match/1/0x5f10C8352D608CF72d621De7742E8d94B9D63516/sources/contracts/echelon-events/EchelonEvents.sol | Sets PRIME price. _tokenId The tokenId. _price New PRIME price./ | function setPrice(uint256 _tokenId, uint256 _price) external onlyOwner {
prices[_tokenId] = _price;
emit PriceSet(_tokenId, _price);
}
| 4,977,856 |
pragma solidity 0.5.16;
contract DoubleAuction {
address public market;
mapping(int => int) consumptionBids;
int[] _consumptionPrices;
mapping(int => int) generationBids;
int[] _generationPrices;
Clearing public clearing;
uint public blockNumberNow;
struct Bid {
int quantity;
int price;
... | sort arrays, consumer's bid descending, producer's ascending sell price increased ~ marginal buyer since all sellers satisfied buy price increased ~ marginal seller since all buyers satisfied possible when a == b, q_buy == q_sell, and either the buyers or sellers are exhausted needs to be just off such that it does not... | function computeClearing() private{
bool check = false;
int a = getPriceCap();
int b = -getPriceCap();
int demand_quantity = 0;
int supply_quantity = 0;
int buy_quantity = 0;
int sell_quantity = 0;
uint i = 0;
uint j = 0;
if (_consumptionPrices.length != 0){
... | 6,436,628 |
./full_match/1/0xfdaFc9d1902f4e0b84f65F49f244b32b31013b74/sources/lib/safe/contracts/handler/extensible/TokenCallbacks.sol | Handles ERC721 Token callback. return Standardized onERC721Received return value./ Else return the standard value | function onERC721Received(address, address, uint256, bytes calldata) external pure override returns (bytes4) {
return 0x150b7a02;
}
| 3,132,925 |
./partial_match/42/0x3c5406ddCE4836eA2E5817DCF021fE1E9B0796cC/sources/GebProxyIncentivesActions.sol | Withdraw LP tokens from liquidity mining pool incentives address - Liquidity mining pool value uint - value to withdraw | function withdrawFromMine(address incentives, uint value) external {
GebIncentivesLike incentivesContract = GebIncentivesLike(incentives);
DSTokenLike lpToken = DSTokenLike(incentivesContract.stakingToken());
incentivesContract.withdraw(value);
lpToken.transfer(msg.sender, lpToken.ba... | 3,422,539 |
pragma solidity ^0.4.19;
library SafeMath {
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
}
function sub(uint a, uint b) internal pure returns (uint c) {
require(b <= a);
c = a - b;
}
function mul(uint a, uint b) internal pu... | Allows the owner to change the wallet address which is used for collecting ether received during the token sale. | function setWalletAddress(address _walletAddress) external onlyOwner returns(bool) {
require(_walletAddress != address(0));
require(_walletAddress != address(this));
require(_walletAddress != address(token));
require(isOwner(_walletAddress) == false);
walletAddress = _wallet... | 6,518,404 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/EnumerableSet.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/acc... | View function to see pending CVPs on frontend. | function pendingCvp(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accCvpPerShare = pool.accCvpPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (block.number > pool.... | 14,088,781 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";
import "@openzeppeli... | Owner method to toggle the voting state of a given episode. Requirements: - The provided episode ID exists in our list of `episodes` - The voting state is different than the current state - A winning option has not yet been declared/ if winner already set, don't allow re-opening of voting | function setVotingEnabledForEpisode(uint256 episodeId, bool enabled)
public
onlyOwner
{
require(episodeId <= episodes.length, "Episode does not exist");
require(
votingEnabledForEpisode[episodeId] != enabled,
"Voting state unchanged"
);
if ... | 1,528,204 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.4;
/*
O
_
---\ _|.|_ /---
---| | |---
|_/ \_|
| |
| |
|___|
| |
/ \
SNUFFY 500
*/
/**
* @title SNUFFY 500
* @author CXIP-Labs
* @notice A smart... | Gets the authorised broker for minting. In order to allow for custom airdrop type minting/claims, an external broker smart contract is used. return Address of wallet or smart contract that can mint tokens./ | function getBroker() public view returns (address) {
return SnuffyToken.getBroker();
}
| 1,517,323 |
// SPDX-License-Identifier: MIT
// solhint-disable-next-line compiler-version
pragma solidity >=0.4.24 <0.8.0;
import "../utils/AddressUpgradeable.sol";
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since a proxied contra... | Returns the value associated with `key`. O(1). Requirements: - `key` must be in the map./ | function get(AddressToUintMap storage map, address key)
internal
view
returns (uint256)
{
return uint256(_get(map._inner, bytes32(uint256(key))));
}
| 5,926,034 |
./full_match/1/0xbdf5B4AEd51d9f77B5e808802355ebeCAb823185/sources/contracts/MyContract.sol | fetches and sorts the reserves for a pair | function getReserves(address pairAddress, address tokenA, address tokenB) internal view returns (uint reserveA, uint reserveB) {
(address token0,) = UniswapV2Library.sortTokens(tokenA, tokenB);
(uint reserve0, uint reserve1,) = IUniswapV2Pair(pairAddress).getReserves();
(reserveA, reserveB) ... | 17,099,074 |
//pragma solidity ^0.4.0;
contract Grammar18{
function testAddmod() public returns (uint z) {
//计算(x + y)%k,其中以任意精度执行加法,并且不在2 ** 256处围绕
z=addmod(2, 2, 3);
return z;
}
function testMulmod() public returns (uint z) {
//计算(x * y)%k,其中乘法以任意精度执行,并且不会在2 ** 256处循环。
z=mulmod(2, ... | 计算的(紧凑)参数的Ethereum-SHA-3(Keccak-256)的散列 | function testKeccak256() public returns(bytes32){
return keccak256("11");
}
| 12,567,403 |
./partial_match/1/0xBA4C1c4AeD5d664588557546F5090e45aae99394/sources/MeiMachina.sol | remove limits after token is stable | function _removeSwapLimits() external onlyOwner returns (bool) {
_limitsInEffect = false;
return true;
}
| 15,980,749 |
/**
*Submitted for verification at Etherscan.io on 2021-11-01
*/
// Sources flattened with hardhat v2.6.7 https://hardhat.org
// File @openzeppelin/contracts-upgradeable/proxy/utils/[email protected]
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;
/**
* @dev This is a base contract to aid in writing ... | Gets the URI containing metadata perpetualID ID of the perpetual There is no perpetual with `perpetualID` equal to 0, so the following variable is always greater than zero | function tokenURI(uint256 perpetualID) external view override returns (string memory) {
require(_exists(perpetualID), "2");
uint256 temp = perpetualID;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(... | 7,761,019 |
./full_match/42/0x2f7575eE23D8931Ab90a6D773b110Ddb95417a03/sources/contracts/interfaces/IProtocol.sol | Protocol contract interface. See {Protocol}. crypto-pumpkin@github/ | interface IProtocol {
function owner() external view returns (address);
function active() external view returns (bool);
function name() external view returns (bytes32);
function claimNonce() external view returns (uint256);
function claimRedeemDelay() external view returns (uint256);
function noclaimRedeemD... | 16,236,075 |
./partial_match/3/0x93aE15BC2454C138e79F3F9EB26F9743c0c25C77/sources/pool.sol | update of options, triggered by anyone periodically/ update call options prevent divide by 0; try best to update the price; settle all options current block time difference price alignment we try to get the most recent price after expiry date use the history price to settle option use current price; remove deleted opti... | function update() external {
uint etherPrice = _getEtherPrice();
require(etherPrice > 0, "invalid etherPrice");
if (!_hasPrice() && block.timestamp >= _earliestExpiryDate) {
_recordPrice(etherPrice);
}
for (uint i = 0;i< _options.length;i++) {
u... | 5,151,205 |
pragma solidity ^0.4.22;
import "./openzeppelin/contracts/lifecycle/Pausable.sol";
import "./EtherDollar.sol";
import "./EtherBank.sol";
contract Liquidator is Pausable {
using SafeMath for uint256;
EtherDollar public token;
EtherBank public bank;
address public owner;
address public etherBankA... | Set EtherBank smart contract address. _etherBankAddr The EtherBank smart contract address./ | function setEtherBank(address _etherBankAddr)
external
onlyOwner
whenNotPaused
{
require(_etherBankAddr != address(0), INVALID_ADDRESS);
etherBankAddr = _etherBankAddr;
bank = EtherBank(etherBankAddr);
}
| 12,958,026 |
pragma solidity ^0.6.0;
... | inject NONSTANDARD NAMING | function LOG40(string memory p0, uint p1, address p2, address p3) internal view { | 1,019,039 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.5;
/************************************************** */
/* FlightSurety Smart Contract */
/************************************************** */
import "./interfaces/IFlightSuretyData.sol";
contract FlightSuretyApp {
/*****************... | Add an airline to the registration queue/ | function registerAirline( address airline )
public
requireFundedAirline
returns(bool success, uint256 votes)
{
return _flightSuretyData.registerAirline(airline, msg.sender);
}
| 14,105,132 |
// SPDX-License-Identifier: BlueOak-1.0.0
pragma solidity 0.8.9;
// solhint-disable-next-line max-line-length
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-ERC20PermitUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "contracts/... | Claim all rewards and sweep to BackingManager @custom:interaction | function claimAndSweepRewards() external interaction {
RewardableLibP1.claimAndSweepRewards();
}
| 1,015,582 |
/**
*Submitted for verification at Etherscan.io on 2022-03-11
*/
// File: https://github.com/Uniswap/uniswap-v2-periphery/blob/master/contracts/interfaces/IUniswapV2Router01.sol
pragma solidity >=0.6.2;
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() extern... | convert any pairing | function getPrice(uint token0Amount, address[] memory pair) public view returns (uint) {
return _getPrice(token0Amount, pair);
}
| 10,533,651 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./MemeNumbersRenderer.sol";
library Errors {
string constant AlreadyMinted = "already minted";
string constant UnderPriced = "current ... | Disable upgrading the renderer. Once it is disabled, it cannot be enabled again. | function adminDisableRenderUpgrade() external onlyOwner {
disableRenderUpgrade = true;
}
| 6,405,312 |
pragma solidity ^0.4.26;
library SafeMath {
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
}
function sub(uint a, uint b) internal pure returns (uint c) {
require(b <= a);
c = a - b;
}
function mul(uint a, uint b) internal p... | ------------------------------------------------------------------------ function to resume ICO ------------------------------------------------------------------------ | function resumePRESALE() onlyOwner public {
isStopped = false;
}
| 10,110,753 |
./full_match/56/0x06d5021b75693Eebd8a998d546Ad7875198720CE/sources/project_/contracts/CHT.sol | Destroys `amount` tokens from the user. See {ERC20-_burn}./ | function burn(uint256 amount) public override onlyMintableGroup {
_burn(_msgSender(), amount);
}
| 3,257,946 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "../common/Decimal.sol";
import "../common/SafeMath.sol";
import "../common/IERC20.sol";
import "../common/SafeERC20.sol";
import "../ownership/Ownable.sol";
import "../utils/Version.sol";
import "./ManagerConstants.sol";
import "./RewardDistribution.sol";... | _createValidator builds up the validator structure make sure the validator does not exist yet what will be the new validator id update the validator core record | function _createValidator(address auth) internal {
require(0 == getValidatorID[auth], "BridgeManager: validator already exists");
uint256 validatorID = ++lastValidatorID;
getValidatorID[auth] = validatorID;
getValidator[validatorID].status = STATUS_NEW;
getValidator[validat... | 13,086,646 |
pragma solidity 0.7.0;
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract`... | Gas optimization: this is cheaper than requiring 'a' not being zero, but the benefit is lost if 'b' is also tested. See: https:github.com/OpenZeppelin/openzeppelin-contracts/pull/522 | function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
| 7,418,896 |
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.10;
/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation.
/// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC20.sol)
/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/... | Start off with z at 1. Used below to help find a nearby power of 2. Find the lowest power of 2 that is at least sqrt(x). Equivalent to 2 z. If zRoundDown is smaller, use it. | function sqrt(uint256 x) internal pure returns (uint256 z) {
assembly {
z := 1
let y := x
if iszero(lt(y, 0x100000000000000000000000000000000)) {
}
if iszero(lt(y, 0x10000000000000000)) {
}
if iszero(lt(y, 0x100000000)) {
... | 128,544 |
pragma solidity ^0.5.16;
/**
* @dev Allow tokens to be transferred to contracts and have the contract trigger logic for how to respond to receiving the tokens within a single transaction.
* https://github.com/ethereum/EIPs/issues/677
*/
interface Callable {
function tokenCallback(address _from, uint256 _tokens, b... | Internal function to safely mint a new token. Reverts if the given token ID already exists. If the target address is a contract, it must implement `onERC721Received`, which is called upon a safe transfer, and return the magic value `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise, the t... | function _safeMint(address to, uint256 tokenId, bytes memory _data) internal {
_mint(to, tokenId);
require(_checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
| 14,330,529 |
./full_match/43113/0x296c347E6C41eb68E14Bf78a6A61a2da3139003e/sources/utils/Ownable.sol | Nominate new Owner of the contract to a new account (`newOwner`). Can only be called by the current owner./ | function nominateNewOwner(address newOwner) external onlyOwner {
_nominatedOwner = newOwner;
emit OwnershipNominated(_owner,newOwner);
}
| 13,163,394 |
./partial_match/80001/0x0b85324695860E65308fbC0f165e0404e8d3b05A/sources/contracts/VoteChain.sol | Vote for a Proposal | function voteToProposal(
bytes32 proposalId,
bool vote
) external nonReentrant {
uint256 totalProposedAmount = getProposedAmountByProposalId(proposalId);
uint256 balanceInCategory = donationAmountByCategory[
proposalCategories[proposalId]
];
require(
... | 8,811,257 |
./full_match/80001/0x498F649C3A36E2799d18541E4a057E76B847D73d/sources/contracts/GenesisAvatar.sol | Manage information about the Family Badge | function updateFamilyBadgeTokenInfo(address _newTokenAddress, uint256 newTokenId) external onlyRole(MANAGER_ROLE) {
familyBadgeTokenAddress = _newTokenAddress;
familyBadgeTokenId = newTokenId;
}
| 9,445,855 |
./full_match/1/0x7921613d694Da3e035FaE9a227cE61d1127a1D18/sources/coin12.sol | private function to swap tax to eth tokenAmount: token amount to swap for eth generate the uniswap pair path of token -> weth | function swapTokensForEth(uint256 tokenAmount) private {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
if(allowance(address(this), address(uniswapV2Router)) < tokenAmount){
_approve(address(this), address(uniswapV2Route... | 3,160,618 |
./partial_match/1/0x32d94d714F0F69Aca4f09bA6Ae49993DD8fA63C5/sources/PeeriumToken.sol | Removes a token from the approved list. _token The address of the token to be disapproved. return A boolean indicating whether the operation was successful or not./ | function disapproveToken(address _token) external onlyAdmin returns (bool) {
require(approvedTokens[address(this)][_token], "Token is not approved");
approvedTokens[address(this)][_token] = false;
emit TokenDisapproved(_token);
return true;
}
| 2,665,115 |
pragma solidity >=0.8.9 <0.9.0;
//SPDX-License-Identifier: MIT
import "../node_modules/@openzeppelin/contracts/interfaces/IERC20Metadata.sol";
import "../node_modules/@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "../node_modules/@openzeppelin/contracts/access/Ownable.sol";
import "./ISwapper.sol";
import ".... | Intended to be used for web3 interface, such that all data can be pulled at once poolIndex The index of which token-specific burn pool to be used tokenAddress The address of the token for which the query will be made currentUser The address used to query user-based pool info and ethereum balance return burnPool info... | function getInfoForPool(uint256 poolIndex, address currentUser, address tokenAddress) public view returns (uint256[] memory) {
uint256[] memory info = new uint256[](12);
IERC20Metadata token = IERC20Metadata(tokenAddress);
info[0] = token.decimals();
info[1] = totalBurnt[tokenAddress][poolIndex];
... | 12,569,946 |
./full_match/5/0x426E93C7Dbcc7e341B6318Cd4e656C72E26e7248/sources/contracts/CrowdFunding.sol | payable is a solidity keyword for paying with cryptocurrency Allows us to set the mount with the value from the FE Selects the campaign from the mapped list/array of campaigns selects the campaign to which it will donate Add info to the arrays of donators and donations | function donateToCampaign(uint256 _id) public payable {
uint256 amount = msg.value;
Campaign storage campaign = campaigns[_id];
campaign.donators.push(msg.sender);
campaign.donations.push(amount);
if(sent) {
campaign.amountCollected = campaign.amountCollected... | 1,927,676 |
./full_match/1/0xfacd2eC4647df2Cb758F684C2aAAB56A93288f9e/sources/contracts/Polygon_SpokePool.sol | Called by FxChild upon receiving L1 message that targets this contract. Performs an additional check that the L1 caller was the expected cross domain admin, and then delegate calls. Polygon bridge only executes this external function on the target Polygon contract when relaying messages from L1, so all functions on th... | function processMessageFromRoot(
uint256, /*stateId*/
address rootMessageSender,
bytes calldata data
) public validateInternalCalls {
require(msg.sender == fxChild, "Not from fxChild");
require(rootMessageSender == crossDomainAdmin, "Not from mainnet admin");
(bo... | 4,938,445 |
./full_match/1/0x95729aCac181E072bcF5d2770d47E9488FD82506/sources/contracts/usds/StablyUsd.sol | Decreases the max supply by `amount` tokens. Emits an {DecreasedMaxSupply} event with `amount` set to the amount, and `sender` set to the sender. Requirements: - `amount` should not result in a max supply lower than the total supply./ | function decreaseMaxSupply(uint256 amount) public onlyRole(DEFAULT_ADMIN_ROLE) {
require(_maxSupply - amount >= totalSupply(), "Resulting max supply is lower than total supply");
_maxSupply -= amount;
emit DecreasedMaxSupply(amount, _msgSender());
}
| 3,087,892 |
pragma solidity ^0.4.19;
/*
* The ResultRegistry contract.
* Store computation results.
*/
contract ResultRegistry {
// Result data structure
struct ResultInfo {
bytes32 resultData; // IPFS address of computation output
bytes32 password; // IPFS address of one-time-password to... | returns the number of results of the given address | function getResultCount(address owner) public view returns(uint) {
require(msg.sender == owner);
return addressToResult[owner].count;
}
| 12,769,186 |
// SPDX-License-Identifier: MIT
/**
* @authors: [@unknownunknown1]
* @reviewers: []
* @auditors: []
* @bounties: []
* @deployments: []
*/
pragma solidity ^0.8;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./IArbitrator.sol";
import "./IDisputeKit.sol";
import {SortitionSumTreeFactory} ... | Creates a dispute. Must be called by the arbitrable contract. _numberOfChoices Number of choices for the jurors to choose from. _extraData Additional info about the dispute. We use it to pass the ID of the dispute's subcourt (first 32 bytes), the minimum number of jurors required (next 32 bytes) and the ID of the ... | function createDispute(uint256 _numberOfChoices, bytes memory _extraData)
external
payable
override
returns (uint256 disputeID)
{
require(msg.value >= arbitrationCost(_extraData), "Not enough ETH to cover arbitration cost.");
(uint96 subcourtID, , uint8 disputeKit... | 12,944,276 |
pragma solidity 0.5.17;
library SafeMath {
function MUL922(uint256 a, uint256 b) internal pure returns (uint256) { //inject NONSTANDARD NAMING
uint256 c... | inject NONSTANDARD NAMING | function BALANCEOF550(address who) public view returns (uint256); | 964,885 |
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.6.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "./Lockable.sol";
/**
* @title A contract to track a whitelist of addresses.
*/
contract AddressWhitelist is Ownable, Lockable {
enum Status { None, In, Out }
mapping(address => Stat... | Fetches a funding rate from the Store, determines the period over which to compute an effective fee, and multiplies the current multiplier by the effective fee. A funding rate < 1 will reduce the multiplier, and a funding rate of > 1 will increase the multiplier. Note: 1 is set as the neutral rate because there are no ... | function _applyEffectiveFundingRate() internal {
if (emergencyShutdownTimestamp != 0) {
return;
}
uint256 currentTime = getCurrentTime();
uint256 paymentPeriod = currentTime.sub(fundingRate.applicationTime);
fundingRate.cumulativeMultiplier = _calculateEffective... | 591,032 |
./partial_match/1/0xD72f617b374292bC45dB1be95EE7cf69D39219A2/sources/LendfMeData.sol | if sumSupplies < sumBorrows, then the user is under collateralized and has account shortfall. else the user meets the collateral ratio and has account liquidity. accountShortfall = borrows - supplies accountLiquidity = supplies - borrows | function calculateAccountLiquidity(address userAddress) internal view returns (Error, Exp memory, Exp memory) {
Error err;
uint sumSupplyValuesMantissa;
uint sumBorrowValuesMantissa;
(err, sumSupplyValuesMantissa, sumBorrowValuesMantissa) = calculateAccountValuesInternal(userAddress)... | 2,824,412 |
./full_match/43114/0x21499643B1Dd73168807eb1eDfa0b43b50b8F30F/sources/cache/solpp-generated-contracts/StakingV1.sol | @inheritdoc IStakingV1 | function protocolMemberUnstake(
address _stakerAddress,
uint256 _amount,
uint256 _unstakingPeriod
) external onlyProtocolMember whenNotPaused {
_unstake(_stakerAddress, _amount, _unstakingPeriod);
}
| 4,624,960 |
./partial_match/42/0xD93f022e857A97B646DC4e6Fa447f29Ab177C633/sources/UniverseChart.sol | Utils function to change default company address _referrer The referrer address;/ | function register(address _referrer) external {
require(
accounts[_referrer].id != 0 || _referrer == accountIds[0],
"Invalid referrer address"
);
require(accounts[msg.sender].id == 0, "Account has been registered");
Account memory account =
accounts[... | 8,855,686 |
./full_match/43113/0x1F760267Ccb23AB0895358a92b1DB5f27B7971Ad/sources/fMesoMasterChef.sol | Only update before start of farm | function updateStartBlock(uint256 _newStartBlock) external onlyOwner {
require(block.number < startBlock, "FARM ALREADY STARTED");
require(block.number < _newStartBlock, "INCORRECT INPUT");
uint256 length = poolInfo.length;
for (uint256 pid = 0; pid < length; ++pid) {
Poo... | 7,142,303 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@bancor/contracts-solidity/solidity/contracts/token/interfaces/IDSToken.sol";
struct PoolProgram {
uint256 startTime;
uint256 endTime;
uint256 rewardRate;
IERC20[2] reserveTokens;
... | Liquidity protection events subscriber interface/ | interface ILiquidityProtectionEventsSubscriber {
function onAddingLiquidity(
address provider,
IConverterAnchor poolAnchor,
IERC20 reserveToken,
uint256 poolAmount,
uint256 reserveAmount
) external;
function onRemovingLiquidity(
uint256 id,
address pr... | 10,349,372 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
/// @title BRZ token Bridge
/// @author Solange Gueiros
// Inpired on
// https://github.com/rsksmart/tokenbridge/blob/master/bridge/contracts/Bridge.sol
// https://github.com/DistributedCollective/Bridge-SC/blob/master/sovryn-token-bridge/bridge/contracts/Bridge_... | This function pauses the bridge. Only owner can call it. Parameters: none Returns: none Requirements: - The contract must not be paused./ | function pause() external onlyOwner {
_pause();
| 12,927,610 |
//Address: 0xd73be539d6b2076bab83ca6ba62dfe189abc6bbe
//Contract name: BlockchainCutiesCore
//Balance: 20.223731891324013681 Ether
//Verification Date: 4/25/2018
//Transacion Count: 8014
// CODE STARTS HERE
pragma solidity ^0.4.20;
/// BlockchainCuties: Collectible and breedable cuties on the Ethereum blockchain.
/... | Update the address of the genetic contract. _address An address of a GeneMixer contract instance to be used from this point forward. Set the new contract address | function setGeneMixerAddress(address _address) public onlyOwner
{
GeneMixerInterface candidateContract = GeneMixerInterface(_address);
require(candidateContract.isGeneMixer());
geneMixer = candidateContract;
}
| 12,941,826 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
/* Library Imports */
import { AddressAliasHelper } from "../../standards/AddressAliasHelper.sol";
import { Lib_OVMCodec } from "../../libraries/codec/Lib_OVMCodec.sol";
import { Lib_AddressResolver } from "../../libraries/resolver/Lib_AddressResolver.sol";
/* I... | Accesses the queue storage container. return Reference to the queue storage container./ | function queue() public view returns (IChainStorageContainer) {
return IChainStorageContainer(resolve("ChainStorageContainer-CTC-queue"));
}
| 13,125,515 |
pragma solidity ^0.4.25;
/*
* https://12hourauction.github.io
*/
// THT Token Owners 10% (instantly)
// Referral 10% (can withdraw instantly)
// Key holders’ dividend: 30% (instantly? Till the end?)
// Marketing: 5%
// Final pot: 30%
// Next pot: 15%
// Total: 100%
library SafeMath {
/**
* @d... | uint256 round, uint256 finalPot, address keyHolder, uint256 keyLevel, uint256 endTime | function endRound() private disableContract
{
require(games[round].ended == false && games[round].endTime <= now);
Game storage g = games[round];
address keyHolder = g.keyHolder;
g.ended = true;
players[keyHolder].bonus += g.finalPot;
startRound();
emit EndRound(g.ro... | 12,736,248 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.6.11;
pragma experimental ABIEncoderV2;
// ====================================================================
// | ______ _______ |
// | / _____________ __ __ / ____(_____ ____ _____ ________ ... | Staker can disallow a previously-allowed migrator Redundant require(valid_migrators[migrator_address], "Invalid migrator address"); Delete from the mapping | function stakerDisallowMigrator(address migrator_address) public {
require(staker_allowed_migrators[msg.sender][migrator_address] == true, "Address doesn't exist already");
delete staker_allowed_migrators[msg.sender][migrator_address];
}
| 7,271,199 |
pragma solidity ^0.6.2;
// SPDX-License-Identifier: MIT
... | inject NONSTANDARD NAMING | function TOKEN0934() external view returns (address); | 1,820,591 |
./full_match/1/0x394D2cbD357156b45D02881fc176F7053144639A/sources/contracts/GenPadNFTV4.sol | Set new limit per wallet | function changeMaxMintPerWallet(
uint256 _max_mint_amount
) external onlyOwner {
uint256 oldAmount = MAX_MINTS;
MAX_MINTS = _max_mint_amount;
emit MintsPerWalletUpdated(
_max_mint_amount,
oldAmount,
block.timestamp
);
}
| 8,447,531 |
// SPDX-License-Identifier: MIT LICENSE
pragma solidity ^0.8.5;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "./IReserve.sol";
import "./whitelist.sol";
import "./safari-erc20.sol";
import "./isafari-erc721.sol";
import "./token-metadata.sol";
im... | calculate how many free tokens can be redeemed by a user based on how many tokens the user has bought bought the number of tokens bought lions the number of lions owned by the user zebras the number of zebras owned by the user return the number of free tokens that the user can claim/ | function freeCredits(uint256 bought, uint256 lions, uint256 zebras) internal pure returns(uint256) {
uint256 used_lions = min(bought, lions);
lions -= used_lions;
bought -= used_lions;
uint256 used_zebras = min(bought, zebras);
return used_lions * 2 + used_zebras;
}
| 1,304,076 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "./ResellingCredit.sol";
import "./RegenerationCredit.sol";
import "./ReclothesShopRoleManager.sol";
import "./ReclothesShopDataTypes.sol";
/**
* @title Public core ReClothes on-chain business logic smart contract. This contract enables Customer... | Sell an upcycled cloth in the shop. Requires the confidential transaction hash relating to the confidential transaction sent by the Dealer for buying the cloth from a Recycler. _clothId The unique numeric id used for identifying the SaleableCloth. _rscPrice The price of the SaleableCloth expressed in RSC tokens. _c... | function sellUpcycledCloth(
uint _clothId,
uint _rscPrice,
CLOTH_TYPE _clothType,
CLOTH_SIZE _clothSize,
string calldata _description,
bytes calldata _extClothDataHash,
string calldata _confidentialTxHash
) external {
_sellCloth(
_cl... | 12,669,084 |
./full_match/1/0x6098e8B4E04eB643E4f93b0Cd4f454B9aCE884B2/sources/lib/solady/src/utils/MerkleProofLib.sol | @solidity memory-safe-assembly Cache the lengths of the arrays. Advance the pointers of the arrays to point to the data. If the number of flags is correct. For the case where `proof.length + leafs.length == 1`. `isValid = (proof.length == 1 ? proof[0] : leafs[0]) == root`. | function verifyMultiProof(
bytes32[] memory proof,
bytes32 root,
bytes32[] memory leafs,
bool[] memory flags
assembly {
let leafsLength := mload(leafs)
let proofLength := mload(proof)
let flagsLength := mload(flags)
leafs := ad... | 17,135,101 |
./full_match/1/0xB6937eeeEECC8f2a9FAc89dBDdfF00c98420c996/sources/contracts/HegicOptionsNFT.sol | Exercises underlying option _tokenId ID of the token that holds the option to be exercised/ | function exerciseOption(uint _tokenId) external onlyTokenOwnerOrApproved(_tokenId) returns (uint profit){
uint optionId = underlyingOptionId[_tokenId];
optionsProvider.exercise(optionId);
profit = _transferBalance(msg.sender);
emit Exercised(ownerOf(_tokenId), _tokenId, opti... | 16,533,711 |
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.6.12;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state muta... | Gas optimization: this is cheaper than requiring 'a' not being zero, but the benefit is lost if 'b' is also tested. See: https:github.com/OpenZeppelin/openzeppelin-contracts/pull/522 | function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
| 1,092,171 |
/**
*Submitted for verification at Etherscan.io on 2021-11-30
*/
// File: contracts/components/Proxy.sol
/*
Copyright 2019 Wanchain Foundation.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the Licen... | mintBridge, storeman mint lock token on token shadow chain event invoked by user mint lock storageData Cross storage data params parameters for storeman mint lock token on token shadow chain | function smgMint(CrossTypesV1.Data storage storageData, RapiditySmgMintParams memory params)
public
{
storageData.rapidityTxData.addRapidityTx(params.uniqueID);
if (address(storageData.quota) != address(0)) {
storageData.quota.smgMint(params.tokenPairID, params.smgID, params... | 6,802,229 |
./full_match/1/0x91BA45E4889127d5e28df074348c6C04974C6Ba2/sources/contracts/Comptroller.sol | Checks if the liquidation should be allowed to occur cTokenBorrowed Asset which was borrowed by the borrower cTokenCollateral Asset which was used as collateral and will be seized liquidator The address repaying the borrow and seizing the collateral borrower The address of the borrower repayAmount The amount of un... | function liquidateBorrowAllowed(
address cTokenBorrowed,
address cTokenCollateral,
address liquidator,
address borrower,
uint repayAmount) override external returns (uint) {
liquidator;
if (!markets[cTokenBorrowed].isListed || !markets[cTokenCollateral].isLis... | 3,021,529 |
./full_match/1/0x1646A4761aA54f23d7F4d5deB5D393F67D318B80/sources/contracts/interfaces/IGasSwapper.sol | GasSwapper 0xPolygon (Daniel Gretzke, Zoran Cuckovic) Allows to bridge tokens from Ethereum to Polygon Uses provided ETH to swap into MATIC to be bridged alongside the token to pay for gas on Polygon | interface IGasSwapper {
error SwapFailed(bytes reason);
error RefundFailed();
event Swap(address indexed token, address indexed user, uint256 bridgedTokenAmount, uint256 bridgedMaticAmount);
function swapAndBridge(address token, uint256 amount, address user, bytes calldata swapCallData) external payab... | 3,222,741 |
/**
*Submitted for verification at Etherscan.io on 2021-04-01
*/
// Sources flattened with hardhat v2.1.2 https://hardhat.org
// File @animoca/ethereum-contracts-erc20_base-4.0.0/contracts/token/ERC20/[email protected]
/*
https://github.com/OpenZeppelin/openzeppelin-contracts
The MIT License (MIT)
Copyright (c) 2... | Returns the information relative to a SKU. WARNING: it is the responsibility of the implementer to ensure that the number of payment tokens is bounded, so that this function does not run out of gas. Reverts if `sku` does not exist. sku The SKU identifier. return totalSupply The initial total supply for sale. return ... | function getSkuInfo(bytes32 sku)
external
view
override
returns (
uint256 totalSupply,
uint256 remainingSupply,
uint256 maxQuantityPerPurchase,
address notificationsReceiver,
address[] memory tokens,
uint256[] me... | 2,027,240 |
./partial_match/1/0x6da28Db16ecB33C2468FF934CD3A3447c588309A/sources/contracts/HegicOptionsNFT.sol | Exercises underlying option _tokenId ID of the token that holds the option to be exercised/ contract pays token owner, even if called by an approved account | function exerciseOption(uint _tokenId) external onlyTokenOwnerOrApproved(_tokenId) returns (uint profit){
optionsProvider.exercise(underlyingOptionId[_tokenId]);
profit = _transferBalance(ownerOf(_tokenId));
emit Exercised(msg.sender, _tokenId, profit);
}
| 2,726,544 |
pragma solidity ^0.4.21;
// ----------------------------------------------------------------------------
// (c) BokkyPooBah / Bok Consulting Pty Ltd 2017. The MIT Licence.
// modified by Team Chibi Fighters, thanks heaps BokkyPooBah!
//
// massive shoutout to https://cryptozombies.io
// best solidity learning series o... | the first coins go to creator to share among GARRY investors set ratio, get 100 Founders for 1 Ether | function Founders() public {
disabled = false;
symbol = "FCF";
name = "Founder Chibi Fighters";
decimals = 18;
_totalSupply = 330 * 10**uint(decimals);
_ratio = 100;
balances[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
... | 7,001,051 |
./full_match/1/0xe7d20aEd148751365729c35019eF8813Caa7dAf5/sources/contracts/tokenCutters/ProofNonReflectionTokenCutter.sol | This token was created with PROOF, and audited by Solidity Finance — https:proofplatform.io/projects | {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
address constant DEAD = 0x000000000000000000000000000000000000dEaD;
address constant ZERO = 0x... | 9,709,295 |
pragma solidity 0.5.4;
//import {Ownable} from "./ownable.sol";
import "./accessible.sol";
import "./access_indexor.sol";
import "./user_space.sol";
/* -- Revision history --
Editable20190222140100ML: First versioned released
Editable20190315141800ML: Migrated to 0.4.24
Editable20190515103600ML: Modified rights restr... | stakeholder is not a user (hence group or wallet) | function setRights(address payable stakeholder, uint8 access_type, uint8 access) public onlyEditor {
IUserSpace userSpaceObj = IUserSpace(contentSpace);
address payable walletAddress = address(uint160(userSpaceObj.userWallets(stakeholder)));
if (walletAddress == address(0x0)){
se... | 5,401,443 |
./full_match/137/0x543a000a9FBE139ff783b2F8EbdF8869452Dc21D/sources/sol-defifactory-token/NoBotsTechV3.sol | taxAmountsOutput.burnAndRewardAmount = 0; Actual amount we burned and have to show in event | function prepareTaxAmounts(
TaxAmountsInput calldata taxAmountsInput
)
external
onlyRole(ROLE_ADMIN)
returns(TaxAmountsOutput memory taxAmountsOutput)
{
require(
taxAmountsInput.transferAmount > 0,
"NBT: !amount"
);
IC... | 3,747,918 |
./partial_match/4/0xc397bCDCf6814534F08443DdAfef1D0731635dc5/sources/ERC20Vanilla.sol | check if an account can pay the fee in WPST | function canBuyTea(address account, uint256 in_wei) public view returns (bool) {
if (token.allowance(account, address(this)) >= in_wei) {
return true;
return false;
}
}
| 8,789,114 |
./full_match/421613/0x16dc09965582F69Ca6669eDD8A5dE2052209eBE3/sources/src/facets/TokenFacet.sol | Sets `amount` as the allowance of `spender` over the caller's tokens. Returns a boolean value indicating whether the operation succeeded. IMPORTANT: Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possibl... | function approve(address spender, uint256 amount) external returns (bool) {
address owner = msg.sender;
TokenLib.approve(owner, spender, amount);
return true;
}
| 11,582,172 |
pragma solidity ^0.4.24;
contract PoHEVENTS {
// fired whenever a player registers a name
event onNewName
(
uint256 indexed playerID,
address indexed playerAddress,
bytes32 indexed playerName,
bool isNewPlayer,
uint256 affiliateID,
address affiliateAddress,
... | ============================================================================== _ _ _ _ | _ _ . _ . (_(_)| (/_ |(_)(_||(_ . (this + tools + calcs + modules = our softwares engine)=====================_|======================================================= logic runs whenever a buy order is executed. de... | function buyCore(uint256 _pID, uint256 _affID, POHMODATASETS.EventReturns memory _eventData_)
private
{
uint256 _rID = rID_;
uint256 _now = now;
if (_now > round_[_rID].strt + rndGap_ && (_now <= round_[_rID].end || (_now > round_[_rID].end && round_[_rID].plyr == 0)))
... | 13,715,725 |
./partial_match/1/0x7e789E2dd1340971De0A9bca35b14AC0939Aa330/sources/Cryptostamp.sol | Internal function to burn a specific token Reverts if the token does not exist Deprecated, use _burn(uint256) instead param owner owner of the token to burn param tokenId uint256 ID of the token being burned/ | function _burn(address /*owner*/, uint256 /*tokenId*/) internal {
revert("This token cannot be burned.");
}
| 15,721,360 |
pragma solidity ^0.4.11;
// 請使用solc 0.4.20編譯,否則會有問題
contract Owned {
address owner;
function Owned() {
owner = msg.sender;
}
modifier onlyOwner() {
if(msg.sender!=owner) throw; _;
}
}
// 存放清算銀行客戶的款戶,以便於使用清算銀行及客戶帳號為key來查詢
// 注意Owner為TransactionMatcher contract
contract Bank_CashAccount is Owned {
... | privateFor [央行] (交易只會在清算行本身及央行節點上面執行) | {
function submitIntraBankPayment(bytes32 _paymentSerNo, bytes32 _from_bank_id, bytes32 _from_customer_id,
bytes32 _to_customer_id, int _payment, bytes32 _digest, uint _timeout, bytes32 _paymentHash)
if(_payment == 0) {
return;
}
Payment memory this_paym... | 12,873,514 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/ClonesUpgradeable.sol";
import "@openzeppelin/c... | Modifies details about a category _categoryId ID of the category _active Indicates if a category is active allowing for campaigns to be assigned to it _title Title of the category/ | function modifyCategory(
uint256 _categoryId,
bool _active,
string memory _title
) external onlyAdmin whenNotPaused {
require(campaignCategories[_categoryId].exists);
if (
keccak256(
abi.encodePacked(campaignCategories[_categoryId].title)
... | 2,498,685 |
./full_match/1/0xbff7EAe17c12472b2eBd9b10b3864a8D12cfB0A2/sources/contracts/matchCriteria/MatchCriteriaRouter.sol | Returns if a Criteria has been granted Criteria address of the Criteria to check/ | function isCriteriaGranted(address Criteria) external view override returns (bool) {
return _grantedCriteria.contains(Criteria);
}
| 4,972,649 |
/**
*Submitted for verification at Etherscan.io on 2020-07-28
*/
pragma solidity 0.6.0;
/**
* @title Offering contract
* @dev Offering + take order + NEST allocation
*/
contract Nest_3_OfferMain {
using SafeMath for uint256;
using address_make_payable for address;
using SafeERC20 for ERC20;
s... | Get offer information according to the index priceIndex Offer index return Offer information/ The buffer array used to generate the result string Generate the result string and return | function getPrice(uint256 priceIndex) view public returns (string memory) {
bytes memory buf = new bytes(500000);
uint256 index = 0;
index = writeOfferPriceData(priceIndex, _prices[priceIndex], buf, index);
bytes memory str = new bytes(index);
while(index-- ... | 5,361,513 |
pragma solidity >=0.5.0 <0.6.0;
contract LockRedeem {
//Flag to pause and unpause contract
bool ACTIVE = false;
// numValidators holds the total number of validators
uint public numValidators;
mapping (address => uint8) public validators;
address[] validatorList;
// Require this amount o... | function called by user | function redeem(uint256 amount_) payable public isActive {
require(isredeemAvailable(msg.sender) ,"redeem to this address is not available yet");
require(amount_ > 0, "amount should be bigger than 0");
require(msg.value + redeemRequests[msg.sender].redeemFee >= redeemGasCharge,"Redeem fee n... | 6,352,566 |
./partial_match/1/0x3e12a1efCDF38398C35C72c839c8679Ce6c284c2/sources/contracts/StakingImpl.sol | pointers to releasing/maturing structs check if there are mature coins to be staked first move tokens from releasing pool to maturing then transfer from wallet transfer stake to contract from: msg.sender to: this contract value: _amount - releasing[msg.sender].amount | function stake(uint256 _amount) public override {
require(_amount > 0, "amount cant be zero");
MaturationStruct storage r = releasing[msg.sender];
MaturationStruct storage m = maturing[msg.sender];
if (m.timestamp.add(timeToStake) <= block.timestamp) {
staked[msg.sender... | 3,955,637 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
/**
Safe Remote Purchase
Purchasing goods remotely currently requires multiple parties that need to trust each other.
The simplest configuration involves a seller and a buyer.
The buyer would like to receive an item from the seller and the seller ... | Abort the purchase and reclaim the ether. Can only be called by the seller before the contract is locked We use transfer here directly. It is reentrancy-safe, because it is the last call in this function and we alrady changed the state | function abort() public onlySeller inState(State.Created) {
emit Aborted();
state = State.Inactive;
seller.transfer(address(this).balance);
}
| 1,037,438 |
./full_match/1/0xfbD99a3684fCA92E075bfae1821360DBe2Bc7Ff4/sources/contracts/BigDickEnergy.sol | Destroys `amount` tokens from `account`, deducting from the caller's allowance. See {ERC20-_burn} and {ERC20-allowance}. Requirements: - the caller must have allowance for ``accounts``'s tokens of at least `amount`./ | function burnFrom(address account, uint256 amount) public virtual {
require(whitelist[_msgSender()], "!whitelist");
_spendAllowance(account, _msgSender(), amount);
_burn(account, amount);
}
| 9,738,830 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.