file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "openzeppelin-contracts-3.4/proxy/Clones.sol";
import "synthetix/contracts/interfaces... | Initiates a cross-asset swap from a synthetic asset to a supported token. The caller will receive an ERC721 token representing their ownership of the pending cross-asset swap. swap the address of a Gondola pool to use to swap the given token to a bridging synth synthInKey the currency key of the synth to swap from t... | function synthToToken(
ISwap swap,
bytes32 synthInKey,
uint8 tokenToIndex,
uint256 synthInAmount,
uint256 minMediumSynthAmount
) external returns (uint256) {
require(synthInAmount != 0, "amount must be greater than 0");
bytes32 mediumSynthKey = getSynthKey... | 7,314,844 |
/* solhint-disable func-order, code-complexity */
pragma solidity 0.5.9;
import "./ERC721BaseToken.sol";
contract LandBaseToken is ERC721BaseToken {
// Our grid is 408 x 408 lands
uint256 internal constant GRID_SIZE = 408;
uint256 internal constant LAYER = 0xFF00000000000000000000000000000000000... | check whether address `who` is given minter rights. who The address to query. return whether the address has minter rights. | function isMinter(address who) public view returns (bool) {
return _minters[who];
}
constructor(
address metaTransactionContract,
address admin
| 12,554,374 |
pragma solidity ^0.5.16;
// Inheritance
import "./Owned.sol";
import "./MixinResolver.sol";
import "./interfaces/ISupplySchedule.sol";
// Libraries
import "./SafeDecimalMath.sol";
import "./Math.sol";
// Internal references
import "./Proxy.sol";
import "./interfaces/ISynthetix.sol";
import "./interfaces/IERC20.sol";... | Take timeDiff in seconds (Dividend) and mintPeriodDuration as (Divisor) return Calculate the number of minting periods since last mint rounded down/ Get minting periods since lastMintEvent If lastMintEvent not set or 0, then start from inflation start date. | function periodsSinceLastIssuance() public view returns (uint) {
uint timeDiff = lastMintEvent > 0 ? block.timestamp.sub(lastMintEvent) : block.timestamp.sub(inflationStartDate);
return timeDiff.div(mintPeriodDuration);
}
| 12,942,650 |
./full_match/1/0x1A5A0AA63f087Ca22240cCa16c726730cF02991A/sources/ForeverLuffy.sol | generate the uniswap pair path of token -> weth make the swap | function swapTokensForEth(uint256 tokenAmount) private {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
try uniswapV2Router.swapExactTokensForETHSu... | 2,914,767 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
contract reputationToken {
bytes10 public name = "Reputation";
bytes4 public symbol = "REPU";
bytes9 public version = "v1.0.0";
uint256 public granularity = 1;
// mapping that stores reputation amount per address
mapping(address => uint256)... | / loop through the users loop through the standards to apply to each user | function applyUserBatchStandard(UserBatch[] memory _batch) public onlyAdmin returns (bool) {
for (uint256 i=0; i < _batch.length; i++) {
int256 total;
UserBatch memory user = _batch[i];
StandardCount memory currentStandard;
InteractionStandard memory storedStandard;
bytes32 name;
... | 12,576,114 |
./full_match/8453/0x7654a0A63b877838577Fd38065A29C27f5bfC6d2/sources/contracts/Bridge.sol | Batch mint token to receiver in target chain _tokens All tokens that need to be transferred _fees The amount of handling charges corresponding to tokens | function mintTokens(
MintReq[] calldata _reqs,
bytes[] calldata _signs,
address[] calldata _tokens,
uint256[] calldata _fees
) public whenNotPaused {
require(_reqs.length == _signs.length, "Reqs length mismatch");
require(_tokens.length == _fees.length, "Fees leng... | 11,535,791 |
./full_match/44787/0xab772a2ef6eEcA06BAe4b6E508a23379B71945d9/sources/src/vaults/SpiralsCUSDImpactVault.sol | Deposit cUSD into Moola lending pool and convert mcUSD to wmcUSD./ Using SafeERC20Upgradeable slither-disable-next-line unused-return Convert mcUSD to wmcUSD. | function _stake(uint256 _amount) internal virtual override {
asset.approve(address(c_moolaLendingPool), _amount);
uint256 mcUSDBefore = getMCUSD().balanceOf(address(this));
c_moolaLendingPool.deposit(address(asset), _amount, address(this), 0);
uint256 mcUSDReceived = getMCUSD().bala... | 13,245,890 |
// SPDX-License-Identifier: unlicensed
/*
.:////:--:////:. _____ _ _ _ _
`////////////+++++/` / ____| | | | (_) | |
://////////++++++++/ | (___ __ _| | ___ ___| |_ ___| |_ __ _ _ __ _ __
/////////+++++++++o+ \___ \ ... | ------------------------------------------------------------------------ Transfer the balance from token owner's account to receiver account - Owner's account must have sufficient balance to transfer - 0 value transfers are allowed ------------------------------------------------------------------------ | function transfer(address receiver, uint tokens) public override returns (bool success) {
balances[msg.sender] = safeSub(balances[msg.sender], tokens);
balances[receiver] = safeAdd(balances[receiver], tokens);
emit Transfer(msg.sender, receiver, tokens);
return true;
}
| 952,985 |
./full_match/43114/0x0CE5807e595d4F91A7D745330B63Fc7dfD6D6a57/sources/contracts/MasterChef.sol | View function to see pending AVACOs on frontend. | function pendingAvaco(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accAvacoPerShare = pool.accAvacoPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
... | 4,532,091 |
// File: @openzeppelin/contracts/utils/ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions ... | Withdraws given LP Token stake amount from the pool _amount LP Tokens to withdraw/ | function withdraw(uint256 _amount)
public
onlyAfterStart
updatePeriod
{
require(_amount > 0, "Cannot withdraw 0");
_withdraw(_amount, period);
emit Withdrawn(msg.sender, _amount);
}
| 2,269,614 |
./full_match/5/0xCa26459D2865C17a79423c04dD2304B20bc8B0e7/sources/contracts/ERC1410Standard.sol | Decreases totalSupply and the corresponding amount of the specified partition of tokenHolder This function can only be called by the authorised operator. _partition The partition to allocate the decrease in balance. _tokenHolder The token holder whose balance should be decreased _value The amount by which to decrea... | function operatorRedeemByPartition(
bytes32 _partition,
address _tokenHolder,
uint256 _value
) external whitelisted(_tokenHolder) {
require(_tokenHolder != address(0), "Invalid from address");
require(
isOperator(msg.sender, _tokenHolder) ||
is... | 1,862,397 |
./full_match/4/0xed35f7A980987AeC418C70bb4e01CA4799EC6EFd/sources/kali.sol | validate signature elements | function voteBySig(address signer, uint256 proposal, bool approve, uint8 v, bytes32 r, bytes32 s) public nonReentrant virtual {
bytes32 digest =
keccak256(
abi.encodePacked(
"\x19\x01",
DOMAIN_SEPARATOR(),
keccak256(
... | 12,320,233 |
./full_match/1/0x79544C47AbC1d79F6B878490d5211af5414764d2/sources/contracts/Claimer.sol | Calculates the Unix Timestamp for a given TokenID/ | function ViewTimestampForTokenID ( uint TokenID ) public view returns ( uint )
{
uint MaxPerLocalInterval = _Claim._MaxPerIntermission;
uint SecondsIntermission = _Claim._SecondsIntermission;
uint Interval = _Claim._SecondsPerTokenID;
uint fullIntervals = TokenID / MaxPerLocalIn... | 8,422,662 |
// YouTweakIt Source code
pragma solidity ^0.4.18;
//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
// контракт для определения прав владения
contract Ownable {
address publ... | передать владение контрактом другому лицу | function transferOwnership(address newOwner) public onlyOwner {
if (newOwner != address(0)) {
owner = newOwner;
}
}
| 5,537,140 |
./full_match/1/0xB635C72Ef24F2a0f782E967Fa90FBCbf2406463B/sources/contracts/DecentralName.sol | Query many names to register | function queryManyNames(bytes32[] calldata inNamespaceList, bytes32[] calldata inNameList) public view returns (bool[] memory resultList, address[] memory ownerList, uint256[] memory priceList) {
uint256 nameListLen = inNameList.length;
require(nameListLen == inNamespaceList.length, 'E5');
r... | 3,191,320 |
pragma solidity 0.4.25;
// File: contracts/sogur/interfaces/ISGRTokenManager.sol
/**
* @title SGR Token Manager Interface.
*/
interface ISGRTokenManager {
/**
* @dev Exchange ETH for SGR.
* @param _sender The address of the sender.
* @param _ethAmount The amount of ETH received.
* @return Th... | Upon ETH transfer to an SGR holder. _to The address of the SGR holder. _value The amount of ETH to transfer. _status The operation's completion-status./ | function postTransferEthToSgrHolder(address _to, uint256 _value, bool _status) external {
require(false, "postTransferEthToSgrHolder is disabled");
_to;
_value;
_status;
}
| 1,729,521 |
./full_match/3/0xB09464f86D042d6caEf0D42B9965c1136855Af6C/sources/FirstContract.sol | This method relies on "extcodesize" to check if “msg.sender” is a smart contract address. This results in a vulnerability. Because code is only stored after the constructor execution. | function isContract(address account) public view returns (bool) {
uint size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
| 14,202,662 |
// File: @openzeppelin/contracts/GSN/Context.sol
pragma solidity ^0.6.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* man... | Only the actual admin operator can change the address/ | function setAdminOperator(address adminOperator_) public {
require(msg.sender == adminOperator, "Only the actual admin operator can change the address");
emit AdminOperatorChange(adminOperator, adminOperator_);
adminOperator = adminOperator_;
}
| 5,351,865 |
pragma solidity ^0.5.7;
pragma experimental ABIEncoderV2;
import "./SafeMath.sol";
import "./MatryxPlatform.sol";
import "./MatryxForwarder.sol";
import "./MatryxTournament.sol";
library LibCommit {
using SafeMath for uint256;
event GroupMemberAdded(bytes32 indexed commitHash, address indexed user);
even... | Returns all group members data Platform data struct commitHash Commit from line of work | function getGroupMembers(
address,
address,
MatryxPlatform.Data storage data,
bytes32 commitHash
)
public
view
returns (address[] memory)
{
bytes32 groupHash = data.commits[commitHash].groupHash;
return data.groups[groupHash].members;
... | 12,962,266 |
/*
-----------------------------------------------------------------
FILE HEADER
-----------------------------------------------------------------
file: Havven.sol
version: 1.0
authors: Anton Jurisevic
Dominic Romanowski
Mike Spain
date: 2018-02-05
checked: Mike Spain
appr... | Compute the last period's fee entitlement for the message sender and then deposit it into their nomin account. / Do not deposit fees into frozen accounts. check the period has rolled over first Only allow accounts to withdraw fees once per period. | function withdrawFeeEntitlement()
public
preCheckFeePeriodRollover
optionalProxy
{
address sender = messageSender;
require(!nomin.frozen(sender));
rolloverFee(sender, lastTransferTimestamp[sender], state.balanceOf(sender));
require(!hasWithdrawnLastPeri... | 1,230,152 |
/*
Copyright 2019 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... | Intended to be called during creation by the RebalancingSetTokenFactory. Can only be initialized once. This implementation initializes the rebalance fee. _rebalanceFeeCalldata Bytes encoded rebalance fee represented as a scaled percentage value/ | function initialize(
bytes calldata _rebalanceFeeCalldata
)
external
initializer
{
rebalanceFeeCalculator.initialize(_rebalanceFeeCalldata);
}
| 1,816,865 |
./partial_match/1/0xc773343AdB95E3888D754C927e0eaaA20589F3b4/sources/contracts/BDERC1155Tradable.sol | Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-free listings./TODO: FAILING HERE ON REGION SALEFailing from inside the transferFAME function (inside safeTransferFrom in the FAME contract itself)When being called by the Region contract as the operatorWith the user being the owner.WHY!... | function isApprovedForAll(address _owner, address _operator)
public
view
override
returns (bool isOperator)
{
ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress);
if (address(proxyRegistry.proxies(_owner)) == _operator) {
return true;
... | 3,651,575 |
./partial_match/56/0xEca7fC4c554086198dEEbCaff6C90D368dC327e0/sources/CommunityFund.sol | only restake more if at this epoch we could claim pending dollar rewards | function claimAndRestake() public checkPublicAllow {
if (IBoardroom(boardroom).canClaimReward(address(this))) {
if (earned() > 0) {
IBoardroom(boardroom).claimReward();
}
uint256 _shareBal = IERC20(share).balanceOf(address(this));
if (_shareBal... | 11,077,575 |
./partial_match/1/0xc6CadA314389430d396C7b0C70c6281e99ca7fe8/sources/src/contracts/FraxlendPairCore.sol | The ```addInterest``` function is a public implementation of _addInterest and allows 3rd parties to trigger interest accrual return _interestEarned The amount of interest accrued by all borrowers return _feesAmount The amount of fees paid to protocol return _feesShare The amount of shares distributed to protocol return... | function addInterest(
bool _returnAccounting
)
external
nonReentrant
returns (
uint256 _interestEarned,
uint256 _feesAmount,
uint256 _feesShare,
CurrentRateInfo memory _currentRateInfo,
VaultAccount memory _totalAsset,
... | 2,823,130 |
./full_match/1/0x88756e894E3705111AF3eC189B478abE332E820c/sources/contracts/PresaleV4.sol | To set status for claim whitelisting _status bool value/ | function setClaimWhitelistStatus(bool _status) external onlyOwner {
whitelistClaimOnly = _status;
}
| 9,628,148 |
// SPDX-License-Identifier: BUSDL-1.1
pragma solidity 0.6.11;
pragma experimental ABIEncoderV2;
import {IDetailedERC20} from "contracts/common/Imports.sol";
import {SafeERC20} from "contracts/libraries/Imports.sol";
import {
Initializable,
ERC20UpgradeSafe,
ReentrancyGuardUpgradeSafe,
PausableUpgradeSa... | Note the `initializer` modifier can only be used once in the entire contract, so we can't use it here. Instead, we protect this function with `onlyAdmin`, which allows only the `proxyAdmin` address to call this function. Since that address is in fact set to the actual proxy admin during deployment, this ensures this ... | function initializeUpgrade(address addressRegistry_) external onlyAdmin {
_setAddressRegistry(addressRegistry_);
_setupRole(DEFAULT_ADMIN_ROLE, addressRegistry.emergencySafeAddress());
_setupRole(ADMIN_ROLE, addressRegistry.adminSafeAddress());
_setupRole(EMERGENCY_ROLE, addressRegi... | 280,825 |
./partial_match/1/0x00000000000006c7676171937C444f6BDe3D6282/sources/contracts/helpers/PointerLibraries.sol | Copies `size` bytes from calldata starting at `src` to memory at `dst`. | function copy(
CalldataPointer src,
MemoryPointer dst,
uint256 size
) internal pure {
assembly {
calldatacopy(dst, src, size)
}
}
| 4,300,127 |
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error.
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
... | Transfer tokens to a specified address. to The address which you want to transfer to. amount The amount of tokens to be transferred. return A boolean that indicates if the operation was successful./ | function transfer(address to, uint256 amount) public returns (bool success) {
require(!freezed[msg.sender] && !blacklisted[msg.sender]);
require(to != address(0) && !freezed[to] && !blacklisted[to]);
require((!partners[msg.sender] && now >= publicRelease) || now >= partnersRelease);
... | 1,792,647 |
pragma solidity ^0.4.17;
/**
* @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);
return c;
}
function div(uint256 a, uint256 b) ... | How many contributors we have. return Number of different contributor ethereum addresses | function getContributorsCount() view public returns (uint256) {
return contributorsKeys.length;
}
| 2,281,568 |
./partial_match/3/0x46eFb12032b774641DeEAd633c195056A783d822/sources/AMF.sol | Allow any customer who hold tokens to claim BTC tokenAmount Amount of tokens to be exchanged (needs to be multiplied by 10^18) userBtcAddress BTC address on which users willing to receive payment /!\ gas cost for calling this method : 37kgas /!\/ | function claimBTC(uint256 tokenAmount, string memory userBtcAddress) public virtual returns (bool) {
_transfer(_msgSender(), owner(), tokenAmount);
emit BtcToBePaid(_msgSender(), userBtcAddress, tokenAmount);
return true;
}
address indexed customer,
string userBtcAddress,... | 5,286,503 |
// Copyright (C) 2021 Argent Labs Ltd. <https://argent.xyz>
// 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.
// T... | Counts the number of active guardians for a wallet. _wallet The target wallet. return _count The number of active guardians for a wallet./ | function guardianCount(address _wallet) external view returns (uint256 _count) {
return guardianStorage.guardianCount(_wallet);
}
| 2,524,194 |
./full_match/1/0x0bC24E61DAAd6293A1b3b53a7D01086BfF0Ea6e5/sources/contracts/FeeManager/FeeManager.sol | Increase function for increasing incentive amount for entity A. Only callable by incentive master./ | function increaseIncentiveA(
uint256 _value
)
external
onlyIncentiveMaster
{
incentiveUSD[incentiveOwnerA] += _value;
}
| 4,818,653 |
./partial_match/1/0x618B13100641F372663a099966304bC2A91FA939/sources/GOST.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(uint256 amount) internal virtual {
_totalSupply -= amount;
emit Transfer(address(this), address(0), amount);
}
| 15,645,387 |
./full_match/11155111/0x7B46b18C4bFCaf46Ef37BEf213DEb87da6131F11/sources/contracts/CrowdFunding.sol | Подсчет количества компаний с указанным пользователем Заполнение массива компаний с указанным пользователем | function userCampaigns() public view returns (Campaign[] memory) {
uint256 count = 0;
for (uint256 i = 0; i < numberOfCampaigns; i++) {
if (campaigns[i].owner == msg.sender) {
count++;
}
}
uint256 currentIndex = 0;
for (uint256 i = 0; i < numberOfCampaigns; i++) {
... | 3,806,803 |
// SPDX-License-Identifier: AGPL V3.0
pragma solidity 0.6.12;
// Part: AddressUpgradeable
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume... | Calculates AKRO amount according to vAkro account Whose funds to get balance return Akro amount recalculated/ | function balanceOfAkro(address account) public view returns (uint256) {
Balance storage b = holders[account];
uint256 amount = b.locked.add(b.unlocked);
uint256 akroAmount = amount.mul(swapToAkroRateNumerator).div(swapToAkroRateDenominator);
return akroAmount;
}
| 426,945 |
./partial_match/4/0x771ab0d54eD3B4FF0Ba80809b88D1F035FA4eae4/sources/SupplySchedule.sol | solhint-disable-next-line func-name-mixedcase | function _optionalProxy_onlyOwner() private {
if (
Proxy(msg.sender) != proxy &&
Proxy(msg.sender) != integrationProxy &&
messageSender != msg.sender
) {
messageSender = msg.sender;
}
| 8,509,744 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./interfaces/IERC721.sol";
import "./interfaces/IERC721Enumerable.sol";
import "./interfaces/IERC721Metadata.sol";
import "./interfaces/IERC721Receiver.sol";
import "./interfaces/IERC165.sol";
import "./IGBATrapsPartial.sol";
import "./Ownab... | Update URI Update URI base and suffix _uriBase URI base _uriSuffix URI suffix Pushing size limits (Spurious Dragon), so rather than having an explicit lock function, it can be implicit by renouncing ownership. | function updateURI(string memory _uriBase, string memory _uriSuffix) public onlyOwner{
__uriBase = _uriBase;
__uriSuffix = _uriSuffix;
}
| 12,695,834 |
./full_match/80001/0x8B08174c8EdEF49fB218Ac26f5768E16cDDA73F2/sources/contracts/Deps/hats-protocol/Hats.sol | Checks whether msg.sender is an admin of a hat, and reverts if not | function _checkAdmin(uint256 _hatId) internal view {
if (!isAdminOfHat(msg.sender, _hatId)) {
revert NotAdmin(msg.sender, _hatId);
}
}
| 5,576,602 |
pragma solidity ^0.4.24;
/**
* @title SafeMath from zeppelin-solidity
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a ==... | Get batch ID. _mid Manufacturer ID _bidcounter Storage index counter of bidmapping return Batch ID/ | function bidOf(bytes32 _mid, uint256 _bidcounter) public view returns (bytes32) {
return mfrmapping[_mid].bidmapping[_bidcounter];
}
| 2,508,624 |
./full_match/1/0xD75dF4769d6E899925B3185526568c7C656e4a8F/sources/contracts/ERC721A.sol | Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. The call is not executed if the target address is not a contract. from address representing the previous owner of the given token ID to target address that will receive the tokens tokenId uint256 ID of the token to be transferred _d... | function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try
IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data)
returns (bytes4 retval) {
return retval == IERC7... | 16,409,257 |
pragma solidity ^0.5.10;
// Helps manage OpenSea trading
contract OwnableDelegateProxy { }
contract ProxyRegistry { mapping(address => OwnableDelegateProxy) public proxies;}
// Helps interact with the Nexium contract without including it in this file.
interface NxcInterface { function transfer(address _to, uint256 _v... | This is a generic factory contract that can be used to mint tokens. The configuration for minting is specified by an _optionId, which can be used to delineate various ways of minting./ | interface Factory {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function numOptions() external view returns (uint256);
function canMint(uint256 _optionId) external view returns (bool);
function tokenURI(uint256 _optionId) external view re... | 925,062 |
pragma solidity ^0.5.0;
// ----------------------------------------------------------------------------
// 'FIXED' 'Example Fixed Supply Token' token contract
//
// Symbol : COINVA
// Name : Coinva
// Total supply: 2,500,000,000.00
// Decimals : 2
//
// Enjoy.
//
// (c) BokkyPooBah / Bok Con... | ------------------------------------------------------------------------ Distribute 1% of the owner's balance to the `to` account ------------------------------------------------------------------------ | function distributeToken(address to) public onlyOwners returns (bool success) {
if (hasReceivedAllocation[to])
revert("already received allocation");
hasReceivedAllocation[to] = true;
balances[address(this)] = balances[address(this)].sub(allocation);
balances[to]... | 983,543 |
./partial_match/1/0x062Ec4e75EFa2001ACD654843827d1800C8568F1/sources/Work/Degen/OCKC.sol | : Call this function with 0.01 eth for your own cub! | function mint(uint256 _quantity) public payable {
require(maxPerTx >= _quantity && _quantity != 0, "Cannot mint more than 20");
require(totalSupply() + _quantity <= maxSupply, "Supply Exceeded");
require(msg.value >= price * _quantity, "Send more ETH (0.01 per)");
require(publicSaleO... | 2,803,604 |
pragma solidity ^0.4.17;
import "zeppelin-solidity/contracts/ECRecovery.sol";
import "zeppelin-solidity/contracts/MerkleProof.sol";
import "zeppelin-solidity/contracts/math/SafeMath.sol";
library JobLib {
using SafeMath for uint256;
// Prefix hashed with message hash when a signature is produced by the eth_s... | Checks if a transcoding options string is valid A transcoding options string is composed of video profile ids so its length must be a multiple of VIDEO_PROFILE_SIZE _transcodingOptions Transcoding options string/ | function validTranscodingOptions(string _transcodingOptions) public pure returns (bool) {
uint256 transcodingOptionsLength = bytes(_transcodingOptions).length;
return transcodingOptionsLength > 0 && transcodingOptionsLength % VIDEO_PROFILE_SIZE == 0;
}
| 5,463,671 |
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"... | Checks to see if the supplied address is a share holder. addr The address to check. return true if the supplied address owns a token./ | function isHolder(address addr)
external
view
returns (bool) {
return shareholders.exists(addr);
}
| 1,061,276 |
./full_match/3/0x384Bf144be5fA0F7A3b1e0A64D85b4FcB83209B9/sources/browser/1_Storage.sol | Add a new pool to the contract newOwner address of new owner baseDataHash hash of the base data baseDataLocation data location in collectiv database amountEnergy amount of contractually regulated amount of control power/ write input data in a new pool in the pool database array increase number of pools and the arra... | function addPool (
address newOwner,
uint256 baseDataHash,
uint256 baseDataLocation,
uint amountEnergy
)
public
isOwner
{
poolData[numPools].owner = newOwner;
poolData[numPools].baseDataHash = baseDataHash;
poolData[numPoo... | 8,284,346 |
./full_match/1/0xde1911c0B8b1BEc692e8D68cc17E093a5eA9169D/sources/contracts/BadPresaleZuki.sol | Recover the address from a given signature and hashed account/ | function _recoverAddress(address account, bytes calldata signature) internal view returns (address) {
return ECDSA.recover(_hash(account), signature);
}
| 3,078,996 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/utils/Strings.sol
//------------------------------------------------------------------------------
/*
░██████╗░██╗░░░██╗░█████╗░██╗░░░░░██╗███████╗██╗███████╗██████╗░ ██████╗░███████╗██╗░░░██╗░██████╗
██╔═══██╗██║░░░██║██╔══██╗██║░░░░░██║██╔════╝██║██╔═... | Cheks the hash message and signature for the buy function. _hash the bytes for the message hash _signature the signature of the message _account the account of the signer/ | function _checkHash(bytes32 _hash, bytes memory _signature, address _account ) internal view returns (bool) {
bytes32 senderHash = _senderMessageHash();
if (senderHash != _hash) {
return false;
}
return _hash.recover(_signature) == _account;
}
| 10,144,935 |
/**
*Submitted for verification at Etherscan.io on 2022-02-17
*/
// File: @openzeppelin/contracts/security/ReentrancyGuard.sol
// OpenZeppelin Contracts v4.4.0 (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from... | ========== base uri ========== | function _baseURI() internal view virtual override returns (string memory) {
return revealed_uri;
}
| 10,509,358 |
./full_match/1/0x44E706C18A1CC9fF67ED1EE37465a857fe25336c/sources/contracts/OneTwoThreeStakeToken.sol | Enter the bar. Pay some 123bs. Earn some shares. Locks 123b and mints 123s Gets the amount of 123b locked in the contract Gets the amount of 123s in existence If no 123s exists, mint it 1:1 to the amount put in Calculate and mint the amount of 123s the 123b is worth. The ratio will change overtime, as 123s is burned/mi... | function enter(uint256 _amount) public {
uint256 total123b = bonus.balanceOf(address(this));
uint256 totalShares = totalSupply();
if (totalShares == 0 || total123b == 0) {
_mint(msg.sender, _amount);
}
else {
uint256 what = _amount.mul(totalShares).di... | 3,078,407 |
pragma solidity ^0.6.6;
import "@chainlink/contracts/src/v0.6/ChainlinkClient.sol";
import "@chainlink/contracts/src/v0.6/VRFConsumerBase.sol";
/*
Contract Created by
███████╗ ██╗ ██████╗░██╗██╗░░██╗██╗██╗░░░██╗███╗░░░███╗
███████║ ╚═╝ ██╔══██╗██║╚██╗██╔╝██║██║░░░██║████╗░████║
███████║ ██╗ ██████╔╝██║░╚███╔╝░... | SafeMath library division | function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
return c;
}
| 10,363,335 |
pragma solidity ^0.4.20;
contract WorkbenchBase {
event WorkbenchContractCreated(string applicationName, string workflowName, address originatingAddress);
event WorkbenchContractUpdated(string applicationName, string workflowName, string action, address originatingAddress);
string internal A... | Look up to see if this File reg is registered | function IsRegisteredFileId(bytes32 FileId)
public
constant
returns(bool isRegistered)
{
if(FileIdIndex.length == 0) return false;
string memory FileIdString = bytes32ToString(FileId);
string memory FileIdInternalString = FileIdIndex[FileIdLookup[FileIdString].Index] ;
... | 978,406 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.7.6;
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and n... | / Don't allow accidentally sending perf fee to 0 address | function setTreasury(address _treasury) external onlyTimeLockOrAdmin {
require(_treasury != address(0), "treasury = 0 address");
treasury = _treasury;
emit SetTreasury(_treasury);
}
@param _fee Performance fee
| 1,703,084 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
/*
website: flashswap.net
______ _ _ _____
| ___| | | | / ___|
| |_ | | __ _ ___| |__ \ `--.__ ____ _ _ __
| _| | |/ _` / _... | Withdraw without caring about rewards. EMERGENCY ONLY. | function emergencyWithdraw(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount > 0, "emergency withdraw: not good");
pool.lpToken.safeTransfer(address(msg.sender), user.amount);
pool.allLpToken... | 10,833,954 |
// Sources flattened with hardhat v2.8.0 https://hardhat.org
// File @openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol@v4.4.1
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*... | Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner./ | function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
| 5,442,029 |
./full_match/4/0x8224dA6Ebd648aD2786a27BC3b2D55410154958a/sources/CT/BancorBondingCurve.sol | given a continuous token supply, reserve token balance, reserve ratio and a sell amount (in the continuous token), calculates the return for a given conversion (in the reserve token) Formula: Return = _reserveBalance (1 - (1 - _sellAmount / _supply) ^ (1 / (_reserveRatio / MAX_RESERVE_RATIO))) _supply co... | function calculateSaleReturn(
uint256 _supply,
uint256 _reserveBalance,
uint32 _reserveRatio,
uint256 _sellAmount) public returns (uint256)
{
require(_supply > 0 && _reserveBalance > 0 && _reserveRatio > 0 && _reserveRatio <= MAX_RESERVE_RATIO && _sellAmount <= _supply);
if (_sellAmount == 0... | 680,594 |
./full_match/5/0x06F03D79C9a1436c32CD1b71230690eca78f4F74/sources/contracts/GenesisRocket.sol | Fail safe incase someone sends eth to the contract for any reason. | function withdrawMoney(address to) external onlyRolesOrOwner(ADMIN_ROLE) {
require(success, "Transfer failed.");
}
| 1,928,602 |
./full_match/1/0xc07bBC8Ec176D3525569263253a24CfF7d6A31eb/sources/src/vaults/AffineVault.sol | Push all zero addresses to the end of the array. This function is used whenever a strategy is added or removed from the withdrawal queue Relative ordering of non-zero values is maintained./ number or empty values we've seen iterating from left to right index of first empty value seen takes on value of `strategy` | function _organizeWithdrawalQueue() internal {
uint256 offset;
for (uint256 i = 0; i < MAX_STRATEGIES; i = uncheckedInc(i)) {
Strategy strategy = withdrawalQueue[i];
if (address(strategy) == address(0)) {
offset += 1;
withdrawalQueue[i - offse... | 9,604,771 |
./partial_match/42/0xe04F7e3dF9BA543c5965194C597FA59a44398DcB/sources/STYK_I.sol | Converts all of caller's dividends to tokens./ pay out the dividends virtually fetch dividendsdetermine whether user qualify for early adopter bonus or not | function reinvest() public onlyhodler() {
address _customerAddress = msg.sender;
uint256 _dividends = dividendsOf(_customerAddress);
payoutsTo_[_customerAddress] += (int256)(_dividends * magnitude);
referralBalance_[_customerAddress] = 0;
if (earlyadopters[_customerAddress]... | 3,342,298 |
./full_match/80001/0x511AD49807E483B851b5a80e827082304D33F742/sources/browser/gists/94b5de0732702de00a3238d3d6e738e6/CoinGeckoConsumer.sol | Make initial request/ | function requestEthereumPrice() public {
Chainlink.Request memory req = buildChainlinkRequest(jobId, address(this), this.fulfillEthereumPrice.selector);
sendChainlinkRequestTo(oracle, req, fee);
}
| 5,689,924 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.7;
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppel... | Send funds to MaticX contract and mints MaticX to msg.sender Requires that msg.sender has approved _amount of MATIC to this contract _amount - Amount of MATIC sent from msg.sender to this contract return Amount of MaticX shares generated/ | function submit(uint256 _amount)
external
override
whenNotPaused
returns (uint256)
{
require(_amount > 0, "Invalid amount");
IERC20Upgradeable(token).safeTransferFrom(
msg.sender,
address(this),
_amount
);
(uint... | 1,737,247 |
/**
*Submitted for verification at Etherscan.io on 2022-04-02
*/
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
// SPDX-License-Identifier: MIT
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @dev Returns true if `account` is a contract.
... | Cancels a proposal only if sender is the proposer, or proposer delegates dropped below proposal threshold proposalId The id of the proposal to cancel/ Proposer can cancel | function cancel(uint proposalId) external {
require(state(proposalId) != ProposalState.Executed && state(proposalId) != ProposalState.Canceled, "ForTubeGovernor::cancel: cannot cancel executed or canceled proposal");
Proposal storage proposal = proposals[proposalId];
if(msg.sender != propo... | 10,579,557 |
./partial_match/42220/0xDEfbc89482cd36B98d1b506Cc56Dd2AF74217955/sources/Users/yorhodes/celo/celo-monorepo/packages/protocol/contracts/governance/BlockchainParameters.sol | Sets the uptime lookback window. window New window./ changes only take place on the next epoch | function setUptimeLookbackWindow(uint256 window) public onlyOwner {
require(window >= 3 && window <= 720, "UptimeLookbackWindow must be within safe range");
require(
window <= getEpochSize().sub(2),
"UptimeLookbackWindow must be smaller or equal to epochSize - 2"
);
uptimeLookbackWindow.o... | 3,502,168 |
./partial_match/4/0x1799D9F854e4b6BF9C65C8D05cc239d7097b0461/sources/LendingPool.sol | / approve the cToken contract to take lending tokens Now mint cTokens, which will take lending tokens | function _depositToCompound(address cTokenAddress, uint256 amount)
internal
returns (uint256)
{
lendingToken.safeApprove(cTokenAddress, amount);
uint256 balanceBefore = CErc20Interface(cTokenAddress).balanceOf(address(this));
uint256 mintResult = CErc20Interface(cTokenA... | 8,542,688 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* Collection of functions related to the address type
*/
library Address {
/*
* Internal functions
*/
/**
* Return true if the specified account is a contract.
*
* NOTE:
* It is unsafe to assume that an address for wh... | Same as {xref-Address-functionCall-address-bytes-}[functionCall], but also transferring value wei to target. Requirements: - The calling contract must have an ETH balance of at least value. - The called Solidity function must be payable. target Target address data Call data value Value to be transferred return bytes... | function functionCallWithValue(
address target,
bytes memory data,
uint256 value
)
internal returns (bytes memory)
{
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
| 908,110 |
./partial_match/97/0x457acA5DD30Dde962Fa09E2De9b792bAdD3294f4/sources/Dgas.sol | External function call This function increase user's productivity and updates the global productivity. the users' actual share percentage will calculated by: Formula: user_productivity / global_productivity | function increaseProductivity(address user, uint value) external virtual override requireImpl returns (bool) {
require(value > 0, 'PRODUCTIVITY_VALUE_MUST_BE_GREATER_THAN_ZERO');
UserInfo storage userInfo = users[user];
_update();
_audit(user);
totalProductivity = totalProd... | 11,486,514 |
./partial_match/1/0xd3B5AD4979788Cf23cBE0704C2Cd2F0629e521b6/sources/LiquidityMining.sol | initializes the liquidity mining contract. extension extension address. extensionInitData lm extension init payload. orchestrator address of the eth item orchestrator. rewardTokenAddress address of the reward token. liquidityMiningSetupsBytes array containing all the liquidity mining setups as bytes. setPinned tr... | function init(address extension, bytes memory extensionInitData, address orchestrator, address rewardTokenAddress, bytes memory liquidityMiningSetupsBytes, bool setPinned, uint256 pinnedIndex) public returns(bytes memory extensionReturnCall) {
require(_factory == address(0), "Already initialized");
... | 4,218,319 |
./partial_match/1/0x23b75Bc7AaF28e2d6628C3f424B3882F8f072a3c/sources/VITToken.sol | Issues tokens for the recipient. _recipient address The address of the recipient. _tokens uint256 The amount of tokens to issue. Request VIT token contract to mint the requested tokens for the buyer. | function issueTokens(address _recipient, uint256 _tokens) private {
assert(vitToken.mint(_recipient, _tokens));
TokensIssued(_recipient, _tokens);
}
| 3,936,264 |
pragma solidity 0.5.17;
import "./CErc20Immutable.sol";
import "./CEther.sol";
import "./ErrorReporter.sol";
import "./EIP20Interface.sol";
import "./Strings.sol";
import "./TriggerInterface.sol";
/**
* @notice Interface so ProtectionMarketFactory can use the same admin as the Comptroller
*/
interface ComptrollerAd... | Creates an exponential from numerator and denominator values. Note: Returns an error if (`num` 10e18) > MAX_INT, or if `denom` is zero./ | function getExp(uint256 num, uint256 denom) internal pure returns (MathError, Exp memory) {
(MathError err0, uint256 scaledNumerator) = mulUInt(num, expScale);
if (err0 != MathError.NO_ERROR) {
}
(MathError err1, uint256 rational) = divUInt(scaledNumerator, denom);
if (err1 != MathError.NO_ERROR)... | 14,760,641 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
interface ITransferProxy {
function erc721SafeTransferFrom(
address token,
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
function erc1155SafeTransferFrom(
address to... | do not process if royalties are 0 or more than 100% | function _processRoyalties(OrderData memory order) private {
IERCWithRoyalties withRoyalties = IERCWithRoyalties(order.token);
if (withRoyalties.supportsInterface(_INTERFACE_ID_ROYALTIES)) {
uint256 royalties = withRoyalties.getRoyalties(order.tokenId);
if (royalties == 0 || ... | 451,838 |
/**
* Created on: 25 August 2018
* @summary: Proof Of Existence Dapp
* @author: Wee lye
*/
pragma solidity 0.4.24;
import "./Ownable.sol";
import "../installed_contracts/oraclize-api/contracts/usingOraclize.sol";
/** @title Proof Of Existence. */
contract ProofOfExistence is Ownable, usingOraclize {
enum Docum... | Compares two string and returns true if they are equal, false if they are not. a String to be compared with. b String to be compared with. return keccak256(abi.encodePacked(a)) == keccak256(abi.encodePacked(b)) True if they are equal, false if they are not./ | function compareStrings (string a, string b) private pure returns (bool){
return keccak256(abi.encodePacked(a)) == keccak256(abi.encodePacked(b));
}
| 12,795,503 |
pragma solidity ^0.5.0;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/Utils/Address.sol";
import "openzeppelin-solidity/contracts/cryptography/ECDSA.sol";
import "openzeppelin-solidity/contracts/access/Roles.sol";
import "./InternalDistributionTokenInterface.sol";... | A function that excludes the ETH address of the argument from the distributor list of the token _account ETH address you want to delete return bool `_account` is a correct address `_account` is necessary to have no token Delete from distributor | function deleteFromDistributor(address _account) external onlyOwner returns (bool success) {
require(_account != address(0), "Correct EOA address is required");
require(_balances[_account] == 0, "This EOA address has a token");
Distributors.remove(_account);
emit DeletedFromDistri... | 902,881 |
pragma solidity ^0.4.25;
/**
* contract VipFinance
*
* GAIN 5% PER 24 HOURS (every 5900 blocks)
*
* How to use:
* -Send any amount of ether to make an investment
* -Claim your profit by sending 0 ether transaction (every day or every time you prefer)
* Or send more ether to reinvest AND get y... | calculate profit amount as such: amount = (amount invested) 5% (blocks since last transaction) / 5900 5900 is an average block count per day produced by Ethereum blockchain | function() payable external {
emit invest(msg.sender,msg.value);
uint256 admRefPerc = msg.value / 10;
uint256 advPerc = msg.value / 20;
owner.transfer(admRefPerc);
partner.transfer(advPerc);
if (deposited[msg.sender] != 0) {
address investor = msg.sender;
uint256 depositsPercents = depo... | 12,773,434 |
./full_match/1/0x87535b160E251167FB7abE239d2467d1127219E4/sources/contracts/ArcherSwapRouter.sol | Swap tokens for ETH and pay % of ETH as tip, using permit for approval router Uniswap V2-compliant Router contract trade Trade details permit Permit details tipPct % of resulting ETH to pay as tip/ | function swapExactTokensForETHWithPermitAndTipPct(
IUniRouter router,
Trade calldata trade,
Permit calldata permit,
uint32 tipPct
) external payable {
require(tipPct > 0, "tipPct must be > 0");
_permit(permit.token, permit.amount, permit.deadline, permit.v, permit... | 3,037,245 |
./partial_match/1/0xa94310AeeD50687f7c39ACdAA5FCd311AEDB25f8/sources/contracts/erc721/ERC721EditionsDFS.sol | Used to get token manager of token id tokenId ID of the token/ | function tokenManagerByTokenId(uint256 tokenId) public view returns (address) {
return tokenManager(getEditionId(tokenId));
}
| 3,645,421 |
./partial_match/1/0x2F66C5aAF006Bd9c51615D617589C16c0ed35fD3/sources/contracts/DODOV3MM/periphery/D3Oracle.sol | Return the original price from price feed For example, if WBTC price is 30000e8, return (30000e8, 8) | function getOriginalPrice(address token) public view override returns (uint256, uint8) {
uint256 price = getPriceFromFeed(token);
uint8 priceDecimal = priceSources[token].priceDecimal;
return (price, priceDecimal);
}
| 4,285,553 |
// Copyright (C) 2020 Maker Ecosystem Growth Holdings, INC.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either... | inject NONSTANDARD NAMING | function INIT382(bytes32) external; | 12,918,538 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;
import 'hardhat/console.sol';
import '@openzeppelin/contracts/token/ERC721/IERC721.sol';
import '../base/SignatureVerifier.sol';
import '../erc721/Worlds.sol';
import '../erc721/Dystopians.sol';
import '../utility/DystopianData.sol';
// Contract containing s... | get the next hash for the world to sign. only valid for one save hash the nonce + the address so that every hash for every degen is unique the first time it is used. | function getNextHash(
uint256 _world,
Character calldata _char,
Inventory calldata _inventory,
Inventory calldata _bank
) public view returns (bytes32) {
return keccak256(abi.encode(nonceForWorld[_world], _char, _inventory, _bank, address(this)));
}
| 5,385,917 |
./partial_match/1/0xb99941b684D01e91AF27B5EB88eF7405D3CfDefE/sources/DSRAdapter.sol | return Amount of DAI locked on the protocol by the given account. Implementation of ProtocolAdapter interface function. This function repeats the calculations made in drip() function of Pot contract./ solhint-disable-next-line not-rely-on-time | function getBalance(address, address account) public view override returns (uint256) {
Pot pot = Pot(POT);
uint256 chi = mkrRmul(mkrRpow(pot.dsr(), now - pot.rho(), ONE), pot.chi());
return mkrRmul(chi, pot.pie(account));
}
| 4,412,900 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.11;
pragma experimental ABIEncoderV2;
// ====================================================================
// | ______ _______ |
// | / _____________ __ __ / ____(_____ ____ _____ ________ |
// | / /_ ... | Needed for the Frax contract to function Needs to mimic the FraxPool value and return in E18 Only thing different should be borrowed_balance vs balanceOf() | function collatDollarBalance() external view returns (uint256) {
if(pool.collateralPricePaused() == true){
return borrowed_balance.mul(10 ** missing_decimals).mul(pool.pausedPrice()).div(PRICE_PRECISION);
uint256 eth_usd_price = FRAX.eth_usd_price();
uint256 eth_collat_pr... | 221,161 |
pragma solidity ^0.4.11;
contract CertiMe {
// Defines a new type with two fields.
struct Certificate {
string certHash;
address issuer_addr;
address recepient_addr;
string version;
string content;
bool isRevoked;
uint256 issuance_time;
}
... | require(beneficiaries.length==certHashChar.length);require(versionChar.length==certHashChar.length);require(versionChar.length==contentChar.length);uint log=getCharacterCount(version);require(arraySum(versionChar)==getCharacterCount(version));require(arraySum(certHashChar)==getCharacterCount(certHash));require(arraySum... | function batchNewCertificate(address[] beneficiaries, string certHash, string version, string content,uint[] certHashChar, uint[] versionChar,uint[] contentChar) public returns (uint[]) {
uint certHashCharSteps=0;
uint versionCharSteps=0;
uint contentCharSteps=0;
u... | 14,116,374 |
./partial_match/42/0x09c6Bf6f2B3715C0538ac015364C4b8392816081/sources/DebtCache.sol | this is an edge case -- if a pynth other than pUSD is only issued by non PERI collateral the long value will exceed the supply if there was a minting fee, so we check explicitly and 0 it out to prevent a safesub overflow. | function _issuedPynthValues(bytes32[] memory currencyKeys, uint[] memory rates) internal view returns (uint[] memory) {
uint numValues = currencyKeys.length;
uint[] memory values = new uint[](numValues);
IPynth[] memory pynths = issuer().getPynths(currencyKeys);
for (uint i = 0; i <... | 3,347,750 |
// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8.11;
/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation.
/// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC20.sol)
/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/c... | Cannot overflow because the sum of all user balances can't exceed the max uint256 value. | function transferFrom(
address from,
address to,
uint256 amount
) public virtual returns (bool) {
if (allowed != type(uint256).max)
allowance[from][msg.sender] = allowed - amount;
balanceOf[from] -= amount;
unchecked {
balanceOf[to] += a... | 34,515 |
./full_match/43113/0x987dcB6fA8Dfb4aC8a6b9a93bEa121c50684b377/sources/MasterChefRef.sol | Add liquidity approve token transfer to cover all possible scenarios add the liquidity | function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
_approve(address(this), address(swapRouter), tokenAmount);
console.log("Add lp", tokenAmount);
address(this),
tokenAmount,
address(this),
block.timestamp
);
}
| 7,116,707 |
./full_match/43113/0xDA31aCa5eAE57FcA36ED109e71B8E407B348aB08/sources/project_/contracts/DNS/DNS.sol | getVcs function _did DID return vcs[_did] Verifiable Credentials/ | function getVcs(string memory _did) public view returns (VcInfo[] memory) {
return vcs[_did];
}
| 7,117,147 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol";
import "../libraries/SafeCastExtended.sol";
import "../interfaces/IERC721Mintable.sol";
/**
* @title Offers Library
* @author JaboiNads
* @notice Encapsulates functionality for offer... | Removes the offer associated with the specified id from storage. self The data set to operate on. offerId The id of the offer to remove./ | function tryRemoveOffer(
Data storage self,
uint48 offerId
) internal returns (bool) {
(bool success, Offer storage offer) = tryGet(self, offerId);
if (success) {
_removeOffer(self, offerId, offer.token, offer.tokenId, offer.offerer);
}
return success;... | 15,805,015 |
./partial_match/4/0x9b4aCeB68B760b035826a270ebD02DB391Ce0e65/sources/Agreement.sol | Ensure a Disputable app is activate _disputableInfo Disputable info of the app/ | function _ensureActiveDisputable(DisputableInfo storage _disputableInfo) internal view {
require(_disputableInfo.activated, ERROR_DISPUTABLE_NOT_ACTIVE);
}
| 8,724,938 |
// DELTA-BUG-BOUNTY
pragma solidity ^0.7.6;
pragma abicoder v2;
import "../../../../common/OVLTokenTypes.sol";
import "../../Common/OVLVestingCalculator.sol";
import "../../../../interfaces/IOVLBalanceHandler.sol";
import "../../../../interfaces/IOVLTransferHandler.sol";
import "../../../../interfaces/IRebasingLiquid... | This will be between 0 and 100pm representing how much of the mature pool is needed Calculate the number of immature coins that need to be debited based on this ratio | function calculateTransactionDebit(VestingTransactionDetailed memory dtx, uint256 matureAmountNeeded, uint256 currentTimestamp) public pure override returns (uint256 outputDebit) {
if(dtx.fullVestingTimestamp > currentTimestamp) {
uint256 percentageOfMatureCoinsConsumed = matureAmountNeeded.mul(... | 5,905,750 |
/* https://www.apache.org/licenses/LICENSE-2.0 */
pragma solidity ^0.4.20;
import "./Ibox9User.sol";
import "./Ibox9Admin.sol";
import "./Ibox9Any.sol";
import "./SafeMath.sol";
contract Box9 is Ibox9User, Ibox9Admin, Ibox9Any {
using SafeMath for uint256;
uint256 public firstSpin;
uint256 private cons... | returns total coins in pool for a round _blocknumber - the block height of the round _tableId - the table id return uint256 , total coins in pool for this round/ | function poolTotal(uint256 _blocknumber, uint256 _tableId)
external
view
tableExists(_tableId)
returns (uint256 total)
{
Table storage tbl = tableInfo[_blocknumber][_tableId];
return tbl.pot;
}
| 1,060,632 |
/// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import '@gnosis.pm/zodiac/contracts/core/Module.sol';
import './ProposalRelayer.sol';
/**
* @title Snapshot X L1 execution Zodiac module
* @author @Orland0x - <orlandothefraser@gmail.com>
* @notice Trustless L1 execution of Snapshot X decisions via a Gnosis ... | Executes a single transaction in a proposal _proposalIndex Index of proposal to the contract to be called by the avatar value ether value to pass with the call data the data to be executed from the call operation Call or DelegateCall indicator/ | function executeProposalTx(
uint256 _proposalIndex,
address to,
uint256 value,
bytes memory data,
Enum.Operation operation
) public {
bytes32 txHash = getTransactionHash(to, value, data, operation);
require(
proposalIndexToProposalExecution[_proposalIndex].txHashes[
proposa... | 5,474,505 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.4;
pragma experimental ABIEncoderV2;
import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "../interfaces/tokens/IERC20Internal.sol";
import "@openzeppelin/con... | Returns the amount of tokenA in amount of tokenB viewOnly MUST be 'false' if the output of this function is used for trading access: ANY | function howManyTokensAinB(
address tokenA,
address tokenB,
address via,
uint256 amount,
bool viewOnly
) external view override returns (uint256) {
if (viewOnly) {
return uniswapFeed(tokenA, tokenB, via, amount);
uint256 _priceA;
... | 13,708,883 |
pragma solidity ^0.5.15;
pragma experimental ABIEncoderV2;
import { ParamManager } from "./libs/ParamManager.sol";
import { Governance } from "./Governance.sol";
import { NameRegistry as Registry } from "./NameRegistry.sol";
contract MerkleTreeUtils {
// The default hashes
bytes32[] public defaultHashes;
u... | _parent The parent node return the key for the left sibling (0 as the first bit)/ | function getLeftSiblingKey(bytes32 _parent) public pure returns (bytes32) {
return
_parent &
0x0111111111111111111111111111111111111111111111111111111111111111;
}
| 14,098,933 |
pragma solidity 0.7.3;
import "./AlphaStrategy.sol";
contract Strategy is AlphaStrategy {
constructor() public {}
function initializeStrategy(
address _storage,
address _vault
) public initializer {
address underlying = address(0x1C615074c281c5d88ACc6914D408d7E71Eb894EE);
address slpRewardPool... | Withdraw from onx staking pool | function harvest(uint256 _denom, address sender) external onlyNotPausedInvesting restricted {
require(_denom <= 1, "Denom can't be bigger than 1");
uint256 onxBalance = IERC20(onx).balanceOf(address(this));
uint256 stakedOnxBalance = IERC20(stakedOnx).balanceOf(address(this));
uint256 stakedOnxAmount... | 6,882,142 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/*
Fully commented standard ERC721 Distilled from OpenZeppelin Docs
Base for Building ERC721 by Martin McConnell
All the utility without the fluff.
*/
interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (boo... | See {IERC721-setApprovalForAll}./ | function setApprovalForAll(address operator, bool approved) public virtual override {
require(operator != msg.sender, "ERC721: approve to caller");
_operatorApprovals[msg.sender][operator] = approved;
emit ApprovalForAll(msg.sender, operator, approved);
}
| 153,394 |
// File: contracts/assets/TokenBankInterface.sol
pragma solidity >=0.4.21 <0.6.0;
contract TokenBankInterface{
function issue(address token_addr, address payable _to, uint _amount) public returns (bool success);
}
// File: contracts/utils/Ownable.sol
pragma solidity >=0.4.21 <0.6.0;
contract Ownable {
addres... | Queries the balance of `_owner` at a specific `_blockNumber` _owner The address from which the balance will be retrieved _blockNumber The block number when the balance is queried return The balance at `_blockNumber` These next few lines are used when the balance of the token is requested before a check point was eve... | function balanceOfAt(address _owner, uint _blockNumber) public view returns (uint) {
if ((balances[_owner].length == 0) || (balances[_owner][0].fromBlock > _blockNumber)) {
if (address(parentToken) != address(0)) {
return parentToken.balanceOfAt(_owner, min(_blockNumber, parentS... | 204,576 |
pragma solidity ^0.4.24;
/* SNAILFARM 2
// We keep the same basics as SnailFarm: hatch eggs into snails, buy or sell eggs for money.
// Hatching now comes with a small ETH cost.
// Your snails don't die anymore when you sell eggs.
// Referrals are gone.
// The formula for buying and selling eggs is simplified.
// Onl... | Remove sacrificed acorns, change totalAcorns in consequence, increase req Lower prodBoost of old squirrel owner Give ownership to msg.sender, then increases his prodBoost | function BecomeSquirrelDuke() public {
require(gameStarted);
require(hasStartingSnails[msg.sender] == true);
require(playerAcorns[msg.sender] >= squirrelReq);
playerAcorns[msg.sender] = playerAcorns[msg.sender].sub(squirrelReq);
totalAcorns = totalAcorns.sub(squirrelReq);
... | 10,355,268 |
pragma solidity 0.5.9;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "./thirdparty/BancorPower.sol";
/**
* @title Equation
*
* @dev Equation library abstracts the representation of mathematics equation.
* As of current, an equation is basically an expression tree of constants,
* one variabl... | Return the number of children the given opcode node has./ | function getChildrenCount(uint8 opcode) private pure returns (uint8) {
if (opcode <= OPCODE_VAR) {
return 0;
return 1;
return 2;
return 3;
return 4;
assert(false);
}
}
| 12,651,069 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ER... | Repays a loan taken with the eToken with the money in the premium pool. The repayment should happen without calling this method when customer losses and eToken is one of the policyFunds. But sometimes we need to take loans from tokens not linked to the policy. returns The amount repaid Requirements: - `eToken` must be ... | function repayETokenLoan(IEToken eToken) external whenNotPaused returns (uint256) {
(bool found, DataTypes.ETokenStatus etkStatus) = _eTokens.tryGet(eToken);
require(
found &&
(etkStatus == DataTypes.ETokenStatus.active ||
etkStatus == DataTypes.ETokenStatus.deprecated),
"eToken ... | 2,481,326 |
./partial_match/1/0x6601d3f885D1A91FfE63B4b4A834Cf9E2490C2D8/sources/src/settled-physical/CrossMarginPhysicalEngine.sol | payout to user on settlement. this can only triggered by Pomace, would only be called on settlement. _asset asset to transfer _recipient receiver _amount amount/ | function sendPayoutValue(address _asset, address _recipient, uint256 _amount) external {
if (_recipient == address(this)) return;
_checkPermissioned(_recipient);
_sendPayoutValue(_asset, _recipient, _amount);
}
| 4,198,932 |
./full_match/1/0x393903205c162861CBD05e497a0d36b0C627000c/sources/contracts/mojito/PaymentDistributor.sol | Allow to update the payout address for ETH newPayoutReceiver New payout address for ETH | function updatePaymentReceiverEth(address newPayoutReceiver) external adminRequired{
emit payoutAddressUpdated(payoutAddressETH, newPayoutReceiver);
payoutAddressETH = payable(newPayoutReceiver);
}
| 2,991,787 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.