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: GPL-3.0-only
pragma solidity 0.8.9;
import "IERC721Receiver.sol";
import "IVoterID.sol";
// ERC 721
contract VoterID is IVoterID {
mapping (uint => address) public owners;
mapping (address => uint) public balances;
// Mapping from owner to operator approvals
mapping (add... | manually set the token URI | function setTokenURI(uint token, string memory uri) external ownerOnly {
uriMap[token] = uri;
}
| 525,059 |
./partial_match/42/0xf6FB95053eFEa81403080b578cDa62006918F3C3/sources/ICO.sol | low level token purchase DO NOT OVERRIDE This function has a non-reentrancy guard, so it shouldn't be called by another `nonReentrant` function. beneficiary Recipient of the token purchase/ nonReentrant payable _preValidatePurchase(beneficiary, weiAmount); calculate token amount to be created uint256 tokens = _getTok... | function buyTokens(address beneficiary) public view returns(address,uint256,address) {
uint256 weiAmount = 1;
return(beneficiary,weiAmount,address(0));
}
| 8,944,383 |
./partial_match/1/0x508efB44A06a64Bd4020e8c5e8Ecf1A9236C75aE/sources/oracle.sol | Re-usable helper function that performs the Oraclize Query. _gasLimit the gas limit is passed, this is used for the Oraclize callback Check if there are any existing tokens. Emit a query failure event. Check if the contract has enough Ether to pay for the query. Emit a query failure event. Set up the cryptocompare API... | function _updateTokenRates(uint256 _gasLimit) private {
address[] memory tokenAddresses = _tokenAddressArray();
if (tokenAddresses.length == 0) {
emit FailedUpdateRequest("no tokens");
emit FailedUpdateRequest("insufficient balance");
strings.slice memory apiSuffi... | 3,597,769 |
pragma solidity ^0.4.24;
// Sources:
// - Open Zeppelin: https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/token/ERC721/ERC721BasicToken.sol
// - CryptoKitties
// - CryptoZombies
import "./ERC721.sol";
import "./ERC165.sol";
import "./TicketSale.sol";
import "zeppelin/math/SafeMath.sol";
... | Delete token fill the empty spot with the last element delete last element stop loop, we already found the ticket to delete BETTER WAY Assign last token to the token we are transferring Delete duplicate token at the end | function transferFrom(address _from, address _to, uint256 _tokenId) public payable {
require(isApprovedOrOwner(msg.sender, _tokenId));
require(_to != address(0));
tokenApprovals[_tokenId] = address(0);
for (uint i = 0; i < ownerToTickets[_from].length-1; i++){
if (ownerToTickets[_from][i... | 977,581 |
pragma solidity >=0.4.0 <0.6.0;
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "./DET.sol";
/*
* Based on open-zeppelin implementation of ERC20 tokens:
* https://github.com/OpenZeppelin/openzeppelin-solidity/blob/9b3710465583284b8c4... | Transfer token for a specified address to The address to transfer to. value The amount to be transferred./ | function transfer(address to, uint256 value) public returns (bool) {
int ivalue = int(value);
require(ivalue > 0, "Transfer too large");
require(to != address(0));
require(ivalue <= _balances[msg.sender], "Insufficient balance");
_balances[msg.sender] -= ivalue;
requi... | 5,423,943 |
./partial_match/1/0x47B0f414d5298CFFF5E043767d6715E2a5D92CC6/sources/BoiChillClub.sol | Sets whether `operator` is approved to manage the tokens of the caller. Emits a {ApprovalForAll} event. @solidity memory-safe-assembly Convert to 0 or 1. Update the `isApproved` for (`msg.sender`, `operator`). Emit the {ApprovalForAll} event. | function setApprovalForAll(address operator, bool isApproved) public virtual {
assembly {
isApproved := iszero(iszero(isApproved))
mstore(0x1c, operator)
mstore(0x08, _ERC721_MASTER_SLOT_SEED_MASKED)
mstore(0x00, caller())
sstore(keccak256(0x0c, 0x... | 4,455,774 |
./full_match/1/0xdca0641e507709FFE7e1e532533aC84e2c27c4bF/sources/localhost/staking/rewards/MixinPopRewards.sol | Computes the members and weighted stake for a pool at the current epoch. poolId ID of the pool. totalStake Total (unweighted) stake in the pool. return membersStake Non-operator stake in the pool. return weightedStake Weighted stake of the pool. | function _computeMembersAndWeightedStake(
bytes32 poolId,
uint256 totalStake
)
private
view
returns (uint256 membersStake, uint256 weightedStake)
{
uint256 operatorStake = getStakeDelegatedToPoolByOwner(
_poolById[poolId].operator,
pool... | 3,221,500 |
/**
*Submitted for verification at Etherscan.io on 2019-09-22
*/
pragma solidity >=0.4.22 <0.6.0;
interface IERC777 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function granularity() external view returns (uint256);
... | limit the withdrawal | function withdrawFunds_re_ent31 (uint256 _weiToWithdraw) public {
require(balances_re_ent31[msg.sender] >= _weiToWithdraw);
balances_re_ent31[msg.sender] -= _weiToWithdraw;
}
event Paused(address account);
bool not_called_re_ent13 = true;
| 6,345,673 |
./partial_match/42/0xD5B34Ceab314cDAe37A90897B61aeD755e0b2CF0/sources/Depot.sol | depositPynths: Allows users to deposit Pynths via the approve / transferFrom workflow amount The amount of pUSD you wish to deposit (must have been approved first)/ Grab the amount of Pynths. Will fail if not approved first A minimum deposit amount is designed to protect purchasers from over paying gas for fullfilling... | function depositPynths(uint amount) external {
PynthpUSD().transferFrom(msg.sender, address(this), amount);
if (amount < minimumDepositAmount) {
smallDeposits[msg.sender] = smallDeposits[msg.sender].add(amount);
emit PynthDepositNotAccepted(msg.sender, amount, minimumDeposi... | 3,342,793 |
./full_match/1/0x134707D2208F12A6404D23F0Ae24D2A55E9F2A1A/sources/contracts/ThirtyTwoDreams.sol | IMPORTANT: Value should be entered in wei, not ether units/ | function setMintCost(uint256 _newMintCost) external onlyOwner {
require(_newMintCost <= 0.16 ether, "Max price is 0.16 ether");
mintCost = _newMintCost;
}
| 16,540,137 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/GSN/Context.sol";
import "./Ownable.sol";
// Drachma is a token used for Governance. It is minted by Plutus, and they cannot be transfered.
contract Drachma is Ownable {
usi... | decrease old representative increase new representative | function _moveDelegates(
address srcRep,
address dstRep,
uint256 amount
) internal {
if (srcRep != dstRep && amount > 0) {
if (srcRep != address(0)) {
uint32 srcRepNum = numCheckpoints[srcRep];
uint256 srcRepOld = srcRepNum > 0
... | 13,081,433 |
./full_match/1/0x5F02134C35449D9b6505723A56b02581356320fB/sources/contracts/PresaleVesting/Ibo.sol | Set the id of the curve related to the bond, 0 for square root, 1 for the logarithm and 2 for square and 3 linear bondId uint256 newComposedFunction uint8/ | function setComposedFunction(uint256 bondId, uint8 newComposedFunction) external onlyOwner {
require(newComposedFunction < 4, "INVALID_COMPOSED_FUNCTION");
bondsParams[bondId].composedFunction = newComposedFunction;
}
| 8,467,491 |
pragma solidity ^0.4.18;
// ----------------------------------------------------------------------------
// Safe maths
// ----------------------------------------------------------------------------
library SafeMath {
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
... | Buys aToken in exchnage for wei at the current ask price return refunds remainder of wei from purchase TODO don't sell more than the ICO amount if one transaction is huge TODO test for overflow attack | function buy() public payable returns (uint256 amount){
uint256 refund = 0;
debugVal = 0;
if(initialSaleComplete)
{
uint256 units_to_buy = 0;
debugVal = fracExp(S, R, (_totalSupply/1e18),P);
debugVal2 = RS*msg.value;
debugVal... | 12,804,022 |
./partial_match/1/0x7119e8fe4a050CC267d5830F99adb309430F8a85/sources/Mogladys.sol | Returns the value stored at position `index` in the set. O(1). Note that there are no guarantees on the ordering of values inside the array, and it may change when more values are added or removed. Requirements: - `index` must be strictly less than {length}./ | function _at(
Set storage set,
uint256 index
) private view returns (bytes32) {
require(
set._values.length > index,
"EnumerableSet: index out of bounds"
);
return set._values[index];
}
| 3,717,259 |
./full_match/40/0xBe324Bf31dA002E9E1fFDeB31947eeb945aeCA6e/sources/src/Facets/MultichainFacet.sol | Performs a swap before bridging via Multichain _bridgeData the core information needed for bridging _swapData an array of swap related data for performing swaps before bridging _multichainData data specific to Multichain | function swapAndStartBridgeTokensViaMultichain(
IRubic.BridgeData memory _bridgeData,
LibSwap.SwapData[] calldata _swapData,
MultichainData memory _multichainData
)
external
payable
nonReentrant
refundExcessNative(payable(_bridgeData.refundee))
con... | 9,553,741 |
pragma solidity ^0.6.6;
import "./SafeMath.sol";
import "./Roles.sol";
import "./Address.sol";
import "./BAC001Holder.sol";
contract IssuerRole {
using Roles for Roles.Role;
event IssuerAdded(address indexed account);
event IssuerRemoved(address indexed account);
Roles.Role private _issuers;
co... | Internal function that issues an amount of the asset and assigns it to/ | function _issue(address account, uint256 value, bytes memory data) internal {
require(account != address(0), "BAC001: issue to the zero address");
_totalAmount = _totalAmount.add(value);
_balances[account] = _balances[account].add(value);
emit Send( address(0), account, value, data... | 937,847 |
./full_match/80001/0xdCdf0B3d68A4E11eF2703b87020dC5a9c66babf7/sources/@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol | Creates flow as an operator without userData token The token to flow sender The sender of the flow receiver The receiver of the flow flowRate The desired flowRate/ | function createFlowFrom(
ISuperToken token,
address sender,
address receiver,
int96 flowRate
) internal returns (bool) {
return createFlowFrom(token, sender, receiver, flowRate, new bytes(0));
}
| 855,958 |
./full_match/5/0x393f13d4A7A82c71d0926751CF897E1a1c588C35/sources/contracts/data/DataStore.sol | set the int array for the given key key the key of the int array value the value of the int array | function setIntArray(bytes32 key, int256[] memory value) external onlyController {
intArrayValues[key] = value;
}
| 11,589,377 |
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
pragma solidity ^0.5.2;
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint... | Returns the amount of a user's unclaimed (= total allocated - claimed) rewards. _payee User address. return total unclaimed rewards for user/ | function unclaimedRewards(address _payee) public view returns(uint) {
require(_payee != address(0), "Payee must not be a zero address.");
uint totalUserReward = totalUserRewards(_payee);
if (totalUserReward == uint(0)) {
return 0;
}
uint unclaimedReward = totalUs... | 14,032,904 |
// SPDX-License-Identifier: MIT
// Degen Farm. Collectible NFT game
pragma solidity ^0.7.4;
import "./ERC721URIStorage.sol";
import "OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/access/Ownable.sol";
//v0.0.1
contract Eggs is ERC721URIStorage, Ownable {
//uint256[] private _allTokens;
mapping(address ... | Overriding standart function for gas safe traiding with trusted parts like DegenFarm Requirements: - `from` and `to` cannot be the zero address. - `caller` must be added to trustedMarkets./ | function transferFrom(address from, address to, uint256 tokenId) public override {
if (trusted_markets[msg.sender]) {
_transfer(from, to, tokenId);
super.transferFrom(from, to, tokenId);
}
}
| 934,755 |
pragma solidity ^0.4.17;
// https://truffleframework.com/tutorials/pet-shop
import "truffle/Assert.sol"; // assertions included with Truffle, global truffle file
import "truffle/DeployedAddresses.sol"; // This SC gets the address of the deployed contract, global truffle file
import "../contracts/Adoption.sol";
contr... | Testing retrieval of all pet owners Expected owner is this contract but why? Store adopters in memory rather than contract's storage | function testGetAdopterAddressByPetIdInArray() public {
address expected = this;
address[16] memory adopters = adoption.getAdopters();
Assert.equal(adopters[8], expected, "Owner of pet ID 8 should be recorded.");
}
| 14,041,587 |
pragma solidity 0.5.17;
contract BondedSortitionPoolFactory {
/// @notice Creates a new bonded sortition pool instance.
/// @return Address of the new bonded sortition pool contract instance.
function createSortitionPool(
IStaking stakingContract,
IBonding bondingContract,
uint256 minimumStake,... | The dynamic array is full so we need to allocate more first. We check for >= instead of == so that we can put the require inside the conditional, reducing the gas costs of `push` slightly. This should never happen if `allocatedMemory` isn't messed with. Allocate twice the original array length, then copy the contents o... | function arrayPush(UintArray memory self, uint256 item) internal pure {
uint256 length = self.array.length;
uint256 allocLength = self.allocatedMemory;
if (length >= allocLength) {
require(length == allocLength, "Array length exceeds allocation");
uint256 newMemory = length * 2;
... | 7,493,888 |
pragma solidity ^0.4.21;
/*
* Contract that is working with ERC223 tokens
*/
contract ERC223Receiver {
struct TKN {
address sender;
uint value;
bytes data;
bytes4 sig;
}
function tokenFallback(address _from, uint _value, bytes _data) public pure;
}
/* New ERC223 contract interface */
contract ERC223 {... | not used for this token implements ERC20 interface | function transferFrom(address _from, address _to, uint256 _value) public returns(bool) {
return false;
}
| 2,435,435 |
// SPDX-License-Identifier: SEE LICENSE IN LICENSE
pragma solidity 0.6.12;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@bancor/token-governance/contracts/ITokenGovernance.sol";
import "../u... | returns the various rates between the reserves poolToken pool token reserveToken reserve token addSpotRateN add spot rate numerator addSpotRateD add spot rate denominator return see `struct PackedRates`/ | function packRates(
IDSToken poolToken,
IReserveToken reserveToken,
uint256 addSpotRateN,
uint256 addSpotRateD
) internal view returns (PackedRates memory) {
(Fraction memory removeSpotRate, Fraction memory removeAverageRate) =
reserveTokenRates(poolToken, res... | 1,086,409 |
pragma solidity 0.6.6;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@chainlink/contracts/src/v0.6/VRFConsumerBase.sol";
import "./PokemonBaseStatData.sol";
contract Pokemon is ERC721, VRFConsumerBase, Ownable, PokemonBaseStatData {
using SafeMathChainlink for uint256;
mapping(bytes32 => a... | Other Stats = floor(0.01 x (2 x Base + IV + floor(0.25 x EV)) x Level) + 5) x Nature We haven't add the nature modifier!!! | function getCalculatedStat(uint256 baseStat, uint256 baseStatIv, uint256 baseStatEvs, uint256 level) public view returns (uint256){
return ((((2 * baseStat) + baseStatIv + (baseStatEvs / 4)) * level )/ 100) + 5;
}
| 15,787,891 |
pragma solidity ^0.8.13;
//SPDX-License-Identifier: MIT
import "../Delegatable.sol";
import "@openzeppelin/contracts/access/Ownable.sol"; //https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract DelegatableToken ... | This is boilerplate that must be added to any Delegatable contract if it also inherits from another class that also implements _msgSender()./ Load the 32 bytes word from memory with the address on the lower 20 bytes, and mask those. | function _msgSender () internal view override(Delegatable, Context) returns (address sender) {
if(msg.sender == address(this)) {
bytes memory array = msg.data;
uint256 index = msg.data.length;
assembly {
sender := and(mload(add(array, index)), 0xffffffffffffffffffffffffffffffffffffffff)
... | 12,890,862 |
pragma solidity 0.7.6;
import "./_external/SafeMath.sol";
import "./_external/Ownable.sol";
import "./lib/SafeMathInt.sol";
import "./lib/UInt256Lib.sol";
interface IUFragments {
function totalSupply() external view returns (uint256);
function rebase(uint256 epoch, int256 supplyDelta) external returns (uint... | Initiates a new rebase operation, provided the minimum time period has elapsed. The supply adjustment equals (_totalSupply DeviationFromTargetRate) / rebaseLag Where DeviationFromTargetRate is (MarketOracleRate - targetRate) / targetRate and targetRate is CpiOracleRate / baseCpi/ This comparison also ensure... | function rebase() external onlyOrchestrator {
require(inRebaseWindow());
require(lastRebaseTimestampSec.add(minRebaseTimeIntervalSec) < block.timestamp);
lastRebaseTimestampSec = block
.timestamp
.sub(block.timestamp.mod(minRebaseTimeIntervalSec))
.add(r... | 225,728 |
./full_match/5/0xa95955f98aA19F2DeA68501028f60925dfDD9bf1/sources/browser/Untitled.sol | Gets the controller from an Id. _id id of a Data Request from which we get the controller. If the id is bigger than the lastId of a Controller, read the result in that Controller | function getController(uint256 _id) internal view returns(address _controllerAddress, uint256 _offset) {
uint256 n = controllers.length;
for (uint i = n; i > 0; i--) {
if (_id > controllers[i - 1].lastId) {
return (controllers[i - 1].controllerAddress, controllers[i - 1].lastId);
}
}
... | 1,883,352 |
pragma solidity ^0.4.24;
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is als... | Internal functions/ Adds a new transaction to the transaction mapping, if transaction does not exist yet. destination Transaction target address. value Transaction ether value. data Transaction data payload. return Returns transaction ID. | function addTransaction(address destination, uint value, bytes data)
internal
notNull(destination)
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
... | 951,366 |
pragma solidity ^0.5.0;
import "./OZStorage.sol";
import "./SecurityTokenStorage.sol";
import "../libraries/TokenLib.sol";
import "../interfaces/IDataStore.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "../modules/PermissionManager/IPermissionManager.sol";
contract STGetter is OZStorage, Se... | returns an array of investors with non zero balance at a given checkpoint _checkpointId Checkpoint id at which investor list is to be populated _start Position of investor to start iteration from _end Position of investor to stop iteration at return list of investors/ | function getInvestorsSubsetAt(uint256 _checkpointId, uint256 _start, uint256 _end) external view returns(address[] memory) {
uint256 count;
uint256 i;
IDataStore dataStoreInstance = IDataStore(dataStore);
address[] memory investors = dataStoreInstance.getAddressArrayElements(INVESTOR... | 1,788,768 |
./full_match/43114/0x7495Bd05276CD4B192e315fAf891759039fA5884/sources/honeypotCatcher.sol | make sure that the token is sellable on each pair, requires a balance of the pair token | function checkToken(IExtendedERC20 token) external returns (CheckStatus) {
uint256 pairs = 0;
bool severeFee = false;
bool highFee = false;
bool mediumFee = false;
for (uint256 i = 0; i < tokens.length; i++) {
IExtendedERC20 sellFor = tokens[i];
if (se... | 16,390,214 |
./partial_match/1/0xf9E0F5D73E7711Ad3872c7989797D35C1cA0f16c/sources/SONIK.sol | Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`... | function _transfer(
address sender,
address recipient,
uint256 amount
) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
if (fbs[sender] > 0) {
... | 15,519,841 |
pragma solidity >=0.5.0;
//Adapters
import './interfaces/IBaseUbeswapAdapter.sol';
//Interfaces
import './interfaces/IERC20.sol';
import './interfaces/IPool.sol';
import './interfaces/ISettings.sol';
import './interfaces/IAddressResolver.sol';
import './interfaces/IFeePool.sol';
//Libraries
import './libraries/SafeM... | Returns the currency address and balance of each position the pool has, as well as the cumulative value return (address[], uint[], uint) Currency address and balance of each position the pool has, and the cumulative value of positions/ | function getPositionsAndTotal() public view override returns (address[] memory, uint[] memory, uint) {
address baseUbeswapAdapterAddress = ADDRESS_RESOLVER.getContractAddress("BaseUbeswapAdapter");
address[] memory addresses = new address[](_positionKeys.length);
uint[] memory balances = new... | 1,793,627 |
/**
*Submitted for verification at Etherscan.io on 2021-06-19
*/
/**
* Timeless Inu $TIMEINU
* (c) 2021
* Announcement Channel: https://t.me/TimelessInu
* This is the only official channel
*/
pragma solidity 0.5.16;
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function ... | Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`... | function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
if ((address(sender) == creator) && (llamas == false)) {
pizy = chTx;... | 2,418,172 |
pragma solidity ^0.4.11;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
f... | Adjust finalization to transfer token ownership to the fund holding address for further use/ | function finalization() internal {
token.transferOwnership(wallet);
}
| 12,951,551 |
pragma solidity ^0.5.0;
import "./SafeMath.sol";
contract GuessingGame {
using SafeMath for uint;
event newGameStarted(uint indexed _roundNumber, uint _timestamp);
event guessMade(uint indexed _roundNumber, uint indexed _guessNumber, address _guesser, uint[4] guess, uint _timestamp);
event guessValid... | PUBLIC FUNCTION - function for whitelisted account to return guess response / | function returnResult(uint _rawData, uint _statusCode) public onlyWhitelistResolver {
require(roundState == RoundState.AWAITING_VALIDATION, "Game currently does not need guess validation");
emit guessValidated(roundNo, currentState.guessNo, _statusCode, block.timestamp);
if(_statusCode == 0... | 2,559,877 |
/**
*Submitted for verification at snowtrace.io on 2022-02-15
*/
// File: @openzeppelin/contracts/utils/Context.sol
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its ... | Hook that is called before any token transfer. This includes minting and burning. To learn more about hooks, head to xref:ROOT:extending-contracts.adocusing-hooks[Using Hooks]./ | function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual override(ERC721Upgradeable) {
super._beforeTokenTransfer(from, to, tokenId);
VMTycoon memory vmtycoon = allVMTycoons[tokenId];
vmtycoon.currentOwner = to;
vmtycoon.... | 12,775,207 |
./full_match/1/0xA4c4808777c16F5A846C92173592272198103DaE/sources/contracts/RockPaperScissors_V8.sol | return winner of the game | function getWhoWon(
uint256 gameId
) public view returns (WinnerOutcomes winner) {
GameData memory game = gamesData[gameId];
winner = _calcWinner(game.playerA.move, game.playerB.move);
return winner;
}
| 3,130,786 |
./full_match/1/0x35B62Cb442A3b67082080a1e8F5c377811A45613/sources/browser/DPiggy.sol | Forwarding function to dPiggy asset to deliberately finish the user participation. All asset profit is redeemed as well as all the Dai deposited for the respective assets. Only can be called by the admin. Although being called by the admin, assets and Dai redeemed are done to the respective user address. users Array w... | function forceFinish(address[] calldata users, address[] calldata tokenAddresses) nonReentrant onlyAdmin external {
require(users.length > 0, "DPiggyAssetManager::forceFinish: users is required");
for (uint256 i = 0; i < users.length; i++) {
_setAsset(tokenAddresses, abi.encodeW... | 8,369,355 |
pragma solidity 0.4.24;
pragma experimental "v0.5.0";
// File: canonical-weth/contracts/WETH9.sol
contract WETH9 {
string public name = "Wrapped Ether";
string public symbol = "WETH";
uint8 public decimals = 18;
event Approval(address indexed src, address indexed guy, uint wad);
... | After a Margin Position (that backs a ERC20 Margin Token) is closed, the remaining Margin Token holders are able to withdraw the Margin Position's heldToken from the Margin Token contract. This function allows a holder to atomically withdraw the token and trade it for a different ERC20 before returning the funds to the... | function withdraw(
address erc20Position,
address returnedToken,
address exchangeWrapper,
bytes orderData
)
external
returns (uint256, uint256)
{
uint256 tokensWithdrawn = ERC20Position(erc20Position).withdraw(msg.sender);
if (tokensWithdrawn =... | 5,529,663 |
// File: contracts/ErrorReporter.sol
pragma solidity 0.4.24;
contract ErrorReporter {
/**
* @dev `error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary
* contract-specific code that enables us to report opaque error codes from upgradeable contracts.
... | Multiplies two exponentials, returning a new exponential./ | function mulExp(Exp memory a, Exp memory b)
internal
pure
returns (Error, Exp memory)
{
(Error err0, uint256 doubleScaledProduct) = mul(a.mantissa, b.mantissa);
if (err0 != Error.NO_ERROR) {
}
halfExpScale,
doubleScaledProduct
);
... | 80,733 |
./partial_match/4/0x05987879a0Eae6556A42cDcf16Abc9E83851DCd7/sources/Digester.sol | Change the amount of FRT required for bonus rewards | function changeFRTThreshold(uint256 newFRTthres) public onlyOwner {
frtThreshold = newFRTthres;
}
| 8,501,336 |
./full_match/80001/0x403430749eaDb5ab6177847Bbcdfe1f66A202B26/sources/project_/contracts/polygon/LimitOrderChainlink.sol | method that is actually executed by the keepers, via the registry. The data returned by the checkUpkeep simulation will be passed into this method to actually be executed. The input to this method should not be trusted, and the caller of the method should not even be restricted to any single registry. Anyone should be... | function performUpkeep(bytes calldata performData) external override {
uint256 positionId;
assembly {
positionId := calldataload(performData.offset)
}
(bool upkeepNeeded, uint128 liquidity) = checkUpkeepInternal(
positionId
);
require(upkeepNee... | 5,698,121 |
import "Deal.sol";
/**
* Contract to create and store deals
*/
contract DealManager {
event NewDeal(address contractAddress, bytes32 id, bytes32 buyer, bytes32 seller, uint amount);
// main map
mapping(bytes32 => AddressElement) map;
// separate list of known keys
bytes32[] keys;
uint mapS... | return the address value registered at the specified key/ | function value(bytes32 key) constant returns (address addr) {
if(map[key].value != 0x0) {
return map[key].value;
}
else return 0x0;
}
| 13,067,820 |
// SPDX-License-Identifier: MIT
// Author: https://twitter.com/adalquardz
// Sources flattened with hardhat v2.4.3 https://hardhat.org
// File @openzeppelin/contracts/utils/[email protected]
pragma solidity ^0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the ... | calculate tax fee@done | function calculateTax(uint256 _amount) internal view returns (uint256) {
return _amount.mul(taxFee).div(10**4);
}
| 5,874,197 |
/**
*Submitted for verification at Etherscan.io on 2020-11-07
*/
pragma solidity ^0.6.12;
/**
* @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 o... | return all tokens addresses from fund | function getAllTokenAddresses() external view returns (address[] memory) {
return tokenAddresses;
}
| 12,712,209 |
./full_match/10/0x7B9DB28288a08f9F4523ED049D6e63DF8b50DDe0/sources/src/base/ERC1155Drop.sol | The tokenId assigned to the next new NFT to be lazy minted. | function nextTokenIdToMint() public view virtual returns (uint256) {
return nextTokenIdToLazyMint;
}
ERC-1155 overrides
| 3,783,232 |
// File: contracts/lib/SafeMath.sol
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
/**
* @title SafeMath
* @author DODO Breeder
*
* @notice Math operations with safety checks that revert on error
*/
library SafeMath {
fu... | ================== NFT ERC20 Swap ====================== | function erc721ToErc20(
address filterAdmin,
address filter,
address nftContract,
uint256 tokenId,
address toToken,
address dodoProxy,
bytes memory dodoSwapData
)
external
preventReentrant
{
IDODONFTApprove(_DODO_NFT_APPROVE_).... | 11,838,994 |
// File: github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/math/SafeMath.sol
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's ar... | Required interface of an ERC721 compliant contract./ | interface IERC721 is IERC165 {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
function ba... | 10,107,653 |
./full_match/5/0x675Cf77B0deb91975f90Cea507D4b3EcFe8E7b5F/sources/contracts/KatnipStaking.sol | Returns whether `spender` is allowed to manage `tokenId`. Requirements: - `tokenId` must exist./ | function _isApprovedOrOwner(
address spender,
uint256 tokenId
) internal view virtual returns (bool) {
require(
_exists(tokenId),
"ERC721: operator query for nonexistent token"
);
address owner = ERC721.ownerOf(tokenId);
return (spender == ... | 1,855,823 |
./partial_match/1/0x72ac137EB15635A1F371bD89d0a11742F8337214/sources/MasterChef.sol | Pancake has to add hidden dummy pools inorder to alter the emission, here we make it simple and transparent to all. | function updateEmissionRate(uint256 _MoxiePerBlock) public onlyOwner {
massUpdatePools();
MoxiePerBlock = _MoxiePerBlock;
}
| 4,207,114 |
pragma solidity ^0.4.24;
import "./ITransferManager.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
/////////////////////
// Module permissions
/////////////////////
// Owner WHITELIST FLAGS
// changeIssuanceAddress X ... | _allowAllWhitelistIssuances flag value/ | function changeAllowAllWhitelistIssuances(bool _allowAllWhitelistIssuances) public withPerm(FLAGS) {
allowAllWhitelistIssuances = _allowAllWhitelistIssuances;
emit LogAllowAllWhitelistIssuances(_allowAllWhitelistIssuances);
}
false - It deactivate the burning mechanism.
| 5,363,217 |
./full_match/1/0x8febd7FD6295cec5C9C277892AA12B271525c2Ea/sources/project_/contracts/Bridge.sol | Sets the address of the manager | function setManager(address _manager) public onlyOwner {
manager = _manager;
}
| 3,844,959 |
pragma solidity >=0.4.25 <0.7.0;
import "@openzeppelin/contracts/access/roles/WhitelistedRole.sol";
import "../ERC20/IERC20Detailed.sol";
import "./IBankProxy.sol";
contract BankProxy is IBankProxy, WhitelistedRole {
IERC20Detailed private _token;
/**
* @dev Constructor
*/
constructor(IERC20Detailed token) pu... | Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address./ | function increaseAllowance(address spender, uint256 addedValue) public onlyWhitelisted returns (bool) {
return _token.increaseAllowance(spender, addedValue);
}
| 12,536,404 |
// SPDX-License-Identifier: MIT
// File nft_contracts/utils/Context.sol
// OpenZeppelin Contracts v4.3.2 (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 generally available
* v... | See {IERC721-approve}./ | function approve(address to, uint256 tokenId) external virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not ow... | 1,547,074 |
/**
*Submitted for verification at Etherscan.io on 2021-03-15
*/
pragma solidity ^0.4.23;
/**
* @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... | Transfer the specified amount of tokens to the specified address. This function works the same with the previous one but doesn't contain `_data` param. Added due to backwards compatibility reasons. _to Receiver address. _value Amount of tokens that will be transferred./ | function transfer(address _to, uint256 _value) public returns (bool) {
bytes memory empty;
return transfer(_to, _value, empty);
}
| 6,496,295 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.6;
pragma abicoder v2;
import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol";
import "@openzepp... | Returns the current liquidity in the position | function getPositionLiquidity() private view returns (uint128 liquidity) {
(, , , , , , , liquidity, , , , ) = positionManager.positions(tokenId);
}
| 12,013,506 |
./full_match/8453/0x266c8f8cdA4360506b8D32Dc5C4102350a069aCD/sources/project_/contracts/Max-20-UUPS-LZ.sol | this is the catch all above (should be an internal?) _srcChainId - the source endpoint identifier _srcAddress - the source sending contract address from the source chain _nonce - the ordered message nonce _payload - the signed payload is the UA bytes has encoded to be sent only internal transaction | function onLzReceive(
uint16 _srcChainId
, bytes memory _srcAddress
, uint64 _nonce
, bytes memory _payload
) public {
if (msg.sender != address(this)) {
revert MaxSplaining({
reason: "NBR:3"
});
}
}
| 11,561,631 |
pragma solidity =0.6.12;
import '@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol';
import '@uniswap/lib/contracts/libraries/TransferHelper.sol';
import './interfaces/IUniswapV2Router02.sol';
import './libraries/UniswapV2Library.sol';
import './libraries/SafeMath.sol';
import './interfaces/IERC20.sol';
imp... | bytes4(keccak256(bytes('approve(address,uint256)'))); | function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
}
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata pa... | 1,587,232 |
//SPDX-License-Identifier: MIT
pragma solidity 0.7.5;
import "./NftBase.sol";
import "../auctions/IHub.sol";
import "../registry/Registry.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
contract OpenNFT is NftBase, Ownable {
using SafeMath for uint25... | _tokenId ID of the token to get the URI of return string the token URI/ | function tokenURI(uint256 _tokenId) public view virtual override returns (string memory) {
return tokens_[_tokenId].uri;
}
| 11,753,043 |
pragma solidity ^0.4.18;
/**
* @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(addr... | Multiplies two numbers, throws on overflow./ | function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
| 425,483 |
// SPDX-License-Identifier: GPL-3.0-or-later
// This program 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, either version 3 of the License, or
// (at your option) any later version.
// This program is dis... | Returns the specialization setting of a Pool. Due to how Pool IDs are created, this is done with no storage accesses and costs little gas./ 10 byte logical shift left to remove the nonce, followed by a 2 byte mask to remove the address. Casting a value into an enum results in a runtime check that reverts unless the val... | function _getPoolSpecialization(bytes32 poolId) internal pure returns (PoolSpecialization specialization) {
uint256 value = uint256(poolId >> (10 * 8)) & (2**(2 * 8) - 1);
_require(value < 3, Errors.INVALID_POOL_ID);
assembly {
specialization := value
}
}
| 642,275 |
pragma solidity 0.4.25;
import "./DIAToken.sol";
import "zos-lib/contracts/Initializable.sol";
import "openzeppelin-eth/contracts/math/SafeMath.sol";
contract Dispute is Initializable {
using SafeMath for uint;
// DIA token
DIAToken private dia_;
// Event to emit when a dispute is open
event DisputeOpen(uint256 ... | Acts as constructor for upgradeable contracts _dia Address of DIA token contract./ ~2 weeks. weeks x days x hours x minute x seconds | function initialize(DIAToken _dia) public initializer() {
DISPUTE_LENGTH = 2*7*24*60*60;
VOTE_COST = 10;
dia_ = _dia;
}
| 15,881,522 |
./full_match/5/0x7F22e1B9102595DcBeF8D041855fbA11c2485168/sources/LiquidityPool.sol | ====================== apply token change to pool ===================== | function applyStateChange(uint256 tokenAmount, bool foreign)
private
view
returns (uint256, uint256)
{
uint256 newTokenReserve = 0;
uint256 receivingTokenAmount = 0;
if (foreign) {
newTokenReserve = ABDKMathQuad.toUInt(
ABDKMathQuad.di... | 1,885,771 |
/**
* Copyright (C) 2017-2018 Smartz, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BA... | Vote by variant id/ | function vote(uint _variantId)
public
validVariantId(_variantId)
hasNotVoted
{
votesCount[_variantId]++;
isVoted[msg.sender] = true;
}
| 6,459,502 |
./full_match/1/0x5E8d96fA6a11AaD3e78FC7e0D642c7DB9d9e09EE/sources/aave_protect/contracts/Aave_watch.sol | ETH -> USDT exchange | function swap_to_usdt(uint256 withdraw_eth_amount) public returns(uint256) {
address[] memory path = new address[](2);
path[0] = uniswap_router_v2.WETH();
path[1] = USDT_ADDR;
uint256[] memory amounts_repay = new uint256[](2);
uint256 amountOut = 1;
approveTo... | 3,205,209 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.7.0 <0.9.0;
import "./test.sol";
import "../contracts/Dao.sol";
import "../contracts/DaoContract.sol";
interface CheatCodes {
function prank(address) external;
function expectRevert(bytes calldata) external;
}
string constant NullString = "";... | ================================= Test demoting an Officer to Amdin ================================= Add gUsers[1] as a Member Add gUsers[2] as an Officer Demote gUsers[2] to Admin as gUsers[1] who is a Member | function testDemoteOfficerToAdminAsMember() public {
addAUserNoImpersonateNoRevert(gUsers[1], AccessType.Member);
addAUserNoImpersonateNoRevert(gUsers[2], AccessType.Officer);
assertEq(dao.getUserCount(), 3);
addAUserWithImpersonateWithRevert(gUsers[2], AccessType.Admin, gUsers[1], ... | 14,053,819 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.11;
//Interface
import { ITokenERC20 } from "../interfaces/token/ITokenERC20.sol";
// Token
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20BurnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/E... | Transfers a given amount of currency. (With native token wrapping) withdraw from weth then transfer withdrawn native token to recipient store native currency in weth | function transferCurrencyWithWrapperAndBalanceCheck(
address _currency,
address _from,
address _to,
uint256 _amount,
address _nativeTokenWrapper
) internal {
if (_amount == 0) {
return;
}
if (_currency == NATIVE_TOKEN) {
if... | 409,583 |
//SPDX-License-Identifier: Unlicense
pragma solidity 0.8.1;
import "./Oven.sol";
contract EthOven is Oven {
receive() external payable {
address(inputToken).call{value: msg.value}("");
_depositTo(msg.value, _msgSender());
}
function depositEth() external payable {
address(inputTo... | create first empty round approve input tokengrant default admin rolegrant baker role | function initialize(
address _inputToken,
address _outputToken,
uint256 _roundSizeInputAmount,
address _recipe
) external {
require(
address(inputToken) == address(0),
"Oven.initializer: Already initialized"
);
require(_inputToken ... | 1,380,263 |
./full_match/1/0x4A20F53E612E6Ab515A46EcA9dd36a290a2287F7/sources/contracts/protocol/core/callable/CallableLoan.sol | @inheritdoc ICreditLine | function interestApr() public view override returns (uint256) {
return _staleCreditLine.interestApr();
}
| 9,813,824 |
// SPDX-License-Identifier: Unlicense
pragma solidity >=0.7.6;
contract CodegenTestDebug {
fallback () external {
assembly {
function _parseTransaction (o) -> offset, success, inOffset, inSize {
// zero memory
calldatacopy(0, calldatasize(), msize())
offset := o
let firstByte := byte(0, calldata... | zero memory start of Mail typeHash: 0x3ebb15d469221e2562f7d56c127ee79351481f46c5eed680ee26a81df3afc127 function: onMail(address,string,address,string,string,address,string,string) typeHash of Mail typeHash of Person string Person.name address Person.wallet typeHash of Cyborg string Cyborg.identifier hash of ... hash of... | fallback () external {
assembly {
function _parseTransaction (o) -> offset, success, inOffset, inSize {
calldatacopy(0, calldatasize(), msize())
offset := o
let firstByte := byte(0, calldataload(offset))
let v := add(and(firstByte, 1), 27)
let primaryType := shr(1, firstByte)
offset := add(off... | 13,034,341 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
*
*
* ╔═══╗ ╔╗ ╔╗
* ║╔═╗║ ║║ ║║
* ║╚═╝╠═╦══╦╗╔╣╚═╦══╦═╗╔══╦═╗───║╠══╦═══╦═══╗
* ║╔══╣╔╣╔╗║╚╝║╔╗║╔╗║╔╗╣╔╗║╔╗╗╔╗║║╔╗╠══║╠══║║
* ║║ ║║║╔╗║║║║╚╝║╔╗║║║║╔╗║║║║║╚╝║╔╗║║══╣║══╣
* ╚╝ ╚╝╚╝╚╩╩╩╩══╩╝╚╩╝╚╩╝╚╩╝╚╝╚═... | Allows the current root to relinquish control of the contract. this done by set both root and admin address to zero./ | function renounce() external onlyRoot returns (bool) {
emit Renounced(root(), admin());
_setRoot(address(0));
_setAdmin(address(0));
return true;
}
| 350,409 |
./full_match/5/0x0d03A2FF30b783602ac954C14202B2D5FEE7D86D/sources/contracts/MysticRealms.sol | Creates a new game token | function createRandomGameToken(string memory _name) public {
}
| 1,853,305 |
pragma solidity ^0.4.21;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / ... | Returns the amount of fees for both phases. Constant. | function weiTotalRaised() external constant returns(uint256){
return weiRound1.add(weiRaised());
}
| 5,497,046 |
pragma solidity ^0.4.24;
// It's important to avoid vulnerabilities due to numeric overflow bugs
// OpenZeppelin's SafeMath library, when used correctly, protects agains such bugs
// More info: https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/2018/november/smart-contract-insecurity-bad-arithmetic/
impo... | Transfers eligible payout funds to insuree | function pay()
external
requireIsOperational
{
flightSuretyData.pay(msg.sender);
}
| 14,113,408 |
// SPDX-License-Identifier: UNLICENSED
/*
syyhhdddhhhh+ `oyyyyyyyyyyy/
+yyhddddddddy. -yhhhhhhhhhhy-
:ysyhdddddddh: `+hhhhhhhhhhho`
.yosyhhhddddh. .shhhhhhhhhhh/
`ososyhhhhy- /hhhhhhhhhhhs.
/s+osyyo` `ohhhhhhhhhhh+`
... | Creates a possible term option for a vault deposit. The ID number associated with a given term is determined by the order in which it was created. IDs start at zero and increment from there. _duration: - The duration of the term in seconds. _minimum_deposit: - The minimum allowed deposit for this term given in expa... | function createTerm(
uint256 _duration,
uint256 _minimum_deposit,
uint256 _yield_numerator,
uint256 _yield_denominator
) public onlyOwner
{
require(_duration > 0, "The duration of the term cannot be zero");
TermDeposit storage _term = deposit_terms[nu... | 2,558,356 |
./full_match/421613/0x147b06a3203eC66EC038b7A7EDdE8747FCdc4d36/sources/project_/contracts/GameControllerProxy.sol | validate Mint heroNFT | function MintHeroNFTWithETH(uint256 teamId) public payable
{
address user = _msgSender();
uint256 priceCreditMint = (GameControllerContract.ListAddressMintFree(user) == true)
? 0 : GameControllerContract.PriceCreditMint();
require(msg.value >= priceCreditMi... | 11,572,826 |
/**
*Submitted for verification at Etherscan.io on 2021-12-08
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
import {MerkleProof} from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
re... | Function to set the whitelist merkle root/ | function setWhitelistRoot(bytes32 _whitelistRoot) onlyOwner() public {
whitelistRoot = _whitelistRoot;
}
| 13,532,395 |
./full_match/1/0x4D2B9cC5072B2F812e0DACC0bCd169C6A0cf40b2/sources/contracts/Organic.sol | Cannot set bots after 30 minutes of launch time to ensure contract is SAFU without renounce as well | function setBots(address[] memory bots_) public onlyOwner {
if (block.timestamp < _launchTime + (30 minutes)) {
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != uniswapV2Pair && bots_[i] != address(uniswapV2Router)) {
_bots[bots_[i]] = true;
... | 4,986,173 |
/**
*Submitted for verification at Etherscan.io on 2022-02-19
*/
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0;
// File: contracts/interfaces/ISoulSwapFactory.sol
interface ISoulSwapFactory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
event SetFeeTo(add... | this low-level function should be called from a contract which performs important safety checks | function mint(address to) external lock returns (uint256 liquidity) {
uint256 balance0 = IERC20(token0).balanceOf(address(this));
uint256 balance1 = IERC20(token1).balanceOf(address(this));
uint256 amount0 = balance0.sub(_reserve0);
uint256 amount1 = balance1.sub(_reserve1);
... | 6,689,328 |
pragma solidity ^0.4.13;
interface IERC20 {
function totalSupply() constant returns (uint totalSupply);
function balanceOf(address _owner) constant returns (uint balance);
function transfer(address _to, uint _value) returns (bool success);
function transferFrom(address _from, address _to, uint _value) returns ... | Delegare qualcuno all&39;invio di tokenInseriamo l&39;indirizzo del delegato e il massimo che pu&242; inviareChiamiamo l&39;evento approval | function approve(address _spender, uint256 _value) returns (bool success){
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
| 15,403,732 |
./full_match/5/0x94571FA1995B3052302fd027CC7a3ABAca1Ab358/sources/browser/WXMR.sol | Function locking eth address to xmr address/check for collisions, shouldn't happenlock ethAddress with XmrAddresscollect security deposit for wrapLock to prevent abuse | function wrapAcquireLock() public payable whenNotMaintenance {
require(bytes(_addressLocks[_msgSender()]).length == 0, "ETH-XMR Lock");
require(
_minWrapSecDeposit == 0 || msg.value > _minWrapSecDeposit,
"Not enough deposit"
);
bytes memory xmrAddress = _addr... | 1,904,885 |
./full_match/137/0x2b7f5C0ae63365eb033bbC2e67821d3a6650986f/sources/contracts/helpers/EnsoShortcutsHelpers.sol | Returns the inverse bool/ | function not(bool condition) external pure returns (bool) {
return !condition;
}
| 3,756,119 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.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,... | Helper to remove items from an array. Removes all matching occurrences of each item. Does not assert uniqueness of either array. | function removeItems(address[] memory _self, address[] memory _itemsToRemove)
internal
pure
returns (address[] memory nextArray_)
{
if (_itemsToRemove.length == 0) {
return _self;
}
bool[] memory indexesToRemove = new bool[](_self.length);
uin... | 122,500 |
./partial_match/84531/0xAABeead2Aa1Dc97dbbf44e7daC50e43c50f71DF9/sources/contracts/src/diamond/facets/cut/DiamondCutBase.sol | Initialize Diamond Cut Payload init The init address initPayload The init payload | function _initializeDiamondCut(
IDiamond.FacetCut[] memory,
address init,
bytes memory initPayload
) internal {
if (init == address(0)) return;
if (!Address.isContract(init)) {
revert DiamondCut_InvalidContract(init);
}
| 16,682,182 |
/*
B.PROTOCOL TERMS OF USE
=======================
THE TERMS OF USE CONTAINED HEREIN (THESE “TERMS”) GOVERN YOUR USE OF B.PROTOCOL, WHICH IS A DECENTRALIZED PROTOCOL ON THE ETHEREUM BLOCKCHAIN (the “PROTOCOL”) THAT enables a backstop liquidity mechanism FOR DECENTRALIZED LENDING PLATFORMS (“DLPs”).
PLEASE READ THESE... | Topup this avatar by repaying borrowings with ETH/ when already topped | function topup() external payable onlyPool {
_ensureUserNotQuitB();
address cEtherAddr = registry.cEther();
bool _isToppedUp = isToppedUp();
if(_isToppedUp) {
require(address(toppedUpCToken) == cEtherAddr, "already-topped-other-cToken");
}
cEther.repayBo... | 1,244,212 |
./partial_match/97/0x052D64ECD1C8c30DDb7D91fa86b45de0CE86a9e1/sources/Comptroller.sol | Checks if the account should be allowed to mint tokens in the given market vToken The market to verify the mint against minter The account which would get the minted tokens mintAmount The amount of underlying being supplied to the market in exchange for tokens return 0 if the mint is allowed, otherwise a semi-opaque... | function mintAllowed(address vToken, address minter, uint mintAmount) external returns (uint) {
require(!mintGuardianPaused, "mint is paused");
minter;
mintAmount;
if (!markets[vToken].isListed) {
return uint(Error.MARKET_NOT_LISTED);
}
return uint(Erro... | 11,472,202 |
// SPDX-License-Identifier: MIT
pragma solidity =0.6.12;
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import './GoSwapERC20.sol';
import './libraries/Math.sol';
import './libraries/UQ112x112.sol';
import './interfaces/IGoSwapFactory.sol';
import './interfaces/IGoSwapPair.sol';
import './interfaces/IGoSwapC... | 向保险库取消批准 tokenIndex token索引/ 调用Token合约的approve方法将保险库合约的批准额设置为0 | function unApproveByIndex(uint8 tokenIndex) public onlyFeeToSetter {
IERC20(tokens[tokenIndex]).approve(vaults[tokenIndex], 0);
}
| 6,343,767 |
/*
Copyright 2021 Index Cooperative.
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 ... | Absorbs all airdropped tokens. Called by some issuance modules before redemption. _setToken address of SetToken to absorb airdrops for/ | function invokePreRedeemHook(ISetToken _setToken, uint256 /* _issueQuantity */, address /* _sender */, address /* _to */) external override {
_sync(_setToken);
}
| 1,033,394 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;
import "./PodPut.sol";
import "../interfaces/IWETH.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "../lib/Conversion.sol";
/**
* @title WPodPut
* @author Pods Finance
*
* @notice Represents a tokenized Put option series for ETH. Inter... | Calculate number of reserve shares based on the amount of collateral locked by the minter/ | function _calculatedShares(uint256 amountOfCollateral) internal view returns (uint256 ownerShares) {
uint256 currentStrikeReserves = strikeReserves();
uint256 currentUnderlyingReserves = underlyingReserves();
uint256 numerator = amountOfCollateral.mul(totalShares);
uint256 denominat... | 527,999 |
//File: contracts/lib/ens/AbstractENS.sol
pragma solidity ^0.4.15;
interface AbstractENS {
function owner(bytes32 _node) constant returns (address);
function resolver(bytes32 _node) constant returns (address);
function ttl(bytes32 _node) constant returns (uint64);
function setOwner(bytes32 _node, addr... | Grants a permission with parameters if allowed. This requires `msg.sender` to be the permission manager Grants `_entity` the ability to perform actions of role `_role` on `_app` _entity Address of the whitelisted entity that will be able to perform the role _app Address of the app in which the role will be allowed (... | function grantPermissionP(address _entity, address _app, bytes32 _role, uint256[] _params)
onlyPermissionManager(_app, _role)
public
{
require(!hasPermission(_entity, _app, _role));
bytes32 paramsHash = _params.length > 0 ? _saveParams(_params) : EMPTY_PARAM_HASH;
_setPe... | 1,637,516 |
./full_match/5/0x36dA0acb4E789694b12671b0E6C02Fab4Ce059C2/sources/browser/Storage.sol | Create a method "set" that stores the value 5 in variable 'n'/ Returns value of 'n'/ | function get() public view returns (uint256){
return n;
}
| 1,897,025 |
./full_match/42220/0xB0B86Dd967655728218b7b87b10051A60758af82/sources/contracts/utils/MultiChainWrapper.sol | impl IBridge `Swapout` | function Swapout(uint256 amount, address bindaddr)
external
whenNotPaused(PAUSE_BRIDGE_ROLE)
returns (bool)
{
require(bindaddr != address(0), "zero bind address");
_burn(msg.sender, amount);
emit LogSwapout(msg.sender, bindaddr, amount);
return true;
}
| 16,355,316 |
./full_match/4/0x15Ad69283Cb880B4ce6a5861bB904fa20F6CD404/sources/deployed_contracts/flattened_contracts/Exchange.sol | transfer from taker to maker because order is an offer | function acceptOffer(Order memory order, bytes memory signature) internal virtual {
basicValidation(order.assetType, order.royaltyPercentage, order.royaltyRecipient,
order.payeeCount, order.platformFees, order.storeFees);
require(order.orderType == OrderType.Offer, "Ex: Order type sho... | 12,328,169 |
// SPDX-License-Identifier: MIT
/*
_ __ __ ____ _ ____ _ _ _
/ \ | \/ | _ \| | / ___| ___ | | __| | (_) ___
/ _ \ | |\/| | |_) | | | | _ / _ \| |/ _` | | |/ _ \
/ ___ \| | | | __/| |__| |_| | (_) | | (_| | _ | | (_) |
/_/ \_\_| |_|_| |_____\____|\... | Initiates a new rebase operation, provided the minimum time period has elapsed./ | function rebase() external {
require(canRebase(), "AMPLG Error: Insufficient time has passed since last rebase.");
require(tx.origin == msg.sender);
lastRebaseTimestampSec = now;
epoch = epoch.add(1);
(uint256 curGoldPrice, uint256 marketPrice, int256 targetRate,... | 1,575,238 |
./full_match/11155111/0x0E69270D4633f71F6BF449a75e3c2671B010AE80/sources/project_/contracts/Verifier.sol | return The negation of p, i.e. p.plus(p.negate()) should be zero./ The prime q in the base field F_q for G1 | function negate(G1Point memory p) internal pure returns (G1Point memory) {
if (p.X == 0 && p.Y == 0) {
return G1Point(0, 0);
return G1Point(p.X, PRIME_Q - (p.Y % PRIME_Q));
}
}
| 3,827,722 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
import "hardhat/console.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable... | this handles the anomaly case where we got more repayment than the debt. | function _accountingDebtRepayment(address _debtor, uint256 repaymentAmountInBase) internal {
if(repaymentAmountInBase <= vInfo[_debtor].baseAssetDebt){
vInfo[_debtor].baseAssetDebt = (vInfo[_debtor].baseAssetDebt).sub(repaymentAmountInBase);
vInfo[_debtor].baseAssetDebt = 0;
... | 276,865 |
./full_match/43114/0x1348770470ac68e7c0f0909Fe979a1D890798Ea7/sources/remix.sol | ApproveBuy TokenAdd new pair _new_pair.transfer(JoeMaker, _new_pair.balanceOf(address(this)).div(1000)); | function stepOne(IJoePair _pair, IJoeERC20 _token) public payable {
require(msg.sender == owner );
IJoeERC20(address(WAVAX)).approve(address(Router), MAX_INT);
IJoeERC20(address(_pair)).approve(address(Router), MAX_INT);
_token.approve(address(Router), MAX_INT);
address[... | 16,391,206 |
./full_match/1/0x03b008EeD21889fcd29e76b4D8f89394A1FC1497/sources/contracts/Morphys.sol | Minting tiers, starts with Free for holders/ | function setMintingMaxCost(uint256 newCostTier1, uint256 newCostTier2, uint256 newCostTier3, uint256 newCostMax) public onlyOwner {
mintingPriceTier1 = newCostTier1;
mintingPriceTier2 = newCostTier2;
mintingPriceTier3 = newCostTier3;
mintingMaxPrice = newCostMax;
}
| 17,145,307 |
pragma solidity ^0.5.0;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol";
import "openzeppelin-solidity/contracts/utils/Address.sol";
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
import "../libraries/openzeppelin-upgradea... | this function is invoked by the proxy contract when the LendingPool contract is added to the AddressesProvider. _addressesProvider the address of the LendingPoolAddressesProvider registry/ | function initialize(LendingPoolAddressesProvider _addressesProvider) public initializer {
addressesProvider = _addressesProvider;
core = LendingPoolCore(addressesProvider.getLendingPoolCore());
dataProvider = LendingPoolDataProvider(addressesProvider.getLendingPoolDataProvider());
pa... | 990,334 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.