file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
/** * Token name: KT * Interface: ERC721 * This token is established by Krypital Group LLC, mainly used as a gift for Krypital supporters. * Total supply of KTs is set to 2100. * A KT holder can either hold it as a souvenir (leave message on the message board), or play the game by merging/decomposing tokens. ...
This method is for decomposing (or split) a token. Only can be done by token holder when token is not frozen. Note: one of the tokens will take the original token's place, that is, the old ID will actually map to a new token! Level down by 1!!! A level 1 token cannot be decomposed. The genes of the two new born tokens ...
function decompose(uint256 token_id) public whenNotFrozen(token_id) onlyOwnerOf(token_id) decomposeAllowed(token_id) hasKT(token_id) withinTotal{ KT storage decomposed = KTs[token_id]; decomposed.level = decomposed.level-1; decomposed.gene = decomposed.gene/2; KT memory newKT = KT({ officialNot...
7,283,920
pragma solidity ^0.4.23; /** * @title Datatrust Anchoring system * @author Blockchain Partner * @author https://blockchainpartner.fr */ contract Datatrust { // Event emitted when saving a new anchor event NewAnchor(bytes32 merkleRoot); /** * @dev Save a new anchor for a given Merkle tree root ha...
Save a new anchor for a given Merkle tree root hash Use events as a form of storage _merkleRoot bytes32 hash to anchor/
function saveNewAnchor(bytes32 _merkleRoot) public { emit NewAnchor(_merkleRoot); }
2,119,584
./full_match/42161/0xAcD1cAeF47E4c47BafE8a51B3F4305Fc38203b7A/sources/contracts/Luneko.sol
Activate the taxes.
function activateTaxes() external onlyOwner { taxRate = 2; taxActive = true; }
16,307,476
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol"; import "@openzeppelin/contracts/finance/PaymentSplitter.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@open...
Minting by the agent only recipient The recipient of the NFT id The intended token Id uri The intended token URI/
function mintAuthorized( address recipient, uint256 id, string memory uri ) external { require(hasRole(AGENT_ROLE, _msgSender()), "unauthorized to mint"); require(vacant(id)); _mint(recipient, id, uri); }
14,015,101
pragma solidity 0.6.7; import "./lib/enumerableSet.sol"; import "./lib/safe-math.sol"; import "./lib/erc20.sol"; import "./lib/ownable.sol"; import "./interfaces/strategy.sol"; import "./pud-token.sol"; // MasterChef was the master of pud. He now governs over Pud. He can make Pud and he is a fair guy. // // Note that...
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.totalShares; if (lpSupply == 0) { pool.lastRewardBlock = block.number; return; ...
7,245,949
./full_match/3/0x89ce35170d5de0fb1FaddC27Df1b9E91dD2e83D4/sources/contracts/SigmoidBonds.sol
check if the bond is redeemable
function bondIsRedeemable(uint256 class, uint256 nonce) public view override returns (bool){ if (last_bond_redeemed[class] >= nonce) { return (true); } if (uint256(_info[class][nonce][1]) < now) { uint256 total_liquidity = last_activeSupply[class]; uint25...
8,173,767
./partial_match/1/0xe8765eC7b69ab754c149b96178106082fabf5a65/sources/contracts/ERC-721/ERC721PoolFactory.sol
PUBLIC STORAGE @inheritdoc IERC721PoolFactory @inheritdoc IERC721PoolFactory @inheritdoc IERC721PoolFactory PUBLIC CONSTANT FUNCTIONS @inheritdoc IERC721PoolFactory
function allPoolsLength() external view override returns (uint256) { return allPools.length; }
2,766,431
./partial_match/1/0xf6c33a5aCA089BE53bA8c95685426aCD2fc4F4e1/sources/helpers.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 virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); require(amount <= availableAmount(sender),"ERC20 : amount ...
15,727,184
./full_match/80001/0xD8224491fcF8dE30135A4c53ac2c1Edb90D82A06/sources/MembershipCrossmint.sol
set mintRate as per new collection launch
function setMintRate(uint256 _mintRate) external onlyOwner { mintRate = _mintRate; }
845,059
//SPDX-License-Identifier: MIT pragma solidity 0.8.8; import "./IERC20.sol"; import "./IERC20_Bridge_Logic_Restricted.sol"; import "./IMultisigControl.sol"; import "./ERC20_Asset_Pool.sol"; /// @title ERC20 Bridge Logic /// @author Vega Protocol /// @notice This contract is used by Vega network users to deposit and w...
this function allows the exemption_lister to exempt a depositor from the deposit limits this feature is specifically for liquidity and rewards providers depositor The depositor to exempt from limits emits Depositor_Exempted if successful
function exempt_depositor(address depositor) public override { require(depositor != address(0), "cannot exempt zero address"); require(!exempt_depositors[depositor], "depositor already exempt"); require(msg.sender == exemption_lister, "unauthorized exemption lister"); exempt_depositors[depos...
12,891,044
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol"; import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Supply.sol"; import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; import "@openzeppelin/contracts/acc...
Mints a token to an address with a tokenURI. _to address of the future owner of the token/
function mintTo(address _to, uint256 _amount, string memory _CID ) public { uint256 newTokenId = _getNextTokenId(); _CIDS[newTokenId] = _CID; _mint(_to, newTokenId, _amount, ""); _incrementTokenId(); }
12,882,342
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @title A base MisBlock token contract /// @author Anderson L /// @notice This contract is inherited by MisBlockETH and MisBlockBSC token contracts. /// @dev All functions requiring onlyOwner are also pausable. import "@openzeppelin/contracts/token/ERC20/ERC...
enable/disable Swap and Liquidity feature. Must be called from only owner./
function setSwapAndLiquifyEnabled(bool enabled) external onlyOwner whenNotPaused { swapAndLiquifyEnabled = enabled; emit SwapAndLiquifyEnabledUpdated(enabled); }
5,426,048
// SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.8.0 <0.9.0; library BLS { // Field order uint256 constant N = 21888242871839275222246405745257275088696311157297823662689037894645226208583; // Negated genarator of G2 uint256 constant nG2x1 = 11559732032986387107991004021392285783925812861821192...
solium-disable-next-line security/no-inline-assembly (N + 1) / 4 = 0xc19139cb84c680a6e14116da060561765e05aa45a1c72a34f082305b61f3f52 N = 0x30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47
function sqrt(uint256 xx) internal view returns (uint256 x, bool hasRoot) { bool callSuccess; assembly { let freemem := mload(0x40) mstore(freemem, 0x20) mstore(add(freemem, 0x20), 0x20) mstore(add(freemem, 0x40), 0x20) mstore(add(freemem, ...
2,504,711
pragma solidity ^0.4.13; interface ERC721Enumerable /* is ERC721 */ { /// @notice Count NFTs tracked by this contract /// @return A count of valid NFTs tracked by this contract, where each one of /// them has an assigned and queryable owner not equal to the zero address function totalSupply() public v...
token's name/
function name() external pure returns (string) { return NAME; }
478,468
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity ^0.8.6; import "@gnosis.pm/zodiac/contracts/core/Modifier.sol"; import "./Permissions.sol"; contract Roles is Modifier { address public multisend; mapping(address => uint16) public defaultRoles; mapping(uint16 => Role) internal roles; event A...
Returns array of modules. start Start of the page. pageSize Maximum number of modules that should be returned. return array Array of modules. return next Start of the next page. Init array with max page size Populate return array Set correct size of returned array solhint-disable-next-line no-inline-assembly
function getModulesPaginated(address start, uint256 pageSize) external view returns (address[] memory array, address next) { array = new address[](pageSize); uint256 moduleCount = 0; address currentModule = modules[start]; while ( currentModul...
6,977,354
./full_match/1/0xEBc651F4A8C898b5C45FBEEEC9CF125bB8b452E1/sources/@openzeppelin/contracts@4.3.2/token/ERC721/IERC721.sol
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...
3,170,586
/** *Submitted for verification at Etherscan.io on 2021-09-04 */ /** *Submitted for verification at Etherscan.io on 2021-09-01 */ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its ...
ERC-721 Non-Fungible Token Standard, optional enumeration extension/
interface IERC721Enumerable is IERC721 { function totalSupply() external view returns (uint256); function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); function tokenByIndex(uint256 index) external view returns (uint256); } }
124,211
/* ** ** dddddddd ...
treasury redeem $PANDA tokens./
function treasuryRedeem() external nonReentrant onlyOwner { require(treasuryRedeemAmount > 0, "PandaDAO: Invalid amount required."); require(pandaToken.balanceOf(msg.sender) >= treasuryRedeemAmount, "PandaDAO: you do not have enough PandaToken."); terminalv1_1.redeem(msg.sender, PANDADAO_PRO...
1,294,181
./full_match/80001/0xd3f069cF82bdd9C0764148Fd07a07144C729003c/sources/SCS.sol
Allows minting(transfer from 0 address), but not transferring while paused() except from owner
function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { if (!(from == address(0)) && !(from == owner())) { require(!paused(), "ERC721Pausable: token transfer while paused"); } }
846,467
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IBeacon.sol"; import "../Utils/Address.sol"; import "../Utils/StorageSlot.sol"; /** * @dev This abstract contract provides setters and getters for the different * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] storage slots. * * _Available since...
Stores a new address in the EIP1967 admin slot./
function _setAdmin(address newAdmin) internal { require(newAdmin != address(0), "ERC1967: new admin is the zero address"); StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin; }
1,821,555
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.8.0; // ==================================================================== // | ______ _______ | // | / _____________ __ __ / ____(_____ ____ _____ ________ | // | / /_ / ___/ __ `| |/_/ /...
Withdraw Metapool LP from the vault back to this contract
function withdrawFromVault(uint256 _vault_shares) external onlyByOwnGovCust { stakedao_vault.withdraw(_vault_shares); }
13,126,581
pragma solidity ^0.5.2; import "./CereneumImplementation.sol"; /// @author AshKetchumNakamoto09 /// @title A Trustless Interest-bearing Cryptographic Certificate of Interest on Ethereum contract Cereneum is CereneumImplementation { using SafeMath for uint256; constructor( bytes32 a_hBTCMerkleTreeRoot...
Skips the UTXO verification on a claim, useful for Unit Testing
function testFakeClaim( uint256 a_nAmount, address a_address, BlockchainType a_nWhichChain ) external { UpdateDailyData(); m_nTotalRedeemed = m_nTotalRedeemed.add(GetRedeemRatio(a_nAmount, a_nWhichChain)); (uint256 nRedeemed, uint256 nBonuses, uint256 nPenalties) = GetRedeemAmou...
13,117,160
./full_match/43114/0x594D5519c2BCBFd5D21aa9FA6755312caA31CFd4/sources/contracts/liquid-yield/LyLptHolder.sol
unregister a reward token
function removeRewardtoken(address token) external onlyOwnerExec { rewardTokens.remove(token); }
4,513,111
./full_match/1/0xA309c1E54d91b9f45845c4899A7e35999540406B/sources/contracts/staking/StakingPool.sol
Withdraw without caring about rewards. EMERGENCY ONLY. pid The index of the pool. to Receiver of the LP tokens.
function emergencyWithdraw(uint256 pid, address to) external validatePoolByPid(pid) nonReentrant { require(to != address(0), "emergencyWithdraw: receiver is the zero address"); PoolInfo memory pool = poolInfo[pid]; UserInfo storage user = userInfo[pid][msg.sender]; uint256 amount = ...
17,053,111
// SPDX-License-Identifier: GPL-3.0 /* This file is part of the Enzyme Protocol. (c) Enzyme Council <[email protected]> For the full license information, please view the LICENSE file that was distributed with this source code. */ pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/E...
Provides a constant string identifier for an adapter return identifier_ An identifier string
function identifier() external pure override returns (string memory identifier_) { return "CHAI"; }
1,698,254
./full_match/80001/0xC158A41ea8e573E0cE5B3e09FDEeB8ffbF35B1d7/sources/contracts/ERC721A.sol
See {IERC721Metadata-tokenURI}./
function tokenURI( uint256 tokenId ) public view virtual override returns (string memory) { require( _exists(tokenId), "ERC721Metadata: URI query for nonexistent token" ); string memory baseURI = _baseURI(); return bytes(baseURI).lengt...
857,419
./full_match/80001/0xdCdf0B3d68A4E11eF2703b87020dC5a9c66babf7/sources/@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol
Increases the flow rate allowance for flow operator allowing userData to be a parameter here triggered stack too deep error token The token used in flow flowOperator The address whose flow rate allowance is increased addedFlowRateAllowance amount to increase allowance by/
function increaseFlowRateAllowance(ISuperToken token, address flowOperator, int96 addedFlowRateAllowance) internal returns (bool) { return increaseFlowRateAllowance(token, flowOperator, addedFlowRateAllowance, new bytes(0)); }
855,947
./full_match/80001/0xa85310809BF2CFdecC61b249048F5Db33bf8012c/sources/project_/contracts/Orderbook.sol
Decode calldata settleInfo & calldata priceUpdateData. pyth.updatePriceFeeds{value: pyth_fee}(priceUpdateData); PythStructs.Price memory closingPrice = pyth.getPrice( makersLegs[maker.order_ID][i].feedID );
function orderbook_settle_order( bytes calldata settleInfo, bytes[] calldata priceUpdateData, bytes32[] calldata maker_leg_feed_ids ) external onlyVault returns ( HDGXStructs.MakerOrder memory _maker, HDGXStructs.TakerOrder memory _taker, ...
863,928
pragma solidity ^0.5.0; library Pairing { struct G1Point { uint X; uint Y; } // Encoding of field elements is: X[0] * z + X[1] struct G2Point { uint[2] X; uint[2] Y; } /// @return the generator of G1 function P1() internal pure ret...
return the generator of G1
function P1() internal pure returns (G1Point memory) { return G1Point(1, 2); }
7,233,453
// SPDX-License-Identifier: MIT /** * Stick Fighter .m. (;) (;) (;) . (;) . |\_(;)_/| |/ )|( \| ( o ) )8( ( o ) )8( ;|S|; ||S|| ...
Returns a tokenURI of a specific token
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token."); string memory baseURI2 = _baseURI(); return bytes(baseURI2).length > 0 ? string(abi.encodePacked(baseURI2, tok...
11,752,500
pragma solidity 0.6.7; pragma experimental ABIEncoderV2; contract ControllerV4 { using SafeERC20 for IERC20; using Address for address; using SafeMath for uint256; address public constant burn = 0x000000000000000000000000000000000000dEaD; address public onesplit = 0xC586BeF4a0992C495Cf22e1ae...
Anyone can harvest it at any given time. I understand the possibility of being frontrun But ETH is a dark forest, and I wanna see how this plays out i.e. will be be heavily frontrunned? if so, a new strategy will be deployed. stablecoin we want to convert to Collects crv tokens Don't bother voting in v1 x% is sent...
function harvest() public onlyBenevolent override { (address to, uint256 toIndex) = getMostPremium(); ICurveMintr(mintr).mint(gauge); uint256 _crv = IERC20(crv).balanceOf(address(this)); if (_crv > 0) { uint256 _keepCRV = _crv.mul(keepCRV).div(keepCRVMa...
7,450,274
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0 <0.9.0; import "./libraries/math/WadRayMath.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/...
Moves `amount` of tokens from `sender` to `recipient`. This 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"); _beforeTokenTransfer(sender, recip...
15,853,191
// 口口口口口口口口口口口口口口口口口口口口口口口口口口口口口口口口口口口口口口口口口口口口口口口口口口口口口口口口口口口口口 // 口口口口口口口口口口口口口       口口口口口口口口口口口口口口口口口口口口口口口口口口口口    口口口口口口口口口 // 口口口口口口口口口口口口         口口口口口口口口口口口口口口口口口口口口口口口口口口口    口口口口口口口口口 // 口口口口口口口口口口口    口口口    口口口口口口口口口口口口口口口口口口口口口口口口口口    口口口口口口口口口 // 口口口口口口口口口口    口口口口口    口口口口口口口口口口口口口口口口口口口口口口口口口    口口口口口...
no need to require value <= totalSupply, since that would imply the sender&39;s balance is greater than the totalSupply, which should be an assertion failure
function _burn(address _who, uint256 _value) internal { require(_value <= balances[_who], "no value to burn"); balances[_who] = balances[_who].sub(_value); totalSupply_ = totalSupply_.sub(_value); emit Burn(_who, _value); emit Transfer(_who, address(0), _value); }
15,053,884
// SPDX-License-Identifier: MIT /**************************************************************** ** ** ** ██████╗ █████╗ ██████╗ ███╗ ███╗ █████╗ ███╗ ██╗ ** ** ██╔════╝██╔══██╗██╔══██╗ ████╗ ████║██╔══██╗████╗ ██║ ** ** ██║ ██████...
disables an address for management controller the address to disbale/
function removeController(address controller) external onlyOwner { controllers[controller] = false; }
185,911
pragma solidity ^0.4.18; /* ASTRCoin ICO - Airdrop code */ /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); ret...
reset the rate to the default
function resetAirdropAmount() onlyOwner public { AIRDROP_AMOUNT = 10 * decimalsConversion; }
15,827,641
/** *Submitted for verification at Etherscan.io on 2021-05-26 */ // SPDX-License-Identifier: GPL-3.0 pragma solidity 0.6.12; pragma experimental ABIEncoderV2; // Global Enums and Structs struct StrategyParams { uint256 performanceFee; uint256 activation; uint256 debtRatio; uint256 minDebtPerHarve...
emergency withdraw. sends balance plus amount to governancedont care about error here
function emergencyWithdraw(uint256 amount) external override management { cToken.redeem(amount); want.safeTransfer(vault.governance(), want.balanceOf(address(this))); }
2,154,516
pragma solidity ^0.4.21; library SafeMath { /** * @dev 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); retu...
Constructor _name - token name _symbol - token symbol _cap - token cap - 0 value means no cap/
function TestToken(string _name, string _symbol,uint _cap) public { name = _name; symbol = _symbol; cap = _cap; }
6,737,538
./full_match/1/0x1807e79594A19de9a887f0A1448F4AB4c347B763/sources/lib/relic-sdk/packages/contracts/lib/Storage.sol
compute the slot for a struct field given the base slot and offset base the slot of the struct base offset the slot offset in the struct/
function structFieldSlot( bytes32 base, uint256 offset ) internal pure returns (bytes32) { return bytes32(uint256(base) + offset); }
17,042,462
/* * This file was generated by MyWish Platform (https://mywish.io/) * The complete code could be found at https://github.com/MyWishPlatform/ * Copyright (C) 2018 MyWish * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as publis...
event for token purchase logging purchaser who paid for the tokens beneficiary who got the tokens value weis paid for purchase amount amount of tokens purchased/
function Crowdsale(uint256 _startTime, uint256 _endTime, uint256 _rate, address _wallet) public { require(_startTime >= now); require(_endTime >= _startTime); require(_rate > 0); require(_wallet != address(0)); token = createTokenContract(); startTime = _startTime; endTime = _endTime; ...
104,816
/** *Submitted for verification at Etherscan.io on 2021-07-25 */ /* 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 mechanis...
set as 0 if not in market CR = collateralRatio = collateralFactorMantissa
function getAvatarInfo( Registry registry, BComptroller bComptroller, address[] memory cTokens, uint[] memory priceFeed, address avatar ) public returns(AvatarInfo memory info) { require(cTokens.length == priceFeed.length, "cTokens-priceFeed-...
7,827,232
// SPDX-License-Identifier: MIT pragma solidity ^0.8.2; pragma abicoder v2; import {CallForFundsStorage} from "./CallForFundsStorage.sol"; import {ISuperfluid} from "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol"; import {IConstantFlowAgreementV1} from "@superfluid-finance/ethe...
======== PRIVATE =========
function setFundingState(FundingState fundingState_) private { fundingState = fundingState_; emit FundingStateChanged(fundingState_); }
1,843,232
pragma solidity ^0.5.4; import "./AuctionityTreasurer_V1.sol"; import "../CommonContract/AuctionityLibrary_V1.sol"; import "../CommonContract/AuctionityChainId_V1.sol"; import "../CommonContract/SafeMath.sol"; contract AuctionityTreasurer_V2 is AuctionityTreasurer_V1 { event LogLockDepot_V2( address user...
public Unlock part of deposit to a called smart contract, for internal use in same proxy user address tokenContractAddress address : ERC1155 smart contract tokenId uint256 : tokenId of ERC1155 amount uint256 amount to lock lockedFor uint256 lockedId
function internalUnLockDeposit_V2( address user, address tokenContractAddress, uint256 tokenId, uint256 amount, uint256 lockedFor ) public { _unlockDeposit_V2(user, tokenContractAddress, tokenId, amount, lockedFor); }
12,762,803
// SPDX-License-Identifier: MIT pragma solidity ^0.8.3; import "./IERC20.sol"; import "../access/Ownable.sol"; import "../interfaces/IUniswapV2Pair.sol"; import "../interfaces/IUniswapV2Factory.sol"; import "../interfaces/IUniswapV2Router02.sol"; contract Safe is IERC20, Ownable { mapping(address => uint256) pri...
avoid fee calling _tokenTransfer with false
function _rewardLiquidityProviders(uint256 liquidityRewards) private { _tokenTransfer(address(this), uniswapV2Pair, liquidityRewards, false); IUniswapV2Pair(uniswapV2Pair).sync(); totalLiquidityProviderRewards = totalLiquidityProviderRewards + (liquidityRewards); ...
5,432,457
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import { SignatureDrop } from "contracts/signature-drop/SignatureDrop.sol"; // Test imports import "./utils/BaseTest.sol"; import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; cont...
note: Testing state changes; reset eligibility of claim conditions and claiming again for same condition id./
function test_state_claimCondition_resetEligibility_waitTimeInSecondsBetweenClaims() public { vm.warp(1); address receiver = getActor(0); bytes32[] memory proofs = new bytes32[](0); SignatureDrop.AllowlistProof memory alp; alp.proof = proofs; SignatureDrop.ClaimCon...
1,798,331
// SPDX-License-Identifier: GPLv3 pragma solidity 0.7.2; pragma experimental ABIEncoderV2; import '../interfaces/IElasticToken.sol'; import '../libraries/ElasticMath.sol'; import '../core/ElasticDAO.sol'; import '../models/DAO.sol'; import '../models/Ecosystem.sol'; import '../models/Token.sol'; import '../models/To...
Initializes and builds the ElasticDAO struct _ecosystemModelAddress - the address of the ecosystem model _controller the address which can control the core DAO functions _summoners - an array containing the addresses of the summoners _name - the name of the DAO _maxVotingLambda - the maximum amount of lambda that ...
function initialize( address _ecosystemModelAddress, address _controller, address[] memory _summoners, string memory _name, uint256 _maxVotingLambda ) external nonReentrant { require(initialized == false, 'ElasticDAO: Already initialized'); require( _ecosystemModelAddress != addres...
10,474,416
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (governance/Governor.sol) pragma solidity ^0.8.0; import "../utils/cryptography/ECDSA.sol"; import "../utils/cryptography/draft-EIP712.sol"; import "../utils/introspection/ERC165.sol"; import "../utils/math/SafeCast.sol"; import "../utils...
See {IGovernor-contestDeadline}./
function contestDeadline() public view virtual override returns (uint256) { return voteStart() + votingPeriod(); }
12,635,395
// 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...
Schedule a gradual weight change, from the current weights to the given endWeights, over startTime to endTime./ If the start time is in the past, "fast forward" to start now This avoids discontinuities in the weight curve. Otherwise, if you set the start/end times with only 10% of the period in the future, the weights ...
function updateWeightsGradually( uint256 startTime, uint256 endTime, uint256[] memory endWeights ) external authenticate whenNotPaused nonReentrant { InputHelpers.ensureInputLengthMatch(_getTotalTokens(), endWeights.length); uint256 currentTime = block.timestamp; ...
6,380,767
pragma solidity ^0.5.8; import "openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol"; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "openzeppelin-solidity/contracts/math/Math.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "solidity-bytes-utils/contracts/BytesLib...
Removes the proposals with the most upvotes from the queue, moving them to the approval stage. If any of the top proposals have expired, they are deleted./ solhint-disable-next-line not-rely-on-time solhint-disable-next-line not-rely-on-time TODO(asa): We can save gas by not deleting here
function dequeueProposalsIfReady() public { if (now >= lastDequeue.add(dequeueFrequency)) { uint256 numProposalsToDequeue = Math.min(concurrentProposals, queue.list.numElements); uint256[] memory dequeuedIds = queue.popN(numProposalsToDequeue); for (uint256 i = 0; i < numProposalsToDequeue; i = ...
12,589,504
./full_match/4/0xC92a0b9d1e6237fa7bCC0185f0B0A7b6c11286f6/sources/PermaNFT.sol
----- admin functions -----
function setAllowedCreatorsOnly(bool allowedCreatorsOnly_) public onlyOwner { allowedCreatorsOnly = allowedCreatorsOnly_; }
12,353,577
/** *Submitted for verification at Etherscan.io on 2021-07-13 */ //SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.6; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then b...
See {IERC721-ownerOf}./
function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: Owner query for nonexistent token"); return owner; }
7,792,916
/* -------------------------------------------------------------------------------- The Bethereum [BETHER] Token Smart Contract Credit: Bethereum Limited ERC20: https://github.com/ethereum/EIPs/issues/20 ERC223: https://github.com/ethereum/EIPs/issues/223 MIT Licence -------------------------------------------------...
Checks how much _spender can withdraw from _owner /
function allowance(address _owner, address _spender) constant returns (uint256 remaining) { return allowed[_owner][_spender]; }
20,883
./full_match/42/0xE3fd40E658284bac18b42b15A8a7B6C8E2D3Dbb0/sources/contracts/BaseRewardPool.sol
Adds an extra reward only `rewardManager` can add extra rewards _reward token address of the reward
function addExtraReward(address _reward) external onlyAddress(rewardManager) { require(_reward != address(0), "!reward setting"); extraRewards.push(_reward); }
9,570,954
./full_match/1/0x3B1E4e5e307207978E2e52Ee92516bfE5De0f2E7/sources/contracts/protocol/vault/GeneralVault.sol
Convert an `_amount` of collateral internal asset to collateral external asset and send to caller on liquidation. - Caller is only LendingPool _asset The address of collateral external asset _asset = 0x0000000000000000000000000000000000000000 means to use ETH as collateral _amount The amount of collateral internal a...
function withdrawOnLiquidation(address _asset, uint256 _amount) external virtual returns (uint256); function processYield() external virtual; function pricePerShare() external view virtual returns (uint256); function setTreasuryInfo(address _treasury, uint256 _fee) public payable virtual onlyAdmi...
16,422,562
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/t...
Transfers `tokenId` from `from` to `to`. As opposed to {transferFrom}, this imposes no restrictions on msg.sender. Requirements: - `to` cannot be the zero address. - `tokenId` token must be owned by `from`. Emits a {Transfer} event./ Clear approvals from the previous owner
function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ownerOf(tokenId) == from, "INCORRECT TOKEN OWNER"); require(to != address(0), "TRANSFER TO ZERO ADDRESS"); _beforeTokenTransfer(from, to, tokenId); _approve(addres...
1,776,570
pragma solidity ^0.8.0; // Copyright 2020 Keyko GmbH. // SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0) // Code is Apache-2.0 and docs are CC-BY-4.0 import '@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol'; /** * @title DID Registry Library * @author Keyko * * @dev All function calls a...
updateDIDOwner transfer DID ownership to a new owner _self refers to storage pointer _did refers to decentralized identifier (a byte32 length ID) _newOwner the new DID owner address/
function updateDIDOwner( DIDRegisterList storage _self, bytes32 _did, address _newOwner ) internal { require(_newOwner != address(0)); _self.didRegisters[_did].owner = _newOwner; }
12,991,480
./full_match/4/0xf13e93A3dB4283FDAc71aA2Cb59f5FB84119Df2b/sources/browser/HALOTOKEN.sol
transform room initiation
function transformActivate(bool _isActive) public onlyAdmins { roundActive = _isActive; }
12,408,300
/** * (0x%x,2909) Solo une altro contratta che ho fatto. Nel codice ci fidiame. In crito e rifugio. Crito-difese à vita. * * Author: 2021 Crypto Fix Finance and Contributors. BSD 3-Clause Licensed. * Baseate ni Putanas. * Passed compliance checks by 0xFF4 marked XFC. * Final version: need to change router and wa...
T:PEND(MERGE):(f9):Allows one to get agreement data and someone's termos to agreement aidrequire(_privLawAgreement[_aid].signedOn[_who]!=0,"AuthZ: this x-persona did not sign this agreement ID"); specifics for signee (_who) agreement generics (everyone) stack too deep (after merge)
function getAgreementData(uint256 _aid, address _who) public view returns (string memory, string memory, string memory) { bool _validSign = xffa.verifySimpleSignSaltedHash(_privLawAgreement[_aid].signature[_who],_who,"I hereby consent aid",_privLawAgreement[_aid].signatureNonce[_who]); string memory...
12,876,851
./full_match/1/0x069c8eA3d0Bd677009b8620182457859caD11Ed5/sources/contracts/LilDeadFellaz.sol
Prizes mints by owner Prize mints must mint first, and cannot be minted after the maximum has been reached
function mintPrizes(uint amount) public onlyOwner { uint currentTotalSupply = totalSupply(); require(currentTotalSupply < MAX_PRIZE_MINTS, "LilDeadFellaz: Max prize mint limit reached"); if (currentTotalSupply + amount > MAX_PRIZE_MINTS){ amount = MAX_PRIZE_MINTS - currentTotalSupply; } _m...
2,904,476
// Sources flattened with hardhat v2.0.5 https://hardhat.org // File deps/@openzeppelin/contracts-upgradeable/proxy/Initializable.sol // SPDX-License-Identifier: MIT pragma solidity >=0.4.24 <0.7.0; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be de...
return the token being held./
function token() public view returns (IDigg) { return _digg; }
1,677,852
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; impo...
return the start time for depositing to portfolio./
function startPortfolioDeposits() external view returns (uint256) { return _startPortfolioDeposits; }
1,064,660
./full_match/80001/0x0C3D02B43f5e892FdA061C41d2F90d8e5673BB0D/sources/contracts/GotMinted.sol
Initializes the contract in unpaused state./
function Pausable_init() internal onlyOwner onlyInitializing { __Pausable_init_unchained(); }
873,358
./full_match/80001/0x65778600A4F7e79B469f679280B1193f5e44A72f/sources/contracts/RetirementCertificates.sol
Mint new Retirement Certificate NFT that shows how many TCO2s have been retired. retiringEntity The entity that has retired TCO2 and is eligible to mint an NFT. params Retirement params retirementEventIds An array of event ids to associate with the NFT. return The token id of the newly minted NFT. The function c...
function mintCertificateWithExtraData( address retiringEntity, CreateRetirementRequestParams calldata params, uint256[] calldata retirementEventIds ) external virtual nonReentrant returns (uint256) { return _mintCertificate(retiringEntity, params, retirementEventIds); }
9,520,812
./partial_match/1/0x5C0Fe44391ee35856A5De861dFd340197D252624/sources/src/SeaDrop.sol
get public mint price nftContract The nft contract address./
function getPublicMintPrice(address nftContract) external view override returns (uint256) { return _publicMintPrices[nftContract]; }
3,579,968
/** *Submitted for verification at Etherscan.io on 2021-10-26 */ // SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.6.12; pragma experimental ABIEncoderV2; // Global Enums and Structs struct StrategyParams { uint256 performanceFee; uint256 activation; uint256 debtRatio; uint256 minDebtPerHarv...
Check if current block's base fee is under max allowed base fee Useful for testing until ganache supports london fork Hard-code current base fee to 1000 gwei This should also help keepers that run in a fork without baseFee() to avoid reverting and potentially abandoning the job
function isCurrentBaseFeeAcceptable() public view returns (bool) { uint256 baseFee; try baseFeeProvider.basefee_global() returns (uint256 currentBaseFee) { baseFee = currentBaseFee; baseFee = 1000 * 1e9; } return baseFee <= maxAcceptableBaseFee; }
508,438
/** *Submitted for verification at Etherscan.io on 2020-02-11 */ // File: @aragon/os/contracts/common/EtherTokenConstant.sol /* * SPDX-License-Identitifer: MIT */ pragma solidity ^0.4.24; // aragonOS and aragon-apps rely on address(0) to denote native ETH, in // contracts where both tokens and ETH are accept...
ERC897, the address the proxy would delegate calls to/
function implementation() public view returns (address) { return pinnedCode(); }
451,381
// Sources flattened with hardhat v2.6.1 https://hardhat.org // File @openzeppelin/contracts/utils/Context.sol@v4.3.0 // SPDX-License-Identifier: MIT 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...
Approves another address to transfer the given token ID Can only be called by the token owner or an approved operator. to address to be approved for the given token ID tokenIndex uint256 ID of the token to be approved/
function approve(address to, uint tokenIndex) external virtual override { address tokenOowner = ownerOf(tokenIndex); require(to != tokenOowner, "ERC721: approval to current owner"); require(_msgSender() == tokenOowner || isApprovedForAll(tokenOowner, _msgSender()), "ERC721: appr...
1,335,361
./full_match/314/0x7b7f1f85F599b63432F5D782041c25Dad354f999/sources/node_modules/@openzeppelin/contracts/governance/extensions/GovernorTimelockAccess.sol
Returns bucket and subindex for reading manager data from the packed array mapping./
function _getManagerDataIndices(uint256 index) private pure returns (uint256 bucket, uint256 subindex) { }
8,083,834
pragma solidity 0.4.24; /** * @title SafeMath * @notice Math operations with safety checks that throw on error */ library SafeMath { /** * @notice Multiplies two numbers, throws on overflow. * @param a Multiplier * @param b Multiplicand * @return {"result" : "Returns product"} */ func...
Multiplies two numbers, throws on overflow. a Multiplier b Multiplicand return {"result" : "Returns product"}/
function mul(uint256 a, uint256 b) internal pure returns (uint256 result) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "Error: Unsafe multiplication operation!"); return c; }
12,990,058
// File: ERC20.sol pragma solidity ^0.5.10; /// @title ERC20 interface is a subset of the ERC20 specification. /// @notice see https://github.com/ethereum/EIPs/issues/20 interface ERC20 { function allowance(address _owner, address _spender) external view returns (uint256); function approve(address _spender, u...
Update ERC20 token exchange rate. _token ERC20 token contract address. _rate ERC20 token exchange rate in wei. _updateDate date for the token updates. This will be compared to when oracle updates are received. Require that the token exists. Update the token's rate. Update the token's last update timestamp. Emit the ...
function updateTokenRate(address _token, uint _rate, uint _updateDate) external onlyAdminOrOracle { require(_tokenInfoMap[_token].available, "token is not available"); _tokenInfoMap[_token].rate = _rate; _tokenInfoMap[_token].lastUpdate = _updateDate; emit UpdatedTokenRate(msg.sender...
913,799
./partial_match/1/0xDf0dbc66f85979a1d54671c4D9e439F306Be27EE/sources/_mean-finance/nft-descriptors/solidity/interfaces/IDCAHubPositionDescriptor.sol
The interface for generating a description for a position in a DCA Hub Contracts that implement this interface must return a base64 JSON with the entire description/
interface IDCAHubPositionDescriptor { function tokenURI(address hub, uint256 positionId) external view returns (string memory description); pragma solidity >=0.8.7 <0.9.0; }
9,345,386
./full_match/5/0xbafC5cd0Ab05E195039cEee17440cf0FbBB3Cc70/sources/contracts/CrowdFunding.sol
payable(address(this)).transfer(amount);
function donate(uint256 _id) public payable { uint256 amount = msg.value; Campaign storage campaign = campaigns[_id]; campaign.donators.push(msg.sender); campaign.donations.push(amount); }
7,081,230
/* Copyright 2020 Set Labs Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in...
============ Helper Functions ============ /
function testOnlyValidAndInitializedSet(ISetToken _setToken) function testOnlyValidInitialization(ISetToken _setToken) function initializeModuleOnSet(ISetToken _setToken) external { _setToken.initializeModule(); }
6,349,320
pragma solidity >=0.4.18 <0.7.0; import '../solidity-lib/openzeppelin-solidity-112/contracts/lifecycle/TokenDestructible.sol'; import '../solidity-lib/openzeppelin-solidity-112/contracts/token/ERC20/ERC20.sol'; import '../solidity-lib/openzeppelin-solidity-112/contracts/math/SafeMath.sol'; import './OwnerContract.sol...
get the withdraw wallet addresses list binding to the deposit contract address _deposit the deposit contract address _indices the array of indices of the withdraw wallets/ WithdrawWallet storage wallet = depositRepos[_deposit].withdrawWallets[_indices[i]]; names[i] = wallet.name; wallets[i] = wallet.walletAddr;
function getDepositWithdrawList(address payable _deposit, uint[] memory _indices) onlyOwner public view returns(bytes32[] memory, address[] memory) { require(_indices.length != 0); bytes32[] memory names = new bytes32[](_indices.length); address[] memory wallets = new address[](_indices.length); for...
6,415,876
./full_match/1/0xa6e596b51c6E7FA6f725505c648AE33f27d52a88/sources/nQCToken803.sol
given an amount of Ether, swap all for HATE and send to burn address/
function swapAndBurn(uint256 _amount) public override { require(msg.sender == address(this), "can't swap and burn"); address[] memory path = new address[](2); path[0] = uniswapV2Router.WETH(); path[1] = HATE; uniswapV2Router.swapExactETHForTokensSupportingFeeOnTransferToken...
8,296,634
pragma solidity ^0.6.0; pragma experimental ABIEncoderV2; import "./RealitioERC20.sol"; // openzeppelin imports import "@openzeppelin/contracts/math/SafeMath.sol"; library CeilDiv { // calculates ceil(x/y) function ceildiv(uint256 x, uint256 y) internal pure returns (uint256) { if (x > 0) return ((x - 1) / y...
Removes liquidity to a market - external claiming any pending fees re-balancing fees pool part of the liquidity is exchanged for outcome shares if market is not balanced
function removeLiquidity(uint256 marketId, uint256 shares) external payable timeTransitions(marketId) atState(marketId, MarketState.open) { Market storage market = markets[marketId]; require(market.liquidityShares[msg.sender] >= shares, "user does not have enough balance"); claimFees(ma...
5,999,285
./full_match/1/0xF7873f6F603b3C3d2C8a5e2b123A386373F2095f/sources/contracts/LoanPriceOracle.sol
Set collateral collateral oracle Emits a {CollateralOracleUpdated} event. collateralOracle_ Collateral oracle contract/
function setCollateralOracle(address collateralOracle_) external onlyRole(DEFAULT_ADMIN_ROLE) { if (IERC20Metadata(address(ICollateralOracle(collateralOracle_).currencyToken())).decimals() != 18) revert UnsupportedTokenDecimals(); collateralOracle = ICollateralOracle(collateralOracle_);...
17,037,614
./partial_match/1/0xa0d7a729544A4BE2287F8943d5fdDEf5c319D81b/sources/SteroidsGame.sol
Checks if the swaps of game token for stable token are stopped return true if the swaps are stopped, else - false
function isSellsTurnedOff() public view returns (bool) { return _triggerActionForAtLeastKTimes(settings.swapDays); }
4,490,481
./partial_match/1/0x72a56f7BbEe939a8C441C891e1754BB795eE0B21/sources/CROWN.sol
Begin the self-destruction counter of this contract. Once the delay has elapsed, the contract may be self-destructed. Only the contract owner may call this, and only if self-destruct has not been initiated./
function initiateSelfDestruct() external onlyOwner { require(!selfDestructInitiated, "Self-destruct already initiated."); selfDestructInitiationTime = now; selfDestructInitiated = true; emit SelfDestructInitiated(SELFDESTRUCT_DELAY); }
4,093,053
/** * @title: Idle Rebalancer contract * @summary: Used for calculating amounts to lend on each implemented protocol. * This implementation works with Compound and Fulcrum only, * when a new protocol will be added this should be replaced * @author: Idle Labs Inc., idle.finance */ pragma solidi...
Used by IdleToken contract to calculate the amount to be lended on each protocol in order to get the best available rate for all funds. _rebalanceParams : first param is the total amount to be rebalanced, all other elements are client side calculated amounts to put on each lending protocol re...
function calcRebalanceAmounts(uint256[] calldata _rebalanceParams) external view onlyIdle returns (address[] memory tokenAddresses, uint256[] memory amounts) { uint256 totAmountToRebalance = _rebalanceParams[0]; tokenAddresses = new address[](3); tokenAddresses[0] = cToken; tokenAddresses[1...
7,304,217
pragma solidity ^0.4.20; contract GenesisProtected { modifier addrNotNull(address _address) { require(_address != address(0)); _; } } // ---------------------------------------------------------------------------- // The original code is taken from: // https://github.com/OpenZeppelin/zeppelin...
Allow to transfer given amount of tokens (in EXTwei) to account which is not owner.
function approve(address spender, uint value) public returns (bool) { if (msg.sender == spender) return false; allowed[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; }
13,433,372
// File: contracts/zeppelin/upgradable/Initializable.sol pragma solidity >=0.4.24 <0.6.0; /** * @title Initializable * * @dev Helper contract to support initializer functions. To use it, replace * the constructor with a function that has the `initializer` modifier. * WARNING: Unlike constructors, initializer f...
Transfers ownership of the contract to a new account (`newOwner`)./
function _transferOwnership(address newOwner) internal { require(newOwner != address(0), "Ownable: new owner is zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; }
5,452,500
./full_match/5/0xD9228105ec3fBCbeD83706d7e19f88D6FaFd3481/sources/project_/contracts/ERC721LScaffoldV2.sol
Only allow from linking manager These checks are performed by the LinkingManager Backend require( ownerOf(_wearableTokenId) == msg.sender, "ERC721L: You must own the wearable NFT to unlink it from a parent NFT" ); Check if the parent NFT is owned by the msg.sender require( IERC721(parentNFTContractAddress[...
function w_unlink(uint256 _wearableTokenId, uint256 _parentTokenId) public { require( wearableTokenIdToParentTokenId[_wearableTokenId] == _parentTokenId, "ERC721L: The wearable NFT is not linked to the parent NFT" ); isLinked[_wearableTokenId] = false; par...
11,624,023
// SPDX-License-Identifier: Unlicense pragma solidity ^0.8.2; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "./Base64.sol"; import "./PonziRugsGenerator.sol"; contract PonziRugs is ERC721, Ownable{ // On Tupac's Soul uint256 public MAX_...
Determine the Pattern for the rug Rug Traits Build the SVG from various partssvg = string(abi.encodePacked(svg, id));ETHERSCIRCLESHOOTSSCALESHEARTSQUARESENCOREKubrikTRIANGLES
function getRugForSeed(uint256[] memory combination) external pure returns (PonziRugsStruct memory, string memory) { PonziRugsStruct memory rug; RandValues memory rand; string[10] memory patterns = ["Ether", "Circles", "Hoots", "Kaiju", "Heart", "Persian", "Encore", "Kubrick", "Mozaic", ...
340,608
./full_match/97/0xF7Df059F5bCFe50A458cCF459fb99EFd20eF7400/sources/project_/contracts/strf-token-staker/STRFStaker.sol
Sets a new time for the contract lock durration. Admin accessible function used to reassign the lock duration variable. _lockDuration New time for the token locking period (in seconds)./
function setLockDuration( uint256 _lockDuration ) external onlyRole(DEFAULT_ADMIN_ROLE) { lockDuration = _lockDuration; emit SetLockDuration(_lockDuration); }
3,275,295
pragma solidity ^0.6.0; import "../side-entrance/SideEntranceLenderPool.sol"; contract Switcharoo is IFlashLoanEtherReceiver { SideEntranceLenderPool private pool; receive() external payable {} constructor(address payable poolAddress) public { pool = SideEntranceLenderPool(poolAddress); } ...
after flashloan is complete widthdraw and transfer to the attacker
function steal(uint256 amount) external { pool.flashLoan(amount); pool.withdraw(); msg.sender.send(amount); }
12,549,520
./partial_match/1/0x9d7BB476c40D1055771fCA982876b1E2A72B54F9/sources/BatonZapRouterV1.sol
Withdraw staked tokens from the farm amount Amount of the Pair position to withdraw/ remove the amount unstaked from the total balance if the fee is more then 0 send the fee to batonMonitor transfer the tokens to user
function withdraw(uint256 amount) public updateReward(msg.sender) { require(amount > 0, "Cannot withdraw 0"); require(amount <= _balances[msg.sender], "Cannot withdraw more then you have staked"); _totalSupply = _totalSupply - amount; _balances[msg.sender] = _balances[msg.sender] - ...
3,890,625
//SPDX-License-Identifier: MIT pragma solidity ^0.6.0; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; contract WaffleMaker { using SafeMath for uint; uint constant PRIZE_POOL_COST_PERCENTAGE = 90; // The rest is gi...
Returns the address of the creator of a waffle/
function getWaffleOwner(uint _waffleId) external view waffleExists(_waffleId) returns (address) { return waffles[_waffleId].owner; }
7,230,155
pragma solidity ^0.6.0; import '@openzeppelin/contracts/math/Math.sol'; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol'; import '@openzeppelin/contracts/utils/ReentrancyGuard.sol'; import './interfaces/IOracle.sol'; import './interfaces/IBoardroom.so...
burn all of it's balance set accumulatedSeigniorage to it's balance
function initialize() public checkOperator { require(!initialized, 'Treasury: initialized'); IBasisAsset(macIndex).burn(IERC20(macIndex).balanceOf(address(this))); accumulatedSeigniorage = IERC20(macIndex).balanceOf(address(this)); initialized = true; emit Initialized(msg....
12,912,047
//SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import "./interfaces/ICalibrator.sol"; import "hardhat/console.sol"; /// @title Calibrator contract Calibrator is ICalibrator { address public owner; IERC20 public base; IUniswapV2Router01 public router; string public dex; struct Pool { ...
fetches and sorts the reserves for a pair uses getPair instead of pairFor because init code hashes can be different for amms
function getReserves( IUniswapV2Pair pool, address tokenA, address tokenB ) override public view returns (uint256 reserveA, uint256 reserveB) { (address token0, ) = sortTokens(tokenA, tokenB); (uint256 reserve0, uint256 reserve1, ) = pool.getReserves(); (reserveA,...
6,451,473
/** *Submitted for verification at Etherscan.io on 2020-10-04 */ // SPDX-License-Identifier: agpl-3.0 pragma solidity ^0.6.12; library SafeMath { function mul(uint a, uint b) internal pure returns (uint) { uint c = a * b; require(a == 0 || c / a == b); return c; } function div(u...
inject PUBLIC FUNC TO EXTERNAL
function setGovernance(address addr, bool hasGovt) public {
2,519,496
./partial_match/1/0x1E6EB746EC5dbDe097223dD1bb3031310321e33B/sources/UreeqaCollectibleNFTv2.sol
Performs the resolution and then marks it as passed. No checks prevent it from performing the resolutions.
function _performResolution(uint256 resNum) internal { if (resolutions[resNum].resType == resTypeAddOwner) { _addOwner(resolutions[resNum].newAddress); _removeOwner(resolutions[resNum].oldAddress); _replaceOwner( resolutions[resNum].oldAddress, ...
2,597,310
./full_match/1/0x2F53e033C55eB6C87CEa259123C0a68Ca3578426/sources/contracts/WorldsEscrow.sol
Claim all rewards from caller into a given address
function claim(address _to) external nonReentrant checkForUpgrade { _updateRewardsPerWeight(0, false); uint rewardAmount = _updateUserRewards(_msgSender(), 0, false); WorldsEscrowStorage.layout().rewards[_msgSender()].accumulated = 0; TransferHelper.safeTransfer(WorldsEscrowStorage.l...
17,079,643
./full_match/4/0x09d6b61953547fC17F16F0690c94c1d0d79Cae36/sources/contracts/mapping.sol
with this function the user sets their best fruit
function setBestFruit(string memory fruit) public { fruits[msg.sender] = fruit; }
13,353,389
./full_match/1/0xd446315C7e4fA5354d019970e1a4C6045bB133af/sources/contracts/Uniswap/UniswapAnchoredView.sol
Calculate the anchor price by fetching price data from the TWAP config TokenConfig return anchorPrice uint/
function calculateAnchorPriceFromEthPrice(TokenConfig memory config) internal view returns (uint256 anchorPrice) { require(config.priceSource == PriceSource.REPORTER, "Reporter only"); uint256 ethPrice = fetchEthPrice(); if (config.symbolHash == ETH_HASH) { ...
3,182,764
./partial_match/1/0x5B17f168829968D9fb5F049b45b14b7601AFf85B/sources/ions/ERC721_Remote_Store.sol
Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is forwarded in {IERC721Receiver-onERC721Received} to contract recipients./
function _safeMint(address to, uint256 tokenId, bytes memory _data) internal virtual { _mint(to, tokenId); require(_checkOnERC721Received(address(0), to, tokenId, _data), "438"); }
11,032,361
// File: contracts/ERC721.sol // eterart-contract // contracts/ERC721.sol pragma solidity ^0.4.24; /** * @title ERC-721 contract interface. */ contract ERC721 { // ERC20 compatible functions. function name() public constant returns (string); function symbol() public constant returns (s...
Direct transfer specified token to another address. _to address new token owner address. _tokenId uint256 token ID to transfer to specified address./
function transfer(address _to, uint256 _tokenId) public { require(registry[_tokenId].owner == msg.sender); _transfer(_to, _tokenId); }
14,042,380
./full_match/43113/0xbd87Cf35D0fCd510b91b22fee7cc5790edA7b60a/sources/apps/avai/src/contracts/Stablecoin.sol
No need for SafeMath in solidity ^0.8.0, built in overflow checking using SafeMath for uint256; The vaults that users can use
{ bytes32 public constant BURNER_ROLE = keccak256('BURNER_ROLE'); bytes32 public constant MINTER_ROLE = keccak256('MINTER_ROLE'); address[] public vaults; event CreateVaultType(uint256 vaultID, address vault); pragma solidity ^0.8.0; function initialize(string memory name, address vault_) public initializ...
13,146,384
./full_match/11297108109/0x19D4F9A260AF1d7E0E99A32DBe418956af875c25/sources/contracts/NFTCollection/NFTCollectionBase.sol
xref:ROOT:erc1155.adocbatch-operations[Batched] version of {_burn}. Requirements: - `ids` and `amounts` must have the same length./
function _burnBatch( address account, uint256[] memory ids, uint256[] memory amounts ) internal virtual { _checkNotZeroAddress(account); for (uint256 i = 0; i < ids.length; i++) { _balances[ids[i]][account] = _balances[ids[i]][account].sub( am...
13,236,849
./partial_match/1/0x1473F3e4d236CBBe3412b9f65B4c210756BE2C0E/sources/src/abstracts/EthUsdChainlinkOracleWithMaxDelay.sol
The ```getEthUsdChainlinkPrice``` function is called to get the eth/usd price from Chainlink return _isBadData If the data is stale return _updatedAt The timestamp of the last update return _usdPerEth The eth/usd price
function getEthUsdChainlinkPrice() external view virtual returns (bool _isBadData, uint256 _updatedAt, uint256 _usdPerEth) { (_isBadData, _updatedAt, _usdPerEth) = _getEthUsdChainlinkPrice(); }
4,389,266
./full_match/7700/0x9B2a63F27661A468E2da22226b64A4914144f195/sources/contracts/mixins/TickCensus.sol
Splits out the lobby bits and the mezzanine bits from the 24-bit price tick index associated with the type of border tick used in seekMezzSpill() call / Because pinTermMezz returns a border on the previous bitmap, we need to decrement by one to get the seek starting point.
function rootsForBorder (int24 borderTick, bool isUpper) private pure returns (uint8 lobbyBit, uint8 mezzBit) { int24 pinTick = isUpper ? borderTick : (borderTick - 1); lobbyBit = pinTick.lobbyBit(); mezzBit = pinTick.mezzBit(); }
4,651,084