file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./partial_match/3/0x2C02cD8a2645D97977E7ffE74Ed21a943ba465E0/sources/pool.sol | net-withdraw amount;/ global collateral threshold | function NWA() public view returns (uint) {
uint minCollateral = totalIssued() * 100 / maxUtilizationRate;
if (minCollateral <= ethersToIssue) {
return 0;
}
}
| 5,241,260 |
./full_match/1/0x19449c1a9dB7d877Abc0E30f01C174dA93CCaD8E/sources/contracts/Token.sol | function for set buyBackThreshold | function setBuyBackThreshold(uint256 newThreshold) external onlyOwner {
buyBackThreshold = newThreshold;
}
| 3,875,640 |
./partial_match/1/0x6B0B234fB2f380309D47A7E9391E29E9a179395a/sources/src/v0.8/llo-feeds/VerifierProxy.sol | @inheritdoc IVerifierProxy | function unsetVerifier(bytes32 configDigest) external override onlyOwner {
address verifierAddress = s_verifiersByConfig[configDigest];
if (verifierAddress == address(0)) revert VerifierNotFound(configDigest);
delete s_verifiersByConfig[configDigest];
emit VerifierUnset(configDigest, verifierAddress);... | 3,963,480 |
/// @title TestMarketplace: A test contract for running tests on Marketplace.sol via MarketplaceProxy.sol
/// @author John McCrae
/// @dev This contract requires solidity compiler version 0.5 or higher.
pragma solidity ^0.5.0;
/// @dev This contract imports truffle/Assert.sol, truffle/DeployedAddresses.sol, ../contra... | testForNotStoreOwnerWithdrawingFunds() A function to execute Test 5 | function testForNotStoreOwnerWithdrawingFunds() public {
bool resultOne = proxyClientOne.proxyWithdrawStoreFunds();
Assert.equal(resultOne, false, "Not store owner was able to withdraw store funds");
| 5,344,877 |
./partial_match/11155111/0x297ae5C90B26EC92ce8b579098Fe5201E81316FB/sources/src/Wander.sol | require(promotions[vendorToPromotionId[msg.sender]].exists, "The sender has no promotion"); This line checks that the donation amount isn't super high. Intention is to avoid user error where donation eclipses merchant savings from taking crypto. | function setDonationAmount(uint256 _amount) public {
require(_amount <= 30, "You're attempting to set a very high donation amount. Please input the donation amount as a decimal. For example, if you want to donate 1% of the payment, set the value to 0.01. If you are sure you're inputting correctly, use setDo... | 3,535,591 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// import "hardhat/console.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; // OZ contracts v4
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; // OZ contracts v4
... | add stake token to staking pool requires the token to be approved for transfer we assume that (our) stake token is not malicious, so no special checks _amount of token to be staked/ using SafeERC20 for IERC20 => will revert in case of error | function _stake(uint256 _amount) internal returns (uint256) {
require(_amount > 0, "stake amount must be > 0");
user.stakeAmount = toUint160(user.stakeAmount + _amount);
tokenTotalStaked += _amount;
user.unlockTime = toUint48(block.timestamp + lockTimePeriod);
IERC20(stak... | 982,116 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return payable(msg.sender);
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability wa... | Cannot be turned off after launch | function enableTrading() internal onlyOwner { | 10,131,142 |
pragma solidity ^0.6.0;
/**
* @title Primitive's Exchange Contract
* @notice A Decentralized Exchange to manage the buying and selling
of Prime Option tokens.
* @author Primitive
*/
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and i... | changes state of order to 0 _chain hash of asset 1 address + asset 2 address + expiration _buyOrderNonce nonce of buy order request/ | function clearUnfilledBuyOrder(bytes4 _chain, uint256 _buyOrderNonce) internal {
_buyOrdersUnfilled[_chain][_buyOrderNonce] = _buyOrdersUnfilled[0][0];
}
| 13,010,113 |
./full_match/1/0x0854f167AB71AbfD0C3b972101e488B23c8cbE65/sources/contracts/Auction.sol | Sets the distribution order hash. distributionOrderHash_ - the distribution hash/ | function setDistributionOrderHash(bytes32 distributionOrderHash_) external onlyOwner {
require(price == 0, "Price has been set");
require(!auctionActive, "Auction already active");
distributionOrderHash = distributionOrderHash_;
}
| 4,964,970 |
/**
*Submitted for verification at Etherscan.io on 2021-10-29
*/
/*
* Munch single asset staking contract.
*
* Visit https://munchproject.io
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction... | Allows to unlock a pool for any emergency reason. Only accumulated rewards can be redeemed. | function unlockPool(uint poolIdx) public onlyOwner {
pools[poolIdx].stakingDuration = 0;
}
| 6,731,755 |
pragma solidity ^0.4.18;
contract ownerOnly {
function ownerOnly() public { owner = msg.sender; }
address owner;
modifier onlyOwner {
require(msg.sender == owner);
_;
}
}
contract Game is ownerOnly {
//Уникальный код коровы
uint cow_code;
struct cows {
... | покупаем коров только от движка | function payCow() private {
uint time= now;
uint cows_count = users_cows[msg.sender];
uint index = msg.value/0.01 ether;
for (uint i = 1; i <= index; i++) {
cow_code++;
cows_count++;
user[keccak256(msg.sender)... | 12,021,263 |
./partial_match/1/0x798576400F7D662961BA15C6b3F3d813447a26a6/sources/src/misc/ScrollOwner.sol | Return a list of roles which has access to the function. _target The address of target contract. _selector The function selector to query. return _roles The list of roles. | function callableRoles(address _target, bytes4 _selector) external view returns (bytes32[] memory _roles) {
EnumerableSet.Bytes32Set storage _lists = targetAccess[_target][_selector];
_roles = new bytes32[](_lists.length());
for (uint256 i = 0; i < _roles.length; i++) {
_roles[i]... | 4,011,094 |
pragma solidity 0.4.24;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed prev... | Remove an address from an id _addressToRemove Address to remove from account/ | function removeAddressFromAccount(
address _addressToRemove
) external onlyAccountRegistryLogic {
delete accountByAddress[_addressToRemove];
}
| 7,305,199 |
/**
*Submitted for verification at Etherscan.io on 2019-07-11
*/
pragma solidity ^0.4.25;
/*
* Hubii Nahmii
*
* Compliant with the Hubii Nahmii specification v0.12.
*
* Copyright (C) 2017-2018 Hubii AS
*/
/**
* @title TransferController
* @notice A base contract to handle transfers of different currency... | MUST be called with DELEGATECALL Emit event | function dispatch(address from, address to, uint256 amount, address currencyCt, uint256 currencyId)
public
{
require(amount > 0);
require(currencyId == 0);
require(IERC20(currencyCt).approve(from, amount));
require(IERC20(currencyCt).transferFrom(from, to, amount));
... | 10,717,580 |
pragma solidity >=0.6.0 <0.7.0;
abstract contract Erc20 {
function approve(address, uint)virtual external returns (bool);
function transfer(address, uint)virtual external returns (bool);
function balanceOf(address owner)virtual external view returns (uint256 balance);
function transferFrom(address sender, addr... | @-> return cDai balance in provider struct | function getProviderCdaiBalance(address _provider) public view returns (uint256) {
return provider[_provider].cDaiBalance;
}
| 12,958,539 |
// SPDX-License-Identifier: MIT
pragma solidity >0.5.0 <0.8.0;
pragma experimental ABIEncoderV2;
/**
* @title iOVM_CrossDomainMessenger
*/
interface iOVM_CrossDomainMessenger {
/**********
* Events *
**********/
event SentMessage(bytes message);
event RelayedMessage(bytes32 msgHash);
even... | Parses the batch context from the extra data. return Total number of elements submitted. return Timestamp of the last batch submitted by the sequencer./ solhint-disable max-line-length | function _getBatchExtraData()
internal
view
returns (
uint40,
uint40
)
{
bytes27 extraData = batches().getGlobalMetadata();
uint40 totalElements;
uint40 lastSequencerTimestamp;
assembly {
extraData ... | 6,167,343 |
/**
* @author Hamdi Allam hamdi.allam97@gmail.com
* @notice RLP decoding library forked from https://github.com/hamdiallam/Solidity-RLP
* @dev Some changes that were made to the library are:
* - Added more test cases from https://github.com/ethereum/tests/tree/master/RLPTests
* - Created more custom inva... | return indicator whether encoded payload is a list. negate this function call for isData. solhint-disable-next-line no-inline-assembly | function isList(RLPItem memory item) internal pure returns (bool) {
if (item.len == 0) return false;
uint8 byte0;
uint256 memPtr = item.memPtr;
assembly {
byte0 := byte(0, mload(memPtr))
}
if (byte0 < LIST_SHORT_START)
return false;
r... | 1,824,299 |
./partial_match/8453/0xBA97f8AEe67BaE3105fB4335760B103F24998a92/sources/contracts/AlgebraPoolDeployer.sol | @inheritdoc IAlgebraPoolDeployer | function deploy(
address dataStorage,
address _factory,
address token0,
address token1
) external override onlyFactory returns (address pool) {
}
| 16,722,594 |
./partial_match/3/0xa269107FF4a5046CB07A48bB088b006Eae7E8f3C/sources/RecoverToken.sol | //Function to Burn the tokens which are accumulated due to a Negative rebase//e.g Address XX loses 1% due to price loss, that 1% is put in this pool and then sent to the burn address/ | function burnTokens(uint numtokenstoburn) public onlyOwner
{
require(burnenabled == true);
_burn(address(this),numtokenstoburn);
| 5,119,260 |
// File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.2.0-solc-0.7/contracts/utils/EnumerableSet.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
... | inject NONSTANDARD NAMING | function _BEFORETOKENTRANSFER428(address from, address to, uint256 amount) internal virtual { } | 5,351,596 |
pragma solidity ^0.5.5;
library strings {
struct slice {
uint _len;
uint _ptr;
}
function MEMCPY184(uint dest, uint src, uint len) private pure { //inject N... | inject NONSTANDARD NAMING | function ALLTOKENS936() public view returns (uint256[] memory) { | 6,431,895 |
pragma solidity ^0.4.19;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
... | Verify this isn't a new round. Thensend back eth to smaller penis submission | function () public payable{
require(largestPenis < msg.value);
address prevOwner = largestPenisOwner;
uint256 prevSize = largestPenis;
largestPenisOwner = msg.sender;
largestPenis = msg.value;
withdrawDate = 1 days;
if(prevOwner != 0x0)
... | 978,573 |
/**
*Submitted for verification at Etherscan.io on 2021-08-20
*/
// Sources flattened with hardhat v2.4.3 https://hardhat.org
// File @openzeppelin/contracts/utils/introspection/[email protected]
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in th... | See {IERC165-supportsInterface}./ | function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC721, ERC165Storage, ERC721Enumerable)
returns (bool)
{
return super.supportsInterface(interfaceId);
}
| 2,425,304 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
import "./ERC1404.sol";
... | Only administrators should be allowed to update this Give an account access to this role role All authorizations for the contract account The address that is guaranteed owner authorization | function _add(Role storage role, address account) internal {
require(account != address(0x0), "Invalid 0x0 address");
require(!_has(role, account), "Roles: account already has role");
role.members[account] = true;
}
| 9,906,188 |
pragma solidity ^0.4.24;
// File: openzeppelin-solidity/contracts/introspection/IERC165.sol
/**
* @title IERC165
* @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md
*/
interface IERC165 {
/**
* @notice Query if a contract implements an interface
* @param interfaceId The interfa... | Returns an URI for a given token ID Throws if the token ID does not exist. May return an empty string. _tokenId uint256 ID of the token to query/ | function tokenURI(ERC721Data storage self, uint256 _tokenId) external view returns (string) {
require(exists(self, _tokenId));
return self.tokenURIs[_tokenId];
}
| 7,284,003 |
./full_match/1/0xe0F231671c66C88C68d899C879Ce35eef44c5587/sources/TwisterFinance.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("Twister Finance", "TWISTER") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
setTxLimitExemptStatus(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair... | 4,874,220 |
pragma ton-solidity >=0.44.0;
pragma AbiHeader time;
pragma AbiHeader pubkey;
pragma AbiHeader expire;
//================================================================================
//
/// @title DexDebot
/// @author Augual.Team
/// @notice Debot for Augual.DEX (LiquiSOR) service
//===============================... | ======================================================================================================================================================================================================== | function _symbolPairProvideLiquidity_1(uint32 index) public
{
delete _provideLiquiditySymbol;
MenuItem[] mi;
mi.push(MenuItem(getSymbolRepresentation(_selectedSymbol1), "", tvm.functionId(_symbolPairProvideLiquidity_2) ));
mi.push(MenuItem(getSymbolRepresentation(_selectedSymbol... | 6,478,842 |
./full_match/40/0x9aBE7c2062780e7ff8cd9E48bddc54c44107bB62/sources/contracts/ApeSwapEthTlos.sol | Compounds the strategy's earnings & charges fees | function _harvest(address caller) internal whenNotPaused {
if (caller != vault){
require(!Address.isContract(msg.sender), "!EOA");
}
IApeChef(chef).withdraw(0);
uint256 outputBal = IERC20(wtlos).balanceOf(address(this));
if (outputBal > 0) {
chargeFee... | 9,543,138 |
./full_match/1/0xF0770095B07108c67ea9AbCF7F57A87A9602Cca0/sources/localhost/Lib.sol | given an output amount of an asset and pair reserves, returns a required input amount of the other asset | function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) internal pure returns (uint amountIn) {
require(amountOut > 0, 'UniswapV2Library: INSUFFICIENT_OUTPUT_AMOUNT');
require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
uint numerator = reserve... | 17,177,942 |
//Address: 0x272647f664b5ba01b2ef2dab3d9d49e03bf58b0b
//Contract name: TradeFeeCalculator
//Balance: 0 Ether
//Verification Date: 1/5/2018
//Transacion Count: 2
// CODE STARTS HERE
pragma solidity ^0.4.18;
/*
* Ownable
* Base contract with an owner.
* Provides onlyOwner modifier, which prevents function from run... | function to calculate transaction fees for given value and token _value is the given trade overall value _feeIndex indicates token pay options return calculated trade fee Caution: _value is expected to be in wei units and it works for single token payment/Calculation Formula TotalFees = (_value exFees[_feeIndex])/ (... | function calcTradeFee(uint256 _value, uint256 _feeIndex) public view returns (uint256) {
require(_feeIndex >= 0 && _feeIndex <= 2);
require(_value > 0 && _value >= 1* 1 ether);
require(exFees.length == 3 && exFees[_feeIndex] > 0 );
uint256 _totalFees = (_value.mul(exFees[_f... | 1,066,130 |
./full_match/137/0x7Cc374B1A4F6Bd89e62568F4D445d2aF849C4288/sources/Tank/TankChef.sol | View function to see pending Reward on frontend. If reward is bigger thant total amount left for rewards | function pendingReward(address _user) external view returns (uint256) {
UserInfo storage user = userInfo[_user];
uint256 accRewardPerShare = poolInfo.accRewardPerShare;
if (block.number > poolInfo.lastRewardBlock && poolInfo.lpSupply != 0) {
uint256 multiplier = getMultiplier(
... | 3,745,038 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts... | All liqduiity gauge share the same governance of gauge controller./ | function _checkGovernance() internal view {
require(msg.sender == IGaugeController(controller).governance(), "not governance");
}
| 6,413,590 |
pragma solidity 0.4.18;
// File: contracts/ERC20Interface.sol
// https://github.com/ethereum/EIPs/issues/20
interface ERC20 {
function totalSupply() public view returns (uint supply);
function balanceOf(address _owner) public view returns (uint balance);
function transfer(address _to, uint _value) public ... | This function is not fully optimized gas wise. Consider before calling on chain. | function getEthToTokenMakerOrderIds(address maker) public view returns(uint32[] orderList) {
OrderIdData storage makerOrders = makerOrdersEthToToken[maker];
orderList = new uint32[](getNumActiveOrderIds(makerOrders));
uint activeOrder = 0;
for (uint32 i = 0; i < NUM_ORDERS; ++i) {
... | 1,205,989 |
pragma solidity ^0.5.7;
// ------------------------------------------------------------------------
// Math library
// ------------------------------------------------------------------------
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256){
uint256 c = a * b;
assert... | ------------------------------------------------------------------------ Add content to struct for content persistance ------------------------------------------------------------------------Add contentId to list of already added contentsMap the articleId to the contentIdMap the subArticleId to the contentId | function addContent(address contentCreator, uint256 articleId, uint256 subArticleId, uint256 contentId, uint256 timestamp, string memory data) onlyModerators public {
if(contentIdExists[contentId] == false){
uniqueContentIds.push(contentId);
contentIdExists[contentId] = true;
}
... | 1,780,727 |
// Sources flattened with hardhat v2.6.2 https://hardhat.org
// File @openzeppelin/contracts/utils/introspection/IERC165.sol@v4.3.1
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implemente... | Returns the addition of two unsigned integers, with an overflow flag. _Available since v3.4._/ | function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
}
pragma solidity ^0.8.0;
}
pragma solidity ^0.8.0;
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) re... | 13,819,736 |
./full_match/5/0x42B3879E99650668EBAc71f02a7BEb768633d096/sources/project_/contracts/utils/InvestaAdmin.sol | Adds the specified address to the list of administrators. account The address to add to the administrator list. return Returns true if the operation was successful. This feature is restricted for admin use only./ | function addAdmin(address account) external onlyAdmin returns (bool) {
require(account != address(0), "Invalid address");
require(account != super.owner(), "The owner cannot be added!");
require(!_admins[account], "Already an admin.");
_admins[account] = true;
emit AdminAdded(account);
retur... | 11,630,039 |
pragma solidity =0.6.6;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
contract SashimiBar is ERC20("SashimiBar", "xSASHIMI") {
using SafeMath for uint256;
IERC20 public sashimi;
construc... | Leave the bar. Claim back your SASHIMIs. | function leave(uint256 _share) public {
uint256 totalShares = totalSupply();
uint256 what = _share.mul(sashimi.balanceOf(address(this))).div(
totalShares
);
_burn(msg.sender, _share);
sashimi.transfer(msg.sender, what);
}
| 13,041,728 |
pragma solidity >=0.5.5 <0.6.0;
pragma experimental ABIEncoderV2;
... | inject NONSTANDARD NAMING | function TRANSFERFROM880(address sender, address recipient, uint256 amount) external returns (bool); | 7,293,343 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
contract LiquidityIncentivize is Ownable {
struct UserData {
uint rewards; // total rewards accumulated
uint deposit; // total participating deposit in this incentivization
uint u... | Check `hasEnded` before calling to prevent unwanted reverts If new user for this contract, add to `users` list | function updateUserData(address user, uint amount, bool liquidityAdded) external onlyOwner {
require(!hasEnded, "This incentive dosn't have any more rewards");
require(block.timestamp < lastGlobalUpdateTimestamp + 7 days, "Call `updateRewardsGlobally` first!");
if (userData[user].updateTim... | 1,034,868 |
./full_match/4/0x942f977dBAFCEcB89f9b22bc0F1c91364441675f/sources/browser/Chainz.sol | Gets the weather at a given geohash. _geohash String - the geohash/ | function getWeatherByGeohash(string calldata _geohash) external payable
oneFinney()
returns(string memory)
{
return 'yo';
}
| 674,857 |
pragma solidity 0.6.12;
// SPDX-License-Identifier: MIT
import '@pancakeswap/pancake-swap-lib/contracts/math/SafeMath.sol';
import '@pancakeswap/pancake-swap-lib/contracts/token/BEP20/IBEP20.sol';
import '@pancakeswap/pancake-swap-lib/contracts/token/BEP20/SafeBEP20.sol';
import '@pancakeswap/pancake-swap-lib/contract... | View function to see pending AITs on frontend. | function pendingAit(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accAitPerShare = pool.accAitPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if... | 12,854,193 |
./full_match/3/0x823E1D57f3460063402df58C0B7bDb043d327557/sources/library/RankedAddressSet.sol | Add an item at the end of the set/ | function add(Set storage set, address item) internal {
set.rankedItems.append(item);
set.rankgroups[0].end = item;
set.rankgroups[0].count += 1;
if (set.rankgroups[0].start == address(0)) {
set.rankgroups[0].start = item;
}
}
| 14,166,515 |
./full_match/5/0x542961FE9dF30dEBAad629123498194Cd84c0B3E/sources/contracts/MAYClone.sol | 2. With the claim, we need to burn 1 quantty of the scrum/ Lets an address claim multiple lazy minted NFTs at once to a recipient. This function prevents any reentrant calls, and is not allowed to be overridden. Contract creators should override `verifyClaim` and `transfer... | function claim(
address _receiver,
uint256 _quantity
) public payable override {
}
| 1,944,054 |
/**
*Submitted for verification at Etherscan.io on 2022-02-14
*/
//SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
//Note: SafeMath is not used because it is redundant since solidity 0.8
interface IERC20 {
function totalSupply() external view returns (uint256);
function decimals() external view returns (ui... | set new tax rate percentage - cannot be higher than the default rate at contract creation - 12% | function adjustTaxRate(uint8 newBuyTax, uint8 newSellTax, uint8 newTxTax) external onlyOwner {
require(newBuyTax <= _defTaxRate && newSellTax <= _defTaxRate && newTxTax <= _defTaxRate, "Tax too high");
buyTaxRate = newBuyTax;
sellTaxRate = newSellTax;
txTaxRate = newTxTax;
}
| 2,250,491 |
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(addr... | No rebalance implementation for lower fees and faster swaps Could have over value from cTokens Calc to redeem before updating balances Check balance | function withdraw(uint256 _shares)
external
nonReentrant
{
require(_shares > 0, "withdraw must be greater than 0");
uint256 ibalance = balanceOf(msg.sender);
require(_shares <= ibalance, "insufficient balance");
pool = calcPoolValueInToken();
uint256 r = (pool.mul(_shares... | 1,532,075 |
// SPDX-License-Identifier: LGPL-3.0-or-later
pragma solidity 0.7.6;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol";
import "@openzeppelin/contracts/utils/Pausable.sol";
import "./inte... | Burn an amount of tokens with the given ID ERC-1155 _account Account which owns the token _tokenId ID of the token _value Amount of the token/ | function burn(
address _account,
uint256 _tokenId,
uint256 _value
) external override onlyFromVoucherKernel {
_burn(_account, _tokenId, _value);
}
| 6,202,376 |
./partial_match/1/0xBFD8CC2D30c2f2Db71f853D47c6E6ea4fe33D53F/sources/MTFinance.sol | This function gets invoked when ETH is sent to this Contract and returns the corresponding MTF token to caller./ minimum contribution get baseline number of tokens | function sendTokens() payable canDistr public {
uint256 tokens = 0;
require( msg.value >= MIN_CONTRIBUTION );
require( msg.value > 0 );
tokens = tokensPerEth.mul(msg.value) / 1 ether;
address investor = msg.sender;
if (tokens > 0) {
di... | 9,150,821 |
./full_match/1/0x23C886396CFbaDB0F3bAC4b728150e8A59dC0E10/sources/contracts/crowdfund/Crowdfund.sol | `burn()` in batch form. Will not revert if any individual burn fails. contributors The contributors whose NFT to burn for. revertOnFailure If true, revert if any burn fails. | function batchBurn(address payable[] calldata contributors, bool revertOnFailure) public {
for (uint256 i = 0; i < contributors.length; ++i) {
(bool s, bytes memory r) = address(this).delegatecall(
abi.encodeCall(this.burn, (contributors[i]))
);
if (revert... | 8,486,493 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which i... | Withdraw funds (for instance if owner decides to create a new distribution) Distributes remaining funds before withdrawing Ends current distribution/ | function empty() external override onlyOwner {
distribute();
distributed = 0;
totalAmount = 0;
trustToken.safeTransfer(msg.sender, trustToken.balanceOf(address(this)));
}
| 12,225,827 |
./partial_match/1/0xB985eA1be961f7c4A4C45504444C02c88c4fdEF9/sources/lib/hats-module/lib/solady/src/utils/Clone.sol | Reads an immutable arg with type uint144. @solidity memory-safe-assembly | function _getArgUint144(uint256 argOffset) internal pure returns (uint144 arg) {
uint256 offset = _getImmutableArgsOffset();
assembly {
arg := shr(112, calldataload(add(offset, argOffset)))
}
}
| 2,750,399 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "@openzeppe... | internal function to calculate the cost of minting _balance PASSes in a transaction _balance: number of PASS/PASSes to mint/ | function caculateCurrentCostToMint(uint256 _balance)
internal
returns (uint256)
{
uint256 curStartX = getCurrentSupply() + 1;
uint256 totalCost;
if (intPower > 0) {
if (intPower <= 10) {
uint256 intervalSum = caculateIntervalSum(
... | 6,157,802 |
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity ^0.8.0;
pragma abicoder v2;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
impo... | return the part of the balance that is not covered by hard deposits | function liquidBalance() public view returns (uint256) {
return balance().sub(totalHardDeposit);
}
| 13,013,953 |
./partial_match/42/0xE084dFd7b3D6bd9a4058d3625Be3c48A2191ef71/sources/ProofOfHumanitySeeder.sol | Change the governor of the proof of humanity contract. _governor The address of the new governor./ | function changeGovernor(address _governor) external onlyByGovernor {
proofOfHumanity.changeGovernor(_governor);
}
| 8,852,828 |
./full_match/5/0x5358a276C28028dB9DCcD5Fe1fC92540652530aa/sources/contracts/messageService/lib/RateLimiter.sol | Resets the rate limit amount. If the used amount is higher, it is set to the limit to avoid confusion/issues. Only the RATE_LIMIT_SETTER_ROLE is allowed to execute this function. Emits the LimitAmountChanged event. usedLimitAmountToSet will use the default value of zero if period has expired _amount The amount to ... | function resetRateLimitAmount(uint256 _amount) external onlyRole(RATE_LIMIT_SETTER_ROLE) {
uint256 usedLimitAmountToSet;
bool amountUsedLoweredToLimit;
bool usedAmountResetToZero;
if (currentPeriodEnd < block.timestamp) {
currentPeriodEnd = block.timestamp + periodInSeconds;
usedAmountRes... | 7,069,844 |
./full_match/3/0x3175fcB2BDBcd46392E955C915539363d4367a14/sources/browser/Untitled.sol | Withdraw LP tokens from MasterChef. | function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pending = user.amount.mul(pool.accSMORTIPerSh... | 8,141,061 |
/**
*Submitted for verification at Etherscan.io on 2021-10-09
*/
// File: @openzeppelin/contracts/utils/Context.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While the... | Mints Lost Pups Early Adopters Passport/ If we haven't set the starting index and this is 1) the first token to be sold after | function mintPassport(uint numberOfTokens) public payable {
require(saleIsActive, "Sale must be active to mint passport");
require(numberOfTokens <= maxPurchase, "Can only mint 20 tokens at a time");
require(totalSupply().add(numberOfTokens) <= MAX_PASSPORTS, "Purchase would exceed max suppl... | 10,708,792 |
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
import "../refs/CoreRef.sol";
import "../utils/Timed.sol";
import "./IRewardsDistributor.sol";
import "../external/Decimal.sol";
import { Math } from "@openzeppelin/contracts/math/Math.sol";
import { SafeMath } from "@openzeppelin/contracts/math/SafeMath.sol"... | sets the staking contract to send TRIBE rewards to | function setStakingContract(address _stakingContract) external override onlyGovernor {
stakingContract = IStakingRewards(_stakingContract);
emit StakingContractUpdate(_stakingContract);
}
| 1,102,005 |
./full_match/1/0xD953Eda57EAB69F2EB0103bffA9acc66eA98e0aB/sources/contracts/modules/Module.sol | Executes an operation from the context of the FunWallet contract. dest The destination address to execute the operation on. value The value to send with the transaction. data The data to be executed. return The return data of the executed operation./ | function _executeFromFunWallet(address dest, uint256 value, bytes memory data) internal returns (bytes memory) {
return FunWallet(payable(msg.sender)).execFromModule(dest, value, data);
}
| 17,017,357 |
/**
// SPDX-License-Identifier: Unlicensed
*/
pragma solidity 0.8.9;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability... | exclude from paying fees or having max transaction amount | constructor() ERC20("Common Wealth Inu", "CWI") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Fact... | 1,251,316 |
./partial_match/1/0xAB42127980a3bff124E6465e097a5fC97228827e/sources/src/contracts/core/DataLayrServiceManager.sol | VIEW FUNCTIONS Checks that the hash of the `index`th DataStore with the specified `duration` at the specified UTC `timestamp` matches the supplied `metadata`. Returns 'true' if the metadata matches the hash, and 'false' otherwise./ | function verifyDataStoreMetadata(
uint8 duration,
uint256 timestamp,
uint32 index,
DataStoreMetadata memory metadata
)
external
view
returns (bool)
{
return(
getDataStoreHashesForDurationAtTimestamp(
duration,
... | 9,359,636 |
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asser... | Return the total convert lots owned by an address _lotOwner The address of the convert lot owner return total convert lots owner by the address/ | function totalConvertLotsByAddress(address _lotOwner) public view returns (uint256) {
return ownedConvertLots[_lotOwner].length;
}
| 10,007,315 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
import "./openzeppelin-solidity/contracts/ERC20/SafeERC20.sol";
import "./openzeppelin-solidity/contracts/ERC20/ERC20.sol";
import "./openzeppelin-solidity/contracts/ERC20/IERC20.sol";
import "./openzeppelin-solidity/contracts/SafeMath.sol";
// This contract ha... | Withdraws the user's entire balance of xTGEN./ | function exit() public {
withdraw(balanceOf(msg.sender));
}
event Stake(address indexed user, uint256 amountOfTGEN, uint256 amountOfShares);
event Withdraw(address indexed user, uint256 amountOfShares, uint256 amountOfTGEN);
| 6,424,501 |
./full_match/5/0x38b33e1DCe15A41D076889F3e24EA34D8C131684/sources/contracts/Betting.sol | If everyone bets increase, _betPool = _betIncreasePool. If price falls (choice = 0), no one gets anything. Similarly, if everyone bets decrease, _betIncreasePool = 0 and no one gets anything. Alternatively, if choice == 2, there is no significant change in latestPrice, so no one gets anything and all funds are returned... | function disburseFunds(uint256 choice) public onlyOwner {
uint256 sumCorrectBet;
if (choice == 2 || _numPlayers == 0 || _betPool == 0 || (_betPool == _betIncreasePool && choice == 0) || (_betIncreasePool == 0 && choice == 1)) {
for (uint256 i = 0; i < _numPlayers; i++) {
_token.transfer(_better... | 1,862,306 |
pragma solidity ^0.4.16;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor se... | assert(balances[_to] >= _value); no need to check, since mint has limited hardcap | function transferFrom(address _from, address _to, uint256 _value) whenTransferAllowed public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from] - _value;
balances[_... | 13,132,137 |
/**
*Submitted for verification at Etherscan.io on 2020-04-21
*/
/**
Copyright 2020 PoolTogether Inc.
This file is part of PoolTogether.
PoolTogether is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation under versio... | Set a value of a tree. _key The key of the tree. _value The new value. _ID The ID of the value. `O(log_k(n))` where `k` is the maximum number of childs per node in the tree, and `n` is the maximum number of nodes ever appended./ Append. Add node. Get the index and append the value. Potentially append a new no... | function set(SortitionSumTrees storage self, bytes32 _key, uint _value, bytes32 _ID) internal {
SortitionSumTree storage tree = self.sortitionSumTrees[_key];
uint treeIndex = tree.IDsToNodeIndexes[_ID];
treeIndex = tree.nodes.length;
tree.nodes.push(_value);
... | 1,763,697 |
pragma solidity ^0.4.24;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(add... | Type of the Module factory/ | function getType() public view returns(uint8) {
return 1;
}
| 10,356,686 |
pragma solidity ^0.6.2;
// SPDX-License-Identifier: MIT
... | inject NONSTANDARD NAMING | function INCREASEALLOWANCE808(address spender, uint256 addedValue) public virtual returns (bool) { | 1,820,528 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.4;
// Uncomment if needed.
// import "hardhat/console.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@ope... | fill INonfungiblePositionManager.MintParams struct to call INonfungiblePositionManager.mint(...) token0 one of token pair in uniswap pool, note here not necessary to ensure that token0 < token1 token1 another token fee fee amount0 amount of token0 amount1 amount of token1 tickLeft tickLower tickRight tickUpper ... | function mintParams(
address token0,
address token1,
uint24 fee,
uint256 amount0,
uint256 amount1,
int24 tickLeft,
int24 tickRight,
uint256 deadline
)
internal
view
returns (INonfungiblePositionManager.MintParams memory para... | 11,915,370 |
./full_match/80001/0x8F9e1D36a87e5EC2e4F2EC659ebab65AdE90378c/sources/contracts/lib/TheMerge.sol | A difficulty value greater than `264` indicates that a transaction is being executed in a PoS block. Also note that the `DIFFICULTY` opcode (0x44) is renamed to `PREVRANDAO` post-merge./ | function merged() public view returns (bool) {
return block.difficulty > DIFFICULTY_THRESHOLD;
}
| 5,597,907 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.8;
import "@openzeppelin/contracts/GSN/Context.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Pausable.sol";
import "@animoca/ethereum-contracts-core_library/contra... | Withdraws the remainder of the sender's escrow balance to their wallet. Reverts if the sale has not ended. Reverts if the sender has no balance to withdraw from. Reverts if the transfer to the sender fails. Emits the Withdrawn event. An amount of REVV is transferred from the contract to sender./ | function withdraw() external whenInState(SALE_END_STATE) {
address sender = _msgSender();
uint256 balance = balanceOf[sender];
require(balance != 0, "PrePaid: no balance");
require(
revv.transfer(sender, balance),
"PrePaid: transfer out failed"
);
... | 6,363,795 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "./interfaces/IComptroller.sol";
import "./interfaces/IConverter.sol";
import "./interfaces/ICToken.sol";
import ... | Set the converter for liquidation _converter The new converter/ | function setConverter(address _converter) external onlyGovernor {
require(_converter != address(0), "empty converter");
converter = IConverter(_converter);
require(converter.source() == address(collateral), "mismatch source token");
require(converter.destination() == address(underlyi... | 620,985 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity 0.6.11;
pragma experimental ABIEncoderV2;
// ====================================================================
// | ______ _______ |
// | / _____________ __ __ / ____(_____ ____ _____ ________ |
... | Withdraw Metapool LP from Curve DAO back to this contract | function withdrawFromVault(uint256 _metapool_lp_out) external onlyByOwnGov {
crvFRAX_vault.withdraw(_metapool_lp_out, address(this), 1);
}
| 1,013,131 |
./full_match/80001/0x7081B1cbA94FA165FEC1B39be999A0e4fB812566/sources/project_/contracts/DistrictPower.sol | determine referrer 确定推荐人 if referrer is already set or msg.sender is the root user whose referrer is address(0) | ) external payable notContract nonReentrant {
require(msg.value >= MIN_INVEST, "Too small");
require(msg.value <= MAX_INVEST, "Too large");
require(!gamePaused, "Paused");
UserGlobalInfo storage userGlobalInfo = userGlobalInfos[msg.sender];
address _referrer = userGlobalInfo... | 5,665,098 |
pragma solidity ^0.5.11;
contract PropertyTransferApp {
// Defining new Mapping type for property
mapping(uint256 => Property) public properties;
// Defining Instance Variable
address public contractOwner;
// Defining Struct for Property
struct Property {
uint256 id;
s... | Query for Property by Query ID | function queryPropertyById(uint256 _propertyid) public view
returns (uint256 propertyID,string memory name,string memory owner,uint256 area,uint256 value) {
require(_propertyid > 0,"Property ID cannot be null...!!!");
return (properties[_propertyid].id,properties[_propertyid].name,propertie... | 12,912,694 |
/**
*Submitted for verification at Etherscan.io on 2022-05-02
*/
// Sources flattened with hardhat v2.8.2 https://hardhat.org
// File contracts/solidity/proxy/IBeacon.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev This is the interface that {BeaconProxy} expects of its beacon.
*/
interfa... | Gets the amount of xToken in existence Calculates the amount of base tokens the xToken is worth | function burnXTokens(address who, uint256 _share) external onlyOwner returns (uint256) {
uint256 totalShares = totalSupply();
uint256 what = (_share * baseToken.balanceOf(address(this))) / totalShares;
_burn(who, _share);
baseToken.safeTransfer(who, what);
return what;
}
... | 7,935,864 |
./partial_match/97/0x6fC5a01FDb790415c89deFA0C18416212A3a51C0/sources/BEP20Token.sol | Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), Reverts when dividing by zero. Counterpart to Solidity's `%` operator. This function uses a `revert` opcode (which leaves remaining gas untouched) while Solidity uses an invalid opcode to revert (consuming all remaining gas). Requiremen... | function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
| 11,462,853 |
pragma solidity ^0.4.11;
/**
* Math operations with safety checks
*/
library SafeMath {
function mul(uint a, uint b) internal returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint a, uint b) internal returns (uint) {
// assert(b > 0); //... | To change the approve amount you first have to reduce the addresses` allowance to zero by calling `approve(_spender, 0)` if it is not already 0 to mitigate the race condition described here: https:github.com/ethereum/EIPs/issues/20issuecomment-263524729 | function approve(address _spender, uint _value) {
if ((_value != 0) && (allowed[msg.sender][_spender] != 0)) revert();
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
}
| 5,424,798 |
./full_match/1/0x27eE048B431d00d8f9fFC3Fe3B8e657efEb58538/sources/contracts/erc721/MemswapERC721.sol | When isBuy = true: amount = buy amount endAmount = sell end amount startAmountBps = sell start amount bps expectedAmountBps = sell expected amount bps (now() - startTime) maxAmount = startAmount + (endAmount - startAmount) --------------------- ... | function _postProcess(
Intent memory intent,
TokenDetails[] memory tokenDetailsToFill,
uint128 amountToCheck,
uint128 makerBuyBalanceDiff,
uint128 makerSellBalanceDiff,
uint128 sourceBalanceDiff
) internal {
bytes32 intentHash = getIntentHash(intent);
... | 3,102,079 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgrade... | Updates the govenance address. Only governance can set a new governance. The governance can be renounced by setting a zero address./ | function setGovernance(address _governance) public onlyGovernance {
address oldGovernance = governance;
governance = _governance;
emit GovernanceUpdated(oldGovernance, _governance);
}
| 924,515 |
// VIURE Founders Token Sale Smart Contract for VR Arcades
pragma solidity ^0.4.6;
contract VIUREFoundersTokenSale {
// Maps addresses to balances in ETH
mapping (address => uint) public balances;
uint public transferred_total = 0;
// Minimum and Maximum Goals for Token Sale
uint public constan... | In the case that there is any ETH left unclaimed after the two month refund window, Send the ETH to the loftVR Offline Project Wallet Transfer remaining ETH to loftVR Offline Project Wallet | function transfer_remaining_funds_to_project() {
if (!has_token_sale_time_ended()) throw;
if (is_min_goal_reached()) throw;
if (block.number <= refund_window_end_block) throw;
if (this.balance == 0) throw;
if (!project_wallet.send(this.balance)) throw;
}
| 1,757,190 |
/*
Copyright 2018 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... | Get combinedTokenArray of Rebalancing Set return combinedTokenArray/ | function getCombinedTokenArrayLength()
external
view
returns(uint256)
{
return combinedTokenArray.length;
}
| 12,972,657 |
pragma solidity 0.5.17; // optimization runs: 200, evm version: istanbul
// WARNING - `executeActionWithAtomicBatchCalls` has a `bytes[]` argument that
// requires ABIEncoderV2. Exercise caution when calling that specific function.
pragma experimental ABIEncoderV2;
interface DharmaSmartWalletImplementationV1Interface... | Allow the designated escape hatch account to redeem and "sweep" the total token balance or Ether balance (by supplying the null address) from the smart wallet. The call will revert for any other caller, or if there is no escape hatch account on this smart wallet. An `Escaped` event will be emitted. No value is returned... | function escape(address token) external {
(bool exists, address escapeHatch) = _ESCAPE_HATCH_REGISTRY.getEscapeHatch();
if (!exists) {
revert(_revertReason(6));
}
if (msg.sender != escapeHatch) {
revert(_revertReason(7));
}
if (token == address(0)) {
uint256 balance = addr... | 2,135,514 |
./full_match/5/0xC0424Bc02b0670c803453c094B5BFE32f6c916b0/sources/lib/ERC721H/src/ERC721ACH.sol | Returns the owner of the `tokenId` token. The owner of a token is also its approver by default. tokenId The ID of the token to query. return owner of the `tokenId` token./ | function ownerOf(
uint256 tokenId
) public view virtual override returns (address owner) {
bool runSuper;
IOwnerOfHook hook = IOwnerOfHook(hooks[HookType.OwnerOf]);
if (address(hook) != address(0)) {
(owner, runSuper) = hook.ownerOfHook(tokenId);
runSuper... | 11,611,623 |
pragma solidity ^0.4.25;
// pragma experimental ABIEncoderV2; // MWJ TESTING RETURNING A STRUCT...
// 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... | ADD an airline to the registration list/ uint256 votes; Register new airline When registered, it will have 1 vote, but could retrieve actual value if (success) {votes = 1;} else {votes = 0;} return (success, votes); votes, success, | function registerAirline(
string _name,
address _addr,
address _sponsor
)
onlyAirline
verifyCaller(_sponsor)
external
{
require(!flightSuretyData.isAirlineRegistered(_name), "Airline is already registered.");
success = flightSuretyData.registe... | 5,494,575 |
// SPDX-License-Identifier: MIT LICENSE
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
// Utility Libraries
import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol";
impo... | Set Interfaces salmon = IERC20(_salmon); | function setInit(address _river, address erc20Address, address _traits ) public onlyOwner {
river = IRiver(_river);
salmon = ISalmon(erc20Address);
traits = ITraits(_traits);
getRandomChainlink();
}
| 10,251,825 |
./full_match/5/0xF19747EB85f5BA19AA2B8912577E50FB3395C035/sources/contracts/RafflesF.sol | Only admin can change the Raffle NFT Contract Address/ | function changeDefaultNFT(uint256 _eventId, address _newNftContract, uint256 _tokenId) public onlyAdmin {
}
| 1,877,420 |
./full_match/1/0x270B682EC9B272b623F1e72B8EE2CF27cDC9C18e/sources/Users/tudorg/Desktop/projects/DeBa/contracts/deba/strategies/lendingCompoundStrategy.sol | return CTokenInterface(compAsset).balanceOfUnderlying(address(this)); | function underlyingBalance() public view returns(uint256){
return invested;
}
| 4,878,162 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.25 <0.7.0;
pragma experimental ABIEncoderV2;
import { SafeMath } from "@openzeppelin/contracts/math/SafeMath.sol";
import { UniERC20 } from "../Libraries/LibUniERC20.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { IProvider ... | Basic Core Functions returns the borrow annualized rate for an asset in ray (1e27)Example 8.5% annual interest = 0.085 x 10^27 = 85000000000000000000000000 or 85(1024) | interface IProvider {
function deposit(address _collateralAsset, uint256 _collateralAmount) external payable;
function borrow(address _borrowAsset, uint256 _borrowAmount) external payable;
function withdraw(address _collateralAsset, uint256 _collateralAmount) external payable;
function payback(address _borr... | 1,422,646 |
pragma solidity ^0.4.13;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// ... | determine if addr has role addr address roleName the name of the role return bool/ | function hasRole(address addr, string roleName)
view
public
returns (bool)
{
return roles[roleName].has(addr);
}
| 187,876 |
./full_match/5/0xd0CE2928FFb72B16c0BeF339b99db50ee487C8A2/sources/contracts/claim/abstract/AdvancedDistributor.sol | supply of internal token used to track voting power | function getTotalVotes() external view returns (uint256) {
return totalSupply();
}
| 1,871,438 |
./full_match/43114/0xbFC4028Cd378Dc64a2e87473da4f993D5498702f/sources/masterchef.sol | Update reward variables of the given pool to be up-to-date. | function updatePool(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
if (block.number <= pool.lastRewardBlock) {
return;
}
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (lpSupply == 0 || pool.allocPoint == 0) {
pool.lastRew... | 4,525,100 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./AccessControlUpgradeable.sol";
import "../utils/structs/EnumerableSetUpgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
* @dev External interface of AccessControlEnumerable declared to support ERC165 detection.
*/
interface IAccessCont... | gasAccountTargetEthBalance The target ETH balance of the gas account | function updateGasAccountTargetEthBalance(uint256 gasAccountTargetEthBalance)
external
onlyRole(MANAGER_ROLE)
{
IYieldManager(moduleMap.getModuleAddress(Modules.YieldManager))
.updateGasAccountTargetEthBalance(gasAccountTargetEthBalance);
emit GasAccountTargetEthBalanceUpdated(gasAccountTarge... | 12,070,153 |
./partial_match/1/0x916c729002C041972c640390A0fAD1Db29b6a6c2/sources/Whitelist.sol | checks for transfer restrictions between jurisdictions. return if transfers between these jurisdictions are allowed and if a token lockup should apply: - 0 means transfers between these jurisdictions is blocked (the default) - 1 is supported with no token lockup required - >1 is supported and this value defines the loc... | function getJurisdictionFlow(
uint _fromJurisdictionId,
uint _toJurisdictionId
) external view returns (uint lockupLength) {
return jurisdictionFlows[_fromJurisdictionId][_toJurisdictionId];
}
| 11,021,658 |
pragma solidity ^0.4.18;
// ----------------------------------------------------------------------------
// 'ADE' 'AdeCoin' token contract
//
// Symbol : ADE
// Name : AdeCoin
// Total supply: Generated from contributions
// Decimals : 8
//
// ------------------------------------------------------------... | ------------------------------------------------------------------------ Transfer `tokens` from the `from` account to the `to` account The calling account must already have sufficient tokens approve(...)-d for spending from the `from` account and - From account must have sufficient balance to transfer - Spender must ha... | function transferFrom(address from, address to, uint tokens) public is_not_locked(msg.sender) is_not_locked(from) is_not_locked(to) validate_position(from,tokens / (10**uint(decimals))) returns (bool success) {
require(transferFromCheck(from,to,tokens));
return true;
}
| 1,561,412 |
/**
*Submitted for verification at Etherscan.io on 2021-06-10
*/
// Website: https://goatgangster.com/
// Telegram: https://t.me/GoatGangterXXX
// SPDX-License-Identifier: MIT
// File: @uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol
pragma solidity >=0.5.0;
interface IUniswapV2Factory {
event Pair... | Transfers operator of the contract to a new account (`newOperator`). Can only be called by the current operator./ | function transferOperator(address newOperator) public onlyOperator {
require(newOperator != address(0), "transferOperator: new operator is the zero address");
emit OperatorTransferred(_operator, newOperator);
_operator = newOperator;
}
| 2,078,296 |
./full_match/3/0xf6b62Ef67fc2A7d122e08cbde38BDE08Ad5aAE50/sources/releasable__1__mod.sol | Destroys `amount` tokens from `account`, reducing the total supply. Emits a {Transfer} event with `to` set to the zero address. Emits a {Burn} event with `amount` burned. Requirements: - `account` cannot be the zero address. - `account` must have at least `amount` tokens. - `account` can't be locked./ | function _burn(address account, uint256 amount) internal isUnlocked virtual
{
require(account != address(0), "ERC20: burn from the zero address");
require(!isAddressLocked(account), "Sender address is currently locked and can't burn funds");
uint256 availableBalance = getAvailableBalan... | 8,148,353 |
./full_match/1/0xa11aA626E637df91f3ccd4f795a3d07a3dFaF00e/sources/contracts/BaseBuyAndBurnV3.sol | withdraw a magnitude of dividend producing tokens to a provided destination destination where to send tokens when they have been amount the amount to withdraw against a debt/ | function withdraw(address destination, uint256 amount) external {
uint256 limit = depositOf[msg.sender];
amount = _clamp(amount, limit);
unchecked {
depositOf[msg.sender] = limit - amount;
totalDeposited -= amount;
}
destination = destination == address(0) ? msg.sender : destination;
... | 16,472,464 |
./partial_match/1/0x33271782846661179b026956A780Fa55fbE39458/sources/ServiceV2.sol | ENTITIES | function getEntities() public view returns (address[] memory) {
return entities;
}
| 3,712,288 |
// Sources flattened with hardhat v2.3.3 https://hardhat.org
// File contracts/interfaces/IOracle.sol
pragma solidity 0.8.4;
interface IOracle {
function getTokensOwed(uint256 ethOwed, address pToken, address uTokenLink) external view returns (uint256);
function getEthOwed(uint256 tokensOwed, address pToken,... | Find the Ether value of a certain amount of pTokens. - Must return correct Ether value for _pAmount. _pAmount The amount of pTokens to find Ether value for. return ethValue Ether value of the pTokens (in Wei)./ | function getEthValue(
uint256 _pAmount
)
public
view
returns(
uint256 ethValue
)
{
ethValue = oracle.getEthOwed(_pAmount, address(pToken), uTokenLink);
}
| 59,056 |
./full_match/80001/0x6bbb4C1Ea6a89ACD659D326Be55140964F8cd085/sources/contracts/player-management/PDTOracle.sol | Fulfills the Chainlink request, emits an event and caches it. Oracle only. requestId Bytes32 ID of the request. pdtPrice Latest ParagonsDAO Token Price./ | function fulfillPdtPrice(bytes32 requestId, uint256 pdtPrice) public recordChainlinkFulfillment(requestId) {
emit PdtPriceUpdated(requestId, _pdtPrice, pdtPrice);
_pdtPrice = pdtPrice;
}
USER FUNCTIONS
| 5,609,396 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.