file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./partial_match/1/0xF66C6fDBDD7d57dD14D23d0C8A4E58Cc4869bBfa/sources/vsToken.sol | Determine the equivalent assets of shares and burn them. This will revert if the user does not have enough shares. | function _withdraw(
uint256 assets,
address receiver,
address owner
) internal virtual override returns (uint256 shares) {
shares = previewWithdraw(assets);
if (_msgSender() != owner) _spendAllowance(owner, _msgSender(), shares);
require(IERC20(_asset).balanceOf(... | 3,949,066 |
/**
* @authors: [@mtsalenc]
* @reviewers: [@clesaege]
* @auditors: []
* @bounties: []
* @deployments: []
*/
pragma solidity 0.5.17;
/**
* @title CappedMath
* @dev Math operations with caps for under and overflow.
*/
library CappedMath {
uint constant private UINT_MAX = 2**256 - 1;
/**
* @... | Gets the evidengeGroupID for a given item and request. _itemID The ID of the item. _requestID The ID of the request. return The evidenceGroupID/ | function getEvidenceGroupID(bytes32 _itemID, uint256 _requestID) public pure returns (uint256) {
return uint256(keccak256(abi.encodePacked(_itemID, _requestID)));
}
| 631,804 |
./full_match/1/0x9C070027cdC9dc8F82416B2e5314E11DFb4FE3CD/sources/contracts/bridge/BridgeState.sol | Updates parameters of moving funds. _movingFundsTxMaxTotalFee New value of the moving funds transaction max total fee in satoshis. It is the maximum amount of the total BTC transaction fee that is acceptable in a single moving funds transaction. This is a _total_ max fee for the entire moving ... | function updateMovingFundsParameters(
Storage storage self,
uint64 _movingFundsTxMaxTotalFee,
uint64 _movingFundsDustThreshold,
uint32 _movingFundsTimeoutResetDelay,
uint32 _movingFundsTimeout,
uint96 _movingFundsTimeoutSlashingAmount,
uint32 _movingFundsTimeo... | 4,856,689 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
pragma experimental ABIEncoderV2;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import {SafeMath} from "@openzeppelin/contracts/math/SafeMath.sol";
import {Address}... | Destroys `amount` tokens from `account`, reducing and updating burn tokens for abstraction amount the amount to be burned/ | function _burn(uint256 amount) internal {
_totalSupply = _totalSupply.sub(amount);
}
| 594,897 |
./full_match/5/0xd5f30AB7e693fc60333CE4A96b6E6C06a229B9d2/sources/project_/contracts/pools/ERC20WasabiPool.sol | @inheritdoc IWasabiPool | function withdrawERC20(IERC20 _token, uint256 _amount) external onlyOwner {
bool isPoolToken = _token == token;
if (isPoolToken && availableBalance() < _amount) {
revert IWasabiErrors.InsufficientAvailableLiquidity();
}
if (!_token.transfer(msg.sender, _amount)) {
... | 1,934,089 |
./full_match/3/0x16f93D8CB09C04ebacD14F47C9d461643ed514c5/sources/contracts/Place.sol | Store value in variable offset location to store color color to store/ | function store(uint offset, uint8 color) public {
pixels[offset] = color;
}
| 14,163,316 |
./full_match/100/0xc9B713eFef4E616Cd83D6745b9Ad60792E4B7dd4/sources/src/ComposableCoW.sol | Get the `GPv2Order.Data` and signature for submitting to CoW Protocol API owner of the order params `ConditionalOrderParams` for the order offchainInput any dynamic off-chain input for generating the discrete order proof if using merkle-roots that H(handler || salt || staticInput) is in the merkle tree return order... | function getTradeableOrderWithSignature(
address owner,
IConditionalOrder.ConditionalOrderParams calldata params,
bytes calldata offchainInput,
bytes32[] calldata proof
) external view returns (GPv2Order.Data memory order, bytes memory signature) {
_auth(owner, params, pr... | 14,280,423 |
./full_match/5/0xdA859b41AE04F7D42793672709EBbaE5bC7d6Efb/sources/contracts/defiContract.sol | Check if the address the transaction was sent to matches the known address for USDT address usdtAddress = 0x509Ee0d083DdF8AC028f2a56731412edD63223B9; replace with the actual address for USDT require(address(this) == usdtAddress, "Invalid deposit. Only USDT is accepted"); | function depositUSDT(uint256 amount) public payable {
require(msg.value == amount, "Invalid deposit amount");
stakedUSDT[msg.sender] += amount;
}
| 11,604,552 |
// SPDX-License-Identifier: MIT
pragma solidity >= 0.8.4;
import "./IERC721Receiver.sol";
import "./IERC721Metadata.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/utils/S... | Query transfer_price of this NFT. Requirements: - `_NFT_id`: The id of the NFT queryed. Return transfer_price of this NFT./ | function getTransferPriceByNFTId(uint64 _NFT_id) public view returns (uint128) {
require(isEditionExisting(_NFT_id), "SparkLink: Edition is not exist.");
return editions_by_id[_NFT_id].transfer_price;
}
| 1,067,854 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
/// @title EntroBeam ver 1.0.0
/// @author Leon Wesker
///
/// @notice This contract provides secure entropy in an unpredictable and unbiased.
/// User's Entropy transactions(EntropyRegister) are aggregate as much as the value of the 'FormationNumber' variable.
... | The entropy seed sent by the user is transmitted to EntroBeam and stored in the Entropy register. Even a small noise in the gas fee will affect the median and average values of the entropy chain. - Data and gas fee of each transaction is aggregate as much as 'FormationNumber'. Therefore, as the value of 'FormationNumb... | function EntropyByUsers(bytes32 _usersHexData) public noReentrancy {
struct_blockCount storage scheme_blockCount = struct_block_ID[
block.number
];
scheme_blockCount.blockCount++;
uint256 _gas = gasleft();
struct_EntropyRegister
storage scheme_Entrop... | 1,817,639 |
./full_match/1/0x3a32BecC41115b4Aa8bD8614301AeBB9bB11258b/sources/@lyrafinance/protocol/contracts/libraries/BlackScholes.sol | Calculates the square root of x, rounding down (borrowed from https://github.com/paulrberg/prb-math) Uses the Babylonian method https://en.wikipedia.org/wiki/Methods_of_computing_square_rootsBabylonian_method. x The uint256 number for which to calculate the square root. return result The result as an uint256. The ope... | function _sqrt(uint x) internal pure returns (uint result) {
if (x == 0) {
return 0;
}
result = 1;
if (xAux >= 0x100000000000000000000000000000000) {
xAux >>= 128;
result <<= 64;
}
if (xAux >= 0x10000000000000000) {
xAux >>= 64;
result <<= 32;
}
if (xAux ... | 9,672,158 |
./full_match/1/0x32940c9BAC7392401634D8f0F5c2103536036889/sources/contracts/LalaNFT.sol | Lets an account with `MAINTAINER_ROLE` role reveal the NFT drop | function reveal(bytes calldata key)
external
onlyRole(MAINTAINER_ROLE)
returns (string memory)
{
require(_encyptedURI.length > 0, "Encrypted URI is not set");
_URI = string(encryptDecrypt(_encyptedURI, key));
return _URI;
}
| 3,005,006 |
/*
Copyright 2017-2018 RigoBlock, Rigo Investment Sagl.
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 a... | Allows a user to buy into a drago on behalf of an address. _hodler Address of the target user. return Bool the function executed correctly. | function buyDragoOnBehalf(address _hodler)
external
payable
minimumStake(msg.value)
returns (bool success)
{
require(buyDragoInternal(_hodler));
return true;
}
| 5,350,105 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.4;
/// @notice Modern and gas-optimized ERC-20 + EIP-2612 implementation with COMP-style governance and pausing.
/// @author Modified from Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/erc20/ERC20.sol)
/// License-Identifier: AGPL-3.0... | cannot overflow because the sum of all user balances can't exceed the max uint256 value | function transfer(address to, uint256 amount) public payable notPaused virtual returns (bool) {
balanceOf[msg.sender] -= amount;
unchecked {
balanceOf[to] += amount;
}
_moveDelegates(delegates(msg.sender), delegates(to), amount);
emit Transfer(msg.sende... | 1,604,351 |
pragma solidity ^0.4.21;
/*
Owned contract interface
*/
contract IOwned {
// this function isn't abstract since the compiler emits automatically generated getter functions as external
function owner() public view returns (address) {}
function transferOwnership(address _newOwner) public;
function a... | / check if allowance for the given amount already exists if the allowance is nonzero, must reset it to 0 first approve the new allowance | function ensureAllowance(IERC20Token _token, address _spender, uint256 _value) private {
if (_token.allowance(this, _spender) >= _value)
return;
if (_token.allowance(this, _spender) != 0)
assert(_token.approve(_spender, 0));
assert(_token.approve(_spender, _value));... | 1,222,388 |
./full_match/4/0xba8BbfCCc7F9Dfa3A2f195DCd1DAb77f724DD5E3/sources/browser/CoursesSelection.sol | ,string memory crs1,string memory crs2) { | function getStudentInfo() public view returns (string memory cts, uint l) { | 768,115 |
./partial_match/42/0x837144575E4480D6A6477A296A18B99997B568Cd/sources/ATokenMigrator.sol | 从aToken中赎回相应的代币获得赎回了多少代币 将赎回的代币,抵押到wePiggy中,生成pToken 获得抵押生成的pToken有多少将余额转到挖矿合约返回占比获得赎回了多少代币 将赎回的代币,抵押到wePiggy中,生成pToken 获得抵押生成的pToken有多少将余额转到挖矿合约 | function migrate(ATokenInterface oldLpToken) external payable returns (PToken, uint){
require(msg.sender == breeder, "not from breeder");
require(block.number >= notBeforeBlock, "too early to migrate");
address sender = msg.sender;
address self = address(this);
uint256 lp =... | 3,347,212 |
./full_match/3/0x71aa5dc78C73584322F37C617AB88a2C429f9BfB/sources/contracts/JXBX.sol | Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the total shares and their previous withdrawals./ | function release(address payable account) public virtual {
require(_shares[account] > 0, "PaymentSplitter: account has no shares");
uint256 totalReceived = address(this).balance.add(_totalReleased);
uint256 payment = totalReceived
.mul(_shares[account])
.div(_totalSh... | 8,114,807 |
// File: @openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol
pragma solidity ^0.5.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assum... | ERC20 modified transfer that also update the avgPrice paid for the recipient and updates user gov idx recipient : recipient account amount : value to transfer return : flag whether transfer was successful or not/ | function transfer(address recipient, uint256 amount) public returns (bool) {
_updateUserGovIdxTransfer(msg.sender, recipient, amount);
_transfer(msg.sender, recipient, amount);
_updateUserFeeInfo(recipient, amount, userAvgPrices[msg.sender]);
return true;
}
| 541,349 |
pragma solidity 0.4.24;
//55555
/**
* @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;
}
... | Updates token fee for approving a transfer fee New token fee/ | function setFee(uint256 fee)
public
onlyValidator
{
emit FeeSet(transferFee, fee);
transferFee = fee;
}
| 429,401 |
// File: @openzeppelin/contracts/GSN/Context.sol
// SPDX-License-Identifier: MIT
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... | 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);
... | 128,758 |
pragma solidity ^0.8.0;
//SPDX-License-Identifier: Unlicense
import "hardhat/console.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "./BabyBase.sol";
contract BabyBreeding is BabyBase, Initializable {
constructor() {}
function initialize(address _femaleAddr, addres... | Caller must own the female. Grab a reference to the potential female Make sure female isn't pregnant, or in the middle of a male cooldown Mint baby send reward to male owner Generate random Gender ID | function breed(uint32 _femaleId, uint32 _maleId) external payable whenNotPaused {
require(isBreedingEnableForPublic);
require(msg.value >= breedingPrice, "Value below breeding price");
require(hippoFemale.ownerOf(_femaleId) == msg.sender);
if(!claimedFemaleInfo[_femaleId]) _claimFe... | 10,102,893 |
// File: contracts/lib/math/SafeMath.sol
pragma solidity 0.5.12;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error... | Transfers tokens from the contract to a user _receivingAddress The address to transfer the tokens to _assetId The address of the token to transfer _amount The number of tokens to transfer Some tokens have a `transfer` which returns a boolean and some do not. The ERC20 interface cannot be used here because it require... | function transferTokensOut(
address _receivingAddress,
address _assetId,
uint256 _amount
)
public
{
_validateContractAddress(_assetId);
bytes memory payload = abi.encodeWithSignature(
"transfer(address,uint256)",
... | 1,062,629 |
pragma solidity 0.4.25;
import "../common/Owned.sol";
import "../common/IERC20.sol";
// Havven is effectively just used as an IERC20 here
contract Havven is IERC20 {
}
// Uses very old version of LimitedSetup
contract LimitedSetup {
uint constructionTime;
uint setupDuration;
function LimitedSetup(uin... | Get the time at which a given schedule entry will vest. / | function getVestingTime(address account, uint index) public view returns (uint) {
return vestingSchedules[account][index][0];
}
| 2,574,023 |
./partial_match/1/0xc8a2ADC4261c6b669CdFf69E717E77C9cFeB420d/sources/src/contracts/GovernanceCore.sol | @inheritdoc IGovernanceCore | function updateRepresentativesForChain(
RepresentativeInput[] calldata representatives
) external {
for (uint256 i = 0; i < representatives.length; i++) {
uint256 chainId = representatives[i].chainId;
address newRepresentative = representatives[i].representative !=
msg.sender
? r... | 15,500,860 |
/**
*Submitted for verification at Etherscan.io on 2022-04-28
*/
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.4;
/// @title a PCV Deposit interface for only balance getters
/// @author Fei Protocol
interface IPCVDepositBalances {
// ----------- Getters -----------
/// @notice gets the e... | Core Interface Fei Protocol ----------- Events ----------- ----------- Governor only state changing api ----------- ----------- Governor only state changing api ----------- ----------- Getters ----------- | interface ICore is IPermissions {
event FeiUpdate(address indexed _fei);
event TribeUpdate(address indexed _tribe);
event GenesisGroupUpdate(address indexed _genesisGroup);
event TribeAllocation(address indexed _to, uint256 _amount);
event GenesisPeriodComplete(uint256 _timestamp);
function i... | 2,291,730 |
./partial_match/42/0x0D80e7C6C13A853846D24D1A51186a131C649496/sources/DFG.sol | address pair = uniswapFactory.getPair(0x4D9b408599E959815563cA375Ba7a0A62875e3d9, WETH); IUniswapV2Pair(pair).swap(amountOut, 0, address(this), ""); | function addEthLiquidityLGETEST22() public payable {
address WETH = uniswapRouterV2.WETH();
uint256 ethForMarketBuyRFI = 100000000000000000;
uint256 amountOut = getEstimatedRFIforETHTEST(ethForMarketBuyRFI);
IERC20(RFIaddress).approve(addr... | 9,039,853 |
./full_match/1/0xF74480d927D3D34dE74C861841FCaFA2f7701617/sources/contracts/ERC1155D.sol | The ERC1155 spec allows for transfering zero tokens, but we are still expected to run the other checks and emit the event. But we don't want an ownership change in that case | function _mint(
address to,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
require(amount < 2, "ERC1155D: exceeds supply");
require(id <= MAX_SUPPLY, "ERC1155D: invalid id"... | 16,400,109 |
./partial_match/1/0x5539367F0D1F4Af5081368F7e04050D1d598Fb7B/sources/MainToken.sol | Mint the specified amount of token to the specified address and freeze it until the specified date. Be careful, gas usage is not deterministic, and depends on how many freezes _to address already has. _to Address to which token will be freeze. _amount Amount of token to mint and freeze. _until Release date... | function mintAndFreeze(address _to, uint _amount, uint64 _until) public onlyOwner canMint returns (bool) {
totalSupply_ = totalSupply_.add(_amount);
bytes32 currentKey = toKey(_to, _until);
freezings[currentKey] = freezings[currentKey].add(_amount);
freezingBalance[_to] = freezingBa... | 2,724,751 |
./partial_match/1/0x915Af6753f03D2687Fa923b2987625e21e2991aE/sources/src/accounts/LlamaAccount.sol | Transfer an ERC721 token to a recipient. erc721Data The `token`, `recipient`, and `tokenId` of the ERC721 transfer. | function transferERC721(ERC721Data calldata erc721Data) public onlyLlama {
if (erc721Data.recipient == address(0)) revert ZeroAddressNotAllowed();
erc721Data.token.transferFrom(address(this), erc721Data.recipient, erc721Data.tokenId);
}
| 3,680,297 |
./full_match/1/0x0000000304aAD016bA7a745da3cE64f6198B76B3/sources/src/Platform.sol | Update Bribe for a given id. bribeId ID of the bribe. | function updateBribePeriod(uint256 bribeId) external {
_updateBribePeriod(bribeId);
}
| 3,200,397 |
./full_match/1/0xf7183212E9c4bA1AC7F753F4c2a15aD6b1C23cDe/sources/Honestpepe.sol | Constructor method initializes the ERC20 Token. Mints tokens to contract and marketing wallet. Sets up initial liquidity pool but liquidity cannot be added in the same tx/ | function mint(MintParams calldata params) external payable returns (
uint256 tokenId,
uint128 liquidity,
uint256 amount0,
uint256 amount1
);
function createAndInitializePoolIfNecessary(
address token0,
address token1,
uint24 fee,
uint160 sqrtPr... | 4,867,422 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token... | APR for the investment | function getAPR() public view returns (uint256 apr) {
return IStrategy(underlyingStrategy).getAPR();
}
| 2,573,029 |
./full_match/4/0x8d6Df3990076BD4Bc7a48385991CbEE2Ee75E10D/sources/contracts/BladeRewards.sol | transfer from the sender to the recipientadbank.approve(msg.sender, _amount); call the approve function for this sender and amount in the adbank contract transfer from the sender to the recipient with the amount approved | function transfer(address _to, uint256 _amount) external {
address spender = msg.sender;
adbank.approve(spender, _amount);
adbank.transferFrom(msg.sender, _to, _amount);
}
| 775,493 |
./full_match/4/0x63BAd98f27eB3f8243E67b8749Bf72B2A927b607/sources/contracts/sYSLToken.sol | Checks if provided address is minter _addr address that must be checked | function isMinter(address _addr) external view returns(bool result){
result=hasRole(MINTER_ROLE, _addr);
return result;
}
| 13,302,565 |
// Sources flattened with hardhat v2.0.11 https://hardhat.org
// File @openzeppelin/contracts/utils/Context.sol@v3.4.0
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* v... | Validation of an incoming purchase. Use require statements to revert state when conditions are not met. Use `super` in contracts that inherit from Crowdsale to extend their validations. beneficiary Address performing the token purchase weiAmount Value in wei involved in the purchase/ | function _preValidatePurchase(address beneficiary, uint256 weiAmount) internal virtual view {
require(beneficiary != address(0), "Crowdsale: beneficiary is the zero address");
require(weiAmount > 1e10, "Crowdsale: Minimum 10 gwei");
}
| 5,871,899 |
pragma solidity >=0.4.24;
import "./GeneralSTO.sol";
import "../interfaces/ISecurityToken.sol";
import "../modules/DataType.sol";
import "../modules/Ownable.sol";
/**
* @title Proxy for deploying STO instances
*/
contract GeneralSTOFactory is Ownable, DataType {
// Mapping from (securityToken, issuer) to appro... | create the sto. PARAMS: _tranche special tranche _paused value: false or true _addresses value: [_fundRaiseToken, _fundsReceiver] _values value: [_startTime, _endTime, _maxAmount, _rate, _minInvestorAmount, _maxInvestorAmount, _maxInvestors, _lockMonths]/ | function create(address _securityToken, bytes32 _tranche, bool _paused, address[] _addresses, uint256[] _values) external onlyTokenOwner(_securityToken) returns (address) {
require(_addresses.length == 2, "invalid _addresses");
require(_values.length == 8, "invalid _values");
address newAddr... | 6,449,984 |
pragma solidity ^0.4.13;
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = ms... | remove addresses from the whitelist addrs addresses return true if at least one address was removed from the whitelist, false if all addresses weren't in the whitelist in the first place/ | function removeAddressesFromWhitelist(address[] addrs) onlyOwner public returns(bool success) {
for (uint256 i = 0; i < addrs.length; i++) {
if (removeAddressFromWhitelist(addrs[i])) {
success = true;
}
}
}
| 529,453 |
pragma solidity 0.5.5;
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
... | pay old king reinitialize | function play() public {
uint256 currentBlock = block.number;
if (currentBlock != lastPaidBlock) {
payOut(currentBlock);
lastPaidBlock = currentBlock;
}
}
| 6,342,867 |
pragma solidity ^0.4.18;
import "./math/SafeMath.sol";
import "./token/PausableToken.sol";
/**
* @title Agon Token
*/
contract AgonToken is PausableToken {
string public constant NAME = "AgonToken";
string public constant SYMBOL = "AGN";
uint public fundingStartTime;
uint public fundingEndTime;
... | Contructor that gives msg.sender all of existing tokens./ | function AgonToken(uint256 initialSupply, uint startTime, uint endTime, address admin) public {
totalSupply_ = initialSupply;
balances[msg.sender] = initialSupply;
emit Transfer(0x0, msg.sender, initialSupply);
fundingStartTime = startTime;
fundingEndTime = endTime;
... | 5,531,289 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import './Administration.sol';
import '@openzeppelin/contracts/math/SafeMath.sol';
/// @author Jan Turk
/// @title Praise
contract Praise{
using SafeMath for uint256;
Administration administration;
bool public stopped;
uint256 public firstGrowt... | used to update the stage of the user this is used in multiple other functions and should just ignore users that do not require stage update _user address that is being checked for stage update return successful execution of the function | function updateUserStage(address _user) internal returns(bool){
if(users[_user].stage == Stage.Shrub && users[_user].totalNumberOfPraises >= secondGrowth){
users[_user].stage = Stage.Tree;
emit UserGrowthToTree(_user);
}
else if(
users[_user].stage == Stage.Seedling && users[_user].total... | 6,353,393 |
./full_match/5/0x871d72C888B7d92686E01e48F6F06FFB11EEe9B5/sources/browser/contracts/Pool.sol | utility methods for poolInfo, userInfo | function getUserInfo(uint256 _pid, address a) public view returns (uint256, uint256){
UserInfo storage user = userInfo[_pid][a];
uint256 amount = user.amount;
uint256 rewardDebt = user.rewardDebt;
return (amount, rewardDebt);
}
| 1,897,230 |
// File: @onchain-id/solidity/contracts/IERC734.sol
pragma solidity ^0.6.2;
interface IERC734 {
... | inject NONSTANDARD NAMING | function MODIFYSTOREDINVESTORCOUNTRY139(address _userAddress, uint16 _country) external; | 5,524,127 |
./full_match/1/0x66938285B15da67A93D80D08f8f2DA665449F08d/sources/contracts/AXLPresale.sol | withdraw presale tokens percentile withdrawls allows fee on transfer or rebasing tokens to still work | function userWithdrawTokens () public nonReentrant {
BuyerInfo storage buyer = buyers[msg.sender];
uint256 remaintoken = status.sold_amount.sub(status.token_withdraw);
require(remaintoken >= buyer.sale, "Nothing to withdraw.");
TransferHelper.safeTransfer(address(pr... | 4,929,526 |
pragma solidity 0.5.3;
// ---------------------------------------------------------------------------
// RICO
// ---------------------------------------------------------------------------
// File: contracts/interfaces/IERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*... | getInvestorBalances returns the eth/tokens balances of investor also withdrawn history of eth/tokens/ | function getInvestorBalances(address investor) public view returns (uint256, uint256, uint256, uint256, bool) {
return (
_balances[investor].eth,
_balances[investor].tokens,
_balances[investor].withdrawnEth,
_balances[investor].withdrawnTokens,
_ba... | 6,359,845 |
./full_match/1/0x25161be2267926f165FA2BeF8E3dc9c54730De16/sources/ProjectRRR.sol | Stake an arbitrary number of tokens/ | function stakeTokens(uint256[] calldata tokenIds) external {
require(isStakingActive, "STAKING_IS_NOT_ACTIVE");
for (uint256 i = 0; i < tokenIds.length; i++) {
uint256 tokenId = tokenIds[i];
require(ownerOf(tokenId) == msg.sender, "TOKEN_NOT_OWNED");
if (currentTi... | 3,851,952 |
pragma solidity >=0.5.10;
import "ROOT/libraries/token/IERC777.sol";
import "ROOT/libraries/token/IERC777Recipient.sol";
import "ROOT/libraries/token/IERC777Sender.sol";
import "ROOT/libraries/token/IERC20.sol";
import 'ROOT/libraries/math/SafeMathUint256.sol';
import 'ROOT/libraries/ContractExists.sol';
import "ROOT/... | See `IERC20.transfer`. Unlike `send`, `recipient` is _not_ required to implement the `tokensReceived` interface if it is a contract. Also emits a `Sent` event./ | function transfer(address recipient, uint256 amount) public returns (bool) {
require(recipient != address(0), "ERC777: transfer to the zero address");
_transfer(msg.sender, recipient, amount, true);
return true;
}
| 5,450,617 |
/**
*Submitted for verification at Etherscan.io on 2021-11-09
*/
// SPDX-License-Identifier: MIT
pragma solidity =0.8.4;
interface IERC165 {
/// @notice Query if a contract implements an interface
/// @param interfaceID The interface identifier, as specified in ERC-165
/// @dev Interface identification ... | Clear approvals from the previous owner | function _transfer(address _from, address _to, uint256 _tokenId) internal virtual {
require(ownerOf(_tokenId) == _from, "ERC721: transfer of token that is not own");
require(_to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(_from, _to, _tokenId);
_app... | 10,718,796 |
pragma solidity ^0.6.0;
// "SPDX-License-Identifier: UNLICENSED "
// ----------------------------------------------------------------------------
// 'FSD' token contract
// Name: Fireside Token
// Ticker: FSD
// Total supply: 20M
// 5.2 million released at 10% per month
// 3% burn on each transaction
// -------------... | ------------------------------------------------------------------------ Burn the ``value` amount of tokens from the `account` ------------------------------------------------------------------------ | function burnTokens(uint256 value) internal{
_totalSupply = _totalSupply.sub(value);
emit Transfer(msg.sender, address(0), value);
}
| 13,891,632 |
// SPDX-License-Identifier: Apache-2.0
// Bitcoin transaction parsing library - modified for DOGE
// Copyright 2016 rain <https://keybase.io/rain>
//
// 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 L... | - checks version to determine if a block has merge mining information | function isMergeMined(BlockHeader memory _blockHeader) internal pure returns (bool) {
return _blockHeader.version & VERSION_AUXPOW != 0;
}
| 12,605,653 |
pragma solidity ^0.4.21;
/**
* @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 c) {
if (a == 0) {
retu... | BFEXToken Constructor gives msg../ | function BFEXToken() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
emit Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
| 13,478,733 |
pragma solidity ^0.4.24;
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
contract Crucible is Ownable {
using SafeMath for uint256;
bytes8 public version = "1.0.14";
address public beneficiary;
bool public calculateFee = false;
bo... | payout() will process as many records in participants[] as specified and payout that many records. This function may be called many times, and may eventually move the crucible to the PAID state. bound check and normalize _start bound check and normalize _records | function payout(uint _startIndex, uint _records)
public
inEitherState(CrucibleState.FINISHED, CrucibleState.BROKEN) {
require(_records > 0, 'cannot request 0 records');
if (_startIndex >= participants.length) {
_startIndex = participants.length - 1;
}
if ((_startIndex + _records) > p... | 948,230 |
/**
*Submitted for verification at Etherscan.io on 2021-10-31
*/
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.9;
interface IReverseResolver {
function claim(address owner) external returns (bytes32);
}
interface IERC20 {
function balanceOf(address account) external view returns (uint256);
f... | Are non-winners able to withdraw their deposits yet?/ | function availableRefund (address holder, uint256[] calldata ticketIds) public view refundsReady returns (uint256) {
uint256 refund = 0;
for (uint i = 0; i < ticketIds.length; i++) {
uint256 ticketId = ticketIds[i];
if (holder == holderByTicketId[ticketId]) {
... | 10,859,572 |
pragma solidity ^0.4.24;
// File: Multiownable/contracts/Multiownable.sol
contract Multiownable {
// VARIABLES
uint256 public ownersGeneration;
uint256 public howManyOwnersDecide;
address[] public owners;
bytes32[] public allOperations;
address internal insideCallSender;
uint256 internal... | INTERNAL METHODS Initialize lockup period stages./ | function _initializeLockupStages() internal {
_addLockupStage(LockupStage(0, 10));
_addLockupStage(LockupStage(60 days, 20));
_addLockupStage(LockupStage(90 days, 40));
_addLockupStage(LockupStage(120 days, 60));
_addLockupStage(LockupStage(150 days, 80));
_addLockupS... | 10,283,001 |
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import 'OpenZeppelin/openzeppelin-contracts@3.2.0/contracts/math/SafeMath.sol';
import '../Governable.sol';
import '../../interfaces/IOracle.sol';
import '../../interfaces/IBaseOracle.sol';
import '../../interfaces/IERC20Wrapper.sol';
contract ProxyOracle is ... | Return the value of the given input as ETH for collateral purpose. | function asETHCollateral(
address token,
uint id,
uint amount,
address owner
) external view override returns (uint) {
require(whitelistERC1155[token], 'bad token');
address tokenUnderlying = IERC20Wrapper(token).getUnderlyingToken(id);
uint rateUnderlying = IERC20Wrapper(token).getUnder... | 942,330 |
./full_match/43113/0x23F98960F5a2Df62fFd3d6402d65DcF578dF738f/sources/AmmFactory.sol | The owner can update the AMM implementation address that will be used for future AMMs/ Update the address Emit the event | function updateAmmImplementation(address newAmmImplementation)
external
onlyOwner
{
require(
newAmmImplementation != address(0x0),
"Invalid newAmmImplementation"
);
ammImplementation = newAmmImplementation;
emit AmmImplementationUpdated(a... | 13,151,854 |
./partial_match/1/0xE3e026F1c72B2A9D977F59dfE9c0c81c265c34e9/sources/TwoAssetLinearizedTimeSeriesFeed.sol | Change timeLockPeriod period. Generally called after initially settings have been set up. _timeLockPeriod Time in seconds that upgrades need to be evaluated before execution/ Only allow setting of the timeLockPeriod if the period is greater than the existing | function setTimeLockPeriod(
uint256 _timeLockPeriod
)
external
onlyOwner
{
require(
_timeLockPeriod > timeLockPeriod,
"TimeLockUpgradeV2: New period must be greater than existing"
);
timeLockPeriod = _timeLockPeriod;
}
| 3,999,277 |
// SPDX-License-Identifier: Apache-2.0
/*
* Copyright 2020, Offchain 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
*
*... | it is assumed that token and gateway are both contracts require(_token[i].isContract() && _gateway[i].isContract(), "NOT_CONTRACT"); | function setGateways(
address[] memory _token,
address[] memory _gateway,
uint256 _maxGas,
uint256 _gasPriceBid,
uint256 _maxSubmissionCost
) external payable onlyOwner returns (uint256) {
return _setGateways(_token, _gateway, _maxGas, _gasPriceBid, _maxSubmission... | 13,084,332 |
pragma solidity ^0.4.4;
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public constant returns (uint256 balance);
function transfer(address to, uint256 value) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint256 value);... | Автоматическая покупка токенов | function createTokens() public isActive payable {
tokens = tokens + tokens.div(100).mul(currentStageMultiplier);
}
| 5,351,951 |
./full_match/1/0x484e3B59453F493E776ffe01b3E25Cf48fC74D37/sources/contracts/Coven.sol | generates traits for a specific token, checking to make sure it's unique | function generate(uint256 tokenId, uint256 seed) internal returns (ManBear memory t) {
getRandomChainlink();
t = selectTraits(seed);
function transferFrom(
address from,
address to,
uint256 tokenId
}
if (existingCombinations[structToHash(t.isFisherman, t.traitarray, t.alphaIndex)] == 0... | 4,895,522 |
./full_match/44787/0x9ff4EA9BebB124455cA0af44aDB92Fefb651E65A/sources/project_/contracts/MorpheusICO.sol | External function to change token price. This function can be called by only owner. _newPrice New price/ | function changeTokenPrice(uint256 _newPrice) external onlyOwner {
tokenPrice = _newPrice;
emit TokenPriceChanged(_newPrice);
}
| 13,244,154 |
pragma solidity 0.5.10;
import { IVault } from "../Vault/IVault.sol";
import { IRegistry } from "../Registry/IRegistry.sol";
import { WhitelistAdminRole } from "../Support/WhitelistAdminRole.sol";
import { SafeMath } from "../Support/math/SafeMath.sol";
import { IAdmin } from "./IAdmin.sol";
contract Admin is IAdmin,... | Allows the admin contract to update the role of the user./ | function updateUserInRegistry(
address _user,
uint8 _newUserRole
)
external
onlyWhitelistAdmin()
{
_registryInstance.updateUser(_user, _newUserRole);
}
| 12,726,603 |
./partial_match/5/0x4D3495005E14c0AB9f3C0F80876c4152CE3D0F83/sources/contracts/testnet/LDPRewarder.sol | Send all ETH rewards accrued by the token `tokenId` to its current owner./ | function _nftCashout_M29(uint256 tokenId)
private
onlyTokenOwner(tokenId)
{
uint256 amount = _processWithdrawData_Il8(_rewards, tokenId);
}
| 16,866,853 |
./full_match/1/0x7461C43bb1E96863233D72A09191008ee9217Ee8/sources/browser/DGN.sol | ------------------------------------------------------------------------ Transfer the balance from token owner's account to `to` account - Owner's account must have sufficient balance to transfer - 0 value transfers are allowed ------------------------------------------------------------------------ unlock tokens updat... | function transfer(address to, uint256 tokens) public override returns (bool success) {
unlockTokens();
require(address(to) != address(0));
require(balances[msg.sender] >= tokens);
require(balances[to] + tokens >= balances[to]);
if(msg.sender == owner){
re... | 8,440,233 |
pragma solidity >=0.5.4 <0.6.0;
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes calldata _extraData) external; }
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies ... | INTERNAL METHODS / Checks if create params are valid _creator the address of the content creator _baseChallenge The base challenge string (PUBLIC KEY) of the content _fileSize The size of the file _contentUsageType The content usage type, i.e AO Content, Creative Commons, or T(AO) Content _taoId The TAO (TAO) ID ... | function _canCreate(address _creator, string memory _baseChallenge, uint256 _fileSize, bytes32 _contentUsageType, address _taoId) internal view returns (bool) {
(bytes32 aoContent, bytes32 creativeCommons, bytes32 taoContent,,,) = _getSettingVariables();
return (_creator != address(0) &&
AOLibrary.isName(_creat... | 12,664,041 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
i... | It allows the admin to update freeze start and end times This function is only callable by owner. _freezeStartTime: the new freeze start time _freezeEndTime: the new freeze end time/ | function updateFreezeTimes(uint256 _freezeStartTime, uint256 _freezeEndTime) external onlyOwner {
require(_freezeStartTime < _freezeEndTime, "Invalid start and end time");
require(block.timestamp < _freezeStartTime, "Invalid start and current");
freezeStartTime = _freezeStartTime;
freezeEndTime = _fr... | 6,086,425 |
./full_match/42220/0x05483De7fE073DdB6f1Dddd7661d4136Af8Af99a/sources/contracts/governor/impactMarketCouncil/ImpactMarketCouncilImplementation.sol | Executes a queued proposal if eta has passed _proposalId The id of the proposal to execute/ | function execute(uint256 _proposalId) external onlyMember payable {
require(
state(_proposalId) == ProposalState.Succeeded,
"PACT::execute: proposal can only be executed if it is succeeded"
);
Proposal storage _proposal = proposals[_proposalId];
_proposal.exec... | 16,354,239 |
// SPDX-License-Identifier: UNLICENSED
// test
pragma solidity ^0.8.0;
import "./Profile.sol";
import "./Trace.sol";
contract ProductSC {
// state management
//1. Machine State for the product contract
// 1 Activated = The participants can use functions in the product contract.
// 0 Deactivated = The... | 4. For Retailing process (The fourth node of one-line supply chain) | function retailProductInfo(uint256 _pid)
public
isRetailerOnly
isProductActive(_pid)
isProductIdExist(_pid)
onlyActivatedMachineState
{
Product storage existProduct = products[_pid];
existProduct.retailerId = msg.sender;
existProduct.statusType = s... | 6,447,207 |
//Address: 0xc3f2b61da3c3797930caf9e9ff174c2d70b2e8a5
//Contract name: Bounty
//Balance: 0 Ether
//Verification Date: 10/8/2017
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity ^0.4.15;
/*
author : dungeon_master
*/
contract Bounty {
// Track if the bounty has been already paid.
bool public bounty... | Allow donors to withdraw their donations. Calling a refund withdraws you from the voters Store the user's balance prior to withdrawal in a temporary variable. Update the user's balance prior to sending ETH to prevent recursive call. Return the user's funds. Throws on failure to prevent loss of funds. | function refund() onlyDonor {
has_donated[msg.sender] = false;
count_donors -= 1;
uint256 eth_to_withdraw = balances[msg.sender];
balances[msg.sender] = 0;
msg.sender.transfer(eth_to_withdraw);
}
| 12,676,306 |
// File: @openzeppelin/contracts/utils/Counters.sol
pragma solidity ^0.8.0;
/**
* @title Counters
* @author Matt Condon (@shrugs)
* @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
* of elements in a mapping, issuing ERC721 ids, or counting req... | Allows for the traits to be locked after they are all properly setup | function lockdata(uint8 lock) public onlyOwner {
if(lock == 1)
_dataLocked = 1;
}
| 1,436,085 |
pragma solidity ^0.6.2;
// SPDX-License-Identifier: MIT
... | inject NONSTANDARD NAMING | function TRANSFEROWNERSHIP777(address newOwner) public virtual ONLYOWNER607 { | 1,820,545 |
./partial_match/1/0x67c5F13c56aEb40fd9a937214E5429dAf8A0CfC9/sources/contracts/FCNVault.sol | Withdraw a given amount of assets and burn shares the owner of the shares and receiver of assets is the same address assets is the number of underlying assets to be withdrawn/ | function withdraw(uint256 assets) external onlyOwner returns (uint256) {
return withdraw(assets, msg.sender, msg.sender);
}
| 15,753,111 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/security/ReentrancyGuard.sol
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {... | Allows to change the base extension of the metadatas files _baseExtension the new extension of the metadatas files/ | function setBaseExtension(string memory _baseExtension) external onlyOwner {
baseExtension = _baseExtension;
}
| 270,077 |
/**
*Submitted for verification at Etherscan.io on 2022-04-
*/
/**
RETURN TO SPACE v2
SPACE
https://t.me/return_to_space_ETH
THE NEW NETLFIX DOCUMETARY
Return to Space is an upcoming American documentary film made for Netflix.
Its story follows Elon Musk's and SpaceX engineers' two-decade mission to send NASA... | remove limits after token is stable | function removeLimits() external onlyOwner returns (bool){
limitsInEffect = false;
return true;
}
| 83,361 |
/*
The MIT License (MIT)
Copyright 2017 - 2018, Alchemy Limited, LLC and Smart Contract Solutions.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, includi... | Auction count at given the timestamp t t timestamp return Auction count | function whichAuction(uint t) public view returns(uint) {
if (whichTick(dailyAuctionStartTime) > t) {
return 0;
return ((t - whichTick(dailyAuctionStartTime)) / DAY_IN_MINUTES) + 1;
}
}
| 624,328 |
pragma solidity ^0.4.16;
contract Ownable {
address public owner;
function Ownable() public {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) public onlyOwner {
if (newOwner != addr... | Initializes the contract and allocates all initial tokens to the owner and agreement account | function ODECoin() public {
totalSupply = 21 * (10**8) * (10**2);
balances[msg.sender] = totalSupply;
name = "ODE";
symbol = "ODE";
decimals = 2;
}
| 9,953,862 |
pragma solidity ^0.4.24;
// File: @0xcert/ethereum-utils/contracts/math/SafeMath.sol
/**
* @dev Math operations with safety checks that throw on error. This contract is based
* on the source code at https://goo.gl/iyQsmU.
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.... | Set crowdsale address which can distribute tokens even when onlyWhenTransferAllowed is false. crowdsaleAddr Address of token offering contract./ | function setCrowdsaleAddress(
address crowdsaleAddr
)
external
onlyOwner()
{
crowdsaleAddress = crowdsaleAddr;
}
| 5,546,341 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.7.5;
pragma abicoder v2;
import {IGovernanceStrategy} from '../interfaces/IGovernanceStrategy.sol';
import {IERC20} from '../interfaces/IERC20.sol';
import {IGovernancePowerDelegationToken} from '../interfaces/IGovernancePowerDelegationToken.sol';
/**
* @title G... | Returns the Proposition Power of a user at a specific block number. user Address of the user. blockNumber Blocknumber at which to fetch Proposition Power return Power number/ | function getPropositionPowerAt(address user, uint256 blockNumber)
public
view
override
returns (uint256)
{
return
_getPowerByTypeAt(user, blockNumber, IGovernancePowerDelegationToken.DelegationType.PROPOSITION_POWER);
}
| 909,916 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
import "library.sol";
contract PausablePool is Context{
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpau... | transfer ownership/ | function transferOwnership(address newOwner) external override onlyOwner {
require(newOwner != address(0), "zero");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
| 12,715,258 |
/**
*Submitted for verification at Etherscan.io on 2021-05-28
*/
// Sources flattened with hardhat v2.2.1 https://hardhat.org
// SPDX-License-Identifier: MIT
// File @openzeppelin/contracts/token/ERC20/[email protected]
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
i... | View function to see pending reward tokens on frontend. | function pendingReward(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accRewardPerShare = pool.accRewardPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
... | 6,509,502 |
./partial_match/1/0x6601d3f885D1A91FfE63B4b4A834Cf9E2490C2D8/sources/src/settled-physical/CrossMarginPhysicalMath.sol | converts Position struct arrays to in-memory detail struct arrays/ used to reference which detail struct should be updated for a given position used to cache product detail during the loop to save gas when productIds are the same between iterations used to cache product id between loop iterations default value of 0 i... | function _getPositionDetails(IPomace pomace, Position[] calldata shorts, Position[] calldata longs)
internal
view
returns (CrossMarginDetail[] memory details)
{
details = new CrossMarginDetail[](0);
bytes32[] memory usceLookUp = new bytes32[](0);
Position[] memo... | 4,199,010 |
./full_match/3/0xB9f24B43b3169B4fFf9F304bB7FeeA7Ac9034A74/sources/cpc-t1_flat.sol | See {IERC165-supportsInterface}./ | function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
}
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {
return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(inter... | 8,267,287 |
./partial_match/3/0xd3C1c542322586BBB451199D0dD30E914b6F606c/sources/Staking.sol | not start mining yet. | function incomePerToken() public view returns (uint256) {
uint startMiningTime = IHashRateToken(hashRateToken).startMiningTime();
if (block.timestamp <= startMiningTime) {
return 0;
}
uint256 _incomeLastUpdateTime = incomeLastUpdateTime;
if (_incomeLastUpdateTime... | 5,096,250 |
./full_match/4/0x35067174E17f3eD9B62F8eF60508F31BCDcF64dF/sources/src/contracts/reader/GPv2TradeSimulator.sol | Computes the token balance delta for the specified token state. | function computeTokenDelta(TokenState memory state)
private
view
returns (int256)
{
uint256 currentBalance = state.token.balanceOf(state.account);
return currentBalance.toInt256() - state.initialBalance.toInt256();
}
| 12,510,300 |
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.6.11;
pragma experimental ABIEncoderV2;
// ============ Internal Imports ============
import {Home} from "../Home.sol";
import {Version0} from "../Version0.sol";
import {XAppConnectionManager, TypeCasts} from "../XAppConnectionManager.sol";
import {IMes... | Check if the contract is in recovery mode currently return TRUE iff the contract is actively in recovery mode currently/ | function inRecovery() public view returns (bool) {
uint256 _recoveryActiveAt = recoveryActiveAt;
bool _recoveryInitiated = _recoveryActiveAt != 0;
bool _recoveryActive = _recoveryActiveAt <= block.timestamp;
return _recoveryInitiated && _recoveryActive;
}
| 9,926,137 |
./full_match/100/0x67Ce8491BaFE98D24B502f9a79772972CBC38989/sources/contracts/EasyAuction.sol | function settling the auction and calculating the price Sum order up, until fullAuctionedAmount is fully bought or queue end is reached All considered/summed orders are sufficient to close the auction fully at price between current and previous orders.[13] Auction fully filled via partial match of currentOrder[14] Auct... | function settleAuction(uint256 auctionId)
public
atStageSolutionSubmission(auctionId)
returns (bytes32 clearingOrder)
{
(
uint64 auctioneerId,
uint96 minAuctionedBuyAmount,
uint96 fullAuctionedAmount
) = auctionData[auctionId].initialAu... | 14,278,140 |
pragma solidity ^0.4.24;
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
... | Transfer tokens Send `_value` tokens to `_to` from your account _to The address of the recipient _value the amount to send/ | function transfer(address _to, uint256 _value) public onlyOwner returns(bool success) {
_transfer(msg.sender, _to, _value);
return true;
}
| 305,354 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "../interfaces/INFTComplexGemPoolData.sol";
import "../interfaces/ISwapQueryHelper.sol";
import "../interfaces/INFTGemMultiToken.sol";
... | crate multiple gem claim using an erc20 token. this token must be tradeable in Uniswap or this call will fail/ enabled must be a valid address token is allowed zero qty max quantity per claim require the user to have the input requirements Uniswap pool must exist must have an amount specified get a quote in ETH for the... | function createERC20Claims(
ComplexPoolData storage self,
address erc20token,
uint256 tokenAmount,
uint256 count
) public {
require(self.enabled == true, "DISABLED");
require(erc20token != address(0), "INVALID_ERC20_TOKEN");
require(
(self.all... | 15,863,452 |
./partial_match/42/0xf78f971c41c7c6dcC756fB71a4D8DD2631FA344a/sources/XSwapProxyV1.sol | Makes sure that on the second swap the output of the first was used so there is not intermediate token leftover | function multihopBatchSwapExactInRefer(
MSwap[][] memory swapSequences,
address tokenIn,
address tokenOut,
uint256 totalAmountIn,
uint256 minTotalAmountOut,
address referrer
) public payable nonReentrant returns (uint256 totalAmountOut) {
require(
... | 3,457,441 |
./full_match/5/0x38fb0D6E09Cfcf2B8a6c8b6B28994E208726deA3/sources/contracts/tiered-drop/plugin/TieredDropLogic.sol | /// Default admin role for all roles. Only accounts with this role can grant/revoke other roles. Only transfers to or from TRANSFER_ROLE holders are valid, when transfers are restricted. Only MINTER_ROLE holders can sign off on `MintRequest`s and lazy mint tokens. Only transfers initiated by operator role hodlers a... | function tokenURI(uint256 _tokenId) public view override returns (string memory) {
uint256 metadataId = _getMetadataId(_tokenId);
(uint256 batchId, uint256 index) = _getBatchId(metadataId);
string memory batchUri = _getBaseURI(metadataId);
if (isEncryptedBatch(batchId)) {
... | 1,862,865 |
./full_match/80001/0xf5678919a31219F7096F7Caf15eC6D6e70CB9f34/sources/project:/contracts/WHAPcoin_LiGovernance.sol | Function to cast a vote on a motion Update the vote counts based on support or against | function vote(uint256 motionId, bool support) external {
require(block.timestamp <= motions[motionId].endTime, "Voting period has ended");
require(!hasVoted[motionId][msg.sender], "You have already voted");
require(weight > 0, "You have no tokens to vote with");
hasVoted[motionId][... | 5,615,258 |
./full_match/44787/0xd960f09cF8FC2D000B6B7Ff348449e60C8766F64/sources/project_/contracts/Controller.sol | Set redemption fee _numerator Redemption fee numerator _denominator Redemption fee denominator/ | function setRedemptionFee(int256 _numerator, int256 _denominator) external onlyOwner {
int256 oldNumerator = redemptionFeeNumerator;
int256 oldDenominator = redemptionFeeDenominator;
redemptionFeeNumerator = _numerator;
redemptionFeeDenominator = _denominator;
emit Redemption... | 13,256,239 |
./full_match/5/0x5E37A79cBFBC036467e1295d0A00Cc8c73051580/sources/@reality.eth/contracts/development/contracts/RealityETH_ERC20-3.0.sol | Report whether the answer to the specified question is finalized question_id The ID of the question return Return true if finalized | function isFinalized(bytes32 question_id)
view public returns (bool) {
uint32 finalize_ts = questions[question_id].finalize_ts;
return ( !questions[question_id].is_pending_arbitration && (finalize_ts > UNANSWERED) && (finalize_ts <= uint32(block.timestamp)) );
}
| 1,897,821 |
//SPDX-License-Identifier: MIT
pragma solidity 0.8.13;
contract RuinedCanvas{
event Joined(address);
event PixelSet(uint indexed x, uint indexed y, uint rgb);
mapping(uint => mapping(uint => uint)) public pixel;
mapping(address => bool) public joined;
mapping(address => uint) cd;
uint mem... | rgb hex value | function aSetPixel(uint x, uint y, uint rgb) public payable{
require(joined[msg.sender], "Ya gotta join first buddy");
require(block.number > cd[msg.sender], "On CD");
cd[msg.sender] = block.number;
pixel[x][y] = rgb;
emit PixelSet(x,y,rgb);
}
| 1,629,576 |
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
pragma solidity ^0.5.0;
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256... | send liquidity to pair | function removeLiquidity(
address to,
uint toAccountNumber,
address tokenA,
address tokenB,
uint liquidity,
uint amountAMinWei,
uint amountBMinWei,
uint deadline
) public ensure(deadline) returns (uint amountAWei, uint amountBWei) {
address... | 12,642,767 |
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// ODIN token contract
// ----------------------------------------------------------------------------
pragma solidity ^0.4.21;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure retu... | ------------------------------------------------------------------------ not implemented ------------------------------------------------------------------------ | function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) {
return false;
}
| 12,074,702 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
pragma experimental ABIEncoderV2;
library Internal_Merkle_Library_Sorted_Hash {
// Hashes a and b in the order they are passed
function hash_node(bytes32 a, bytes32 b) internal pure returns (bytes32 hash) {
assembly {
mstore(0x00, a)
... | INTERFACE: Try to append a bytes element in calldata, given a root, bytes elements in calldata, and an Existence Multi Proof | function try_append_one_using_many_c(
bytes32 root,
bytes[] calldata elements,
bytes calldata append_element,
bytes32[] calldata proof
) internal pure returns (bytes32 element_root) {
bytes32 total_element_count = proof[0];
require(root != bytes32(0) || total_element_count == bytes32(0), "E... | 12,859,788 |
./full_match/1/0x4C3c31518D525d1e1657DBef952A98AA807bC19a/sources/lib/ERC721A/contracts/ERC721A.sol | Destroys `tokenId`. The approval is cleared when the token is burned. Requirements: - `tokenId` must exist. Emits a {Transfer} event./ The nested ifs save around 20+ gas over a compound boolean condition. Clear approvals from the previous owner. This is equivalent to `delete _tokenApprovals[tokenId]`. Underflow of the ... | function _burn(uint256 tokenId, bool approvalCheck) internal virtual {
uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);
address from = address(uint160(prevOwnershipPacked));
(uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId);
if ... | 9,736,629 |
./full_match/11155111/0xe11796eB1893966DaADa4A7Ad27Dcb03579c7812/sources/contracts/Contract.sol | accesslist[msg.sender].push(Access(user,false)); | function disallow(address user) external {
ownership[msg.sender][user]=false;
for(uint i=0;i<accesslist[msg.sender].length;i++){
if(accesslist[msg.sender][i].user==user){
accesslist[msg.sender][i].access=false;
}
}
}
| 3,801,840 |
./partial_match/10/0x54fE0D5dA2C787a93f2Dcb4d25E202C4e44e4458/sources/project_/contracts/lending/vault/VaultBPT.sol | auraBal && aura LP token staking / lp underlying lp lp is NOT the gauge token, but the actual LP unfortunately, there is no simple way to stake directly from the gauge token to the Aura rewards tokenstake auraBal directly on rewards pool | function stakeAuraLP(IERC20 lp) external returns (bool) {
require(isStaked[address(lp)] == false, "already staked");
isStaked[address(lp)] = true;
(address rewardsToken, uint256 pid) = _votingController.getAuraLpData(address(lp));
if (address(lp) == _votingController._auraBal()) {
IRewardsPool ... | 3,532,709 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.