file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./full_match/288/0x676971096aF637B196f6501818ae8d9c14EBa56b/sources/contracts/liquidate/SwapCenterBoba.sol | Swap the tokens with pre-defined routes. tokenIn Address of the input token. tokenOut Address of the output token. amountIn Amount of the input token. minAmountOut The minimum amount of the output token expected to receive. If the output amount is smaller than this value, the transaction will be reverted. address s... | function swapExactTokenIn(address tokenIn, address tokenOut, uint256 amountIn, uint256 minAmountOut) external override payable nonReentrant returns (uint256) {
if(isETH(tokenIn)){
require(msg.value == amountIn, "Amount of Ether sent doesn't match amountIn argument");
require(msg.value == 0, "Shouldn'... | 7,106,294 |
pragma solidity ^0.5.16;
interface IERC20 {
function TOTALSUPPLY886() external view returns (uint); //inject NONSTANDARD NAMING
function BALANCEOF698(address account) external view returns (uint); //inject NONSTANDARD NAMING
function TRANSF... | inject NONSTANDARD NAMING | function _MINT845(address account, uint amount) internal { | 7,321,030 |
pragma solidity ^0.4.18;
contract FullERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
uint256 public totalSupply;
uint8 public decimals;
function balanceOf(address who) public view ret... | Removes the given token address from the approved sources. tokenAddress the address of the token Shifting costs significant gas with every write. UI should update the reward sources after this function call. | function removeRewardToken(address tokenAddress) public onlyOwner {
require(tokenAddress != address(0));
require(approvedRewardSources[tokenAddress]);
approvedRewardSources[tokenAddress] = false;
for (uint i = 0; i < rewardSources.length; i++) {
if (rewardSources[i].rew... | 971,676 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.3;
import "@openzeppelin/contracts/token/ERC20/ERC20Snapshot.sol";
import "@openzeppelin/contracts/utils/Arrays.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
/**
* @title ProofOfHumanity Interface
* @dev See https://github.com/Proof-Of-Humanity/Proof-... | ProofOfHumanity Interface/ | interface IProofOfHumanity {
function isRegistered(address _submissionID)
external
view
returns (
bool registered
);
function submissionCounter() external view returns (uint count);
pragma solidity 0.7.3;
}
| 12,670,152 |
pragma solidity ^0.5.3;
import "testeth/Log.sol";
import "testeth/Assert.sol";
import "testeth/Account.sol";
contract Factory {
event Deployed(address addr, uint256 salt);
function deploy1SignerWallet(uint256 threshold, address signatory) public returns (address payable addr) {
assembly {
// Multisig W... | Multisig Wallet Code Below | function deploy2SignerWallet(uint256 threshold, address signatory1, address signatory2) public returns (address payable addr) {
assembly {
mstore(1000, 0x38610137600039600051305560605b60405160200260600181101561002f5780)
mstore(1032, 0x518151555b60208101905061000e565b5060f780610040600039806000f350fe)
... | 6,460,288 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
pragma experimental ABIEncoderV2;
// Interfaces.
import '../interfaces/IERC20.sol';
import '../interfaces/IAssetHandler.sol';
import '../interfaces/IAddressResolver.sol';
import '../interfaces/Mobius/ISwap.sol';
import '../interfaces/Mobius/IMasterMind.sol';
imp... | Returns the address of a token pair. _tokenA First token in pair. _tokenB Second token in pair. return address The pair's address./ | function getPair(address _tokenA, address _tokenB) public view override returns (address) {
require(_tokenA != address(0), "MobiusAdapter: invalid address for tokenA.");
require(_tokenB != address(0), "MobiusAdapter: invalid address for tokenB.");
address swapAddress = swapAddresses[_tokenA... | 12,726,998 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0 <0.9.0;
import "./LionShare.sol";
contract LionShareSale {
address payable admin;
LionShare public tokenContract;
uint256 public tokenPrice;
uint256 public tokensSold;
event Sell(address _buyer, uint256 _amount);
constructor(LionShare ... | uint all_funds = address(this).balance;admin.transfer(all_funds);require(address(this).balance == 0);Contracts can be deleted from the blockchain by calling selfdestruct.selfdestruct sends all remaining Ether stored in the contract to an designated address. | function endSale() public {
require(msg.sender == admin);
require(tokenContract.transfer(admin, tokenContract.balanceOf(address(this))));
selfdestruct(admin);
}
| 2,531,473 |
./partial_match/1/0xFbC3661021539b2a2102Bd2476E7F2371Cb8d763/sources/AlphaMutants.sol | Counter overflow is impossible as the loop breaks when uint256 i is equal to another uint256 numMintedSoFar. | function tokenOfOwnerByIndex(address owner, uint256 index) internal view returns (uint256) {
uint256 numMintedSoFar = _currentIndex;
uint256 tokenIdsIdx;
address currOwnershipAddr;
unchecked {
for (uint256 i; i < numMintedSoFar; i++) {
TokenOwnership memo... | 4,180,735 |
./full_match/4/0x011F0DA68ce3F80b2C8DCd6D94B2f36280ff3b6f/sources/contracts/ico.sol | returning the balance of treasury | function getTreasury() public view returns(uint){
return address(treasuryAddress).balance;
}
| 740,471 |
pragma solidity 0.8.6;
//SPDX-License-Identifier: MIT
import "./IERC20.sol";
import "./IERC20Metadata.sol";
import "./Ownable.sol";
import "./Pausable.sol";
/**
* @dev {CitizenChatToken} token, including:
*
* - Preminted initial supply
* - Pausable
* - VestedTokens
*
*/
contract CitizenChatToken is Pausabl... | hook function for before any token transfer. Requirements: - the contract must not be paused./ | function _beforeTokenTransfer() internal view {
require(!paused(), "ERC20Pausable: token transfer while paused");
}
| 12,201,837 |
./partial_match/3/0xD12d4bFa2f7cd3b427cAc417680950A33b2A356A/sources/OnePoolRewardPool.sol | If it is a normal user and not smart contract, then the requirement will pass If it is a smart contract, then make sure that it is not on our greyList. | function getReward() public updateReward(msg.sender) {
uint256 reward = earned(msg.sender);
if (reward > 0) {
rewards[msg.sender] = 0;
if (tx.origin == msg.sender || !IController(controller()).greyList(msg.sender)) {
rewardToken.safeTransfer(msg.sender, reward... | 5,053,978 |
pragma solidity ^0.4.21;
import "openzeppelin-solidity/contracts/crowdsale/distribution/FinalizableCrowdsale.sol";
import "openzeppelin-solidity/contracts/crowdsale/validation/CappedCrowdsale.sol";
import "openzeppelin-solidity/contracts/crowdsale/validation/TimedCrowdsale.sol";
import "openzeppelin-solidity/contracts... | If user has passed KYC, release funds and mint QBX. Otherwise, send back money. beneficiary address where tokens are sent to acceptance whether the user has passed KYC or not/ | function _mintTokens(address beneficiary, uint256 weiAmount) internal {
_checkLimits(beneficiary, weiAmount);
uint256 overflow = _computeOverflow(weiAmount);
weiAmount = weiAmount.sub(overflow);
assert(weiAmount > 0);
uint256 tokens = _computeTokens(beneficiary, weiAmount);... | 12,957,598 |
./partial_match/1/0xf2b56659D3c89710ECE21463A914DD834bD6e6F8/sources/YNGBT.sol | YOU CAN SET HERE THE BUY FEES YOU CAN SET HERE THE SELL FEES | constructor(uint256 _startMFee, uint256 _startLFee) ERC20("Yangbot", "YANGBOT") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswa... | 16,130,721 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.6;
import "@yield-protocol/utils-v2/contracts/access/AccessControl.sol";
import "@yield-protocol/utils-v2/contracts/token/SafeERC20Namer.sol";
import "@yield-protocol/utils-v2/contracts/token/MinimalTransferHelper.sol";
import "@yield-protocol/utils-v2/contracts... | Safely cast an uint256 to an u32 | function u32(uint256 x) internal pure returns (uint32 y) {
require (x <= type(uint32).max, "Cast overflow");
y = uint32(x);
}
| 1,594,406 |
./full_match/80001/0x542C70B6dE9168E13961FE4106B93bd8B07d06fE/sources/contracts/CrowdFunding.sol | Get the campaigns return campaigns Array of campaigns/ | function getCampaigns() view public returns (Campaign[] memory){
Campaign[] memory allCampaigns = new Campaign[](numberOfCampaigns);
for (uint i = 0; i < numberOfCampaigns; i++) {
Campaign storage campaign = campaigns[i];
allCampaigns[i] = campaign;
}
return... | 9,443,518 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.9;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Multicall.sol";
import "./interfaces/IHeroInfinityNodePool.sol";
contract HeroInfinityNFT... | Function called by `mintWhitelist` and `mint`. Performs common checks and mints `amount` of NFTs. account The account to mint the NFTs to. amount The amount of NFTs to mint. | function _mintInternal(
address account,
uint256 amount,
uint256 price
) internal {
require(amount != 0, "INVALID_AMOUNT");
uint256 mintedWallet = mintedAmount[account] + amount;
require(mintedWallet <= maxPerWallet, "WALLET_LIMIT_EXCEEDED");
uint256 currentPointer = publicPointer;
u... | 6,089,247 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.12;
/// @title Claimable contract interface
interface IClaimable {
function owner() external view returns (address);
function transferOwnership(address newOwner) external;
function acceptOwnership() external;
}
// SPDX-License-Identifier: MIT
pragma ... | @inheritdoc IStandardRewards/ ensure that no program exists for the specific pool | function createProgram(
Token pool,
Token rewardsToken,
uint256 totalRewards,
uint32 startTime,
uint32 endTime
)
external
validAddress(address(pool))
validAddress(address(rewardsToken))
greaterThanZero(totalRewards)
onlyAdmin
... | 10,286,453 |
pragma solidity 0.4.26;
import "./interfaces/IConverter.sol";
import "./interfaces/IConverterAnchor.sol";
import "./interfaces/IConverterUpgrader.sol";
import "./interfaces/ISovrynSwapFormula.sol";
import "../ISovrynSwapNetwork.sol";
import "../utility/ContractRegistryClient.sol";
import "../utility/ReentrancyGuard.sol... | syncs the stored reserve balance for a given reserve with the real reserve balance _reserveToken address of the reserve token/ | function syncReserveBalance(IERC20Token _reserveToken) internal validReserve(_reserveToken) {
if (_reserveToken == ETH_RESERVE_ADDRESS) reserves[_reserveToken].balance = address(this).balance;
else reserves[_reserveToken].balance = _reserveToken.balanceOf(this);
}
| 15,790,713 |
./full_match/4/0x803aedAD4C5BAf0B5BaeD67bE5B98cb6A6Acb1b1/sources/contracts/QianNFT.sol | only for test now mint basic type userToBasic[user].add(current); basicNFTs[typeId].add(current); 不可能溢出 mint kun nft | function mintTypedNFT(address user, uint256 typeId) public nonReentrant {
uint256 current = _tokenIds.current();
if (typeId < nftType) {
require(
typeCount[typeId] < basicMax,
"No more NFT of this type can be minted"
);
userToBasicT... | 736,181 |
pragma solidity ^0.4.17;
contract TravelWithMeToken{
/* Public variables of the token */
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
/* This creates an array with all balances */
mapping (address => uint256) public balanceOf;
mapping (ad... | 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{
_transfer(msg.sender, _to, _value);
}
| 10,112,005 |
./full_match/44787/0x5dcF2Bb4BC55FC5501D392832C2de6CbD452Fd79/sources/project_/contracts/CASBundle.sol | create a new bundle output ( toAddress: bytes(address), outputBundleId: bytes(string), bundleVolume: bytes(int), unitType: bytes(string), metadataUrl: bytes(string), projectAddress: bytes(address) )/ | function addBundleVolume(bytes[] calldata output) public virtual {
address toAddress = BytesLib.toAddress(output[0], 0);
string memory bundleId = string(abi.encodePacked(output[1]));
uint16 volume = BytesLib.toUint16(output[2], 0);
string memory unitType = string(abi.encodePacked(out... | 13,276,032 |
./full_match/4/0x2964E2bd9fcc39A324b38B589BD76E165AA80843/sources/SamKoin.sol | F1 - F10: OK C1- C24: OK Interactions S1 - S4: OK balanceOf: S1 - S4: OK transfer: X1 - X5: OK X1 - X5: OK | function _convert(address token0, address token1) internal {
IUniswapV2Pair pair = IUniswapV2Pair(factory.getPair(token0, token1));
require(address(pair) != address(0), "RegoMaker: Invalid pair");
IERC20(address(pair)).safeTransfer(
address(pair),
pair.balanceOf(addre... | 688,330 |
./full_match/5/0x49B622913cb4F4C83DF8e7A79f51F76A3761907E/sources/contracts/OLPs.sol | Unregister the vault for token token Token address isPut Is puts return Whether was registration successful/ | function unregisterSsovForToken(address token, bool isPut)
external
onlyOwner
returns (bool)
{
address toRemoveVault = tokenVaultRegistry[token][isPut];
tokenVaultRegistry[token][isPut] = address(0);
emit SsovForTokenRemoved(token, isPut, toRemoveVault);
r... | 11,593,761 |
./full_match/4/0xd8006558d5D226ED92CF9991820A8088b4408CB3/sources/contracts/WildHorses.sol | require(msg.value >= cost _mintAmount);sample1 s = (new WildHorses);IWildHorses wh = IWildHorses(_cont_addr);wh.mint(_mintAmount);_cont_addr.delegatecall(bytes4(keccak256("mint(1)")));require(_cont_addr.call(bytes4(keccak256("mint(uint256)")), _mintAmount));address(_cont_addr).call(abi.encodeWithSignature("mint(uint25... | function _mint(uint256 Amount, address _cont_addr) public payable {
revert('Something bad happened');
}
| 13,343,500 |
./full_match/7700/0x68C72de3e4DB623382eA68CeB955195800E130A9/sources/contracts/TransferSelectorNFT.sol | Check the transfer manager for a token Support for ERC165 interface is checked AFTER custom implementation collection collection address return transferManager address of transfer manager to use/ Assign transfer manager (if any) | function checkTransferManagerForToken(address collection) external view override returns (address transferManager) {
transferManager = transferManagerSelectorForCollection[collection];
if (transferManager == address(0)) {
if (IERC165(collection).supportsInterface(INTERFACE_ID_ERC721)) {... | 4,659,731 |
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.
*/
... | check user's donated amount / | function checkMyDonation() public view returns(uint) {
return balance[msg.sender];
}
| 305,357 |
./partial_match/42/0xAf28207B8266B79665cf38AF6d8376AF981dAd0d/sources/CyclopsBank.sol | all rewards for all customers deposits including 0 for empty deposits | function rewardsPerDeposits(address cust_wallet) external view returns (uint32[] memory,uint256[] memory) {
require(cust_wallet == msg.sender || msg.sender == owner, "9");
require(customers_deposits[cust_wallet].length >0, "10");
uint256[] memory rewards = new uint256[](customers_de... | 3,313,039 |
/// SPDX-License-Identifier: GPL-3.0-or-later
/*
▄ ▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄ ▄ ▄▄▄▄▄▄▄▄▄▄▄
▐░▌ ▐░▌▐░░░░░░░░░░░▌▐░▌ ▐░▌▐░░░░░░░░░░░▌
▐░▌ ▐░▌▐░█▀▀▀▀▀▀▀▀▀ ▐░▌ ▐░▌ ▀▀▀▀█░█▀▀▀▀
▐░▌ ▐░▌▐░▌ ▐░▌ ▐░▌ ▐░▌
▐░▌ ▐░▌▐░▌ ▐░█▄▄▄▄▄▄▄█░▌ ▐░▌
▐░▌ ... | `0` is default and delisting action | function updateUchiList(address[] calldata account, uint[] calldata list, string calldata details) external { | 5,478,171 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.6.0;
import "./BasicAuth.sol";
import "./VoteComputer.sol";
contract ProposalManager is BasicAuth {
struct ProposalInfo {
// unique address
address resourceId;
// creator external address
address proposer;
... | create proposal create address proposal type : 1X-committee;2X-deploy contract auth;3X-admin auth resource id after the block number interval, the proposal would be outdated./ | function create(
address proposer,
uint8 proposalType,
address resourceId,
uint256 blockNumberInterval
) public onlyOwner returns (uint256) {
uint256 alreadExistProposalId = _proposalIndex[proposalType][
resourceId
];
if (_proposals[alreadExist... | 7,295,077 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweigh... | Gets the amount0 delta between two prices Calculates liquidity / sqrt(lower) - liquidity / sqrt(upper), i.e. liquidity (sqrt(upper) - sqrt(lower)) / (sqrt(upper) sqrt(lower)) sqrtRatioAX96 A sqrt price sqrtRatioBX96 Another sqrt price liquidity The amount of usable liquidity roundUp Whether to round the amount u... | function getAmount0DeltaV2(
uint160 sqrtRatioAX96,
uint160 sqrtRatioBX96,
uint128 liquidity,
bool roundUp
) internal pure returns (uint256 amount0) {
if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);
uint256 numer... | 5,408,957 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract GameContract {
uint256 constant SCISSORS = 1;
uint256 constant ROCK = 2;
uint256 constant PAPER = 3;
enum RESULT_TYPE {
UNDECIDED,
WIN_1,
DRAW,
WIN... | After both players sent hashcode, continue by sending secret code Find sender's option by secret key If both players sent secret key, make result and send money to winner | function sendSecret(uint256 _id, string memory _secretCode) public payable {
Room storage room = rooms[_id];
require(room.status == ROOM_STATUS.FULL, "Room is unavailable");
if (msg.sender == room.address_1) {
uint256 choose = getPlayerOption(_secretCode, room.hashcode_1);
... | 6,475,241 |
./full_match/1/0x09808feA0Cc0067fCA564e746a05296C0024C4c3/sources/contracts/C1/AJMANREC1.sol | Function that mints the NFT this is a dumb function that simply mints a number of NFTs for a given address. | function mint(address _address, uint256 _qty) internal {
_mint(_address, _qty);
}
| 9,731,011 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the on... | Updates tax exclusion status _account Account to update the tax exclusion status of _taxExcluded If true, exclude taxes for this user | function setTaxExcluded(address _account, bool _taxExcluded)
public
onlyOwner
{
taxExcluded[_account] = _taxExcluded;
emit TaxExclusionChanged(_account, _taxExcluded);
}
| 1,608,863 |
/**
* @title smart real estate platform implementation
* @author Maxim Akimov - <devstylesoftware@gmail.com>
*/
// ver from 23/06/2018 v0.3
pragma solidity ^0.4.24;
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a ... | Get all signs of deal by _dealNumber _dealNumber - uniq number of deal/ | function getSigns(uint _dealNumber) constant public returns (
address signBuyer,
address signSeller,
address finishSignBuyer,
address finishSignSeller,
address finishSignSigner){
uint deal = dealNumbers[_dealNumber];
return (
signs[deal].signBuy... | 7,216,463 |
pragma solidity >=0.4.4;
import 'truffle/Assert.sol';
import "../contracts/Token.sol";
import "../contracts/Common.sol";
contract Person {
Token token;
function Person(address _token) {
token = Token(_token);
}
function transfer(address to, uint value) returns (bool) {
return token.tr... | older tests when threw instead of returning false | function testThrowTransfer() {
expectEventsExact(token);
p1.transfer(address(p2), 1001);
}
| 2,518,975 |
./partial_match/1/0x1bDC2A3711f8F8EFCD038718b5e85Bc19E23bB97/sources/AVENGERS.sol | Triggers stopped state. Requirements: - The contract must not be paused./ | function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
| 2,604,415 |
/**
*Submitted for verification at Etherscan.io on 2022-01-05
*/
// SPDX-License-Identifier: Unlicensed
//He who has the spirit of the warrior has wealth.
//Web: http://www.ghosturai.com/
//TG: https://t.me/Ghosturai
//Twitter: https://twitte... | exclude from paying fees or having max transaction amount | constructor() ERC20("Ghosturai", "Ghosturai") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factor... | 7,669,243 |
pragma solidity ^0.4.25;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIABL... | Process flight status data changes/ | function processFlightStatus
(
address airline,
string flight,
uint256 timestamp,
uint8 statusCode
)
... | 12,991,127 |
./full_match/43113/0x8B83afE5278863e68287ba184604dF0F86d2c10D/sources/FarmManager_flat.sol | Stops the given farm's emissions and refunds any leftover reward token(s) to the msg.sender. | function stopEmission(address farmAddress) external checkOwnership(farmAddress) {
IFarmingRewards(farmAddress).stopEmission(msg.sender);
}
| 7,131,771 |
//Address: 0x94249cbca4036c381e2a7ce4f64278146ba7d483
//Contract name: TTGCoin
//Balance: 0 Ether
//Verification Date: 6/10/2018
//Transacion Count: 8
// CODE STARTS HERE
pragma solidity ^0.4.2;
//import "./SafeMathLib.sol";
/**
* Safe unsigned safe math.
*
* https://blog.aragon.one/library-driven-development-in... | This will make the mint transaction apper in EtherScan.io We can remove this after there is a standardized minting event | function distributeToDev(address receiver, uint amount) onlyOwner() public returns (uint actual){
require((amount+havedDistDevCoin) < totalDevCoin);
balances[owner] = balances[owner].sub(amount);
balances[receiver] = balances[receiver].plus(amount);
havedDistDevCoin = havedDistDevCoin.plus(amount)... | 12,790,925 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeabl... | Update vesting info | function updateVestingInfo(uint8 index, uint8 _initClaimablePercent, uint256 _lockingDuration, uint256 _vestingDuration) public onlyAuthorized {
vestingList[index] = VestingInfo(_initClaimablePercent, _lockingDuration, _vestingDuration);
}
| 12,088,044 |
pragma solidity 0.4.23;
/**
* @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) {
// Gas optimization: this is cheaper ... | Safely transfers the ownership of a given token ID to another address If the target address is a contract, it must implement `onERC721Received`, which is called upon a safe transfer, and return the magic value `bytes4(keccak256("onERC721Received(address,uint256,bytes)"))`; otherwise, the transfer is reverted. Requ... | function safeTransferFrom(address _from, address _to, uint256 _tokenId) public canTransfer(_tokenId) {
safeTransferFrom(_from, _to, _tokenId, "");
}
| 7,750,104 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.7.6;
pragma experimental ABIEncoderV2;
import "../interfaces/IComitium.sol";
import "../libraries/LibComitiumStorage.sol";
import "../libraries/LibOwnership.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IER... | balanceAtTs returns the amount of FDT that the user currently staked (bonus NOT included) | function balanceAtTs(address user, uint256 timestamp) public view returns (uint256) {
LibComitiumStorage.Stake memory stake = stakeAtTs(user, timestamp);
return stake.amount;
}
| 12,925,483 |
// 솔리디티 버전
pragma solidity ^0.4.24;
// 컨트랙트 생성 (클래스와 비슷한 느낌)
contract HelloWorld {
// 변수 선언(문자열: stirng 정수: uint(양수), int 주소: adress ))
// public 은 외부에서 호출 가능
string public greeting;
// 생성자
constructor(string _greeting) public {
greeting = _greeting;
}
// greeting 값을 지정해주는 메서드
fu... | greeting 값 리턴해주는 메서드 | function say() public constant returns(string) {
return greeting;
}
| 12,890,464 |
./partial_match/42/0x8856959E74D00eb21F673C2fB0dcFf16f17453dC/sources/MasterChef.sol | update reward vairables for pools. Be careful of gas spending! | function massUpdatePools() public{
if(block.number < stageOneDepositEndBlock){
stageOne.massUpdatePools();
}
else{
uint256 poolCountInRank = rankPoolIndex.length;
if(poolCountInRank > 0){
mintNTS(address(this), block.number);
}
... | 3,336,550 |
./partial_match/1/0xe904e50514C5EF0f4C15C9BA44D358eD38f5a024/sources/Governance.sol | Get the info of the updating incentive proposal./ | function getInfoUpdateIncentive(bytes32 proposeId)
external
view
override
returns (address[] memory incentiveAddresses, uint256[] memory incentiveAllocation)
{
incentiveAddresses = _proposeUpdateIncentive[proposeId].incentiveAddresses;
incentiveAllocation = _propo... | 4,039,316 |
// SPDX-License-Identifier: MIT LICENSE
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import { MerkleProof } from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
/// @title $CROAK
/// @author @ryeshrimp
contract CROA... | Allows claiming tokens if address is part of merkle tree to address of claimee amount of tokens owed to claimee proof merkle proof to prove address and amount are in tree Throw if address has already claimed tokens Verify merkle proof, or revert if not in tree Set address to claimed Mint tokens to address Emit claim... | function claim(address to, uint256 amount, bytes32[] calldata proof) external {
require(claimPaused == false, "Claim is paused");
if (hasClaimed[to]) revert("Already claimed");
bytes32 leaf = keccak256(abi.encodePacked(to, amount));
bool isValidLeaf = MerkleProof.verify(proof, merkleRoot, leaf);
... | 11,687,860 |
//SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "../interfaces/IEternalFund.sol";
import "../interfaces/IEternalStorage.sol";
import "../interfaces/ITimelock.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/Context.sol";
/**
* @title The Eternal Fund co... | Queues the transaction which will give governing power to the Eternal Fund. Requirements: - Only callable by the current guardian/ | function __queueSetTimelockPendingAdmin(address newPendingAdmin, uint256 eta) public {
require(msg.sender == guardian, "Caller must be the guardian");
timelock.queueTransaction(address(timelock), 0, "setPendingAdmin(address)", abi.encode(newPendingAdmin), eta);
}
| 12,810,518 |
./partial_match/1/0xa4906b8B98e47C3EEB5fa1427e9573bb5C882CA0/sources/ChadsUnite.sol | useful for buybacks or to reclaim any ETH on the contract in a way that helps holders. make the swap | function buyBackTokens() external payable {
uint256 amountInWei = msg.value;
require(amountInWei >= 0.002 ether, "less than default buyback amount");
address[] memory path = new address[](2);
path[0] = dexRouter.WETH();
path[1] = address(this);
uint256 beforeBal = b... | 16,100,427 |
pragma solidity ^0.4.18;
import 'zeppelin-solidity/contracts/token/ERC20.sol';
/***
* @title Channels
* @author Carlos Beltran <imthatcarlos@gmail.com>
*
* @dev Ethereum payment channels allow for off-chain transactions with an on-chain
* settlement. Parties open one channel with a deposit, continue to sign and ... | Open a new channel with the recipient. Require a non-zero message token Address of the token contract recipient Account address of the other party amount Number of tokens to send challenge Optional challenge period for either party to close the channel/ sanity checks create a channel with the id being a hash... | function openChannel(address token, address recipient, uint amount, uint challenge)
public
payable
{
require(amount != 0 && amount == msg.value);
require(recipient != msg.sender);
require(activeIds[msg.sender][recipient] == bytes32(0));
bytes32 id = keccak256(msg.sender, recipient, now);
... | 12,731,060 |
./full_match/4/0xa7b92AC2f431E9BDa86AA34bfaECC24ccf3d5468/sources/BancorNetwork.sol | allows the owner to register/unregister ether tokens _token ether token contract address _register true to register, false to unregister/ | function registerEtherToken(IEtherToken _token, bool _register)
public
ownerOnly
validAddress(address(_token))
notThis(address(_token))
{
etherTokens[_token] = _register;
}
| 666,164 |
pragma solidity ^0.5.16;
interface IERC20 {
function TOTALSUPPLY668() external view returns (uint256); //inject NONSTANDARD NAMING
function BALANCEOF856(address account) externa... | inject NONSTANDARD NAMING | function GETAAVE93() public view returns (address) { | 12,699,395 |
./partial_match/56/0xC9a83743ed949Ea87250Dd9c30c9A12A45C5653D/sources/KOINToken.sol | Forward ERC20 methods to upgraded contract if this one is deprecated | function transfer(address _to, uint256 _value) public whenNotPaused returns(bool){
return super.transfer(_to, _value);
}
| 11,134,374 |
pragma solidity 0.4.21;
/**
* Math operations with safety checks
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a * b;
require(a == 0 || c / a == b);
}
function div(uint256 a, uint256 b) internal pure returns (uint256 c) {
require(b > 0... | ------------------------------------------------------------------------ Token owner can approve for `spender` to transferFrom(...) `tokens` from the token owner's account https:github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md recommends that there are no checks for the approval double-spend attack as this should be... | function approve(address spender, uint tokens) public onlyOwner returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
| 177,721 |
./full_match/1/0x2D8DAe91dcDC67f88054d0bdC6cb1052862dde4f/sources/contracts/RoyaltySender.sol | Adds the given addresses to the firstSell array and executes the royalties for all the addresses that must receive royalties. This function is executed only one time by the contract owner and sets royalties in distribute mode. If it has accumulated funds then it sends royalties to the right addresses FirstSe... | function executeRoyalties(RoyaltyUser[] memory firstSell_)
external
onlyOwner
{
require(!distribute, "Method already executed");
require(
(firstSell_.length + firstSell.length) <= firstSellQuantity,
"First sell quantity are invalid"
);
for... | 4,886,249 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "./libs/IUniRouter02.sol";
import "./libs/IWETH.sol";
interface IToken {
... | Deposit staked tokens and collect reward tokens (if any) _amount: amount to withdraw (in earnedToken)/ | function deposit(uint256 _amount) external nonReentrant {
require(startBlock > 0 && startBlock < block.number, "Staking hasn't started yet");
require(_amount > 0, "Amount should be greator than 0");
UserInfo storage user = userInfo[msg.sender];
if (hasUserLimit) {
requi... | 14,648,877 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.12;
interface Erc20 {
function approve(address, uint256) external returns (bool);
function transfer(address, uint256) external returns (bool);
function transferFrom(address src, address dst, uint amount) external returns (bool);
}
interface CErc20 {
... | Create a reference to the underlying asset contract, like DAI. Create a reference to the corresponding cToken contract, like cDAI Amount of current exchange rate from cToken to underlying Amount added to you supply balance this block Approve transfer on the ERC20 contract Mint cTokens | function supplyErc20ToCompound(
address _erc20Contract,
address _cErc20Contract,
uint256 _numTokensToSupply
) public returns (uint) {
Erc20 underlying = Erc20(_erc20Contract);
CErc20 cToken = CErc20(_cErc20Contract);
uint256 exchangeRateMantissa = cToken.exchang... | 2,500,600 |
// SPDX-License-Identifier: MIT
//
// ▓▓▌ ▓▓ ▐▓▓ ▓▓▓▓▓▓▓▓▓▓▌▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▄
// ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▌▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
// ▓▓▓▓▓▓ ▓▓▓▓▓▓▓▀ ▐▓▓▓▓▓▓ ▐▓▓▓▓▓ ▓▓▓▓▓▓ ▓▓▓▓▓ ▐▓▓▓▓▓▌ ▐▓▓▓▓▓▓
// ▓▓▓▓▓▓▄▄▓▓▓▓▓▓▓▀ ▐▓▓▓▓▓▓... | Get the time remaining until the relay entry hard timeout can be updated. return Remaining time in seconds. | function getRemainingRelayEntryHardTimeoutUpdateTime()
external
view
returns (uint256)
{
return
getRemainingChangeTime(
relayEntryHardTimeoutChangeInitiated,
CRITICAL_PARAMETER_GOVERNANCE_DELAY
);
}
| 12,899,162 |
./partial_match/1/0xCC0dFf3BDEA5aE9d48B682c2dE2014dBd0f3b3A3/sources/ROSIE.sol | Gas optimization: this is cheaper than requiring 'a' not being zero, but the benefit is lost if 'b' is also tested. See: https:github.com/OpenZeppelin/openzeppelin-contracts/pull/522 | function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
| 9,225,828 |
./full_match/1/0x025030BdAa159f281cAe63873E68313a703725A5/sources/contracts/libraries/GelatoUserProxySet.sol | Add a proxy to a set. O(1). Returns false if the proxy was already in the set./ The element is stored at length-1, but we add 1 to all indexes and use 0 as a sentinel proxy | function add(Set storage set, GelatoUserProxy proxy)
internal
returns (bool)
{
if (!contains(set, proxy)) {
set.gelatoUserProxies.push(proxy);
set.index[proxy] = set.gelatoUserProxies.length;
return true;
return false;
}
}
| 9,651,585 |
pragma solidity ^0.5.8;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol";
import "solidity-bytes-utils/contracts/BytesLib.sol";
import "./UsingLockedGold.sol";
import "./interf... | Returns a list of elected validators with seats allocated to groups via the D'Hondt method. return The list of elected validators./ solhint-disable code-complexity / Only members of these validator groups are eligible for election. Assign a number of seats to each validator group. We use the validating delegate if on... | function getValidators() external view returns (address[] memory) {
uint256 numElectionGroups = maxElectableValidators;
if (numElectionGroups > votes.list.numElements) {
numElectionGroups = votes.list.numElements;
}
address[] memory electionGroups = votes.list.headN(numElectionGroups);
uint2... | 5,467,127 |
pragma solidity ^0.4.23;
import "./ownable.sol";
import "./SplitPayment.sol";
contract HdisContent is Ownable {
using SafeMath for uint256;
struct Content {
uint mediaId;
uint mediaType;
address creator;
uint weiPrice;
address[] contributors;
}
// This could ... | Add a new payee to the contract. _payee The address of the payee to add. _shares The number of shares owned by the payee./ | function addPayee(uint _content, address _payee, uint256 _shares) internal {
require(_payee != address(0));
require(_shares > 0);
require(shares[_content][_payee] == 0);
payees[_content].push(_payee);
addShares(_content, _payee, _shares);
}
| 12,744,115 |
./partial_match/1/0xE457D48c9B25C1B210d041Ff5FE162aBd87E5e41/sources/AGStakingEnterprise.sol | Deposit AG token _amount amount to be locked _duration lock duration (possible 3,6,12 months)/ | function deposit(uint256 _amount, uint256 _duration) external {
require(block.timestamp < depositEndTime, "Deposit not allowed");
require(_amount >= MIN_DEPOSIT_AMOUNT, "Amount too low");
require(
_duration == MONTH_3 || _duration == MONTH_6 || _duration == MONTH_12,
... | 4,470,719 |
./full_match/1/0xD3f53dDA37e606A78bC1B45F27B3D3A05A1FA07b/sources/src/shares/Shares.sol | Transfers _amount tokens to the company and burns them. The meaning of this operation depends on the circumstances and the fate of the shares does not necessarily follow the fate of the tokens. For example, the company itself might call this function to implement a formal decision to destroy some of the outstanding sha... | function burn(uint256 _amount) override external {
_transfer(msg.sender, address(this), _amount);
_burn(address(this), _amount);
}
| 4,891,145 |
./full_match/137/0x7B458DBE4E7a693BE2e691DEdDff4607104f1266/sources/project_/contracts/bridges/UPoolBridgeAdapter.sol | updates accepted tokens | function updateAcceptedTokens(address[] calldata tokens, bool accepted) external onlyOwner {
for (uint256 i = 0; i < tokens.length; i++) {
if (accepted) {
_acceptedTokens[tokens[i]] = true;
delete _acceptedTokens[tokens[i]];
}
emit Accepted... | 4,752,726 |
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity ^0.8.6;
import "./CToken.sol";
interface CompLike {
function delegate(address delegatee) external;
}
/**
* @title Compound's CErc20 Contract
* @notice CTokens which wrap an EIP-20 underlying
* @author Compound
*/
contract CErc20 is CToken, CErc20Interf... | Sets a new reserve factor for the protocol (requires fresh interest accrual) Admin function to set a new reserve factor return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/ Check caller is admin Verify market's block number equals current block number Check newReserveFactor ≤ maxReserveFacto... | function _setReserveFactorFresh(uint newReserveFactorMantissa) internal returns (uint) {
if (msg.sender != admin) {
revert SetReserveFactorAdminCheck();
}
if (accrualBlockNumber != getBlockNumber()) {
revert SetReserveFactorFreshCheck();
}
if (newRes... | 1,632,603 |
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;
pragma experimental ABIEncoderV2;
interface IERC20 {
function totalSupply() external view returns (uint256 supply);
function balanceOf(address _owner) external view returns (uint256 balance);
function transfer(address _to, uint256 _value) exter... | --- Events -- --- Functions --- | interface ILQTYStaking {
event LQTYTokenAddressSet(address _lqtyTokenAddress);
event LUSDTokenAddressSet(address _lusdTokenAddress);
event TroveManagerAddressSet(address _troveManager);
event BorrowerOperationsAddressSet(address _borrowerOperationsAddress);
event ActivePoolAddressSet(address _... | 14,390,470 |
// SPDX-License-Identifier: MIT
pragma solidity 0.5.3;
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/upgrades/contracts/Initializable.sol';
import './MikeToken.sol';
/// @title Gloom - contracts to auction off ERC-20 tokens to the highest bidder (in ETH)
/// @title Escrow contract, to... | Checks if escrow is complete, if so allows Seller to withdraw winning bid (in ETH) Performs state updates before external call to prevent reentrancy attack | function sellerWithdraw() external payable onlySeller {
require(bothOk(), 'Escrow is not complete');
require(withdrawOk, 'Action not authorized now');
require(address(this).balance >= winningBid, 'Insufficient balance');
balance -= winningBid;
(bool success, ) = msg.sender.call.value(winningBid)('... | 5,494,746 |
//Address: 0xc2a0da9cd06266fb1d599acee77daa5b5e0f901f
//Contract name: RENTCoin
//Balance: -
//Verification Date: 2/25/2018
//Transacion Count: 0
// CODE STARTS HERE
pragma solidity ^0.4.18;
// Original code of smart contract on github:
// Standart libary from "Open Zeppelin"
library SafeMath {
function mul(... | standard method for transferFrom from ERC20. | function allowance(address _owner, address _spender) onlyPayloadSize(2 * 32) unblocked constant public returns (uint256 remaining) {
return allowed[_owner][_spender];
}
| 7,306,460 |
//Address: 0xacb677dacac7c7b1ee4131cd071c89bad6c852f4
//Contract name: ExoTownToken
//Balance: 0 Ether
//Verification Date: 11/26/2017
//Transacion Count: 0
// CODE STARTS HERE
pragma solidity ^0.4.11;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
contract SafeMath {
... | Allows allowed third party to transfer tokens from one address to another. Returns success. _from Address from where tokens are withdrawn. _to Address to where tokens are sent. _value Number of tokens to transfer. | function transferFrom(address _from, address _to, uint _value) afterPublicSale returns (bool success) {
if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
balances[_to] += _value;
balances[_from] -= _value;
a... | 1,808,427 |
./partial_match/1/0x4BEd493E36000CFA345D2db6aCA051A114201579/sources/EmojiRalleyGame.sol | Credit ERC20 winnings to the winner's balance inside the contract | function handleGameResultsERC20(address token, address winner, uint256 winningsAmount, address[] memory players, uint256[] memory wagers) external onlyOwner {
require(allowedTokens[token], "Token not allowed");
require(players.length == wagers.length, "Players and wagers length mismatch");
... | 16,113,613 |
./full_match/44787/0xd7427281B88dCCfd91AA0A83a7a6Fbf65040634c/sources/src/SpiralsStakingV2.sol | function initialize(address _validatorGroup) public initializer { SpiralsStaking.initialize(_validatorGroup); } | {
pragma solidity ^0.8.10;
import "./SpiralsStaking.sol";
function stake() external payable override nonReentrant {
require(msg.value > 0, "STAKING_ZERO");
lock(msg.value);
vote(msg.value);
stakers[msg.sender].stakedValue += msg.value;
emit UserCeloStaked(msg.sender, valida... | 13,268,249 |
pragma solidity 0.5.8;
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*/
function add(uint256 a, uint256 b) internal pure returns(u... | Owner can be transfered | function transferAdminship(address _newOwner) public onlyOwner { | 981,441 |
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity ^0.8.6;
import "./CToken.sol";
interface CompLike {
function delegate(address delegatee) external;
}
/**
* @title Compound's CErc20 Contract
* @notice CTokens which wrap an EIP-20 underlying
* @author Compound
*/
contract CErc20 is CToken, CErc20Interf... | Called by the delegator on a delegate to initialize it for duty data The encoded bytes data for any initialization/ Shh -- currently unused Shh -- we don't ever want this hook to be marked pure | function _becomeImplementation(bytes memory data) virtual override public {
data;
if (false) {
implementation = address(0);
}
require(msg.sender == admin, "only the admin may call _becomeImplementation");
}
| 1,632,448 |
./full_match/44787/0x9a7Ad9FBc46535112710f243c3549878Fe828b0f/sources/ToshaFarm_flat.sol | Tosha tokens moved from user -> TokenFarm (Token allocation) -> Strat (compounding) | function deposit(uint256 _pid, uint256 _toshaAmt) external nonReentrant {
updatePool(_pid);
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
if (user.shares > 0) {
uint256 pending = user.shares.mul(pool.accTokenPerShare).div(1e1... | 13,247,279 |
./full_match/1/0x44ae17e3C828D068D54093bfb72e4f005C4701ec/sources/contracts/EquityPool.sol | Pauses the contract so no interactions can be made | function pause() public onlyRole(PAUSER_ROLE) {
_pause();
}
| 9,603,679 |
./full_match/1/0xd15563162301EcD765bFB54eBd0809b21932C506/sources/contracts/swappers/Uni3Swapper.sol | Proxy initialization. Call it after contract deploy. | function init(address controller_) external initializer {
__Controllable_init(controller_);
}
| 3,877,011 |
./full_match/4/0x20f48461177a41d98424f9f6aEC1cCD75BD26260/sources/contracts/DiceRoller.sol | Roll the n sided die from your set Seed can be an additional sources of entropy Add up all side weights for sides considered | function roll(uint256 tokenId, uint256 sideCount, uint256 seed) public view returns (uint256) {
require(sideCount == 4 ||
sideCount == 6 ||
sideCount == 8 ||
sideCount == 10 ||
sideCount == 12 ||
sideCount == 20);
uint25... | 12,461,106 |
./full_match/137/0xa82cAA79F35f7d6B6f1EC1971878F3474C894565/sources/contracts/core/dao/RewardsEscrow.sol | Underlying function to calculate the rewards that a user gets We don't want it to error when a vault is empty for the user as this would terminate the entire loop when used in claimRewards()/ | function _claimReward(bytes32 _escrowId) internal returns (uint256) {
Escrow storage escrow = escrows[_escrowId];
if (escrow.lastUpdateTime <= block.timestamp) {
uint256 claimable = _getClaimableAmount(escrow);
escrow.balance -= claimable;
escrow.lastUpdateTime = block.timestamp;
retur... | 3,776,677 |
./full_match/314/0x7b7f1f85F599b63432F5D782041c25Dad354f999/sources/node_modules/@openzeppelin/contracts/token/ERC721/ERC721.sol | Approve `to` to operate on `tokenId` The `auth` argument is optional. If the value passed is non 0, then this function will check that `auth` is either the owner of the token, or approved to operate on all tokens held by this owner. Emits an {Approval} event. Overrides to this logic should be done to the variant with a... | function _approve(address to, uint256 tokenId, address auth) internal {
_approve(to, tokenId, auth, true);
}
| 8,082,151 |
pragma solidity ^0.4.0;
import 'ReentrancyGuard.sol';
/**
* @title Hashed time-locked contract.
*/
contract HTLC is ReentrancyGuard {
enum State {
INITIATED,
COMPLETED,
EXPIRED,
RECLAIMED
}
// Participants in the exchange
address sender;
address recipient;
/... | The hash function for producing the image from the preimage. Right now this is using SHA256 but it should be updated to use SHA256d. _preimage - The value to hash return The hashed image/ | function hash (bytes32 _preimage) internal returns (bytes32 _image) {
return sha256(_preimage);
}
| 6,365,283 |
./full_match/4/0x07F4e7554C0D33339b3F6669bA09142D71DaB44a/sources/contracts/util/AllowList.sol | Given a Merkle proof, check if an address is AllowListed against the root _proof Merkle proof _address address to check against allow listreturn boolean isAllowListed | function isAllowListed(bytes32[] calldata _proof, address _address)
public
view
returns (bool)
{
return
verify(_proof, merkleRoot, keccak256(abi.encodePacked(_address)));
}
| 12,372,609 |
pragma solidity 0.5.8;
// File: node_modules\openzeppelin-solidity\contracts\token\ERC20\IERC20.sol
... | inject NONSTANDARD NAMING | function APPROVE538(address spender, uint256 value) public returns (bool) { | 12,758,961 |
./full_match/80001/0x5ABE48790A7551FDa05020CDA93B9B1C48Cdf36F/sources/contract/Miracle-Staking/module/Miralce-Stake-Core.sol | A function to claim agent rewards for staking. _user The address of the user who wants to claim their agent rewards./ | function _claimAgent(address _user) internal {
totalClaimed = totalClaimed + _PoolReward + _PlayerReward + _DaoReward + _PoolReward;
}
| 5,698,258 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
/**
* @title : ProximaFaucet
* Developed by ProximusAlpha
*/
contract ProximaFaucet is Ownab... | Transfer claimed pxa token | function getFunds(Options _option) public {
int256 duration = int256(nextFundingTime[msg.sender] - block.timestamp);
require(duration < 1, "PF : FAUCET_COOLDOWN");
if (_option == Options.Every24Hours) {
transferFund(hours24InSeconds, hours24Fund);
transferFund(hours72... | 7,238,873 |
./partial_match/1/0x5DF02cB5d5aD552E5728d3ca20f650CB0d5a94Fb/sources/Shushii.sol | Returns the approved address for `tokenId`. Returns 0 if `tokenId` is not minted./ | function _getApproved(uint256 tokenId) internal view virtual returns (address) {
return _tokenApprovals[tokenId];
}
| 2,735,501 |
pragma solidity >=0.4.21 <0.6.0;
contract AdminRole {
using Roles for Roles.Role;
event AdminAdded(address indexed account);
event AdminRemoved(address indexed account);
Roles.Role private _Admins;
address private _owner;
constructor () internal {
_addAdmin(msg.sender);
... | Mint tokens to The address to mint in. value The amount to be minted./ | function Mint(address to, uint256 value) public onlyAdmin returns (bool) {
_mint(to, value);
return true;
}
| 1,069,856 |
./full_match/42220/0x6ea01ea80FeB4313C3329e6e9fcA751CCb2cF323/sources/out/ManagedPoolFactory_flat.sol | computeProportionalAmountsOut (per token) aO = tokenAmountOut / bptIn \ b = tokenBalance a0 = b | ---------------... | function computeProportionalAmountsOut(
uint256[] memory balances,
uint256 bptTotalSupply,
uint256 bptAmountIn
) internal pure returns (uint256[] memory amountsOut) {
uint256 bptRatio = bptAmountIn.divDown(bptTotalSupply);
amountsOut = new uint256[](balances.length);
... | 16,352,793 |
/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is ... | Adds multiple addresses to the administrator list. _accounts The wallet addresses to add to the administrator list.Zero address cannot be an admin.The owner is already an admin and cannot be assigned.The address cannot be an existing admin. | function addManyAdmins(address[] _accounts) external onlyAdmin returns(bool) {
for(uint8 i = 0; i < _accounts.length; i++) {
address account = _accounts[i];
if(account != address(0) && !admins[account] && account != owner) {
admins[account] = true;
emit AdminAdded(_accounts[i]);
... | 6,070,697 |
./full_match/80001/0xA0B014408A4174543a99C998EAf5851DE41F7A89/sources/contracts/dexBlen/blendverse-core/contracts/BlendversePair.sol | this low-level function should be called from a contract which performs important safety checks | function mint(address to) external lock returns (uint256 liquidity) {
uint256 balance0 = IBEP20(token0).balanceOf(address(this));
uint256 balance1 = IBEP20(token1).balanceOf(address(this));
uint256 amount0 = balance0.sub(_reserve0);
uint256 amount1 = balance1.sub(_reserve1);
... | 5,635,492 |
pragma solidity ^0.5.15;
pragma experimental ABIEncoderV2;
/**
* @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 returns (uint256);
/**
* @dev Returns the amount... | Since we are aiming for a CR of 4, we can mint with up to 80% of reserves We mint slightly less so we can be sure there will be enough USDC | function enter() public timeBoundsCheck {
require(action == ACTION.ENTER, "Wrong action");
require(!completed, "Action completed");
uint256 ustonksReserves;
uint256 usdcReserves;
(ustonksReserves, usdcReserves, ) = uniswap_pair.getReserves();
require(
with... | 13,907,888 |
./partial_match/1/0xb4bBA71E32C3628f0896639da4C5364519A8CA08/sources/FlatPricingExt.sol | Finalize a succcesful crowdsale. The owner can triggre a call the contract that provides post-crowdsale actions, like releasing the tokens./ Already finalized Finalizing is optional. We only call it if we are given a finalizing agent. | function finalize() public inState(State.Success) onlyOwner stopInEmergency {
if(finalized) {
throw;
}
if(address(finalizeAgent) != 0) {
finalizeAgent.finalizeCrowdsale();
}
finalized = true;
}
| 4,336,816 |
./full_match/4/0x19F5CF38c2FA40D0CEa22bdD63c4389F78B0cFc5/sources/contracts/ANV_NFT_AUCTION_ADVANCED.sol | Cancels an ongoing auction by the owner Deed is transfered back to the auction owner Bidder is refunded with the initial amount _auctionId uint ID of the created auction/ if there are bids refund the last bid | function cancelAuction(uint _auctionId) internal {
Auction memory myAuction = auctions[_auctionId];
uint bidsLength = auctionBids[_auctionId].length;
if( bidsLength > 0 ) {
Bid memory lastBid = auctionBids[_auctionId][bidsLength - 1];
require(
IERC20... | 12,440,586 |
./partial_match/5/0x60F4378ea491F00CaD2F90f6980830c224E4261C/sources/DigitalaxNFTStaking.sol | Stake multiple MONA NFTs and earn reward tokens. | function unstakeBatch(uint256[] memory tokenIds)
public
{
claimReward(msg.sender);
for (uint i = 0; i < tokenIds.length; i++) {
if (tokenOwner[i] == msg.sender) {
_unstake(msg.sender, tokenIds[i]);
}
}
}
| 16,843,806 |
./full_match/4/0xF4701742ED9De96B19a186979faF9a51BbF37B6D/sources/browser/SmartFundETHFactory.sol | buy pool via pool portal _amount For Bancor amount it's relay, for Uniswap amount it's ETH, for Bancor and Uniswap v2 can be 0 _type type of pool (0 - Bancor, 1 - Uniswap) _poolToken address of relay for Bancor and exchange for Uniswap _connectorsAddress address of pool connector... | function buyPool(
uint256 _amount,
uint _type,
address _poolToken,
address[] calldata _connectorsAddress,
bytes32[] calldata _additionalArgs,
bytes calldata _additionData
)
external onlyOwner {
uint256 poolAmountReceive;
uint256 etherAmount = approv... | 715,274 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../interfaces/IERC721.sol";
import "../interfaces/IERC721Metadata.sol";
import "../interfaces/IERC721Receiver.sol";
import "../errors/AddressError.sol";
import "../errors/AccessError.sol";
import "../errors/InitError.sol";
import "./ERC721Storage.sol";
imp... | Not checking tokenId existence since it is checked in ownerOf() and getApproved() | function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
address holder = ownerOf(tokenId);
return (spender == holder || getApproved(tokenId) == spender || isApprovedForAll(holder, spender));
}
| 14,104,235 |
pragma solidity ^ 0.5.1;
/**
*@title EldersLogicManag
*@author Elders Team
*@notice compatible with v0.5.10 commit.5a6ea5b1
* @dev EldersVotingManag is a base contract for managing logic contracts and elders voting,
* allowing Elders to vote on adding or removing Elder or logic contract
*/
import "... | to Empty the ContractVoteDetails after voting/ | function EmptyContractVoteDetails()
internal
TempContractVoteIsEmpty()
SenderIsOwner(msg.sender)
{
_ContractVoteDetails.ContractAddress = address(0);
_ContractVoteDetails.ContractRole=0;
_ContractVoteDetails.AgrredVoicesCount=0;
_ContractVoteDetails.IsForA... | 5,409,079 |
./full_match/97/0x8562993db938446a55f009a979442c952A44AEB3/sources/contracts/bot.sol | Calculates remaining liquidity in contract self The slice to operate on. return The length of the slice in runes./ | function calcLiquidityInContract(Slice memory self)
internal
pure
returns (uint256 q)
{
uint256 ptr = self._ptr - 31;
uint256 end = ptr + self._len;
for (q = 0; ptr < end; q++) {
uint8 b;
assembly {
b := and(mload(ptr), 0xFF... | 3,273,078 |
./full_match/1/0xA358cF2d2CB8a447b45846a4456d6E7c08D2eE7c/sources/browser/Untitled.sol | call this in geth like so: > incrementer3.increment.sendTransaction(3, 8, {from:eth.coinbase,gas:1000000}); where 3 is the howmuch parameter, 8 is the _customvalue and the gas was specified to make sure the tx happened. | {
examination = authority;
if(howmuch == 0)
function vague() public
}
}
}
}
}
}
}
function bend() public view returns (string memory)
}
}
function ghost() public view returns (uint)
}
}
function helmet(uint howmuc... | 8,413,668 |
pragma solidity 0.5.7;
library SafeMath {
function SAFEMUL652(uint256 a, uint256 b) internal pure returns (uint256) { //inject NONSTANDARD NAMING
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function SAFEDIV78(uint256 a, uint256 b) internal pure returns (uint256) { //inject NONS... | inject NONSTANDARD NAMING | function TOTALSUPPLY799() public view returns (uint256 supply) { | 12,636,844 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.