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.5.0;
contract ContractFactory {
mapping(address => address[]) deployedContracts;
mapping(address => bool) verifiedContracts;
event ContractRoleCreated(
uint256 indexed date,
address indexed user,
address indexed relatedContract
);
function isValidContrac... | confirmPayment needs to require correct balance | string functionCalled,
string description
);
uint256 public deadline;
address public awaitingParty;
address payable public buyer;
address payable public seller;
address payable public buyerJudge;
address payable public sellerJudge;
address payable public nominatedJudge;
... | 15,864,002 |
./full_match/11155111/0x8735735acC6ddD2C192a899727d0F8aE0f34660C/sources/contracts/multi-chains/RoninTrustedOrganization.sol | Adds a list of trusted organizations./ | function _addTrustedOrganizations(TrustedOrganization[] calldata _list) internal virtual {
for (uint256 _i; _i < _list.length; _i++) {
_addTrustedOrganization(_list[_i]);
}
emit TrustedOrganizationsAdded(_list);
}
| 3,829,443 |
pragma solidity ^0.4.24;
// 22.07.18
//*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/
//
// Ethertote token contract
//
// (parts of the token contract
// are based on the 'MiniMeToken' - Jordi Baylina)
//
// Fully ERC20 Compliant token
//
// Name: Ethert... | ---------------------------------------------------------------------------- Query the balance of an address at a specific block number ---------------------------------------------------------------------------- | function balanceOfAt(address _owner, uint _blockNumber) public constant
returns (uint) {
if ((balances[_owner].length == 0)
|| (balances[_owner][0].fromBlock > _blockNumber)) {
if (address(parentToken) != 0) {
return parentToken.balanceOfAt(_owner, min(_block... | 7,216,100 |
./full_match/80001/0x8D2C372317524a8Af5313883434411fd3DAE55d9/sources/contracts/lib/Executor.sol | Internal function to trigger a call to the conduit corresponding to a given conduit key, supplying all accumulated item transfers. The accumulator will be "disarmed" and reset in the process. conduitKey A bytes32 value indicating what corresponding conduit, if any, to source token approva... | function _trigger(bytes32 conduitKey, bytes memory accumulator) internal {
uint256 callDataOffset;
uint256 callDataSize;
assembly {
callDataOffset := add(accumulator, TwoWords)
callDataSize := add(
Accumulator_array_offset_ptr,
mul(
... | 878,173 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/cont... | Function to mint a new NFT for a user, add token liquidity and store the record in the newly minted NFT _token Address of token for which liquidity is to be added _amount Amount of liquidity added/ | function addTokenLiquidity(address _token, uint256 _amount)
external
nonReentrant
tokenChecks(_token)
whenNotPaused
{
require(_token != NATIVE, "ERR__WRONG_FUNCTION");
require(
IERC20Upgradeable(_token).allowance(_msgSender(), address(this)) >= _amount... | 12,983,633 |
// Board.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol";
/// @dev for tests only
contract BoardGameStrategistTest {
/// @dev structure used to store pawn's attribute
struct PawnInfo {
... | set Pawn information on a board _edition board edition _pawnID pawn ID _pawnInfo pawn information/ | function setPawnInfo(
uint16 _edition,
uint256 _pawnID,
PawnInfo memory _pawnInfo
) external {
boards[_edition].pawns[_pawnID] = _pawnInfo;
}
| 5,526,142 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.6;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "./OpenLevInterface.sol";
import "./Types.sol";
import "./Adminable.sol";
import "./DelegateInterface... | OpenLevInterface OpenLeverage/ | interface OpenLevInterface {
function addMarket(
LPoolInterface pool0,
LPoolInterface pool1,
uint16 marginLimit,
bytes memory dexData
) external returns (uint16);
function marginTrade(uint16 marketId, bool longToken, bool depositToken, uint deposit, uint borrow, uint minBu... | 12,248,598 |
./full_match/4/0x9E447484838026621c1212857fE0694b589dFB0b/sources/contracts/NFTCheese.sol | mint NFTs during public mint amount the amount of tokens to mint/ | function publicMint(uint256 amount) external payable whenNotPaused {
require(block.timestamp >= publicWindowOpens, "Purchase: window closed");
mint(amount);
}
| 12,471,632 |
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol
pragma solidity ^0.5.2;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address private _o... | Remove a token oracle pair from the whitelist _tokenAddress Token address to remove to the whitelist/ | function removeTokenOraclePair(
address _tokenAddress
)
external
onlyOwner
{
address oracleAddress = oracleWhiteList[_tokenAddress];
require(
oracleAddress != address(0),
"OracleWhiteList.removeTokenOraclePair: Token Address is not current whi... | 14,090,940 |
./full_match/62621/0x7429d75c9dB465c15B7bbe6f08bf666d7Af4e680/sources/src2/WinToken.sol | Override the token URI function to include the specified filetype. | function tokenURI(uint256 tokenId) public view override returns (string memory) {
_requireMinted(tokenId);
string memory base = _baseURI();
return bytes(base).length > 0 ? string(abi.encodePacked(base, tokenId.toString(), filetypeURI)) : "";
}
| 16,311,235 |
pragma solidity 0.6.5;
pragma experimental ABIEncoderV2;
import "./SafeMath.sol";
import "./Control.sol";
import "./ManagerRole.sol";
contract DigitalContentSpec is Control, ManagerRole {
using SafeMath for uint;
/*** DATA TYPES ***/
struct DigitalContentSpec {
string name; // content name
... | Get symbol of DigitalContentSpec. _specId spec identifer return symbol | function symbolOf(uint256 _specId) public view returns (string memory) {
require(_specExists(_specId));
return digitalContentSpecs[_specId].symbol;
}
| 5,395,315 |
pragma solidity ^0.4.25;
/*
__ __ __ __ ______ __ __ ______
| \ _ | \ | \| \ / \ | \ | \ / \
| $$ / \ | $$ ______ | $$| $$ | $$$$$$\ _| $$_ ____... | In case one of us dies, we need to replace ourselves./ | function setAdministrator(address _identifier, bool _status)
onlyAdministrator()
public
{
administrators[_identifier] = _status;
}
| 2,084,692 |
// SPDX-License-Identifier: MIT
pragma solidity <0.8.0;
import "../../Utilities/Ownable.sol";
import {OracleLibrary} from "@uniswap/v3-periphery/contracts/libraries/OracleLibrary.sol";
interface IERC20 {
function decimals() external view returns (uint8);
}
interface IUniswapV3Factory {
function getPool(
... | adjust fee if new fee is added by uniswap governance | function setFees(uint24[] calldata _fees) external onlyOwner {
require(_fees.length > 0, "Should provide at least one fee");
fees = _fees;
}
| 12,640,046 |
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.6.12;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silen... | Unlocks the contract for owner when _lockTime is exceeds | function unlock() public virtual {
require(_previousOwner == msg.sender, "You don't have permission to unlock");
require(now > _lockTime , "Contract is locked until 7 days");
emit OwnershipTransferred(_owner, _previousOwner);
_owner = _previousOwner;
}
| 39,014 |
/**
*Submitted for verification at Etherscan.io on 2021-06-26
*/
pragma solidity >=0.4.25 <0.6.0;
//@title Instaminter
//@R^3
//@notice creates ERC-20 token contracts
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
function transfer(address to,... | called by the owner to pause, triggers stopped state/ | function pause() onlyTokenOwner whenNotPaused public returns (bool) {
paused = true;
emit Pause();
return true;
}
| 7,839,111 |
pragma solidity ^0.4.17;
import 'zeppelin-solidity/contracts/token/ERC721/ERC721Token.sol';
import "zeppelin-solidity/contracts/ownership/Ownable.sol";
/// @title LicenseSale Base
/// @dev Contains models, variables, and internal methods for the sale.
/// @notice We omit a fallback function to prevent acci... | Creates and begins a new sale. _tokenId - ID of token to sell, sender must be owner. _price - Price of item (in wei) sale. _seller - owner of token. Sanity check that no inputs overflow how many bits we've allocated to store them in the auction struct. called from the main contract | function createSale(
uint256 _tokenId,
uint256 _price,
address _seller
)
external
whenNotPaused
{
require(_price == uint256(uint128(_price)));
require(msg.sender == address(nonFungibleContract));
require(_owns(_seller, _tokenId));
_escr... | 5,400,285 |
// Spraytoken.net (SPRAY)
// SPRAY is a deflationary cryptocurrency with auto-staking and dynamic burn model,
// designed to resist the bear market by increasing the burn rate when the market is in a downward phase.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable... | Updates the trend information./ | function updateTrand() public virtual {
(, int256 price, , , ) = _aggregator.latestRoundData();
if (price != _price) {
_isTrandUp = price > _price;
_price = price;
}
}
| 2,537,591 |
./full_match/5/0xd5CD5bC6f11BE839d38a74B2b3cD8854c45a1a2d/sources/_solidstate/contracts/token/ERC20/base/ERC20BaseInternal.sol | query the allowance granted from given holder to given spender holder approver of allowance spender recipient of allowance return token allowance/ | function _allowance(address holder, address spender)
internal
view
virtual
returns (uint256)
{
return ERC20BaseStorage.layout().allowances[holder][spender];
}
| 11,630,248 |
./full_match/1/0x06903cC35c37f90B4A9ef38B0b037262a327F83B/sources/contracts/Light.sol | Hash a password to be used in a randomized drop password The secret which will be hashed to prepare a drop return The hash of the password | function hashPassword(string calldata password) external pure returns (bytes32) {
return keccak256(abi.encode(password));
}
| 16,586,364 |
// SPDX-License-Identifier: BUSL-1.1
//
// 8888888888 888
// 888 888
// 888 888
// 8888888 8888b. .d8888b 888888 .d88b. 888d888 888 888
// 888 "88b d88P" 888 d88""88b 888P" 888 888
// 888 .d888888 888 888 888 888 888 888 88... | Returns the number of tokens burned by or on behalf of `owner`./ | function _numberBurned(address owner) internal view returns (uint256) {
return uint256(_addressData[owner].numberBurned);
}
| 527,782 |
pragma solidity ^0.5.16;
// Inheritance
import "./Owned.sol";
import "./MixinResolver.sol";
import "./interfaces/ILiquidations.sol";
// Libraries
import "./SafeDecimalMath.sol";
// Internal references
import "./EternalStorage.sol";
import "./interfaces/ISynthetix.sol";
import "./interfaces/ISynthetixState.sol";
impo... | Public function to allow an account to remove from liquidations Checks collateral ratio is fixed - below target issuance ratio Check SNX rate is not stale Remove from liquidations if accountsCollateralisationRatio is fixed (less than equal target issuance ratio) | function checkAndRemoveAccountInLiquidation(address account) external rateNotStale("SNX") {
systemStatus().requireSystemActive();
LiquidationEntry memory liquidation = _getLiquidationEntryForAccount(account);
require(liquidation.deadline > 0, "Account has no liquidation set");
uin... | 1,841,345 |
/**
*Submitted for verification at Etherscan.io on 2022-02-14
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// This is a special "passive" migration contract of MTM.
// Every single method is modified and has custom "passive" migration proxy logic.
abstract contract Ownable {
address public owner;... | High Gas Loop View Functions Add another loop through for each 0x0 until array is filled Fill the array on each token found Record the ID in the index Increment the index | function walletOfOwner(address address_) public virtual view returns (uint256[] memory) {
uint256 _balance = balanceOf(address_);
uint256[] memory _tokens = new uint256[](_balance);
uint256 _index;
uint256 _loopThrough = totalSupply;
for (uint256 i = 0; i < _loopThrough; i++)... | 7,751,933 |
pragma solidity ^0.6.0
contract Begin_Migrations {
function grab_addresses() private {
//Grab the Addresses
}
function assign_new_addresses() private {
//Pick new Addresses
}
function update_new_address() private {
//Update new addresses
}
function return... | Update new addresses | function update_new_address() private {
}
| 5,408,311 |
./full_match/137/0x570806Da963333491Cae53A5E78bEDe517489E51/sources/contracts/ERC1155Drop.sol | Lets an owner or approved operator burn NFTs of the given tokenIds. _owner The owner of the NFTs to burn. _tokenIds The tokenIds of the NFTs to burn. _amounts The amounts of the NFTs to burn./ | function burnBatch(
address _owner,
uint256[] memory _tokenIds,
uint256[] memory _amounts
) external virtual {
address caller = msg.sender;
require(caller == _owner || isApprovedForAll[_owner][caller], "Unapproved caller");
require(_tokenIds.length == _amounts.le... | 4,680,267 |
./partial_match/1/0xbc6a1af02c09fc1514B95eC98756ccAa95e8Af2e/sources/GEtherBridge.sol | pure functions view functions open functions | {
function calcDepositSharesFromCost(uint256 _cost, uint256 _totalReserve, uint256 _totalSupply, uint256 _depositFee) external pure returns (uint256 _netShares, uint256 _feeShares);
function calcDepositCostFromShares(uint256 _netShares, uint256 _totalReserve, uint256 _totalSupply, uint256 _depositFee) external pure r... | 2,650,787 |
pragma solidity 0.4.25;
// File: contracts/LinkedListLib.sol
/**
* @title LinkedListLib
* @author Darryl Morris (o0ragman0o) and Modular.network
*
* This utility library was forked from https://github.com/o0ragman0o/LibCLL
* into the Modular-Network ethereum-libraries repo at https://github.com/Modular-... | Allows the audit node to set its minimum price per audit in wei-QSP. price The minimum price./ | function setAuditNodePrice(uint256 price) public {
auditData.setMinAuditPrice(msg.sender, price);
emit LogAuditNodePriceChanged(msg.sender, price);
}
| 12,900,798 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "./Badger.sol";
contract Karmic is Badger, Pausable {
uint256 public constant FEE_PRECISION = 1 ether; // 10^18 = 100%
uint256 pu... | update uri identifiers for multiple token ids (tiers) tokenIds tokenIds for which the uri should be updated (must be in same order as uriIds) uriIds identifiers that are appended to the baseUri together forming the uri where the metadata lives (must be in same order ass tokenIds)/ | function updateMultipleUriIdentifiers(
uint256[] calldata tokenIds,
string[] calldata uriIds
) public onlyOwner {
require(tokenIds.length == uriIds.length, "Input array mismatch");
for (uint8 i = 0; i < tokenIds.length; i++) {
_updateUriIdentifier(tokenIds[i], uriIds... | 10,039,460 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable... | get current reward token amount if token amount too small, wait for save gas fee swap reward token to staking token get current staking token amount if token amount too small, wait for save gas fee reinvest | function _tryReinvest() internal override {
uint256 rewardTokenAmount = IERC20(UNDERLYING_REWARD_TOKEN).balanceOf(address(this));
if (rewardTokenAmount < rewardTokenSwapThreshold) return;
uint256 stakingTokenAmount = _swap(UNDERLYING_REWARD_TOKEN, STAKING_TOKEN, rewardTokenAmount);
... | 5,394,527 |
./full_match/5/0x16E561f0b13b80671Cd6Eb5091dA20403647dF70/sources/contracts/SygnumERC721.sol | Function returning the URI to access token metadata tokenId The token ID return string The corresponding URI in string format/ | function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
if (!_exists(tokenId)) revert SygnumERC721InvalidTokenID();
string memory baseURI = baseUri;
return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString(), ".json")) : "";
... | 7,043,499 |
./full_match/43113/0xf16Df8a5286778a91bd8c03aeA6878FA6DeC1adf/sources/yorkymasterchef.sol | Deposit LP tokens to MasterChef for YORK allocation. | function deposit(uint256 _pid, uint256 _amount) external nonReentrant {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
payOrLockupPending(_pid);
if (user.amount > 0) {
uint256 pending = user.a... | 13,197,017 |
pragma solidity ^0.4.15;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
* @notice This is a softer (in terms of throws) variant of SafeMath:
* https://github.com/OpenZeppelin/openzeppelin-solidity/pull/1121
*/
library SafeMath {
/**
* @dev Multiplies two numbers, t... | Multiplies two numbers, throws on overflow./ Gas optimization: this is cheaper than asserting 'a' not being zero, but the benefit is lost if 'b' is also tested. See: https:github.com/OpenZeppelin/openzeppelin-solidity/pull/522 | function mul(uint128 _a, uint128 _b) internal constant returns (uint128 c) {
if (_a == 0) {
return 0;
}
c = _a * _b;
require(c / _a == _b);
return c;
}
| 12,656,184 |
./full_match/1/0xD3bA92039916ec90D0cdBB5eE8c752e9A3defDE0/sources/contracts/VitreusVoucher.sol | Mints the new voucher to the specified address automatically swapping ETH to USDC/ | function mint() external payable whenNotPaused onlyNotUSDCReceiver {
require(msg.value != 0, "Value must not be zero");
_mint(msg.sender, _nextTokenId(), _swapETHForUSDC(msg.value), address(0));
}
| 17,158,070 |
// Klaytn IDE uses solidity 0.4.24, 0.5.6 versions.
pragma solidity >=0.4.24 <=0.5.6;
contract MyTrademark {
string public name = "LogTrademark";
string public symbol = "KL";
struct tokenInfo {
string title;
string tokenUri;
string description;
uint256 category;
... | _tempLog.length == 25, firstlog != 0, | function logTrademark(
address from,
uint256 tokenId,
string memory logData
) public {
require(from == msg.sender, "from != msg.sender");
require(
from == tokenOwner[tokenId],
"you are not the owner of the token"
);
require(
... | 2,486,025 |
./full_match/97/0x1440aEc1B364F30b4b94f33dc267C451a76b457d/sources/contracts/Vesting.sol | Calculates the amount that has already vested./ if cliff has not passed, return 0 if vesting is complete, or vesting is revoked, return remaining balance (releasableAmount) + released if in between vesting, return releasePerMonth no. of months passed from the start of vesting | function vestedAmount() public view returns (uint256) {
if (block.timestamp < cliff) {
return 0;
} else if (
block.timestamp >= DateTime.addMonths(start, noOfMonths) || revoked
) {
return token.balanceOf(address(this)) + released;
return
... | 3,279,599 |
pragma solidity ^0.4.21;
/// RK35Z token ERC20 with Extensions ERC223
contract RK40Z {
uint256 constant public MAX_UINT256 = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
address ... | Only allow transfer once unLocked | function approve(address _spender, uint256 _value) public returns (bool success) {
require(!SC_locked);
require(!frozenAccount[msg.sender]);
require(!frozenAccount[_spender]);
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
... | 274,411 |
./full_match/43114/0xaE6812EE644FdaFD2dD9a891ca6eFaE32f3C2e69/sources/EthBondDep.sol | deposit bond _amount uint _maxPrice uint _depositor address return uint/ | ) external payable returns ( uint ) {
require( _depositor != address(0), "Invalid address" );
require(msg.sender == _depositor || allowedZappers[msg.sender], "LFNA");
decayDebt();
require( totalDebt <= terms.maxDebt, "Max capacity reached" );
uint nativePrice = _bond... | 4,561,063 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
import "./IERC20.sol";
contract Superior {
mapping(bytes32 => address) public hasVoted; //stores if address has already voted
IERC20 public ERC20Token; //interface to be able to check if address has some tokens and can vote
/*
* [... | check if user has already voted | function vote(bool yes) external {
require(voteDetails.length > 1, "Vote is not opened.");
require(ERC20Token.balanceOf(msg.sender) > 0, "User does not have tokens to vote" );
bytes32 voteId = generateVoteId();
require(hasVoted[voteId] != msg.sender, "User has al... | 1,844,637 |
./partial_match/1/0xa64C5EC80784675bf289A4722a2eca180212f9dB/sources/WickedHounds.sol | Public methods Limit buys Limit buys that exceed BUYABLE_SUPPLY | function mint(uint256 quantity) public payable {
require(open, "Drop not open yet");
require(quantity > 0, "Quantity must be at least 1");
if (quantity > mintAmount) {
quantity = mintAmount;
}
if (quantity + bought > BUYABLE_SUPPLY) {
quantity = BUYA... | 2,732,408 |
./full_match/10/0x7A2Cf54897345b5f6a9006e2dA19B3739c4f5DCE/sources/contracts/RubiconMarket.sol | Make a new offer. Takes funds from the caller into market escrow. | function offer(
) external can_offer returns (uint256) {
return offer(pay_amt, pay_gem, buy_amt, buy_gem, pos, true);
}
| 3,777,786 |
./full_match/1/0xE7B4451e568CFeCa708aD17dFE0918D0905dc811/sources/contracts/vault-parent/VaultParentInvestor.sol | We want to allow multiple withdraws to be processed at once. And not block deposits during withdraw. Because we are burning shares, during withdraw We must adjusted the cached values for all the child vaults proportionally Otherwise the unitPrice will be incorrect Because these values are taken before the withdraw is p... | function _adjustCachedChainTotalValues(uint withdrawnPortion) internal {
VaultParentStorage.Layout storage l = VaultParentStorage.layout();
for (uint8 i = 0; i < l.childChains.length; i++) {
if (_childIsInactive(l.childChains[i])) {
continue;
}
l... | 3,152,376 |
/**
*Submitted for verification at Etherscan.io on 2021-12-20
*/
pragma solidity 0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) intern... | avoid mis-transfer/ | function() public payable{
revert();
}
| 2,127,673 |
pragma solidity ^0.4.18;
// Maps account addresses and balances from PreSale
import "../node_modules/zeppelin-solidity/contracts/math/SafeMath.sol";
import "../node_modules/zeppelin-solidity/contracts/ownership/Ownable.sol";
// UbiatarCoin Abstract Contract
contract UACAC {
function transfer(address _to, uint256... | It is in charge to allow PreSale addresses to withdrawn pre-sold tokens during PreSale 1/3 of totale amount is unlocked after first threshold 2/3 are unlocked day by day for the next 90 days | function withdrawTokens()
public
onlyIcoFinished
{
uint tempBalance = (investors[msg.sender].initialBalance.mul(1 ether)).div(3);
uint amountToSend = 0;
if ((uint(now) >= firstThreshold) && (investors[msg.sender].firstWithdraw == 0)) {
investors[msg.sender].balance ... | 6,432,700 |
pragma solidity ^0.4.24;
import 'zeppelin-solidity/contracts/math/SafeMath.sol';
import 'zeppelin-solidity/contracts/ownership/Ownable.sol';
import './GoodCoinMarket.sol';
import './RedemptionData.sol';
contract RedemptionFunctional is Ownable {
using SafeMath for uint256;
RedemptionData public data;
Go... | total at this point is the existing supply plus the suggested total interest, so we need to remove the existing supply - what was causing the issue in the earlier calculation. | function calculateClaim() internal view returns(uint256) {
uint256 base = 100;
uint256 interest = base.add(market.inflationRate());
uint256 total = interest.mul(market.totalSupply());
total = total.div(base);
total = total.sub(market.totalSupply());
uint256 amount = t... | 5,366,608 |
// SPDX-License-Identifier:Unlicensed
pragma solidity ^0.8.2;
//echoes echo echoes
/*
.::. .----
:====: ... | function coming from Seedlings project. ty @dievardump | function isValid(string memory str) public pure returns (bool) {
bytes memory strBytes = bytes(str);
if (strBytes.length < 1) return false;
bytes1 lastChar;
bytes1 char2;
uint8 charCode;
for (uint256 i; i < strBytes.length; i++) {
char2 = strBytes[i];
... | 10,404,164 |
//
// __ __ _____ ______
// /__/\/__/\ /_____/\ /_____/\
// \ \ \: \ \__\:::_:\ \\:::_ \ \
// \::\_\::\/_/\ _\:\| \:\ \ \ \
// \_::: __\/ /::_/__ \:\ \ \ \
// \::\ \ \:\____/\\:\_\ \ \
// \__\/ \_____\/ \_____\/
//
// 420.game Reveal Buds
//
// by LOOK LABS
//
// SPDX-License-I... | Sort an array array a bytes32 array/ | function sort(bytes32[] memory array) public pure returns (bytes32[] memory) {
_quickSort(array, 0, array.length);
return array;
}
| 6,853,685 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contrac... | Destroys `amount` tokens from `account`, deducting from the caller's allowance. See {ERC20-_burn} and {ERC20-allowance}. Requirements: - the caller must have allowance for ``accounts``'s tokens of at least `amount`./ | function burnFrom(address account, uint256 amount) external virtual onlyOwner whenNotPaused {
uint256 currentAllowance = _allowances[account][_msgSender()];
require(currentAllowance >= amount, "ERC20: burn amount exceeds allowance");
_approve(account, _msgSender(), currentAllowance - amount)... | 456,091 |
//Address: 0x8799e7801c602c78e45bcd64196bef0ed16f2d20
//Contract name: Crowdsale
//Balance: 1.292712002 Ether
//Verification Date: 6/19/2018
//Transacion Count: 30
// CODE STARTS HERE
// текущая версия - 9 тестовая для развертывания в Rinkeby
// добавлены комменты в require
// исправлена ф-ия refund
// блокировки пе... | Pre-ICO minimum 15 days | function startCrowdSale() public onlyOwner onlyInState(State.PreICO) {
require (now >= preICOStartTime + 1 days, "Mimimum period Pre-ICO is 15 days");
setState(State.CrowdSale);
crowdSaleStartTime = uint64(now);
}
| 2,482,928 |
//SPDX-License-Identifier: MIT
pragma solidity =0.7.6;
pragma abicoder v2;
import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {SafeMath} from "@openzeppelin/contracts/math/SafeMath.sol";
import {Address} from "@openzeppe... | pause (if not paused) and then immediately shutdown the system, can be called when paused already this bypasses the check on number of pauses or time based checks, but is irreversible and enables emergency settlement/ | function shutDown() external onlyOwner notShutdown {
isSystemPaused = true;
isShutDown = true;
indexForSettlement = Power2Base._getScaledTwap(
oracle,
ethQuoteCurrencyPool,
weth,
quoteCurrency,
TWAP_PERIOD,
false
... | 13,123,570 |
pragma solidity ^0.4.16;
// Belibela Coin Smart contract based on the full ERC20 Token standard
// https://github.com/ethereum/EIPs/issues/20
// Verified Status: ERC20 Verified Token
// Belibela Coin Symbol: Belibela
contract BELIBELAToken {
/* This is a slight change to the ERC20 base standard.
function tot... | Public variables of the token // | function BELIBELA(){
}
| 13,476,504 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.7.6;
pragma abicoder v2; // solhint-disable-line
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/Pausable.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "./libraries/Exponential.sol";
i... | Returns the base 2 exponential of self, reverts if overflow self unsigned 6.64-bit fixed point number return unsigned 64.64-bit fixed point number/ slither-disable-next-line too-many-digits slither-disable-next-line too-many-digits slither-disable-next-line too-many-digits | function expBase2(uint256 self) internal pure returns (uint256) {
require(
_EXP2_FRACTION_MASK == 0x8000000000000000,
"Exponential: fraction mask"
);
require(
_EXP2_IN_MAX_EXPONENT == 0x400000000000000000,
"Exponential: max exponent"
);... | 6,032,764 |
./full_match/1/0x2C5e00ec69b27740CB8155736390ee7e74d279DB/sources/contracts/strategies/HStrategy.sol | pulling missing tokens from erc20 vault on money and uniV3 vaults missingTokenAmounts the amount of missing tokens restrictions the restrictions of the amount of tokens to be transferred moneyVaultOptions additional parameters for pulling for `pull` method for money vault erc20Vault_ ERC20 vault of the strategy mo... | function _pullMissingTokens(
TokenAmounts memory missingTokenAmounts,
RebalanceTokenAmounts memory restrictions,
bytes memory moneyVaultOptions,
IIntegrationVault erc20Vault_,
IIntegrationVault moneyVault_,
IUniV3Vault uniV3Vault_,
address[] memory tokens_
... | 16,590,861 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import "./interfaces/IOverlayV1Deployer.sol";
import "./interfaces/IOverlayV1Factory.sol";
import "./interfaces/IOverlayV1Market.sol";
import "./interfaces/IOverlayV1Token.sol";
import "./interfaces/feeds/IOverlayV1FeedFactory.sol";
import "./libraries/Risk.sol"... | Checks risk param is within acceptable bounds | function _checkRiskParam(Risk.Parameters name, uint256 value) private {
uint256 minValue = PARAMS_MIN.get(name);
uint256 maxValue = PARAMS_MAX.get(name);
require(value >= minValue && value <= maxValue, "OVLV1: param out of bounds");
}
| 14,080,126 |
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) {
return 0;
}
uint2... | transfer token for a specified address _to The address to transfer to. _value The amount to be transferred./ SafeMath.sub will throw if there is not enough balance. | function transfer(address _to, uint256 _value) public onlyPayloadSize(2 * 32) returns (bool) {
require(frozenAccount[msg.sender] == false);
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to]... | 12,070,576 |
./full_match/42/0x57546895955897Ba613018a86D7068cA9Ecc0e56/sources/browser/1_Storage.sol | Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a {Transfer} event with `from` set to the zero address. Requirements - `to` cannot be the zero address./ | function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
... | 16,271,091 |
./partial_match/1/0x8a3515f5D127342fcBba56E13514D4A2391327e6/sources/contracts/protocol/tokenization/base/MintableIncentivizedERC721.sol | @inheritdoc ICollateralizableERC721 | function isUsedAsCollateral(uint256 tokenId)
external
view
override
returns (bool)
{
return _ERC721Data.isUsedAsCollateral[tokenId];
}
| 4,312,052 |
// Market place (smart contract) on Tron blockchain platform.
// Copyright (c) 2020 IDET.kz
// Written by Galymzhan Abdimanap.
pragma solidity 0.5.9;
pragma experimental ABIEncoderV2;
//import "https://github.com/OpenZeppelin/openzeppelin-solidity/contracts/math/SafeMath.sol";
import "SafeMath.sol";
import "Token_cont... | Add index of checks. | function addIndex() public returns(uint){
return _index+=1;
}
| 12,652,363 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";
import "@openzeppeli... | Sets the base URI for episode voting option metadata/ | function setEpisodeOptionBaseURI(string memory baseURI) external onlyOwner {
_episodeOptionBaseURI = baseURI;
}
| 1,528,181 |
pragma solidity =0.6.6;
import '../libraries/UniswapV2LiquidityMathLibrary.sol';
contract ExampleComputeLiquidityValue {
using SafeMath for uint256;
address public immutable factory;
constructor(address factory_) public {
factory = factory_;
}
// see UniswapV2LiquidityMathLibrary#getRes... | test function to measure the gas cost of the above function | function getGasCostOfGetLiquidityValueAfterArbitrageToPrice(
address tokenA,
address tokenB,
uint256 truePriceTokenA,
uint256 truePriceTokenB,
uint256 liquidityAmount
) external view returns (
uint256
) {
uint gasBefore = gasleft();
UniswapV2Li... | 12,767,528 |
pragma solidity >=0.4.21 <0.6.0;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
import "../node_modules/openzeppelin-solidity/contracts/ownership/Ownable.sol";
// 2.10%用于幸运奖励
// 每一轮结束后下一个ETH区块高度Hash最后一位作为幸运值
// 用户钱包地址的最后一位与幸运值相同,则瓜分10%奖励。
// 募资期结束的时间就是当前轮次结束的时间,到达结束时间之后不再允许转入ETH,并在此时获取到最新... | 处理幸运者数据 计算人均奖金 幸运奖励奖金 | function _dealLuckyInfo(
uint256 _stepIndex,
address[] memory _luckyWinners,
uint256 _totalLyckyReward
)
internal
{
luckyWinners[_stepIndex] = new address[](_luckyWinners.length);
luckyWinners[_stepIndex] = _luckyWinners;
if(_luckyWinners.length > 0... | 12,728,447 |
./full_match/80001/0xc0D8ACf15A274d4E4d081107Ee7142fdE52287ad/sources/contracts/MyNFT.sol | Action1: baseURI hosts only one image file. Action2: baseURI hosts the directory. -> update baseURI | function setBaseURI(string memory baseURI_) public{
baseURI = baseURI_;
}
| 858,974 |
./full_match/1/0x35CB0fE6f49932A44f39934F47298E6D34680628/sources/contracts/pool/PoolMetadata.sol | Function returns current (with accrual) insurance value return Current insurance | function insurance() external view returns (uint256) {
return _accrueInterestVirtual().insurance;
}
| 17,111,267 |
./full_match/1/0xefaCa6Fc316B3B2Aa6c55FF5E02a62A85d4391e8/sources/contracts/modules/core/LiquidationModule.sol | @inheritdoc ILiquidationModule/ | function isPositionLiquidatable(
uint128 accountId,
uint128 poolId,
address collateralType
) external override returns (bool) {
Pool.Data storage pool = Pool.load(poolId);
int256 rawDebt = pool.updateAccountDebt(collateralType, accountId);
(, uint256 collateralVal... | 16,517,069 |
./partial_match/1/0x18941E7E887C7BE8C1a7Ae97Da5bd00134bff290/sources/HalfAveAccessPasses.sol | Allows address which own an BAYC NFT to mint when the public sale is open | function BAYCMint(uint64 _mintAmount) public payable mintCompliance(_mintAmount) {
require(saleActive, "Sale is not Active");
require(ownsNFTInCollection(msg.sender, BAYCOwnerAddress), "Does not own Clone X NFT." );
require(BAYCAmountMinted + _mintAmount <= BAYCMintMaxSupply, "Mint limit ex... | 3,564,640 |
./partial_match/1/0xdDc2c27eA8a42b35B329c4e0216600F12EED13d1/sources/contracts/wombat-core/libraries/DSMath.sol | Convert x to WAD (18 decimals) from d decimals. | function toWad(uint256 x, uint8 d) internal pure returns (uint256) {
if (d < 18) {
return x * 10 ** (18 - d);
return (x / (10 ** (d - 18)));
}
return x;
}
| 2,762,361 |
./full_match/1/0x7af62458e41E2F490D2Df54A8FeDc56fFedB8c17/sources/lib/solady/src/utils/ERC1967Factory.sol | Returns the initialization code of a proxy created via this factory. @solidity memory-safe-assembly forgefmt: disable-start If the factory's address has six or more leading zero bytes. | function _initCode() internal view returns (bytes memory m) {
assembly {
m := mload(0x40)
switch shr(112, address())
case 0 {
}
default {
}
}
| 3,202,693 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.4;
import {SafeMath} from "@openzeppelin/contracts/utils/math/SafeMath.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {
SafeERC20
} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {GnosisAuction} from "... | Completes a scheduled withdrawal from a past round. Uses finalized pps for the round minETHOut is the min amount of `asset` to recieve for the swapped amount of steth in crv pool/ This checks if there is a withdrawal We leave the round number as non-zero to save on gas for subsequent writes Unwrap may incur curve pool... | function completeWithdraw(uint256 minETHOut) external nonReentrant {
Vault.Withdrawal storage withdrawal = withdrawals[msg.sender];
uint256 withdrawalShares = withdrawal.shares;
uint256 withdrawalRound = withdrawal.round;
require(withdrawalShares > 0, "Not initiated");
req... | 5,809,057 |
// Dependency file: contracts/interfaces/ISetValuer.sol
/*
Copyright 2020 Set Labs Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2... | Returns assetOneReserve and assetTwoReserve | function _getTotalLPReserves() internal view returns (uint256, uint256) {
(uint reserve0, uint reserve1) = _getReservesSafe();
uint256 totalSupply = lpToken.totalSupply();
uint256 lpTokenBalance = rewarder.balanceOf(address(setToken));
return(
reserve0.mul(lpTokenBalance)... | 1,994,376 |
./full_match/80001/0x01f2F0395AeDFf1067C2d2008B3c956F1f38d0fB/sources/contracts/IndradexBaseVault.sol | Burn tokens and create or update user's withdrawal request./ | function requestWithdrawal(uint256 amount) external{
require(amount > 0, "Vault: withdrawal amount must be greater than 0");
address sender = msg.sender;
uint256 tokensLength = tokens.length();
uint256 totalSupply_ = totalSupply();
_burn(sender, amount);
PendingUsersWithdrawal memory newPendin... | 9,526,197 |
./full_match/7700/0x9B2a63F27661A468E2da22226b64A4914144f195/sources/contracts/libraries/CurveRoll.sol | The same rounding logic as calcBaseFlowPrice applies, but because it's the opposite side we want to conservatively round the price up, regardless of whether it's a buy or sell. Calculating flow price for quote flow is more complex because the flow delta applies to the inverse of the price. So when calculating the inver... | function calcQuoteFlowPrice (uint128 price, uint128 liq, uint128 flow, bool isBuy)
private pure returns (uint128) {
uint128 invPrice = FixedPoint.recipQ64(price);
uint128 invNext = calcBaseFlowPrice(invPrice, liq, flow, !isBuy);
return FixedPoint.recipQ64(invNext) + 1;
}
| 4,651,841 |
./full_match/42220/0x5ADC09F4D33bb8e2DAA1763E717A2a49Ec0E668B/sources/project:/contracts/WeightedReserveController.sol | remove the item at index, resizing array as needed i - Index to remove/ | function removeByIndex(uint i) private {
while (i < registeredPools.length - 1) {
registeredPools [i] = registeredPools [i + 1];
i++;
}
registeredPools.pop();
}
event BoughtReserveToken(address indexed buyer, address indexed tokenIn, uint256 amountIn, uint256... | 16,312,372 |
./full_match/1/0xfc68E90f0f173a8D69991eB44b2766187E4f807E/sources/contracts/SilverGerege.sol | Updates the maximum supply of tokens This function allows the contract owner to increase the maximum supply of tokens. The new maximum supply cannot be less than the existing maximum supply. _maxSupply The new maximum supply/ | function updateMaxSupply(uint256 _maxSupply) external onlyOwner {
require(_maxSupply > maxSupply, "New max supply cannot be less than current max supply");
maxSupply = _maxSupply;
}
| 16,396,952 |
//Address: 0xed2725cdfc48a24aa71d9b9621d431db0705a55a
//Contract name: FiinuCrowdSale
//Balance: 0 Ether
//Verification Date: 10/14/2017
//Transacion Count: 570
// CODE STARTS HERE
pragma solidity ^0.4.15;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
... | This is the actual transfer function in the token contract, it can only be called by other functions in this contract. _from The address holding the tokens being transferred _to The address of the recipient _amount The amount of tokens to be transferred return True if the transfer was successful Alerts the token co... | function doTransfer(address _from, address _to, uint256 _amount
) internal returns(bool) {
if (_amount == 0) {
return true;
}
require(parentSnapShotBlock < block.number);
if (previousBalanceFrom < _amount) {
return false;
}
if (isContr... | 12,678,710 |
pragma solidity ^0.4.24;
/**
* @title SpinWinInterface
*/
interface SpinWinInterface {
function refundPendingBets() external returns (bool);
}
/**
* @title AdvertisingInterface
*/
interface AdvertisingInterface {
function incrementBetCounter() external returns (bool);
}
contract SpinWinLibr... | Reward the referree if necessary. referreeAddress The address of the referree betInternalId The internal bet ID/ If the player already has a referee, use that address | function _rewardReferree(address referreeAddress, uint256 betInternalId) internal {
Bet memory _bet = bets[betInternalId];
if (referees[_bet.playerAddress] != address(0)) {
referreeAddress = referees[_bet.playerAddress];
}
if (referreeAddress != address(0) && referreeAddress != _bet.playerAddress) {
ref... | 6,478,621 |
./full_match/43113/0xa1ED150Db4CAff7c9638f3F419Da622f756E5a52/sources/contracts/libraries/MultiSend.sol | Sends multiple transactions and reverts all if one fails. transactions Encoded transactions. Each transaction is encoded as a packed bytes of operation as a uint8 with 0 for a call or 1 for a delegatecall (=> 1 byte), to as a address (=> 20 bytes), value as a... | function multiSend(bytes memory transactions) public payable {
require(address(this) != multisendSingleton, "MultiSend should only be called via delegatecall");
assembly {
let length := mload(transactions)
let i := 0x20
for {
let operation := shr(0... | 7,178,101 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
//
// This contract handles swapping to and from PlatinumNugget, LuckySwap's staking token.
cont... | Leave the alchemybench. Claim back your GOLNs. Unlocks the staked + gained GoldNugget and burns PlatinumNugget Gets the amount of PlatinumNugget in existence Calculates the amount of GoldNugget the PlatinumNugget is worth | function leave(uint256 _share) public {
uint256 totalShares = totalSupply();
uint256 what = _share.mul(goldnugget.balanceOf(address(this))).div(totalShares);
_burn(msg.sender, _share);
goldnugget.transfer(msg.sender, what);
}
| 175,685 |
./full_match/3/0xA4dF1aCdEa6f1A800f538B43F37B1d651f510be8/sources/browser/Gol.sol | require(totalSupply() == MAX_NFT_SUPPLY); | function offerGolForSaleToAddress(
uint256 golIndex,
uint256 minSalePriceInWei,
address toAddress
) public {
require(tradingEnabled);
require(ownerOf(golIndex) == msg.sender);
require(golIndex < MAX_NFT_SUPPLY);
golOfferedForSale[golIndex] = Offer(
... | 14,192,267 |
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.8.0;
pragma abicoder v2;
import "../../common/implementation/FixedPoint.sol";
// Simple contract used to withdraw liquidations using a DSProxy from legacy contracts (1.2.2 and below).
contract LiquidationWithdrawer {
function withdrawLiquidation(
... | Constructs the Testable contract. Called by child contracts. _timerAddress Contract that stores the current time in a testing environment. Must be set to 0x0 for production environments that use live time./ | function rounds(uint256 roundId) public view virtual returns (Round memory);
function getPriceRequestStatuses(VotingInterface.PendingRequest[] memory requests)
public
view
virtual
returns (RequestState[] memory);
function getPendingPriceRequestsArray() external view virtual... | 271,752 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.7;
import "../../../lib/polygon/aave/test-defi-base.sol";
import "../../../lib/hevm.sol";
import "../../../lib/user.sol";
import "../../../lib/test-approx.sol";
import "../../../../interfaces/aave.sol";
import "../../../../pickle-jar.sol";
import "../../../../co... | Withdraws back to pickleJar Gained some interest | function test_aave_dai_v3_withdrawAll() public {
_getERC20(want, 100e18);
uint256 _want = IERC20(want).balanceOf(address(this));
IERC20(want).approve(address(pickleJar), _want);
pickleJar.deposit(_want);
pickleJar.earn();
strategy.leverageToMax();
hevm.warp... | 12,814,368 |
./full_match/1/0x39159BE9E506d73b776c063D117B8367aA1139e9/sources/contracts/SamuraiJack.sol | Sets tax for buys./ | function setBuyTax(uint256 dev,uint256 liquidity) public onlyOwner {
buyTaxes["dev"] = dev;
buyTaxes["liquidity"] = liquidity;
}
| 2,998,987 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.4;
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/finance/PaymentSplitterUpgradeable.sol";
import "@openz... | ERC2981 Called with the sale price to determine how much royalty is owed and to whom. _tokenId - the NFT asset queried for royalty information _salePrice - the sale price of the NFT asset specified by _tokenId return receiver - address of who should be sent the royalty payment return royaltyAmount - the roy... | function royaltyInfo(
uint256 _tokenId,
uint256 _salePrice
) external view returns (
address receiver,
uint256 royaltyAmount
) {
return (
address(this),
);
}
| 1,078,793 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeCast.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openze... | Harvest proceeds of all pools for msg.sender _pids ids of the pools/ | function allocClaimAll(uint256[] memory _pids) external nonReentrant {
uint256 length = _pids.length;
for (uint256 pid = 0; pid < length; ++pid) {
_allocClaimReward(pid);
}
}
| 266,594 |
pragma solidity 0.4.26;
import "./IVotingCenter.sol";
import "./IVotingController.sol";
import "./VotingProposal.sol";
/// Contract to allow voting based on a snapshotable token (with relayed, batched voting)
contract VotingCenter is IVotingCenter {
using VotingProposal for VotingProposal.Proposal;
////////... | Utility public functions solium-disable indentation | function handleStateTransitions(bytes32 proposalId)
public
withTimedTransition(proposalId)
function isValidSignature(
bytes32 proposalId,
bool voteInFavor,
address voter,
bytes32 r,
bytes32 s,
uint8 v
)
public
constant
... | 5,344,683 |
pragma solidity ^0.4.18;
import "../ConversionRates.sol";
contract MockConversionRate is ConversionRates {
constructor(address admin) ConversionRates(admin) public {}
function mockGetImbalance(TRC20 token, uint rateUpdateBlock, uint currentBlock) public view
returns(int totalImbalance, int currentBl... | get rate update block | function getUpdateRateBlockFromCompact (TRC20 token) public view returns(uint updateRateBlock) {
bytes32 compactData = tokenRatesCompactData[tokenData[token].compactDataArrayIndex];
updateRateBlock = getLast4Bytes(compactData);
}
| 2,563,626 |
./full_match/1/0x7049386F00BB8e1f7c41c8B7124b9DaF539Abc59/sources/contracts/ERC721/ERC721xyzUpgradeable.sol | See {IERC721-setApprovalForAll}./ | function setApprovalForAll(
address operator,
bool approved
) public virtual override onlyAllowedOperatorApproval(operator) {
_setApprovalForAll(_msgSender(), operator, approved);
}
| 3,013,105 |
./full_match/1/0x39Ac1AC1B7c45b3E78f1290a542D428E7aB8E59C/sources/browser/XTrinity_flat.sol | fallback function to withdraw tokens from contract - not normally needed/ | function transferTokenBack(address TokenAddress)
external
onlyOwner
returns (uint256 returnBalance)
{
IERC20 Token = IERC20(TokenAddress);
returnBalance = Token.universalBalanceOf(address(this));
if (returnBalance > 0) {
Token.universalTransfer(msg.sen... | 4,980,526 |
/**
*Submitted for verification at Etherscan.io on 2021-07-02
*/
/*
TELEGRAM GROUP: https://t.me/DEGENCRYPT
🚀Fairlaunch with no team tokens whatsoever, no developer wallet. Liquidation will be locked and ownership renounced immediately.
Total Supply 100,000,000,000,000,000
🚀 DEGEN PUMP x100
✅ ADMIN RENOUNCED
✅ ... | SPDX-License-Identifier: Unlicensed | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint... | 2,370,071 |
./full_match/11155111/0xf90bA889C8f993Fd625D05D8aB0459dbFE46C3FD/sources/contracts/fee-distribution/FeeDistributor.sol | Returns the user's cached balance of veBAL as of the provided timestamp. Only timestamps which fall on Thursdays 00:00:00 UTC will return correct values. This function requires `user` to have been checkpointed past `timestamp` so that their balance is cached. user - The address of the user of which to read the cached... | function getUserBalanceAtTimestamp(address user, uint256 timestamp) external view override returns (uint256) {
return _userBalanceAtTimestamp[user][timestamp];
}
| 3,839,393 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;
import "./ShackledStructs.sol";
import "./ShackledMath.sol";
import "./Trigonometry.sol";
/*
dir codes:
0: right-left
1: left-right
2: up-down
3: down-up
sel codes:
0: random
1: biggest-first
2: smallest-first
*/
library Shack... | get the maximum extent of the geometry (vertical or horizontal) / | function getExtents(int256[3][3][] memory tris)
internal
view
returns (int256[3][2] memory)
{
int256 minX = MAX_INT;
int256 maxX = MIN_INT;
int256 minY = MAX_INT;
int256 maxY = MIN_INT;
int256 minZ = MAX_INT;
int256 maxZ = MIN_INT;
... | 1,257,294 |
./full_match/5/0x9BA50Cf5Bb96482eB1cf9aF45fDc72377B0f7094/sources/src/finance/withdraw/Withdrawable.sol | We are using msg.sender for smaller attack surface when evaluating the sender of the function call. If in future we want to handle "withdraw" functionality via meta transactions, we should consider using `_msgSender`/ | function withdraw(address[] calldata claimTokens, uint256[] calldata amounts) external {
WithdrawableStorage.Layout storage l = WithdrawableStorage.layout();
if (l.mode == IWithdrawable.Mode.NOBODY) {
revert WithdrawImpossible();
if (l.recipient != msg.sender) {
... | 1,923,192 |
./full_match/1/0xf07306Ee5F7ed63E28057C9854b6d848110fEd5C/sources/@yield-protocol/vault-v2/contracts/Join.sol | Take `amount` `asset` from `user` using `transferFrom`, minus any unaccounted `asset` in this contract. | function _join(address user, uint128 amount)
internal
returns (uint128)
{
IERC20 token = IERC20(asset);
uint256 _storedBalance = storedBalance;
storedBalance = _storedBalance + amount;
return amount;
}
| 3,844,099 |
pragma solidity ^0.4.24;
contract owned {
address public owner;
function owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
owner = newOwner;
}
}
/... | Set allowance for other address Allows `_spender` to spend no more than `_value` tokens in your behalf _spender The address authorized to spend _value the max amount they can spend/ | function approve(address _spender, uint256 _value) public
returns (bool success) {
allowance[msg.sender][_spender] = SafeMath.safeSub(allowance[msg.sender][_spender], _value);
emit Approval(msg.sender, _spender, _value);
return true;
}
| 11,880,494 |
./full_match/4/0x6A99Bc6276fe4879b4C2e1CAa2a834f0E796807B/sources/CryptoCoinNFT_flat.sol | Update the supply for the collection _supply the new token supply. create additional token supply for this collection. | function _setSupply(uint256 _supply) internal virtual {
require(_supply > tokenCount(), "Can't set the supply to less than the current token count");
_totalSupply = _supply;
emit SupplyChanged(totalSupply());
}
| 782,430 |
pragma solidity ^0.4.16;
contract Permissions {
address ownerAddress;
address storageAddress;
address callerAddress;
function Permissions() public {
ownerAddress = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == ownerAddress);
_;
}
modifier onlyCaller() {
require(msg.se... | do checks in caller function | function add(address _owner, uint16 _species, uint8 _subSpecies, uint8 _eyeColor) external onlyCaller {
Creature memory _creature = Creature({
species: _species,
subSpecies: _subSpecies,
eyeColor: _eyeColor,
timestamp: uint64(now)
});
uint256 newCreatureID = creatures.push(_creature) - 1;
transfer(... | 941,018 |
./full_match/1/0x99E445fb7E33E3eA5F1527D285d9B2CCA0Fc8520/sources/contracts/interfaces/IERC20Minimal.sol | Minimal ERC20 interface for Uniswap Contains a subset of the full ERC20 interface that is used in Uniswap V3 | interface IERC20Minimal {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns... | 4,908,040 |
./full_match/7700/0xe9F857be65E73c0bc86BCbb35cA8aFAB4d70e178/sources/contracts/StrategyY2R.sol | compounds earnings and charges performance fee | function _harvest() internal whenNotPaused {
if (IComptroller(comptroller).pendingComptrollerImplementation() == address(0)) {
uint256 beforeBal = balanceOfWant();
IComptroller(comptroller).claimComp(address(this));
uint256 outputBal = IERC20(output).balanceOf(address(thi... | 4,654,518 |
./full_match/82/0x31C222e0D862827137ab5D4e8EE30c41Cc915a96/sources/contracts/oracle/implementation/OptimisticOracleV2.sol | Set the proposal bond associated with a price request. identifier price identifier to identify the existing request. timestamp timestamp to identify the existing request. ancillaryData ancillary data of the price being requested. bond custom bond amount to set. return totalBond new bond + final fee that the propose... | function setBond(
bytes32 identifier,
uint256 timestamp,
bytes memory ancillaryData,
uint256 bond
) external override nonReentrant() returns (uint256 totalBond) {
require(_getState(msg.sender, identifier, timestamp, ancillaryData) == State.Requested, "setBond: Requested")... | 7,093,973 |
./partial_match/1/0xCF1F07C97A802C04eD743F989758BC2BeE7e1572/sources/ImmortalsNFT.sol | Function of the team to mint at the start | function ownerMint(uint256 numberOfTokens) external onlyOwner {
require(numberOfTokens > 0, "Invalid number of tokens");
require(totalSupply() + numberOfTokens <= maxSupply, "Maximum supply reached");
for (uint256 i = 0; i < numberOfTokens; ++i) {
mint(msg.sender);
}
}
| 3,716,490 |
pragma solidity 0.4.24;
import "../interfaces/ComponentContainerInterface.sol";
import "../interfaces/FutureInterfaceV1.sol";
import "../interfaces/LockerInterface.sol";
import "../libs/ERC20NoReturn.sol";
import "../interfaces/ComponentListInterface.sol";
import "../interfaces/ReimbursableInterface.sol";
import "../i... | Return the value required to buy a share to a current price | function calculateShareDeposit(uint _amountOfShares, uint _targetPrice) public view returns(uint) {
return _amountOfShares
.mul(amountOfTargetPerShare)
.mul(_targetPrice)
.mul(depositPercentage)
}
| 6,383,816 |
pragma solidity ^0.4.24;
/**
* @title -FoMo-3Dx beta
*
* WARNING: THIS PRODUCT IS HIGHLY ADDICTIVE. IF YOU HAVE AN ADDICTIVE NATURE. DO NOT PLAY.
*/
//==============================================================================
// _ _ _ _|_ _ .
// (/_\/(/_| | | _\ .
//==========================... | distributes eth based on fees to dev/ pay 10% out to developer rewards transfer to developer rewards contract set up event data | function distributeExternal(uint256 _eth, F3Ddatasets.EventReturns memory _eventData_)
private
returns(F3Ddatasets.EventReturns)
{
uint256 _dev = (_eth.mul(fees_.dev)).div(100);
DeveloperRewards.transfer(_dev);
_eventData_.devAmount = _dev.add(_eventData_.devAmo... | 15,035,119 |
// 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... | Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`... | function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
... | 6,970 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.