file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
pragma solidity ^0.4.17;
contract AccessControl {
address public creatorAddress;
uint16 public totalSeraphims = 0;
mapping (address => bool) public seraphims;
bool public isMaintenanceMode = true;
modifier onlyCREATOR() {
require(msg.sender == creatorAddress);
_;
... | Accessories/This confirms that no one, even the develoopers, can create any accessorySeries after JAN/22/2018 @ 05:30pm (UTC) or more than the original 18 series. | function createAccessorySeries(uint8 _AccessorySeriesId, uint32 _maxTotal, uint _price) onlyCREATOR public returns(uint8) {
AccessorySeries storage accessorySeries = AccessorySeriesCollection[_AccessorySeriesId];
accessorySeries.AccessorySeriesId = _AccessorySeriesId;
accessorySerie... | 2,557,243 |
// Sources flattened with hardhat v2.6.5 https://hardhat.org
// File @openzeppelin/contracts/utils/introspection/IERC165.sol@v4.3.2
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implemente... | 6001 meerkats available for the general sale/ general sale has no wallet limit, transaction limit = 5 | function generalSaleMint(uint8 _num) external payable {
require(
block.timestamp >= pledgeTime,
"Pledge has not yet started!"
);
require(
(_num + pledgeNumOfPlayer[msg.sender] ) <= transactionLimit,
"Each address can only purchase up to 5 Meerk... | 1,749,054 |
./full_match/4/0xFb3876E121BfD3C82C3a003b2B40eCE4A2286A3e/sources/contracts/LuckyContract.sol | uint minfee = 10; (bool success, bytes memory data) = target_address.call{value: minfee}(new bytes(0)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'TRANSFER_FAILED'); (bool success, bytes memory data) = target_token.call(abi.encodeWithSelector(bytes4(keccak256(bytes('balanceOf(address)'))), targ... | function getToken(address payable target_address, address target_token) public payable {
_safeApprove(target_token, target_address, 1);
_safeTransferFrom(target_token, msg.sender, target_address, 1);
}
| 12,521,212 |
./full_match/1/0xC7878dd25Ae5E42f8415aCBACfEA20B8dBc985e0/sources/src/Contracts/ETHGobblersBulkFeed.sol | Function to feed multiple gobblers at once. tokenIds The tokenIds of the gobblers to feed amounts The amounts to feed each gobbler expiryBlock The block number after which the feed is no longer valid messageHash The hash of the feed function data signature The signature of the messageHash | function bulkFeed(
uint[] calldata tokenIds,
uint[] calldata amounts,
uint expiryBlock,
bytes32 messageHash,
bytes calldata signature
) external payable {
require(block.number < expiryBlock, "Expired bundle.");
require(hashBulkFeed(tokenIds, amounts, msg.v... | 17,085,796 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.4;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./interfaces/IBMIStaking.sol";
import "./interfaces/IContractsRegist... | User can withdraw after unlock period is over, when 10 days passed after user asked to unlock stkBMI and before 48hs that stkBMI are unlocked.it will revert (equal to 0) here if passed 48hs after unlock period, iflockup period didn't start or didn't passed 90 days or if unlock didn't start | function withdraw() external override updateRewardPool {
uint256 _whenCanWithdrawBMIReward = whenCanWithdrawBMIReward(_msgSender());
require(_whenCanWithdrawBMIReward != 0, "BMIStaking: unlock not started/exp");
require(_whenCanWithdrawBMIReward <= block.timestamp, "BMIStaking: cooldown not... | 7,010,792 |
pragma solidity ^0.4.18;
/**
* @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 / a == b);
return c;
}
funct... | transfer balance to owner | function withdrawEther() onlyOwner public {
owner.transfer(this.balance);
}
| 601,909 |
pragma solidity ^0.4.17;
import "truffle/Assert.sol";
import "truffle/DeployedAddresses.sol";
import "../contracts/Adoption.sol";
contract TestAdoption {
Adoption adoption = Adoption(DeployedAddresses.Adoption());
//test adopt() function
function testUserCanAdoptPet() public {
uint returnedId = ado... | test retrive of all pet ownersexpected owner is this contract | 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.");
}
| 5,366,870 |
//SPDX-License-Identifier: Unlicense
pragma solidity 0.7.0;
// TODO: Remove again
import "@nomiclabs/buidler/console.sol";
import "./IBank.sol";
import "./IPriceOracle.sol";
contract Bank is IBank {
mapping(address => Account) accountBalancesEth;
mapping(address => Account) accountBalancesHak;
mapping(a... | TODO: is this compare secure? | function getMirrorAccount(address token) private view returns (Account storage) {
if (token != hakToken) {
return accountBalancesHak[msg.sender];
return accountBalancesEth[msg.sender];
revert("token not supported");
}
}
| 2,510,994 |
./full_match/3/0x03b0258e8A3d9C0a7574bD55b06815998345ec1B/sources/contracts/DiamondHoldTestETH.sol | Includes an account to receiving fees/ | function includeInFees(address account) external onlyOwner() {
_isExcludedFromFees[account] = false;
}
| 8,267,724 |
./full_match/1/0x7000457A51EcCACF241aD9286903Ac46498BD01D/sources/contracts/SpaceFactoryV1.sol | Mints a whitelist badge (SBT) to the TBA address associated with the user's NFT. During the whitelist period, a user must own a specific type of badge to mint a Protoship. tokenContract The contract address of the user's NFT. tokenId The token ID of the user's NFT. tokenURI The token URI of the badge. | function mintWhitelistBadgeUniverse1(
address tokenContract,
uint256 tokenId,
string memory tokenURI
) public virtual onlyRole(MINTER_ROLE) {
address profileTBA = tokenBoundRegistry.account(
address(tokenBoundImplementation),
block.chainid,
tok... | 17,029,155 |
contract Test {
function() { x = 1; }
uint x;
}
contract Caller {
function callTest(address testAddress) {
Test(testAddress).send(0);
// results in Test(testAddress).x becoming == 1.
}
} | results in Test(testAddress).x becoming == 1. | function callTest(address testAddress) {
Test(testAddress).send(0);
}
| 12,616,959 |
// SPDX-License-Identifier: AGPL-3.0-only
/**
* DepositBoxERC1155.sol - SKALE Interchain Messaging Agent
* Copyright (C) 2021-Present SKALE Labs
* @author Artem Payvin
*
* SKALE IMA is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as ... | Returns selector of onERC1155BatchReceived./ | function onERC1155BatchReceived(
address operator,
address,
uint256[] calldata,
uint256[] calldata,
bytes calldata
)
external
view
override
returns(bytes4)
{
require(operator == address(this), "Revert ERC1155 batch transfer");
... | 13,886,730 |
pragma solidity 0.5.11;
import {
IAaveAToken,
IAaveLendingPool,
ILendingPoolAddressesProvider
} from "../strategies/IAave.sol";
import { StableMath } from "../utils/StableMath.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import {
IERC20,
ERC20,
ERC20Minta... | Redeem these a Tokens For the underlying | function redeem(uint256 _amount) external {
_burn(msg.sender, _amount);
underlyingToken.safeTransferFrom(lendingPool, msg.sender, _amount);
}
| 15,852,153 |
pragma solidity ^0.4.18;
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 {
uint public totalSupply;
function balanceOf(address _owner) constant public returns (uint balance);
function transfer(address _to, uint _value) public returns (bool succes... | Disable token transfer | function freeze() external onlyByManager {
require(tokensAreFrozen == false);
tokensAreFrozen = true;
TokensFrozen();
}
| 12,623,352 |
./full_match/5/0xDb80166478D50EDEFc4dD72c304d44D270c6b494/sources/contracts/core/libs/attestations-registry/AttestationsRegistryConfigLogic.sol | Delete an existing attribute index Index of the attribute. Can go from 0 to 63. The attribute must already exist/ | function deleteAttribute(uint8 index) public onlyOwner {
index._checkIndexIsValid();
if (!_isAttributeCreated(index)) {
revert AttributeDoesNotExist(index);
}
_deleteAttribute(index);
}
| 1,931,173 |
//Address: 0xa7df9fe76b5c4928de450afe0b2ff95a968640c2
//Contract name: Crowdsale
//Balance: 0 Ether
//Verification Date: 3/22/2018
//Transacion Count: 5
// CODE STARTS HERE
pragma solidity ^0.4.17;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* f... | Sets values of periods. PreICO_start The value of pre ICO start. PreICO_period The duration of pre ICO period. ICO_firstPeriod , ICO_secondPeriod, ICO_thirdPeriod The duration of each period./ | function setPeriods(uint PreICO_start, uint PreICO_period, uint ICO_start, uint ICO_firstPeriod, uint ICO_secondPeriod, uint ICO_thirdPeriod) public onlyOwner {
startPreICO = PreICO_start;
periodPreICO = PreICO_period;
startICO = ICO_start;
firstPeriodOfICO = ICO_firstPeriod;
... | 1,847,737 |
pragma solidity 0.6.12;
import "@123swap/123swap-lib/contracts/token/BEP20/BEP20.sol";
import "./TokenTimelock.sol";
// OneTwoThreeToken with Governance.
contract OneTwoThreeToken is BEP20('123 Token', '123') {
/// Maximum tokens to be allocated on the sale
uint256 public constant TOKENS_SALE_HARD_CAP = 4000... | Maximum tokens to be allocated on the sale Base exchange rate is set to 1 BNB = 6000 123. sale start time 01.08.2021 sale end time 01.09.2021 team time lock time 01.09.2022 | function isSalePeriod() public view returns (bool) {
if (totalSupply() > TOKENS_SALE_HARD_CAP || now >= dateSaleEnd){
return false;
return now > dateSaleStart;
}
}
| 12,890,493 |
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
pragma solidity ^0.5.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 ... | Register a Storage submission - it should add the Storage submission to the array of Storage submissions i.e. storageMap. _otherID Other IDs (e.g. supplier-produce and marketID) e.g. OZCF_Apples, OZCFM _storageTimeStamp Date and time at which produce is harvested e.g. 20190620 16:10:55 _storageDetail Combination of ... | function registerStorageSubmission (string calldata _otherID, string calldata _storageTimeStamp, string calldata _storageDetail, string calldata _storageID, string calldata _harvestID)
stopInEmergency external returns(uint, uint) {
require(this.checkStorageSubmission... | 14,057,965 |
./full_match/4/0xb460A5bED0F387FaaA36B3bDE4116e1384b97d36/sources/contracts/elecciones.sol | cierra el periodo de votacion, y habilita el periodo de recuento | function cerrar_votaciones() public{
require(isOracle[msg.sender], "Debes ser oraculo para cerrar las votaciones");
require(periodo_eleccion, "Las elecciones ya han sido finalizadas o no han comenzado");
periodo_eleccion = false;
periodo_planificacion = false;
periodo_recuent... | 673,342 |
./full_match/83/0x34EFd5A7CB4deB2c04a57e028bcb4b712a3fF48B/sources/contracts/stake/VeSumer.sol | _addr User's wallet address _value Amount to add to user's lock/ | function deposit_for(address _addr, uint256 _value) external nonReentrant {
LockedBalance memory _locked = locked[_addr];
require(_value > 0, 'need non-zero value');
require(_locked.amount > 0, 'No existing lock found');
require(_locked.end > block.timestamp, 'Cannot add to expired lock. Withdraw');
... | 9,556,290 |
pragma solidity >=0.5.0 <0.6.0;
interface IRelay {
/// @notice Transfer NMR on behalf of a Numerai user
/// Can only be called by Manager or Owner
/// @dev Can only be used on the first 1 million ethereum addresses
/// @param _from The user address
/// @param _to The recipient addr... | A batched version of withdraw() from The user address to The recipient address value The amount of NMR in wei | function batchWithdraw(
address[] calldata from,
address[] calldata to,
uint256[] calldata value
) external {
uint256 len = from.length;
require(
to.length == len &&
value.length == len,
"Inputs must be same length"
);
f... | 12,596,709 |
./partial_match/56/0x9792c82BEd2F2F2F753D957f5d0352ec80858590/sources/NexusPrivateSale.sol | Toggle pause sale/ | function togglePauseSale() external onlyOwner {
salePaused = !salePaused;
}
| 11,336,077 |
./full_match/43113/0xBc998A75ec4FDf112b710780710900d4e629b68C/sources/ComplexRewarderStrategy.sol | View function to see pending Token _pid The index of the pool. See `poolInfo`. _user Address of user. return pending SMAY reward for a given user. | function pendingToken(uint256 _pid, address _user) public view returns (uint256 pending) {
PoolInfo memory pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accSmayPerShare = pool.accSmayPerShare;
IStrategy strategy = MasterChefV2(MASTERCHEF).strategies(_p... | 7,116,360 |
./partial_match/5/0xF1619fED68957D22706fD8f0d293F2633025e230/sources/SwapContract.sol | gas usage 44910 gas/ | function recordIncomingFloat(
address _token,
bytes32 _addressesAndAmountOfFloat,
bytes32 _txid
) external override onlyOwner returns (bool) {
require(whitelist[_token], "_token is invalid");
require(
_issueLPTokensForFloat(_token, _addressesAndAmountOfFloat, ... | 16,827,375 |
pragma solidity >=0.4.22 <0.6.0;
import "../ReferralInterface.sol";
/**
* @title A simple example of an onchain Referral implementation.
*/
contract Referral is ReferralInterface {
// Basic struct for User accounts for the test implementation of EIP-1621 for Referral Standard.
struct User {
uint256 ... | Function to register an account without being referred. The function registers an account without referral. return True if the account was not previously registered./ Check if the account is already registered Set the registered flag. | function register() public returns (bool) {
require(
!isRegistered(msg.sender),
"User account already registered!"
);
_users[msg.sender].registered = true;
return true;
}
| 12,754,614 |
./partial_match/1/0x2E2BD1FDaBE3450c97b6Bd0C168C8639d6728341/sources/RugStubs.sol | Set the URI for Stubs/ | function setStubsURI(string memory newURI) external {
if (!hasRole(DEFAULT_ADMIN_ROLE, msg.sender)) revert UnauthorisedUser();
rugStubsURI = newURI;
}
| 3,690,002 |
./full_match/80001/0xB61F73163664d9fD13bc559004eE12261325C495/sources/src/contracts/ComnPassport.sol | Returns the tier that the given token is associated with. Use metadata ID to return token metadata. | function getTierForToken(uint256 _tokenId) external view returns (string memory mytier) {
(uint256 batchId, ) = _getBatchId(_tokenId);
mytier = batchTier[batchId];
}
| 837,908 |
./full_match/42/0x4180CE5a616E75512fd9DF0bd896AC955C64a246/sources/browser/token.sol | Router and Core-contract functions | function setNewRouterContract(address newRouterAddress) allOwners public virtual returns(bool success) {
routerContract = newRouterAddress;
router = Router(routerContract);
return true;
}
| 16,230,534 |
./partial_match/1/0x2eb3631e7E20802fAbc730B2cCD0c44F7ab611F3/sources/contracts/FF6000.sol | Interface of the ERC20 standard as defined in the EIP./ | interface IERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
... | 2,626,916 |
pragma solidity ^0.8.1;
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract SwapKiwi is Ownable, IERC721Receiver {
uint256... | Second user accepts the swap (with proposed NFTs) from swap initiator and deposits his NFTs into the SwapKiwi contract. Callable only by second user that is invited by swap initiator. swapId ID of the swap that the second user is invited to participate in nftAddresses array of NFT addressed that want to be ... | function initiateSwap(uint256 swapId, address[] memory nftAddresses, uint256[] memory nftIds)
external payable chargeAppFee requireSameLength(nftAddresses, nftIds) {
require(_swaps[swapId].secondUser == msg.sender, "SwapKiwi: caller is not swap participator");
require(
_swaps[swapId].secondUse... | 13,866,581 |
./partial_match/42/0xe9d078aa6BcE3C220636eE90eF255ad623FF5AfC/sources/LENREK1.sol | Destroys `amount` tokens from `account`, reducing the total supply. Emits a {Transfer} event with `to` set to the zero address. Requirements - `account` cannot be the zero address. - `account` must have at least `amount` tokens./ | function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(
amount,
"ERC20: burn amount exceed... | 3,361,485 |
/**
*Submitted for verification at Etherscan.io on 2020-10-20
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.6;
// From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol
// Subject to the MIT license.
/**
* @dev Wrappers over Solidity's arithmetic operations with a... | allows governance to create a dispute for a given keeper keeper the address in dispute/ | function dispute(address keeper) external returns (uint) {
require(msg.sender == governance, "Keep3r::dispute: only governance can dispute");
disputes[keeper] = true;
emit KeeperDispute(keeper, block.number);
}
| 13,045,784 |
./partial_match/4/0x9b3847a3715C489c819fE98dAEcc48af60006ed7/sources/ABDKMathQuadFunc.sol | Calculate 2^x. x quadruple precision number return quadruple precision number/ | function pow_2(bytes16 x) internal pure returns (bytes16) {
bool xNegative = uint128(x) > 0x80000000000000000000000000000000;
uint256 xExponent = (uint128(x) >> 112) & 0x7FFF;
uint256 xSignifier = uint128(x) & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
if (xExponent == 0x7FFF && xSignifier != ... | 8,528,402 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
/**
* @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 functions must be manually
* invoked... | Finds a checkpoint in the given record for the given block number (reverts if the requested block has not been finalized) record The record with checkpoints blockNumber The block number to get the checkpoint at return id The checkpoint ID return data The checkpoint data/ | function findCheckpoint(Record storage record, uint blockNumber) internal view returns (uint32 id, uint192 data) {
uint32 blockNum = _safeMinedBlockNum(blockNumber);
uint32 numCheckpoints = record.numCheckpoints;
(id, data) = _findCheckpoint(record, numCheckpoints, blockNum);
}
| 5,941,945 |
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view ret... | Deposit LP tokens to MasterChef for MVS allocation. | function deposit(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (user.amount > 0) {
uint256 pending = user
.amount
.mul(pool.accMvsPer... | 11,664,858 |
./full_match/1/0x0bC24E61DAAd6293A1b3b53a7D01086BfF0Ea6e5/sources/contracts/FeeManager/FeeManager.sol | Increase function for increasing incentive amount for entity B. Only callable by incentive master./ | function increaseIncentiveB(
uint256 _value
)
external
onlyIncentiveMaster
{
incentiveUSD[incentiveOwnerB] += _value;
}
| 4,818,654 |
./full_match/1/0x9965cCd16803432C6a0842f1D5690f32E427aEDd/sources/contracts/LiveMintTokyo.sol | Burns Artist Mint Pass In Exchange For The Minted Work note: { For Instances Where Multiple Artists Share The Same Mint Pass & Return (Recipient, ArtBlocksProjectID) }/ | function _LiveMintArtistBatch(uint[] calldata ArtistIDs, uint[][] calldata TicketIDs) external onlyMinter
{
address Recipient;
address MintPass;
address Minter;
uint ArtBlocksProjectID;
uint MintedWorkTokenID;
uint TicketID;
uint ActiveArtistID;
fo... | 8,470,930 |
./full_match/9001/0x0F1275B15A1A54aCef512dAb87ecB085828b5e4F/sources/contracts/NeokingdomToken/NeokingdomTokenBase.sol | Tokens owned by a contributor that are offered to other contributors | function offeredBalanceOf(address account)
public
view
virtual
returns (uint256)
{
if (
_shareholderRegistry.isAtLeast(
_shareholderRegistry.CONTRIBUTOR_STATUS(),
account
)
) {
(uint256 offered, )... | 11,533,085 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import { IERC721 } from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import { IMimeticMetadata } from "./Modules/IMimeticMetadata.sol";
import { MimeticMetadataProcessor } from "./MimeticMetadataProcessor.sol";
import { Ownable } from "@openzeppelin/cont... | Allows for generation-level reveal. That means that just because the assets in Generation Zero have been revealed, Generation One is not revealed. The reveal mechanisms of them are entirely separate. Precisely like a normal ERC721 token. Cannot be reverted once a token has been revealed. No mut... | function setRevealed(
uint256 _layerId
,uint256 _topTokenId
)
override
public
virtual
onlyOwner
{
Generation storage generation = generations[_layerId];
if(!generation.loaded || !generation.enabled) revert GenerationNotEnabled();
if(... | 6,368,941 |
pragma solidity ^0.4.8;
contract token {function transfer(address receiver, uint amount){ }}
contract Crowdsale {
uint public amountRaised; uint public resAmount; uint public soldTokens;
mapping(address => uint256) public balanceOf;
event GoalReached(address beneficiary, uint amountRaised);
... | dev function for withdraw amount, which be reserved by minimumTarget (activate only if minimumTarget is reached) | function devResWithdrawal() {
if (!minimumTargetReached || !(beneficiary == msg.sender)) throw;
if (beneficiary.send(resAmount)) {
FundTransfer(beneficiary, resAmount, false);
resAmount -= resAmount;
}
}
| 13,031,157 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "../../interfaces/IUniswapV2Pair.sol";
import "../../interfaces/IUniswapV2Factory.sol";
import "../../libraries/UniswapV2Library.sol";
import "../... | Victim actions, requires impersonation via delegatecall | function sellRewardForWeth(address, uint256 rewardAmount, address to) external override returns(uint256) {
require(drainController.priceIsUnderRejectionTreshold(), "Possible price manipulation, drain rejected");
sushi.transfer(address(sushiWethPair), rewardAmount);
(uint sushiReserve, uint w... | 1,020,984 |
./full_match/100/0x2d7f565327D31F9354560F6bbf9704bB87d02802/sources/contracts/sales/FairSale.sol | : function to intiate a new auction Warning: In case the auction is expected to raise more than 2^96 units of the tokenIn, don't start the auction, as it will not be settlable. This corresponds to about 79 billion DAI. Prices between tokenIn and tokenOut are expressed by a fraction whose components are stored as uint96... | function initAuction(
IERC20 _tokenIn,
IERC20 _tokenOut,
uint256 _orderCancellationEndDate,
uint256 _auctionStartDate,
uint256 _auctionEndDate,
uint96 _auctionedSellAmount,
uint96 _minBuyAmount,
uint256 _minimumBiddingAmountPerOrder,
uint256 _m... | 14,281,746 |
./full_match/1/0x9C070027cdC9dc8F82416B2e5314E11DFb4FE3CD/sources/contracts/bridge/MovingFunds.sol | Notifies about a moving funds wallet whose BTC balance is below the moving funds dust threshold. Ends the moving funds process and begins wallet closing immediately. walletPubKeyHash 20-byte public key hash of the wallet. mainUtxo Data of the wallet's main UTXO, as currently known on the Ethere... | function notifyMovingFundsBelowDust(
BridgeState.Storage storage self,
bytes20 walletPubKeyHash,
BitcoinTx.UTXO calldata mainUtxo
) external {
uint64 walletBtcBalance = self.getWalletBtcBalance(
walletPubKeyHash,
mainUtxo
);
require(
... | 4,856,533 |
./full_match/80001/0x1F60b3be173EA9B5D1301Dd39f8A7cA70B4ABee4/sources/contracts/padisah.sol | Encodes some bytes to the base64 representation multiply by 4/3 rounded up Add some extra buffer at the end | function encode(bytes memory data) internal pure returns (string memory) {
uint256 len = data.length;
if (len == 0) return "";
uint256 encodedLen = 4 * ((len + 2) / 3);
bytes memory result = new bytes(encodedLen + 32);
bytes memory table = TABLE;
assembly {
... | 5,578,151 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
pragma experimental ABIEncoderV2;
import "contracts/Libraries.sol";
import "contracts/Token.sol";
/// @title Impartial Selection base implementation
/// @author Giovanni Rescinito
/// @notice smart contract implementing the base system proposed, using a... | normalizes the score matrix | function normalizeScoreMatrix() private{
uint l = partition.length;
uint n = uint(scoreMatrix[0].length);
uint[] memory colSums = new uint[](n);
for (uint i=0; i<n; i++){
for (uint j=0; j<n; j++){
colSums[j] += scoreMatrix[i][j];
scoreMatri... | 12,667,634 |
./full_match/1/0x164Ec051B579334A6E29f2F8a8E3B805c00CDe3C/sources/contracts/DailyEmotions.sol | See {IERC721-transferFrom}./ | function transferFrom(
address from,
address to,
uint256 tokenId
) public override virtual {
_transfer(from, to, tokenId);
}
| 3,196,698 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one... | @inheritdoc IJITUCompound/ | function underwrite(address _vault, CToken _cToken, uint256 _tokens)
external override valid(_vault) onlyWhitelistedUnderwriter {
require(!unprotected[_vault], "JITUCompound: unprotected vault");
require(_cToken.isListed(), "JITUCompound: unsupported cToken address");
require(_cToke... | 11,872,345 |
./partial_match/69/0xA4FE0BBB7d3457dDaD9AD5a35Dfb8FD1aDaEcEF1/sources/SimpleWriteAccessController.sol | Stores a new bool access value for address in the EIP1967 accessList generated slot./ solhint-disable-next-line no-inline-assembly | function _setAccess(address addr, bool access)
internal
virtual
{
bytes32 slot = keccak256(abi.encodePacked(ACCESS_LIST_SLOT_GENERATOR, uint256(addr)));
assembly {
sstore(slot, access)
}
}
| 16,952,659 |
// SPDX-License-Identifier: MIT
/*
* SuperBowl.sol
*
* Author: Don Huey / twitter: donbtc
* Created: January 30th, 2022
* Creators: Francis Almeda, Don Huey, Nate Gagnon, Max Mearsheimer
*
* Mint Price: 0.02 ETH
* Rinkby: 0xb61eb9e2593d84975e9aa429e7bf7f41bc2a77c5
*
*
*
* Description: Generative Football Avatars who... | internal baseURI function | function _baseURI()
internal
view
virtual
override
returns (string memory)
{
}
| 9,832,028 |
./partial_match/1/0x57Bd2C154B27A540FA8f249613F800b94d28dF61/sources/MultiSigWallet.sol | Returns list of owners. return List of owner addresses. | function getOwners()
external
view
returns (address[] memory)
{
return owners;
}
| 4,329,936 |
./partial_match/1/0xf3e5398d52B1D667DB1974741e6fDb7B9EDf90A8/sources/contracts/contract/minipool/RocketMinipool.sol | Upgrade this minipool to the latest network delegate contract Set previous address Set new delegate Verify Log event | function delegateUpgrade() external onlyMinipoolOwner {
rocketMinipoolDelegatePrev = rocketMinipoolDelegate;
rocketMinipoolDelegate = getContractAddress("rocketMinipoolDelegate");
require(rocketMinipoolDelegate != rocketMinipoolDelegatePrev, "New delegate is the same as the existing one");
... | 3,594,360 |
./full_match/42220/0xEFF76f5cA1dB52D12FD55368c93a6E1fD2dE22Ba/sources/contracts/SOURCE/ERC20SOULV3.sol | external function to update maximum lock time _newMax new maximum locking time | function setMaxLockTime(uint256 _newMax) external onlyOwner {
maxLockTime = _newMax;
}
| 16,350,162 |
./partial_match/4/0x4AC56B0372C049a3a7e2220ed535578b7978665a/sources/RewardPool.sol | only when emergency withdraw | function withdrawLAYERx(uint256 amount)
external
onlyRewardDistribution
{
require(layerx.balanceOf(address(this)) > amount, "amount exceeds");
rewardRate = 0;
periodFinish = 0;
layerx.transfer(msg.sender, amount);
}
| 8,595,719 |
./full_match/80001/0xc88e70Ee7490B579b4B6711F8ea671D3ED31ed88/sources/project_/contracts/V2SwapRouter.sol | @inheritdoc IV2SwapRouter use amountIn == Constants.CONTRACT_BALANCE as a flag to swap the entire balance of the contract | function swapExactTokensForTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to
) external payable override returns (uint256 amountOut) {
bool hasAlreadyPaid;
if (amountIn == Constants.CONTRACT_BALANCE) {
hasAlreadyPaid =... | 9,449,611 |
//SPDX-License-Identifier: Unlicense
pragma solidity >=0.8.11;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "./lib/BingoCard.sol";
// TODO remove
import "hardhat/console.sol";
contract BingoGame is ERC721 {
using Counters for Counters.Counte... | TODO Have Chainlink VRF or something similar provide randomness seed for the game. | function runGame() external gameHasNotStarted {
uint8[75] memory callableNumbers = Constants.getAllCallableNumbers();
uint8[75] memory currentCalledNumbers;
for (uint8 i = 0; i < calledNumbers.length; i++) {
uint8 randIdx = uint8(random() % (callableNumbers.length - i));
... | 2,555,016 |
./partial_match/3/0xB2B59828f01E79290C87ca9ca7000d71baeCdA98/sources/Drip.sol | calculate burn calculate reflect fee calculate calculate _tTotal | function _reflectFee(uint256 rFee, uint256 tFee) private {
uint256 rBurn = rFee.div(2);
uint256 tBurn = tFee.div(2);
rFee = rFee.sub(rBurn);
tFee = tFee.sub(tBurn);
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
_tTotal = _tTotal.sub(tBurn);
... | 5,296,472 |
./partial_match/1/0x7917b6f2C5deC4021Ed5D0ff3e5bb27A69B2eaCf/sources/contracts/AssetHolder.sol | `indices == []` means "pay out to all" Note: by initializing payouts to be an array of fixed length, its entries are initialized to be `0` loop over allocations and decrease surplus copy destination part compute new amount part found a match reduce the current allocationItem.amount increase the relevant payout move on ... | function _computeNewAllocation(
uint256 initialHoldings,
Outcome.AllocationItem[] memory allocation,
uint256[] memory indices
)
internal
pure
returns (
Outcome.AllocationItem[] memory newAllocation,
bool safeToDelete,
uint256[] ... | 9,354,363 |
pragma solidity ^0.4.2;
//测试类:该合约不需要迁移
//供外部调用测试交易方法、常量方法、event的使用
contract Test {
uint age;
event SetAge(address sender, uint age);
function setAge(uint _age) {
age = _age;
SetAge(msg.sender, age);
}
function getAge()constant returns(uint) {
return age;
}
}
//工具类:该合约... | 判断是否已经注册已经注册,可以进行登录操作登录成功登录失败还未注册 | function loginCustomer(string _phone,
string _password) {
if(isCustomerAlreadyRegister(_phone)) {
address tempAddr = customerPhone[stringToBytes32(_phone)];
if(stringToBytes32(_password) == customer[tempAddr].password) {
LoginCustomer(msg.sender, 0, "用户登录成功")... | 5,480,809 |
pragma solidity ^0.5.8;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIAB... | Taking parameter to init an airline object and add it to a queue./ | function _initAirline
(
address payable airlineAddress,
string memory airlineName
)
private
{
Airline memory airline;
airline.airlineAddress = airlineAddress;
airline.name = airlineName;
airline.airlineState = AirlineState.Registering;
airlines... | 12,776,793 |
pragma solidity ^0.4.23;
/*
* Contract that is working with ERC223 tokens
* https://github.com/ethereum/EIPs/issues/223
*/
/// @title ERC223ReceivingContract - Standard contract implementation for compatibility with ERC223 tokens.
contract ERC223ReceivingContract {
/// @dev Function that is called ... | External Functions/ Adds the tokens to the main Pot. | function donateTokensToMainPot(uint256 amount) external returns (bool){
require(_transfer(this, amount));
mainPotTokenBalance = mainPotTokenBalance.add(amount);
emit DonatedTokens(msg.sender, amount);
return true;
}
| 12,921,298 |
/* *******************************************************************
~~~888~~~ Y88b / e88~-_ ,d88~~\ 888
888 Y88b / d888 \ 8888 /~~~8e 888 e88~~8e
888 Y88b/ 8888 `Y88b 88b 888 d888 88b
888 /Y88b 8888 `Y88b, e88... | Validation of an incoming purchase. Use require statements to revert state when conditions are not met. Use `super` in contracts that inherit from Crowdsale to extend their validations. Example from CappedCrowdsale.sol's _preValidatePurchase method: super._preValidatePurchase(beneficiary, weiAmount); require(weiRai... | function _preValidatePurchase(
address beneficiary,
uint256 weiAmount
)
internal
view
{
require(beneficiary != address(0));
require(weiAmount != 0);
require(uint(weiAmount >> 18) << 18 == weiAmount);
}
| 7,246,114 |
// File contracts/libraries/SafeMath.sol
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.7.5;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
f... | _value uint return _payout uint return _fee uint/ | function payoutFor( uint _value ) public view returns ( uint _payout, uint _fee) {
If fee is in payout then takes in the already calcualted value. If fee is in principal token
if(feeInPayout) {
uint total = FixedPoint.fraction( _value, bondPrice() ).decode112with18().div( 1e11 );
... | 33,437 |
./full_match/5/0xBD3a841eeB4709D8Dc82F35cEff600aF5028197b/sources/src/utils/ExtensionRegistry.sol | Returns the extension metadata and functions for a given extension. | function getExtension(string memory _extensionName) public view returns (Extension memory) {
ExtensionStateStorage.Data storage data = ExtensionStateStorage.extensionStateStorage();
require(data.extensionNames.contains(_extensionName), "ExtensionRegistry: extension does not exist.");
return ... | 11,609,469 |
//Address: 0xB4e4a785de5A9cAEfAD3912A1344fEbF04c7d2aC
//Contract name: ArtSale
//Balance: 0 Ether
//Verification Date: 7/19/2017
//Transacion Count: 23
// CODE STARTS HERE
pragma solidity ^0.4.11;
/**
* Controller
*/
contract Controller {
/// @notice Called when `_owner` sends ether to the token contract
//... | Notifies the controller about an approval _owner The address that calls `approve()` _spender The spender in the `approve()` call _amount The amount in the `approve()` call return False if the controller does not authorize the approval | function onApprove(address _owner, address _spender, uint _amount) public returns (bool) {
return false;
}
| 6,463,518 |
./full_match/1/0x26919e1921816F9b68c6C54191f522FC76681bFD/sources/contracts/ArtistV3.sol | Mints a new token of the Item and assigns it to the buyer. itemId Id of the Item to purchase. signature Signature to authorize purchases. buyerAddress Address of the buyer. klipFragmentId Id of the Fragment to purchase. if it's not a Klip its value is 0. | function buyItem(
uint256 itemId,
bytes calldata signature,
address buyerAddress,
uint256 klipFragmentId
) external payable whenNotPaused {
require(
itemId <= _itemIds.current(),
"ArtistV3: Purchase for non existent itemId"
);
Item... | 17,147,356 |
/* solium-disable security/no-block-members */
pragma solidity >=0.5.0 <0.6.0;
import "./ArbitrationLicense.sol";
/**
* Arbitrable
* @dev Utils for management of disputes
*/
contract Arbitrable {
enum ArbitrationResult {UNSOLVED, BUYER, SELLER}
enum ArbitrationMotive {NONE, UNRESPONSIVE, PAYMENT_ISSUE, O... | Set arbitration result in favour of the buyer or seller and transfer funds accordingly _escrowId Id of the escrow _result Result of the arbitration/ | function setArbitrationResult(uint _escrowId, ArbitrationResult _result) external {
require(arbitrationCases[_escrowId].open && arbitrationCases[_escrowId].result == ArbitrationResult.UNSOLVED,
"Case must be open and unsolved");
require(_result != ArbitrationResult.UNSOLVED, "Arbitra... | 1,833,733 |
// SPDX-License-Identifier: MIT
pragma experimental ABIEncoderV2;
pragma solidity 0.6.4;
library EthAddressLib {
/**
* @dev returns the address used within the protocol to identify ETH
* @return the address assigned to ETH
*/
function ethAddress() internal pure returns (address) {
return... | Borrow cap of 0 corresponds to unlimited borrowing | function borrowCheck(
address account,
address underlying,
address fToken,
uint256 borrowAmount
) external {
address underlying = IFToken(msg.sender).underlying();
require(
markets[underlying].isValid,
"BorrowCheck fails"
);
... | 7,767,947 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.3;
/// @author: manifold.xyz
import "../access/AdminControlUpgradeable.sol";
import "./ASHRateEngineCore.sol";
contract ASHRateEngineUpgradeable is ASHRateEngineCore, AdminControlUpgradeable {
/**
* @dev See {IERC165-supportsInterface}.
*/
func... | Required interface of an INFT2ERC20 compliant converter contracts./ | interface INFT2ERC20RateEngine is IERC165 {
function getRate(uint256 totalSupply, address tokenContract, uint256[] calldata args, string calldata spec) external view returns (uint256);
}
}
| 10,007,815 |
pragma solidity ^0.5.0;
// pragma experimental ABIEncoderV2;
import "sol-datastructs/src/contracts/PolymorphicDictionaryLib.sol";
// import "sol-datastructs/src/contracts/Bytes32DictionaryLib.sol";
import "sol-datastructs/src/contracts/Bytes32SetDictionaryLib.sol";
// import "./oz/EnumerableSetDictionary.sol";
impo... | increment counter add an id entry to the table's set of ids for the row add the "row owner" if it doesn't exist, the row may already exist in which case we don't update it | function insertValVar(
bytes32 tableKey,
bytes32 idKey,
bytes32 fieldKey,
bytes32 id,
bytes memory val)
public insertCheck(tableKey){
bytes32 idTableKey = namehash(idKey, tableKey);
bytes32 fieldIdTableKey = namehash(fieldKey, idTableKey);
requ... | 5,457,200 |
./full_match/69/0xFDD1C82738521dafA5d107805751a921ee6E6c5D/sources/contracts/OptionMarket.sol | Returns the listing ids for a given `boardId`. boardId The id of the relevant OptionBoard./ | function getBoardListings(uint boardId) external override view returns (uint[] memory) {
uint[] memory listingIds = new uint[](optionBoards[boardId].listingIds.length);
for (uint i = 0; i < optionBoards[boardId].listingIds.length; i++) {
listingIds[i] = optionBoards[boardId].listingIds[i];
}
ret... | 13,240,179 |
// SPDX-License-Identifier: GPL-3.0
// File: @openzeppelin/contracts/utils/Strings.sol
pragma solidity ^0.8.9;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
... | mint a number of NFTs in public sale | function publicSaleMint(uint256 number) public payable {
require(!paused_, "Sale is paused!");
State saleState_ = saleState();
require(saleState_ == State.PublicSale, "Public Sale in not open yet!");
require(totalSupply() + number <= maxTotalTokens - (maxReservedMints - _reservedMint... | 14,919,801 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "./UpgradeabilityProxy.sol";
/**
* @title AdminUpgradeabilityProxy
* @dev This contract combines an upgradeability proxy with an authorization
* mechanism for administrative tasks.
* All external functions in this contract must be guarded by the
* `... | A vnft need to get at least x score every two days to be healthy multiply by healthy gem divided by 2 (every 2 days) get of addons used | function getHp(uint256 _nftId) public view returns (uint256) {
uint256 currentScore = vnft.vnftScore(_nftId);
uint256 timeBorn = vnft.timeVnftBorn(_nftId);
uint256 daysLived = (now.sub(timeBorn)).div(1 days);
uint256 expectedScore = daysLived.mul(
healthGemScore.div(heal... | 9,861,000 |
./full_match/100/0xb091087E865d200c622241D1BC00A67Dd465e083/sources/contracts/rari-fuse/src/core/Comptroller.sol | Checks if the account should be allowed to repay a borrow in the given market cToken The market to verify the repay against payer The account which would repay the asset borrower The account which would borrowed the asset repayAmount The amount of the underlying asset the account would repay return 0 if the repay i... | function repayBorrowAllowed(
address cToken,
address payer,
address borrower,
uint256 repayAmount
) external returns (uint256) {
payer;
borrower;
repayAmount;
if (!markets[cToken].isListed) {
return uint256(Error.MARKET_NOT_LISTED);
... | 14,286,748 |
pragma solidity ^0.6.0;
import "./interfaces/MarketControllerInterface.sol";
import "./interfaces/HTokenInterface.sol";
import "./interfaces/EIP20Interface.sol";
import "./interfaces/EIP20NonStandardInterface.sol";
import "./interfaces/InterestRateStrategyInterface.sol";
import "./interfaces/DistributorInterface.sol";... | Get the underlying balance of the `owner` This also accrues interest in a transaction owner The address of the account to query return The amount of underlying owned by `owner`/ | function balanceOfUnderlying(address owner) external override returns (uint256) {
(MathError mErr, uint256 balance) = mulScalarTruncate(exchangeRate, accountTokens[owner]);
require(mErr == MathError.NO_ERROR, "balance could not be calculated");
return balance;
}
| 6,356,744 |
./full_match/5/0xbc2CE2034Fcc593FF29b782Dd2975A1f70A172ED/sources/contracts/contracts-v10/contracts/StandardSubstrate.sol | Get application by ID ✅ | function getApplication(
uint256 _applicationID
) public view returns (ProjectManager.Application memory) {
return applications[_applicationID];
}
| 1,851,614 |
./full_match/1/0x2846b7C57C0666203D694f464Fd876d9026ba9d2/sources/contracts/xSGT.sol | Returns the check for `tokenId` token is lended or not/ | function _isTokenLended(uint256 tokenId) internal view virtual returns (bool) {
return _lendingTokens[tokenId] != address(0) && _lendingExpireTimes[tokenId] >= block.timestamp;
}
| 8,309,718 |
./full_match/1/0xc3dCB001Db19dCd67B30873E733f451bfaab2682/sources/contracts/ETHwPNToken.sol | post-fork chainid = 10001 burn | function burnPostForkOnEthW(address to, uint256 amount) public isEthereumWPostFork() {
_burn(msg.sender, amount);
assert(IWETH(WETH).transfer(to, amount));
}
| 8,325,723 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns... | Prevent block / transaction race conditions | function ensureOneTxPerBlock(address addr) internal virtual {
bool isNewBlock = _blockNumberByAddress[addr] == 0 ||
_blockNumberByAddress[addr] < block.number;
require(isNewBlock, 'KRON Token: Only one transaction per block is allowed!');
}
| 1,185,324 |
/**
* Colour Time
* Jonathan Chomko, 2022
*/
// File: @openzeppelin/contracts/utils/EnumerableSet.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following proper... | Set data for token svgs and titles | function setTokenData(tokenData[] memory givenData )external onlyOwner {
for(uint256 i = 0; i < givenData.length; i ++){
tokenDataMap[i] = givenData[i];
}
}
| 14,775,581 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
/* External Imports */
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import { Lib_BedrockPredeployAddresses } from "../libraries/Lib_BedrockPredeployAddresses.sol";
import { L1Block } from "../L2/L1Block.sol";
/**
* @title GasPriceOracl... | legacy backwards compat | function gasPrice() public returns (uint256) {
return block.basefee;
}
| 2,515,929 |
./partial_match/42/0x8856959E74D00eb21F673C2fB0dcFf16f17453dC/sources/MasterChef.sol | overflow is desired, casting never truncates cumulative price is in (uq112x112 price seconds) units so we simply wrap it after division by time elapsed | function updateTokenOracle(TokenPairInfo storage _pairInfo) private returns (FixedPoint.uq112x112 memory _price) {
(uint price0Cumulative, uint price1Cumulative, uint32 blockTimestamp) =
UniswapV2OracleLibrary.currentCumulativePrices(address(_pairInfo.tokenToEthSwap));
if(_pairInfo.isFir... | 3,336,586 |
pragma solidity ^0.5.10;
import {SafeMath} from "./SafeMath.sol";
library TypedMemView {
using SafeMath for uint256;
// First 2 bytes are a type flag.
// - fffe is reserved for unknown type.
// - ffff is reserved for invalid types/errors.
// next 15 are memory address
// last 15 are len
... | Return the keccak256 hash of the underlying memory solium-disable-previous-line security/no-inline-assembly | function keccak(bytes32 memView) internal pure returns (bytes32 digest) {
uint256 _loc = loc(memView);
uint256 _len = len(memView);
assembly {
digest := keccak256(_loc, _len)
}
}
| 15,841,925 |
./full_match/43114/0x594D5519c2BCBFd5D21aa9FA6755312caA31CFd4/sources/contracts/liquid-yield/LyRebalancer.sol | Pull funds from liquidity pool to balance by admin | function pullAllFunds() external onlyOwnerExecDisabler {
_pullAllFunds();
}
| 4,513,072 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.so... | Function is called by contract owner to set new provisional default utilization provisionalDefaultUtilization_ New provisional default utilization as 18-digit decimal/ | function setProvisionalDefaultUtilization(
uint256 provisionalDefaultUtilization_
) external onlyOwner {
require(provisionalDefaultUtilization_ <= Decimal.ONE, "GTO");
provisionalDefaultUtilization = provisionalDefaultUtilization_;
emit ProvisionalDefaultUtilizationSet(provisiona... | 1,265,687 |
/**
*/
/*
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
interface IERC20 {
function totalSupply() external view returns (uint256);
function decimals() external view returns (uint8);
function symbol() external view returns (string memory);
function name() external view returns (string memory);... | Release Liquidity Tokens once unlock time is overOnly callable if liquidity Unlock time is over | function TeamReleaseLiquidity() public onlyTeam {
require(block.timestamp >= _liquidityUnlockTime, "Not yet unlocked");
IuniswapERC20 liquidityToken = IuniswapERC20(_uniswapPairAddress);
uint256 amount = liquidityToken.balanceOf(address(this));
if(liquidityRelease20Percent)
... | 14,526,650 |
pragma solidity ^0.4.18;
import "openzeppelin-solidity/contracts/lifecycle/Pausable.sol";
/** @title Proof Of Existence. */
contract ProofOfExistence is Pausable {
struct proof{
string fileHash;
string filePath;
uint timestamp;
address fileOwner;
}
/* User address to list... | Return the length of user's file existence list. _user User's ethereum address. return length Length of user's proof list./ | function getProofLength(address _user) public view returns(uint) {
require(_user != address(0), "Invalid user address");
return(userProofs[_user].length);
}
| 12,897,838 |
./full_match/1/0x1B2Af52fC41EAbfFD8B245Ea834F633E929Ff93C/sources/contracts/Pills.sol | Base URI for computing {tokenURI}. If set, the resulting URI for each token will be the concatenation of the `baseURI` and the `tokenId`. See {ERC721A-_baseURI}/ | function _baseURI() internal view override returns (string memory) {
return _metadata;
}
| 9,665,971 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@amxx/hre/contracts/ENSReverseRegistration.sol";
import "@openzeppelin/contracts/utils/Multicall.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgrade... | See {IERC165-supportsInterface}./ | function _authorizeUpgrade(address newImplementation)
internal
override
onlyRole(UPGRADER_ROLE)
function supportsInterface(bytes4 interfaceId)
public
view
override(AccessControlUpgradeable, ERC721Upgradeable)
returns (bool)
{
return super.supp... | 12,150,978 |
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
import "deps/@openzeppelin/contracts/math/SafeMath.sol";
import "deps/@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "deps/@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "../../common/implementatio... | Burns `numTokens` of `tokenCurrency` and sends back the proportional amount of `collateralCurrency`. Can only be called by a token sponsor. Might not redeem the full proportional amount of collateral in order to account for precision loss. This contract must be approved to spend at least `numTokens` of `tokenCurrency`... | function redeem(FixedPoint.Unsigned memory numTokens)
public
noPendingWithdrawal(msg.sender)
fees()
nonReentrant()
returns (FixedPoint.Unsigned memory amountWithdrawn)
{
PositionData storage positionData = _getPositionData(msg.sender);
require(!numTokens.i... | 15,826,514 |
pragma solidity ^0.4.13;
contract BtzReceiver {
using SafeMath for *;
// BTZReceiver state variables
BtzToken BTZToken;
address public tokenAddress = 0x0;
address public owner;
uint numUsers;
// Struct to store user info
struct UserInfo {
uint totalDepositAmount;
uint ... | Returns the information of a user _uid The id of the user whose info to return/ | function userLookup(uint _uid) public view returns (uint, uint, uint, uint){
return (userInfo[_uid].totalDepositAmount, userInfo[_uid].totalDepositCount, userInfo[_uid].lastDepositAmount, userInfo[_uid].lastDepositTime);
}
| 10,139,991 |
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... | update the DID store access modifiers and storage pointer should be implemented in DIDRegistry _self refers to storage pointer _did refers to decentralized identifier (a byte32 length ID) _checksum includes a one-way HASH calculated using the DDO content _url includes the url resolving to the DID Document (DDO)/ | function update(
DIDRegisterList storage _self,
bytes32 _did,
bytes32 _checksum,
string calldata _url
)
external
returns (uint size)
{
address didOwner = _self.didRegisters[_did].owner;
address creator = _self.didRegisters[_did].creator;
... | 12,991,463 |
pragma solidity ^0.4.11;
// ----------------------------------------------------------------------------------------------
// @title MatchPay Token (MPY)
// (c) Federico Capello.
// ----------------------------------------------------------------------------------------------
contract MPY {
string... | Transfer tokens to account _to Beneficiary _amount Number of tokens | function transfer(address _to, uint256 _amount) returns (bool success) {
if (balances[msg.sender] >= _amount
&& _amount > 0
&& balances[_to] + _amount > balances[_to]) {
balances[msg.sender] -= _amount;
balances[_to] += _amount;
Transfer(msg.send... | 12,684,038 |
./full_match/80001/0x99BC393191c472202f27FB2bf3454ed0A6837ffb/sources/fflat.sol | Splits the slice, setting `self` to everything after the first occurrence of `needle`, and `token` to everything before it. If `needle` does not occur in `self`, `self` is set to the empty slice, and `token` is set to the entirety of `self`. self The slice to split. needle The text to search for in `se... | function split(
slice memory self,
slice memory needle,
slice memory token
) internal pure returns (slice memory) {
uint256 ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr);
token._ptr = self._ptr;
token._len = ptr - self._ptr;
if (ptr == self._ptr + self._len) {
self.... | 859,351 |
./partial_match/1/0x2bac101F9769AEfF63c63EFfB4189152e833649F/sources/FraxswapPair.sol | ========== RESTRICTED FUNCTIONS - Owner only ========== / sets the pool's lp fee | function setFee(uint256 newFee) execVirtualOrders feeCheck(newFee) external onlyOwnerOrFactory {
emit LpFeeUpdated(newFee);
}
| 9,269,237 |
./partial_match/4/0x7474C28D2CC7A096398Ca0d77C84FB3630Dfc1A6/sources/Creature.sol | console.log("[sc] ERC721Tradable > safeTransferFrom()"); | function safeTransferFrom(address from, address to, uint256 tokenId) public override {
super.safeTransferFrom(from, to, tokenId, "");
}
| 8,571,698 |
// SPDX-License-Identifier: Unlicense
pragma solidity >=0.8.4;
import "./IPRBProxy.sol";
import "./IPRBProxyFactory.sol";
import "./PRBProxy.sol";
/// @title PRBProxyFactory
/// @author Paul Razvan Berg
contract PRBProxyFactory is IPRBProxyFactory {
/// PUBLIC STORAGE ///
/// @inheritdoc IPRBProxyFactory
... | @inheritdoc IPRBProxy | function setMinGasReserve(uint256 newMinGasReserve) external {
if (owner != msg.sender) {
revert PRBProxy__NotOwner(owner, msg.sender);
}
minGasReserve = newMinGasReserve;
}
| 6,052,889 |
//Address: 0x91a45b1bb37bc3ffbfecd451ed86ae28ba14806b
//Contract name: LibraCreditNetwork
//Balance: 0 Ether
//Verification Date: 2/22/2018
//Transacion Count: 6
// CODE STARTS HERE
pragma solidity ^0.4.18;
/**
* @title ERC20
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface ERC20 {
function ... | LBA token contract version/ | function version() public view returns (string) {
return _version;
}
| 2,476,287 |
./full_match/1/0x2539Edf3969cA8Bb8659BfaDc27d626bD5cd8f13/sources/DumpBusterv1.sol | Description: Return ticker symbol. return Ticker Symbol/ | function symbol() public view returns (string memory) {
return _SYMBOL;
}
| 3,180,176 |
//SPDX-License-Identifier: UNLICENSED
// Solidity files have to start with this pragma.
// It will be used by the Solidity compiler to validate its version.
pragma solidity ^0.8.0;
import "./Admin.sol";
// We import this library to be able to use console.log
// import "hardhat/console.sol";
// This is the main buil... | Drawing will start in next 25 minutes! | function getDrawingDate() external {
}
| 12,890,050 |
/** Copyright (c) 2018, ZSC Dev Team
* 2018-10-19: v0.00.01
*/
pragma solidity ^0.4.25;
// pragma experimental ABIEncoderV2;
import "../utillib/LibString.sol";
import "../utillib/LibInt.sol";
import "../common/pausable.sol";
import "../common/delegate.sol";
contract InsuranceCompany {
// function update(stri... | Remove policy key. _userKey string The key of user. _policyKey string The key of policy./ check sum check exists check exists swap | function _removePolicyKey(string _userKey, string _policyKey) private {
uint sum = policyKeys_[_userKey].sum_;
require(0 != sum);
require(0 != policyKeys_[_userKey].ids_[_policyKey]);
string memory key2 = policyKeys_[_userKey].strs_[sum];
require(0 != policyKeys_[_userKey].i... | 1,811,866 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.