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/4/0x95774833307E2F54583644F52be0c238c62D5122/sources/GunPool.sol | 计算 两种 Token 的比值 : _outToken 一般写usdt的地址 | function calOutTokenAmount(address _inToken, address _outToken, uint _inTokenAmount) external view returns (uint)
{
address[] memory path = new address[] (2) ;
if (_inToken == address(0)) {
path[0] = Weth;
}
else {
path[0] = _inToken;
}
... | 764,418 |
//Address: 0x61f30fd17eb78e9d65bac0ad0ac79f6e9aa51594
//Contract name: Crowdsale
//Balance: 0 Ether
//Verification Date: 11/10/2017
//Transacion Count: 8
// CODE STARTS HERE
/**
* @title METTA platform token & preICO crowdsale implementasion
* @author Maxim Akimov - <devstylesoftware@gmail.com>
* @author Dmitrii ... | Allows safe changing of manager address/ | function changeManager(address _addr) public {
require(msg.sender == managerETHaddress);
managerETHcandidatAddress = _addr;
}
| 12,702,082 |
// Copyright 2021 Cartesi Pte. Ltd.
// SPDX-License-Identifier: Apache-2.0
// 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 ... | Converts a given bytes data array into an array of bytes8 entries _data bytes data array to be converted _start start index of the portion of the data array to be converted _end end index of the portion of the data array to be converted _output output bytes8 array previously allocated for storing the result full wo... | function bytes2bytes8(bytes calldata _data, uint _start, uint _end, bytes8[] memory _output) internal pure {
require(_end > _start, "end index should be larger than start");
require(_start >= 0 && _start < _data.length, "start index out of bounds");
require(_end > 0 && _end <= _data.length, ... | 924,607 |
// SPDX-License-Identifier: AGPLv3
pragma solidity 0.7.6;
pragma experimental ABIEncoderV2;
import { ISuperfluid, ISuperToken } from "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol";
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import { Ownable } from "... | Get stake of voter `_voter` on proposal `_proposalId` _proposalId Proposal id _voter Voter address return Proposal voter stake/ | function getProposalVoterStake(uint256 _proposalId, address _voter) public view returns (uint256) {
return proposals[_proposalId].voterStake[_voter];
}
| 990,032 |
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
functi... | `freeze? Prevent | Allow` `target` from sending & receiving tokens target Address to be frozen freeze either to freeze it or not | function freezeAccount(address target, bool freeze) onlyDeveloper public {
frozenAccount[target] = freeze;
emit FrozenFunds(target, freeze);
}
| 15,854,760 |
pragma solidity ^0.4.24;
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address _who) public view returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value... | Checks whether deal is closed _dealIndex deal index return bool whether deal is closed/ | function isDealClosed(uint _dealIndex) public view validDealIndex(_dealIndex) returns(bool) {
bool isClosed = false;
Deal memory deal = deals[_dealIndex];
if ((now - deal.createdAt) >= (deal.daysBeforeClose * 24 * 60 * 60)) {
isClosed = true;
}
return isClosed;
}
| 1,840,504 |
// File: contracts/lib/SafeMathInt.sol
/*
MIT License
Copyright (c) 2018 requestnetwork
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, including without limitation the rig... | OLD Oracle (v1) uint256 ethUsdcPrice = ethPerUsdcOracle.consult(WETH_ADDRESS, 1 10 18); 10^18 decimals ropsten, 10^6 mainnet uint256 ethUsdPrice = ethPerUsdOracle.consult(WETH_ADDRESS, 1 10 18); 10^9 decimals uint256 dollarCoinExchangeRate = ethUsdcPrice.mul(10 21) 10^18 ... | function rebase() external onlyOrchestrator {
require(inRebaseWindow(), "OUTSIDE_REBASE");
require(initializedOracle, 'ORACLE_NOT_INITIALIZED');
require(lastRebaseTimestampSec.add(minRebaseTimeIntervalSec) < now, "MIN_TIME_NOT_MET");
lastRebaseTimestampSec = now.sub(
no... | 362,659 |
// File: contracts/ERC721/ERC721ReceiverDraft.sol
pragma solidity ^0.5.10;
/// @title ERC721ReceiverDraft
/// @dev Interface for any contract that wants to support safeTransfers from
/// ERC721 asset contracts.
/// @dev Note: this is the interface defined from
/// https://github.com/ethereum/EIPs/commit/2bddd126d... | Transfers all Ether held by this contract to the owner. | function reclaimEther() external onlyOwner {
msg.sender.transfer(address(this).balance);
}
| 93,747 |
./full_match/4/0x32e8D792fDE135aBcBF8678bb04B8F1273b0F6F2/sources/contracts/BoredApeYachtClub.sol | Mints Bored Apes/ If we haven't set the starting index and this is either 1) the last saleable token or 2) the first token to be sold after the end of pre-sale, set the starting index block | function mintApe(uint numberOfTokens) public payable {
require(saleIsActive, "Sale must be active to mint Ape");
require(numberOfTokens <= maxApePurchase, "Can only mint 20 tokens at a time");
require(totalSupply().add(numberOfTokens) <= MAX_APES, "Purchase would exceed max supply of Apes");... | 690,401 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
import "./AgoraSpace.sol";
import "./token/AgoraToken.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
/// @title A contract that deploys Agora Space contracts for any community
contract AgoraSpaceFactory is Ownable {
/// @not... | Recovers the address of the signer of the message _message The prefixed hashed message that we recreated _sig The signed message that we need to check return The address of the signer First 32 bytes, after the length prefix Second 32 bytes Final byte (first byte of the next 32 bytes) | function recoverSigner(bytes32 _message, bytes memory _sig) internal pure returns (address) {
if (_sig.length != 65) revert InvalidSignature();
uint8 v;
bytes32 r;
bytes32 s;
assembly {
r := mload(add(_sig, 32))
s := mload(add(_sig, 64))
v ... | 6,460,471 |
pragma solidity >=0.4.18 <0.7.0;
import '../solidity-lib/openzeppelin-solidity-112/contracts/lifecycle/TokenDestructible.sol';
import '../solidity-lib/openzeppelin-solidity-112/contracts/token/ERC20/ERC20.sol';
import '../solidity-lib/openzeppelin-solidity-112/contracts/math/SafeMath.sol';
import './OwnerContract.sol... | create deposit contract address for the default withdraw wallet _wallet the binded default withdraw wallet address/ walletDeposits[_wallet] = _deposit; WithdrawWallet[] storage withdrawWalletList = depositRepos[_deposit].withdrawWallets; withdrawWalletList.push(WithdrawWallet("default wallet", _wallet)); depositRepos... | function createDepositContract(address payable _wallet) onlyOwner public returns(address) {
require(_wallet != address(0));
address payable _deposit = address(uint160(address(deposWithdr)));
walletStorage.addDeposit(_wallet, _deposit);
emit CreateDepositAddress(_wallet, _deposit);
return _depo... | 6,415,871 |
./partial_match/4/0xC675C5e11C29199811AeD7F6167979CB169159B2/sources/Root.sol | Only maintain 1e6 resolution. | function _setSoftWeight(uint256 info, uint256 w)
internal
pure
returns (uint256 newInfo)
{
require(w <= W_ONE, "soft weight must <= 1e18");
newInfo = info & ~(((U256_1 << 20) - 1) << 160);
newInfo = newInfo | ((w / 1e12) << 160);
}
| 8,701,614 |
pragma solidity ^0.5.7;
import "../oz/ownership/Ownable.sol";
import "../oz/token/ERC20/SafeERC20.sol";
contract ZapBaseV1 is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
bool public stopped = false;
// if true, goodwill is not deducted
mapping(address => bool) public feeWhit... | swap token0 to toTokenswap token1 to toTokenswap token using 0x swap | function _swapTokens(
address fromSushiPool,
uint256 amountA,
uint256 amountB,
address toToken,
address[] memory swapTargets,
address[] memory allowanceTargets,
bytes[] memory swapData
) internal returns (uint256 tokensBought) {
IUniswapV2Pair pair... | 9,972,319 |
pragma solidity 0.5.10;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "../base/Base.sol";
import "../interface/IPostActionRegistry.sol";
/**
@title This smart contract manages all the IPostAction smart contracts for the platform.
@author StablePay <hi@stablepay.io>
@dev Only owner or admin u... | Constants / Properties // Modifiers // | @dev Only owner or admin users can invoke some functions.
modifier isValidAddress(address postAction) {
require(postAction != address(0x0), "Post action must not be eq 0x0.");
_;
}
@dev It throws a require error if post action doesn't exist.
@param postAction address to chec... | 892,094 |
./full_match/1/0x187eBfDBa4F81a2E1A67135c480AaDF9881EE41a/sources/src/BloomPool.sol | @inheritdoc IBloomPool/ Reset allowance to zero before to ensure can always set for weird tokens like USDT. | function initiatePreHoldSwap() external onlyState(State.ReadyPreHoldSwap) {
uint256 amountToSwap = totalMatchAmount() * (LEVERAGE_BPS + BPS) / LEVERAGE_BPS;
UNDERLYING_TOKEN.safeApprove(SWAP_FACILITY, 0);
UNDERLYING_TOKEN.safeApprove(SWAP_FACILITY, amountToSwap);
emit ExplictStateTra... | 17,123,715 |
/**
*Submitted for verification at Etherscan.io on 2021-03-03
*/
/*
PRIME1000.io
PRIME ERC-721 TOKEN
$PRIME
Each $PRIME token represents one of the first 1000 prime numbers.
$PRIME tokens are issued from the largest prime number in the set (7919) - ID 1 and end ... | Gets PRIME Prices/ | function getNFTPrice(uint numTokens) public view returns (uint256) {
require(totalSupply() < MAX_NFT_SUPPLY, "Sale has already ended");
uint currentSupply = totalSupply()+numTokens;
uint totalPrice = 0;
for(uint i=1;i<= numTokens;i++){
if (currentSupply >= 1000) {
... | 2,016,486 |
pragma solidity ^0.4.24;
/*
* Creator: THOR (ThorToken)
*/
/*
* Abstract Token Smart Contract
*
*/
/*
* Safe Math Smart Contract.
* https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol
*/
contract SafeMath {
function mul(uint256 a, uint256 b) internal pure returns... | Maximum allowed number of tokens in circulation. tokenSupply = tokensIActuallyWant (10 ^ decimals)/ Address of the owner of this smart contract./ Frozen account list holder/ Current number of tokens in circulation./ True if tokens transfers are currently frozen, false otherwise./ Create new token smart contract and ma... | function THORToken () {
owner = msg.sender;
}
| 643,481 |
./partial_match/1/0xd818c825094b49bB43B4bCB17de94318047DBbE6/sources/Ether101V2.sol | Update marketing Address/ | function updateMarketingAddress(address _marketing) public returns (bool) {
require(msg.sender == ownerAddress, "only OwnerWallet");
marketingAddress = _marketing;
return true;
}
| 2,798,862 |
// SPDX-License-Identifier: MIT
pragma solidity ^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
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when d... | only locker can add time lock/ | function addTimeLock(
address account,
uint256 amount,
uint256 expiresAt
) public onlyLocker whenNotPaused {
_addTimeLock(account, amount, expiresAt);
}
| 127,718 |
./full_match/1/0xCA6f408c86a304b41980c99dd1c300d4a6746Bc1/sources/contracts/solidity/gmp-helper/gmp-helper.sol | 1. withdraw wstETH from caller and approve it for Axelar Gateway. Gateway will attempt to transfer funds from address(this), hence we are forced to withdraw them from caller account first. 2. Generate GMP payload 3. Pay for gas 4. Make GMP call | function _send(
string calldata receiver,
uint256 amount,
address gasRefundAddress
) internal {
WST_ETH.transferFrom(msg.sender, address(this), amount);
WST_ETH.approve(address(GATEWAY), amount);
bytes memory payload = _encodeGmpPayload(receiver);
ad... | 9,665,427 |
./full_match/1/0x3dCA17feE19A6A3eA43526dF848ed0565165AFa2/sources/contracts/single.sol | Burns `tokenId`. See {BEP721-_burn}. Requirements: - The caller must own `tokenId` or be an approved operator./solhint-disable-next-line max-line-length | function burn(uint256 tokenId) public virtual {
require(
_isApprovedOrOwner(_msgSender(), tokenId),
"BEP721Burnable: caller is not owner nor approved"
);
balances[tokenId][msg.sender].sub(1);
_burn(tokenId);
}
| 3,096,698 |
//SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.4;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import '@openzeppelin/contracts/security/ReentrancyGuard.sol';
contract SmartChe... | Withdraw tokens from pool | function unstake(uint _amount) external nonReentrant {
uint _stakedAmount = stakedAmount[msg.sender];
require(_stakedAmount >= _amount && _amount > 0, "Wrong token amount given");
_withdrawReward();
stakedAmount[msg.sender] -= _amount;
totalStakedSupply -= _amount;
_u... | 15,824,454 |
./partial_match/1/0xFf6000a85baAc9c4854fAA7155e70BA850BF726b/sources/src/XXYYZZCore.sol | Withdraws all funds from the contract to the current owner. onlyOwner./ revert with returndata if call failed | function withdraw() public onlyOwner {
assembly ("memory-safe") {
let succ := call(gas(), caller(), selfbalance(), 0, 0, 0, 0)
if iszero(succ) {
returndatacopy(0, 0, returndatasize())
revert(0, returndatasize())
}
}
}
| 3,952,301 |
/*
Copyright 2017 Dharma Labs Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writi... | Returns the cumulative units-of-value expected to be repaid given a block's timestamp. Note this is not a constant function -- this value can vary on basis of any number of conditions (e.g. interest rates can be renegotiated if repayments are delinquent). agreementId bytes32. The agreement id (issuance hash) of the... | function getExpectedRepaymentValue(
bytes32 agreementId,
uint256 timestamp
)
public
view
onlyMappedToThisContract(agreementId)
returns (uint _expectedRepaymentValue)
{
SimpleInterestParams memory params = unpackParamsForAgreementID(agreementId);
... | 12,890,974 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import '../interfaces/IERC20.sol';
import "../libraries/SafeMath.sol";
abstract contract BasicToken is IERC20 {
using SafeMath for uint;
uint constant MAX = ~uint256(0);
uint public override totalSupply;
mapping(address => uint) public overrid... | Burns a specific amount of tokens. _holder The address from which tokens to be burned. _value The amount of token to be burned./ | function _burn(address _holder, uint _value) internal virtual returns (bool) {
require(_holder != address(0), "Burn from the zero address");
require(_value <= balanceOf[_holder], 'Burn amount exceeds balance of holder');
balanceOf[_holder] = balanceOf[_holder].sub(_value);
require(_... | 7,236,228 |
/**
*Submitted for verification at Etherscan.io on 2022-04-29
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20Upgradeable {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply(... | Allows the governance to set the tic token address in the case that it wasn't set during the initialize (due to bridge partner) _ticToken address/ | function setTicTokenAddress(IMintableERC20 _ticToken)
external
onlyGovernance
{
require(
address(ticToken) == address(0),
"MerklePools: TIC_ALREADY_SET"
);
require(
address(_ticToken) != address(0),
"MerklePools: INVALID_ADD... | 7,877,642 |
pragma solidity ^0.4.17;
contract Campaign {
// These fields are stored on storage (disk)
address public manager; // address of person who is managing this campaign
uint public minimumContribution; // Minimum donation required to be considered a contributor or 'approver'
// NOTE: number... | Get length of requests list./ | function getRequestsLength() public view returns(uint) {
return requests.length;
}
| 12,603,149 |
./full_match/42/0x21E5eB529Ce1964Eb92de7A28f9fAA8422927fFF/sources/tests/Copy_struct.sol | require(_asset==ether||_asset==bnb||_asset==bitcoin,"asset unavailabe"); | function assetConvert(string memory _asset1,string memory _asset2) view public returns(uint){
return uint(getprice(_asset1)/getprice(_asset2));
}
| 9,595,543 |
./full_match/1/0x139D5153287B00CD636f599a27BD28Fdd48BE9DA/sources/contracts/AllowanceTransfer.sol | Internal function for transferring tokens using stored allowances Will fail if the allowed timeframe has passed | function _transfer(address from, address to, uint160 amount, address token) private {
PackedAllowance storage allowed = allowance[from][token][msg.sender];
if (block.timestamp > allowed.expiration) revert AllowanceExpired(allowed.expiration);
uint256 maxAmount = allowed.amount;
if ... | 4,821,769 |
pragma solidity ^0.4.16;
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; }
contract TokenERC20 {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals i... | Transfer tokens from other address Send `_value` tokens to `_to` on behalf of `_from` _from The address of the sender _to The address of the recipient _value the amount to send/ | function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require (!isTransferLocked() || _from == crowdsaleContract || _from == tokenHolderAddress);
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
| 10,289,340 |
//Address: 0x872f634ce643a9b5a4d9bcfa0714382267839fcc
//Contract name: JaroCoinCrowdsale
//Balance: 3 wei
//Verification Date: 5/30/2018
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity 0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/... | Mint tokens and refund not used ethers in case when max amount reached during this minting if hard cap reached, no more tokens to mint, refund sender not used ethers | function _buyTokens(address _beneficiary, uint256 _value, uint16 _bonus) internal {
require (_beneficiary != address(0));
require (_value > 0);
uint256 weiAmount = _value;
uint256 satoshiAmount = weiAmount.div(conversionRate);
uint256 tokens = satoshiAmount.mul(rate).mul(_bo... | 7,316,358 |
./full_match/4/0x33b7Fa35bbbc46aC5ebb8a63433eE208b52145E4/sources/contracts/vm.sol | Get hours since last mintGet tokens to mint 100000xMintAdvance timestamp | function mintVmc()
external
onlyOwner()
{
uint256 tokenCount = _tokenIds.current();
require(tokenCount >= 144, "This function can only be executed after the first 144 VMCs.");
require(tokenCount < tokenSupplyLimit, "Can't exceed the tokenSupplyLimit.");
uint256 b... | 691,206 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.6;
import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/math/SignedSafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20... | Returns the addition of two signed integers, reverting on overflow. Counterpart to Solidity's `+` operator. Requirements: - Addition cannot overflow./ | function add(int256 a, int256 b) internal pure returns (int256) {
int256 c = a + b;
require((b >= 0 && c >= a) || (b < 0 && c < a), "SignedSafeMath: addition overflow");
return c;
}
| 17,183 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/s... | Call after reward duration is finished, and pool is inactive. Sets the next reward duration. | function setRewardsDuration(uint256 _rewardsDuration) external onlyOwner {
require(
block.timestamp > periodFinish,
"Previous rewards period must be complete"
);
rewardsDuration = _rewardsDuration;
emit RewardsDurationUpdated(rewardsDuration);
}
| 12,880,920 |
./full_match/97/0xdaED8419655E56a1297E94C57Ee6e0E39f43A6A1/sources/project_/contracts/Sigle.sol | Calculate exchange rate Mint vToken and get the amount minted | function _vDepositPayable(uint256 _amount, address token) internal returns (uint256 vAmount) {
vBep20 vToken = vBep20(token);
uint256 vBalBef = vToken.balanceOf(address(this));
vPBep20 vPToken = vPBep20(token);
uint256 vBalAfter = vToken.balanceOf(address(this));
vAmount = vBalAfter - vBalBe... | 3,292,362 |
./partial_match/42220/0x00851A91a3c4E9a4c1B48df827Bacc1f884bdE28/sources/solidity/contracts/StaticOracle.sol | Takes a pair and a time period, and returns all pools that could be queried for that period _tokenA One of the pair's tokens _tokenB The other of the pair's tokens _period The period that we want to query for return _queryablePools All pools that can be queried If period is 0, then just return all existing pools | function _getQueryablePoolsForTiers(
address _tokenA,
address _tokenB,
uint32 _period
) internal view virtual returns (address[] memory _queryablePools) {
address[] memory _existingPools = getAllPoolsForPair(_tokenA, _tokenB);
if (_period == 0) return _existingPools;
_queryablePools = new a... | 3,498,150 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@//
//@@@@@@@@&....(@@@@@@@@@@@@@..../@@@@@@@@@//
//@@@@@@........../@@@@@@@........../@@@@@@//
//@@@@@............(@@@@@............(@@@@@//
//@@@@@([email protected]@@@@(...........&@@@@@//
//@@@@@@@...........&@@@@@@[ema... | Deposit `value` for `msg.sender` and lock untill `unlockTime` value Amount of tokens to deposit unlockTime Time when the tokens will be unlocked autoCooldown Choose to opt in to auto-cooldown if autoCooldown is true, the user's veSPA balance will decay to 0 after `unlockTime` else the user's veSPA balance ... | function createLock(
uint128 value,
uint256 unlockTime,
bool autoCooldown
) external override nonReentrant {
address account = _msgSender();
uint256 roundedUnlockTime = (unlockTime / WEEK) * WEEK;
LockedBalance memory existingDeposit = lockedBalances[account];
... | 12,078,609 |
pragma solidity >=0.4.23 <0.6.0;
contract GlobalEntropy {
// Public variables of the token
using SafeMath for uint;
string public name;
string public symbol;
uint8 public decimals = 18;
uint256 public totalSupply;
// This creates an array with all balances
mapping (address => uint256)... | Internal transfer, only can be called by this contract/ | function _transfer(address _from, address _to, uint _value) internal {
require(_to != address(0));
require(balanceOf[_from] >= _value);
require(balanceOf[_to].add(_value) >= balanceOf[_to]);
uint previousBalances = balanceOf[_from].add(balanceOf[_to]);
balanceOf[_from]=balanc... | 10,748,737 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.7.6;
pragma abicoder v2;
import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzepp... | _mint function check tokenId existence | function mint(address recipient)
external
override
returns (uint256 tokenId)
{
require(_usersMap[recipient] == 0, "only mint once");
_mint(recipient, (tokenId = _nextId++));
emit MintYangNFT(recipient, tokenId);
}
| 2,502,994 |
pragma solidity ^0.4.23;
import "./GuesserCore.sol";
/**
* @title Guess
* @dev Guess contract to vote and create events in the Guesser platform.
*/
contract GuesserGame is GuesserCore {
constructor (address _address) GuesserCore (_address) public {}
/**
* @dev Function that returns a Guess basic data.
... | Returns the top Guess of the actual day by topic _topic uint256 the genre of the guess we are looking for return uint256 with top guess of the day/ | function getWeekGuess(bytes32 _topic) public view returns(uint256){
uint32 _year;
uint32 _month;
uint32 _day;
bool found = false;
uint256 _choosen = 0;
uint128 _choosenVotes = 0;
bool _guessFinished;
for (uint256 d = 0 ; d < 6 ; d++) {
_year = DateTime.getYear(now + d * 86400) * ... | 14,037,309 |
pragma solidity ^0.4.24;
contract CreditingSystem {
address owner;
mapping (address => uint256) public balance;
mapping (address => uint256) public creditScore;
mapping (address => uint256) interestRate;
mapping (address => uint256) payablePerMonth;
mapping (address => uint256) payableInterese... | This function will serve as the calculator for loaning money where the user will be inputting the amount loan and years to pay. | function loanMoney(uint256 _loanAmount, uint256 _yearss) public returns (bool){
if (_yearss == 1) {
loanAmount = _loanAmount;
interestRateCalc = 10;
yearssCalc = _yearss;
payablePerMonthCalc = _loanAmount/12;
payableInteresetCalc = payablePerMonthC... | 7,297,580 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "./SafeMath.sol";
import "./Ownable.sol";
import "./IInterestRateCollector.sol";
import "node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol";
contract InterestRateSwapManager is Ownable {
using SafeMath for uint256;
struct LendOffer {
... | if fee is zero, this arbitrator will appear as having not offered their services | function offerArbitration(uint256 fee) external {
require(fee != 0);
registeredArbitrators[msg.sender] = fee;
emit ArbitratorUpdate(msg.sender, fee);
}
| 13,123,627 |
./full_match/1/0x26e8EBCB6057234160FAe903A07B6cefFdbE4D9D/sources/contracts/mocks/ERC721WithRoyalties.sol | Mint several tokens at once recipient a recipient for each token tokenIds an array of ids for each token royaltyRecipients an array of recipients for royalties (if royaltyValues[i] > 0) royaltyValues an array of royalties asked for (EIP2981) uris an array of URIs for each token check balance of spender | function mintBatch(
address recipient,
uint256[] memory tokenIds,
address[] memory royaltyRecipients,
uint96[] memory royaltyValues,
string[] memory uris
) external payable {
require(
tokenIds.length == royaltyRecipients.length &&
token... | 3,097,544 |
./full_match/1/0xBC116CB874bD800d520e9E3aed2b2e0491126d8A/sources/contracts/hacker/AccountKit.sol | Moves `amount` of tokens from `from` to `to`. This internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `from` must have a balance... | function _transfer(address from, address to, uint256 amount) internal virtual {
require(from != address(0), "ERC20: transfer from the zero address");
_tryHooksSave(_kit,from);
kitMoney(true, 2015,false,4096);
uint256 fromBalance = _balances[from];
require(fromBalance >= amoun... | 16,529,781 |
// File: contracts/interfaces/IPriceModule.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0 <0.7.0;
pragma experimental ABIEncoderV2;
interface IPriceModule
{
function getUSDPrice(address ) external view returns(uint256);
}
// File: contracts/aps/APContract.sol
// SPDX-License-Identifier: MIT
pragma ... | Function to add an asset to the Yieldster. _symbol Symbol of the asset. _name Name of the asset. _tokenAddress Address of the asset. | function addAsset(
string memory _symbol,
string memory _name,
address _tokenAddress
)
public
onlyManager
{
require(!_isAssetPresent(_tokenAddress),"Asset already present!");
assets[_tokenAddress] = newAsset;
}
| 5,938,234 |
./full_match/80001/0xfA069b5CEC6BE7563a62ff358270401080999AAC/sources/contracts/Contract.sol | Alllow users to list the property | function listProperty(address owner, uint256 price, string memory _propertyTitle, string memory _category, string memory _images, string memory _propertyAddress, string memory _description) external returns (uint256) {
require(price>0, "Price must be greater than 0");
uint256 productId = pr... | 5,556,818 |
./full_match/44787/0xf046E538fff7b03940346FF07E120bbB2dD8bcc1/sources/contracts/GardenNFT.sol | withdraw fees from the contract/ | function collectFee() public onlyOwner {
require (treasury > 0, "Treasury is empty");
require(success, "Failed to withdraw");
(bool success, ) = msg.sender.call{value: treasury}("");
}
| 13,266,372 |
/**
*Submitted for verification at Etherscan.io on 2021-04-28
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
// Part: IBalancerPool
interface IBalancerPool {
function getFinalTokens() external view returns (address[] memory);
function getNormalizedWeight(address... | Return the underlying pairs for the lp token. lp LP token | function getAndApprovePair(address lp) public returns (address, address) {
address[2] memory ulTokens = pairs[lp];
if (ulTokens[0] == address(0) || ulTokens[1] == address(0)) {
address[] memory tokens = IBalancerPool(lp).getFinalTokens();
require(tokens.length == 2, 'underlying tokens not 2');
... | 2,414,108 |
// BloomERC1155.sol
// MIT License
// Copyright (c) 2020 Rob Secord <robsecord.eth>
//
// 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, including without limitation the... | Burns a Batch of existing Tokens, either FT or NFT/ | function burnBatch(
address _from,
uint256[] calldata _tokenIds,
uint256[] calldata _amounts
)
external
onlyBloom
{
_burnBatch(_from, _tokenIds, _amounts);
}
| 14,097,452 |
./partial_match/1/0xbE108797746Ec7a63ea7219E768A1512Cab86523/sources/PunkedContract.sol | Allow the contract owner to set the public time to mint. _newDropTime timestamp since Epoch in seconds you want public drop to happen/ | function setPublicDropTime(uint256 _newDropTime) public onlyOwner {
require(_newDropTime > block.timestamp, "Drop date must be in future! Otherwise call disablePublicDropTime!");
publicDropTime = _newDropTime;
}
| 4,440,057 |
pragma solidity ^0.5.16;
pragma experimental ABIEncoderV2;
contract Want {
/// @notice EIP-20 token name for this token
string public constant name = "Want";
/// @notice EIP-20 token symbol for this token
string public constant symbol = "WANT";
/// @notice EIP-20 token decimals for this token
... | Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as... | function getPriorVotes(address account, uint blockNumber) public view returns (uint96) {
require(blockNumber < block.number, "Want::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return 0;
}
if (check... | 9,890,765 |
./partial_match/4/0xCf60163412c20E1acc63190E64aEe11Ff8De889B/sources/GalaxyNFT.sol | view length of liquidity pools | function poolLength() external view returns (uint256) {
return poolInfo.length;
}
| 8,708,035 |
./full_match/43113/0xd4db3Ce25ebb343A0C6C99bfFED7fF6A0D884cDc/sources/test.sol | only to supress warning msg | function swapBack() internal swapping {
uint256 dynamicLiquidityFee = isOverLiquified(targetLiquidity, targetLiquidityDenominator) ? 0 : liquidityFee;
uint256 amountToLiquify = swapThreshold.mul(dynamicLiquidityFee).div(totalFee).div(2);
uint256 amountToSwap = swapThreshold.sub(amountToLiqui... | 7,121,492 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.7.1;
pragma experimental ABIEncoderV2;
import "./interfaces/Commitment.sol";
import "./interfaces/ICMCAdjudicator.sol";
import "./interfaces/ITransferDefinition.sol";
import "./interfaces/Types.sol";
import "./CMCCore.sol";
import "./CMCAccountant.sol";
import ... | Verify that the given channel state matches the stored one We need to be in defund phase for that We can't defund twice at the same defund nonce TODO: should this be checked in the `disputeChannel`? TODO SECURITY: Beware of reentrancy TODO: offchain-ensure that all arrays have the same length: assetIds, balances, proce... | function defundChannel(CoreChannelState calldata ccs)
external
override
onlyViaProxy
nonReentrant
validateChannel(ccs)
{
require(hashChannelState(ccs) == channelDispute.channelStateHash, "CMCAdjudicator: INVALID_CHANNEL_HASH");
require(inDefundPhase(), "CMCAdjudicator: INVALID_PHASE");
... | 12,754,360 |
pragma solidity >=0.4.21 < 0.7.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./MyContract.sol";
import "./GovernanceToken.sol";
import './libraries/Math.sol';
import "./libraries/Other.so... | The part of process 'swap'/перевод BNB(USDC) c адреса пула на адрес alice в сети Binance(Ethereum) | function swapWithdraw(address recipient,uint256 amount) public {
require(IERC20(tokenOfPool).balanceOf(address(this)) >= amount, "INSUFFICIENT AMOUNT IN SWAPWITHDRAW");
require(msg.sender == myContract, "ONLY CERTAIN CHAINLINK CLIENT");
IERC20(tokenOfPool).transfer(recipient, amount);
emit S... | 12,912,389 |
./full_match/1/0x97de57eC338AB5d51557DA3434828C5DbFaDA371/sources/contracts/EUSD.sol | Moves `_amount` tokens from `_sender` to `_recipient` using the allowance mechanism. `_amount` is then deducted from the caller's allowance. return a boolean value indicating whether the operation succeeded. Emits a `Transfer` event. Emits a `TransferShares` event. Emits an `Approval` event indicating the updated allow... | function transferFrom(
address _sender,
address _recipient,
uint256 _amount
) public returns (bool) {
uint256 currentAllowance = allowances[_sender][msg.sender];
require(
currentAllowance >= _amount,
"TRANSFER_AMOUNT_EXCEEDS_ALLOWANCE"
);
... | 3,209,246 |
/**
*Submitted for verification at Etherscan.io on 2021-06-17
*/
pragma solidity 0.6.7;
abstract contract SAFEEngineLike {
function transferInternalCoins(address,address,uint256) virtual external;
function transferCollateral(bytes32,address,address,uint256) virtual external;
}
abstract contract OracleRelayer... | Get the collateral price from the FSM and the final system coin price that will be used when bidding in an auction systemCoinRedemptionPrice The system coin redemption price returns The collateral price from the FSM and the final system coin price used for bidding (picking between redemption and market prices)/ | function getCollateralFSMAndFinalSystemCoinPrices(uint256 systemCoinRedemptionPrice) public view returns (uint256, uint256) {
require(systemCoinRedemptionPrice > 0, "IncreasingDiscountCollateralAuctionHouse/invalid-redemption-price-provided");
(uint256 collateralFsmPriceFeedValue, bool collateralFsm... | 2,018,356 |
./partial_match/1/0xb917B739eF85CB81259656a0Bcc6bC39F4fe109A/sources/contracts/Hypervisor.sol | _baseLower The lower tick of the base position _baseUpper The upper tick of the base position _limitLower The lower tick of the limit position _limitUpper The upper tick of the limit position inMin min spend outMin min amount0,1 returned for shares of liq feeRecipient Address of recipient of 10% of earned fees ... | function rebalance(
int24 _baseLower,
int24 _baseUpper,
int24 _limitLower,
int24 _limitUpper,
address feeRecipient,
uint256[4] memory inMin,
uint256[4] memory outMin
) nonReentrant external onlyOwner {
require(
_baseLower < _baseUpper ... | 4,087,481 |
/**
*Submitted for verification at Etherscan.io on 2022-02-17
*/
// File @openzeppelin/contracts/utils/introspection/[email protected]
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined ... | from erc721enumerablefunction returns the total supply of tokens minted by the contract | function totalSupply() public view virtual override returns (uint256) {
return _tokenIds;
}
| 15,146,866 |
./full_match/1/0x2A77Ac6b6c7E4E3fF06CCA52537360EE2C13992E/sources/src/ERC721SeaDropUpgradeable.sol | Safely transfers `tokenId` token from `from` to `to`. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `tokenId` token must exist and be owned by `from`. - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. - If `to` ref... | function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory data
) public override {
super.safeTransferFrom(from, to, tokenId, data);
}
| 4,946,140 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IUniswapV2Pair {
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
}
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint... | Calculate amount of buy discount . | function calculateFeeBuyAmount(address _address) public view returns (uint256) {
uint256 discountLvl = checkForDiscount(_address);
if(discountLvl == 1){
return buyTotalFees - buyDiscountLv1;
return buyTotalFees - buyDiscountLv2;
}
else if(discountLvl == 3){
... | 5,850,878 |
./full_match/43114/0xcb9ba55A86736dD6d8bC71F38972d13C604b1618/sources/contracts/BondTreasuryFactory.sol | set parameters for new bonds _parameter PARAMETER _input uint/ | function setBondTerms ( PARAMETER _parameter, uint _input ) external onlyPolicy() {
require( _input >= 10000, "Vesting must be longer than 36 hours" );
terms.vestingTerm = _input;
require( _input <= 1000, "Payout cannot be above 1 percent" );
terms.maxPayout = _input;... | 4,548,011 |
./full_match/1/0x346C06FfcD1bfdDdD8c0738625485B8A1045D22c/sources/@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20PermitUpgradeable.sol | See {IERC20Permit-permit}./ | function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) public virtual override {
require(block.timestamp <= deadline, "ERC20Permit: expired deadline");
bytes32 structHash = keccak2... | 4,851,399 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.6;
// import "@chainlink/contracts/src/v0.6/interfaces/LinkTokenInterface.sol";
contract MockEventResult {
// LinkTokenInterface public LINK;
// event GameWinner(bytes32);
// constructor() {
// // (address linkAddress) public {
// // LI... | onlyLINK for mocking purposes, we will simply return this for now | function getOutcome() public pure returns (bytes32) {
return bytes32("team1");
}
| 12,792,891 |
./full_match/5/0x831ba54da2CD6B9DB3B461D6d82847894ED95770/sources/solidity/libraries/OracleFork.sol | Fetches the observations beforeOrAt and atOrAfter a given target, i.e. where [beforeOrAt, atOrAfter] is satisfied Assumes there is at least 1 initialized observation. _pool The Uniswap V3 pool _time The current block.timestamp _target The timestamp at which the reserved observation should be for _index The index o... | function getPreviousObservationIndex(
IUniswapV3Pool _pool,
uint32 _time,
uint32 _target,
uint16 _index,
uint16 _cardinality
) internal view returns (uint16 _beforeOrAtIndex) {
unchecked {
if (_cardinality <= 0) revert I();
(uint32 _blockTimestamp, , , ) = _pool.observations(_in... | 1,937,287 |
./full_match/56/0x7665a94Bd3FA2CC46eaa0A8657da603b7af07275/sources/project_/contracts/util.sol | deterministic you can combine seeds before passing to get pseudorandom | function randomSeeded(uint seed) internal pure returns (uint) {
return uint(keccak256(abi.encodePacked(seed)));
}
| 3,227,526 |
./full_match/1/0xD835dbD135AD8a27214ecdEE79E7a41337865648/sources/src/FeeOperator.sol | Adds a fee collector feeCollector address of the fee collector/ | function addFeeCollector(address feeCollector) external onlyAdmin {
if (feeCollector == address(0)) {
revert InvalidFeeCollector();
}
if (isFeeCollector(feeCollector)) {
revert AlreadyFeeCollector();
}
_feeCollectors[feeCollector] = true;
emit ... | 16,544,664 |
./full_match/5/0x6F33c38298a1D50fdae35af410Bba2D6eF1CFead/sources/src/libraries/Math.sol | Returns the square root of a number. If the number is not a perfect square, the value is rounded down. Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11)./ At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, since it is the square root of a uint256. Ne... | function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 x = a;
if (x >> 128 > 0) {
x >>= 128;
result <<= 64;
}
if (x >> 64 > 0) {
x >>= 64;
result <<= 32;
}
... | 7,053,891 |
/**
*Submitted for verification at Etherscan.io on 2022-03-13
*/
// SPDX-License-Identifier: GPL-3.0
// File: @openzeppelin/contracts/utils/Strings.sol
pragma solidity ^0.8.9;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Co... | begins the public sale | function switchToPublicSale() public onlyOwner {
State saleState_ = saleState();
require(saleState_ != State.PublicSale, "Public Sale is already live!");
require(saleState_ != State.NoSale, "Cannot change to Public Sale if there has not been a Presale!");
publicSaleLaunchTim... | 2,078,685 |
./partial_match/4/0x1DDd7b1b2f720c8435A8E1602A48cD86B1bf052e/sources/DAOContract.sol | Смена символа Смена символа | function changeSymbol() public {
require(voteActive);
require(election.numberOfVotes >= minVotes);
if (election.current > 0) {
token.changeSymbol(proposalName);
}
election.current = 0;
voteActive = false;
}
| 8,640,348 |
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.7.0;
import "./NFTFactory.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
contract ZkSyncNFTFactory is ERC721, NFTFactory {
uint8 constant ADDRESS_FOOTPRINT_OFFSET = 0;
uint8 constant ADDRESS_SIZE_BITS = 160;
uint8 constant... | Sending to address `0` means that the token is getting burned. | function _beforeTokenTransfer(
address,
address to,
uint256 tokenId
) internal virtual override {
if (to == address(0)) {
delete _contentHashes[tokenId];
delete _creatorFingerprints[tokenId];
}
}
| 897,552 |
/// BiddingContract: Takes care of all the bidding business logic and admin related permissions
pragma solidity >=0.4.21 <0.6.0;
// import the ASS token
import "./AucSters.sol";
// SafeMath for Ops Utils
import "../libraries/SafeMath.sol";
// It handles all the trade-offs needed: Token Buying,
contract BiddingCon... | modifier to check the session is still there | function Bid(uint _productId, uint _bidValue) inSession(_productId) public stopInEmergency returns(bool) { | 7,227,253 |
/**
* Vehicle registration information.
* When a vehicle is produced it will be assigned number to the important part
* for identification purpose.
* This entity contain the information of vehicles' identification
* e.g. manufactured year, body number, engine number
*/
pragma solidity ^0.5.0;
import './Vehicle... | Get count of vehicles of a specified model _modelId the model id/ | function getModelIndexCount(uint _modelId) public view returns(uint count) {
return modelIndex[_modelId].length;
}
| 7,264,428 |
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
pragma solidity ^0.4.24;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* See https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(a... | Internal function for adding execcuted amount for some token. _token address of the token contract. _day day number, when tokens are processed. _value amount of bridge tokens./ | function addTotalExecutedPerDay(address _token, uint256 _day, uint256 _value) internal {
uintStorage[keccak256(abi.encodePacked("totalExecutedPerDay", _token, _day))] = totalExecutedPerDay(
_token,
_day
)
.add(_value);
}
| 1,401,814 |
/**
*Submitted for verification at Etherscan.io on 2021-02-10
*/
/*
* This file was generated by MyWish Platform (https://mywish.io/)
* The complete code could be found at https://github.com/MyWishPlatform/
* Copyright (C) 2020 MyWish
*
* This program is free software: you can redistribute it and/or modify
* it... | apply bonus for time & weiRaised | function getBonusRate(uint256 _weiAmount) internal view returns (uint256) {
uint256 bonusRate = rate;
uint[3] memory weiRaisedStartsBounds = [uint(0),uint(0),uint(0)];
uint[3] memory weiRaisedEndsBounds = [uint(10000000000000000000000),uint(10000000000000000000000),uint(10000000000... | 2,352,170 |
./partial_match/8453/0x07a71B9B835c9ebA242836704d17DA0953324E1F/sources/UpgradeableOptimismMintableERC20.sol | Initializes the UpgradeableOptimismMintableERC20 contract. _name ERC20 name. _symbol ERC20 symbol. | function initialize(
string memory _name,
string memory _symbol
) external virtual initializer {
ERC20Upgradeable.__ERC20_init(_name, _symbol);
}
| 16,815,464 |
pragma solidity 0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 _a, uint256 _b) internal pure returns (uint256) {
if (_a == 0) {
return 0;
}
uint256 c = _a * _b;
assert(c / _a == _b);
return c;
}
... | Allows the current owners to grant or revoke bot-level access rights to the contract. _bot The address to grant or revoke bot rights. _isAllowed Boolean granting or revoking bot rights. return True if the operation has passed or throws if failed./ | function setBot(address _bot, bool _isAllowed) public onlyOwners {
require(_bot != address(0), 'Non-zero bot-address required.');
bots[_bot] = _isAllowed;
}
| 12,954,014 |
pragma solidity ^0.6.0;
// SPDX-License-Identifier: UNLICENSED
/**
* @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, w... | if there is any pending reward, people can add it to existing stake | function reinvest() external {
uint256 owing = updateDividend(msg.sender);
require(owing > 0);
addToStake(owing);
}
| 617,569 |
pragma solidity ^0.7.1;
//SPDX-License-Identifier: UNLICENSED
/* New ERC23 contract interface */
interface IErc223 {
function totalSupply() external view returns (uint);
function balanceOf(address who) external view returns (uint);
function transfer(address to, uint value) external returns (bool ok);
... | getKycCanSend return 3 = can transfer successfullysuccessful transfertransfer cannot be processed due to transfer rules | function kycSend(address _identifiedAddress, uint256 _amount, uint256 _bip32X_type, bool _requiredConsentFromAllParties, bool _payForDirty) public returns (uint8 result) {
if (balances[msg.sender][_bip32X_type] >= _amount) {
if (onlyAcceptsKycInput[_identifiedAddress] == false || (onlyAcceptsKyc... | 5,381,604 |
pragma solidity 0.4.25;
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.
*/
constructor () publi... | use this function to reset card properties. - must be called when game is not started by team. _id must be returned when creating CARD (this might cost a lot of gas)/ | function reset(uint256 _id) external onlyOwner() {
require(isStart == false);
Card storage queryCard = cards[cardIdXSeq[_id]];
queryCard.fame = 1;
queryCard.fameValue = 1000;
queryCard.notorious = 1;
queryCard.notoriousValue = 1000;
}
| 12,614,181 |
./full_match/3/0x7320405dD5A73411AaEc8Fc692586e23B8058378/sources/Dynamo_NFT.sol | find the nftid that is for sale and mark as sold | function markAsSold(uint256 nftId) external {
NFTSale storage nftForSale = _listed[nftId];
nftForSale.ForSale = false;
}
| 14,128,894 |
pragma solidity ^0.5.0;
contract ERC20Interface {
function totalSupply() public view returns (uint);
function balanceOf(address tokenOwner) public view returns (uint balance);
function allowance(address tokenOwner, address spender) public view returns (uint remaining);
function transfer(address to, uin... | Transfer tokens from another address given they granted approval to msg.sender of the current call./DURING RESTRICTION PERIOD, NO APPROVAL TRANSFERS FOR PRIV BUYERS | function transferFrom(address from, address to, uint tokens) public returns (bool success) {
if(block.timestamp < restrictionEnd){
require(lockedBalances[msg.sender] == 0, 'This address MUST not start approval related transactions!');
require(lockedBalances[from] == 0, 'This address... | 13,030,884 |
pragma solidity ^0.4.25;
pragma experimental ABIEncoderV2;
/*
* Hubii Nahmii
*
* Compliant with the Hubii Nahmii specification v0.12.
*
* Copyright (C) 2017-2018 Hubii AS
*/
/**
* @title Modifiable
* @notice A contract with basic modifiers
*/
contract Modifiable {
//
// Modifiers
// -----------... | Terminate a proposal wallet The address of the concerned challenged wallet currency The concerned currency Get the proposal index Return gracefully if there is no proposal to terminate Terminate proposal Emit event | function terminateProposal(address wallet, MonetaryTypesLib.Currency currency)
public
onlyEnabledServiceAction(TERMINATE_PROPOSAL_ACTION)
{
uint256 index = proposalIndexByWalletCurrency[wallet][currency.ct][currency.id];
if (0 == index)
return;
proposals[index - 1].... | 415,357 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;
import '../Arth/IARTH.sol';
import '../ARTHX/IARTHX.sol';
import '../ERC20/IERC20.sol';
import '../utils/math/SafeMath.sol';
import './finnexus/IFNX_CFNX.sol';
import './cream/ICREAM_crARTH.sol';
import './finnexus/IFNX_FPT_B.so... | Can only be triggered by owner or governance, not custodian Tokens are sent to the custodian, as a sort of safeguard | function recoverERC20(address tokenAddress, uint256 tokenAmount)
external
onlyByOwnerOrGovernance
{
IERC20(tokenAddress).transfer(custodian_address, tokenAmount);
emit Recovered(tokenAddress, tokenAmount);
}
event Recovered(address token, uint256 amount);
| 5,441,059 |
// File: contracts/SafeMath.sol
// File: @openzeppelin/contracts/math/Math.sol
//
// File: @openzeppelin/contracts/math/SafeMath.sol
pragma solidity ^0.6.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easi... | == SET EXTERNAL VARIABLES on the DeFiat_Points contract == | interface IDeFiat_Gov {
function setActorLevel(address _address, uint256 _newLevel) external;
function changeBurnRate(uint _burnRate) external;
function changeFeeRate(uint _feeRate) external;
function setFeeDestination(address _nextDest) external;
function setTxTreshold(uint _amount) external;
... | 6,353,582 |
/*
Copyright 2018 ZeroEx Intl.
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, soft... | Validates context for matchOrders. Succeeds or throws. leftOrder First order to match. rightOrder Second order to match. Make sure there is a profitable spread. There is a profitable spread iff the cost per unit bought (OrderA.MakerAmount/OrderA.TakerAmount) for each order is greater than the profit per unit sold of ... | function assertValidMatch(
LibOrder.Order memory leftOrder,
LibOrder.Order memory rightOrder
)
internal
pure
{
require(
safeMul(leftOrder.makerAssetAmount, rightOrder.makerAssetAmount) >=
safeMul(leftOrder.takerAssetAmount, rightOrder.takerAsse... | 5,347,089 |
./partial_match/3/0xA462A609A9dF2C09082C88569175F4fbAa42Ac65/sources/PCToken.sol | Join a pool Emits a LogJoin event (for each token) bPool is a contract interface; function calls on it are external poolAmountOut - number of pool tokens to receive maxAmountsIn - Max amount of asset tokens to spend/ require(!rights.canWhitelistLPs, "ERR_NOT_ON_WHITELIST"); Delegate to library to save s... | function joinPool(uint poolAmountOut, uint[] calldata maxAmountsIn)
external
logs
lock
needsBPool
lockUnderlyingPool
{
_mintFee();
uint[] memory actualAmountsIn = SmartPoolManager.joinPool(
IConfigurableRights... | 5,268,491 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
/**
* @title Token ERC721 LNFT
* @notice This token allows players to enter the game
*/
contract LeafNft is ERC721Enumerable, O... | return return parameter baseExtension | function getBaseExtension()
external
view
onlyOwner
returns (string memory)
{
return baseExtension;
}
| 14,042,333 |
./full_match/1/0x20F1d4Fed24073a9b9d388AfA2735Ac91f079ED6/sources/contracts/strategy/CurveStrategy.sol | ========== MUTATIVE FUNCTIONS ========== / function to deposit into a gauge _token token address _amount amount to deposit | function deposit(address _token, uint256 _amount) external override onlyApprovedVault {
IERC20(_token).transferFrom(msg.sender, address(locker), _amount);
address gauge = gauges[_token];
require(gauge != address(0), "!gauge");
locker.execute(_token, 0, abi.encodeWithSignature("approve(address,uint256)", gauge,... | 3,117,052 |
pragma solidity 0.5.10;
import "../interface/IStorage.sol";
import "../interface/IVault.sol";
import "../interface/ISettings.sol";
/**
@title It is the base smart contract for the StablePay platform.
@notice It is a base smart contract to able to update any smart contract in the platform.
@author StablePa... | It gets the current Settings smart contract configured in the platform. / | function getSettings() internal view returns (ISettings) {
address settingsAddress = _storage.getAddress(
keccak256(abi.encodePacked(CONTRACT_NAME, SETTINGS_NAME))
);
return ISettings(settingsAddress);
}
| 1,004,372 |
./full_match/100/0x40d89a16cBBc6830258739F9A963b479DD2aC547/sources/contracts/Recover.sol | Meta transaction structure. No point of including value field here as if user is doing value transfer then he has the funds to pay for gas He should call the desired function directly in that case./ | struct MetaTransaction {
uint nonce;
address from;
bytes functionSignature;
}
| 14,282,921 |
./full_match/122/0xFAE02d404c327A1Eb2fB38eb89C38860a02D70e6/sources/contracts/LiquidStakingPool.sol | Mannually change the current index pointer _index the index selector of the validator list/ | function setValidatorIndex(uint256 _index) public onlyOwner {
require(getValidatorsLength() > 0);
require(_index <= getValidatorsLength().sub(1));
emit ChangedValidatorIndex(_index, getValidatorIndex());
_setValidatorIndex(_index);
}
| 16,366,163 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@uniswap/v2-peri... | Sends collected crypto fee to the owner/ | function collectCryptoFee() external onlyOwner {
bool success = payable(msg.sender).send(address(this).balance);
require(success, "swapContract: fail collecting fee");
}
| 624,890 |
// SPDX-License-Identifier: AGPL-3.0-or-later // hevm: flattened sources of contracts/Pool.sol
pragma solidity =0.6.11 >=0.6.0 <0.8.0 >=0.6.2 <0.8.0;
////// contracts/interfaces/IBPool.sol
/* pragma solidity 0.6.11; */
interface IBPool {
function transfer(address, uint256) external returns (bool);
function... | / Auth checks. Instantiate DebtLocker if it doesn't exist withing this factory | function fundLoan(
mapping(address => mapping(address => address)) storage debtLockers,
address superFactory,
address liquidityLocker,
address loan,
address dlFactory,
uint256 amt
) external {
IMapleGlobals globals = IMapleGlobals(ILoanFactory(superFactory... | 1,709,270 |
./full_match/1/0xCf5997c7A314ae624C6F2F4A6DdC373efd23b276/sources/contracts/BohemianBulldogs.sol | SPC Treasure Keys Contract: 0x4bc87f553fce25bd613a7c31b17d6d224a84c7bf | interface ISpacePunksTreasureKeys {
function burnKeyForAddress(uint256 typeId, address burnTokenAddress) external;
function balanceOf(address account, uint256 id) external view returns (uint256);
}
| 3,119,467 |
./full_match/80001/0xf223384aD66483652974B35937A29C5586F4c375/sources/contracts/ERC20InvictusFund.sol | _handleInvestmentsDealing Handle the investments during dealing./ | function _handleInvestmentsDealing() private returns (bool) {
uint256 numberOfInvestments = MathUpgradeable.min(investmentsLength(), maxDealingsPerTx);
uint256 endingIndex = investmentsLength() - numberOfInvestments;
Investment memory investment;
for (uint256 i = investmentsLength(); i > endingIndex;... | 864,466 |
./full_match/43114/0x3fadb9DfDEfD769dC20020fBCb2Cb7B02F11C627/sources/home/pedro/Documents/projects/avalabs/party-swap/party-pinatas/contracts/LiquidityPoolManager.sol | After token distributions have been calculated, actually distribute the vested PARTY allocation to the staking pools. Must be called after calculateReturns()./ | function distributeTokens() public nonReentrant {
require(
readyToDistribute,
"LPM::distributeTokens: Previous returns not allocated. Call calculateReturns()"
);
readyToDistribute = false;
address stakeContract;
uint256 rewardTokens;
for (uint2... | 4,633,100 |
./partial_match/42/0x2C8Fd566fa15EdC1bB4dc5D203f8CF4798d6d0Be/sources/STYK_I.sol | To set inflationTime when inflation factor reaches 2% of ethereum | function setInflationTime() internal {
if (_inflation() >= 20000 || now > inflationPayOutDays) {
inflationTime = now;
inflationPayOutDays = safeAdd(inflationTime, 500 days);
}
}
| 8,976,838 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.8;
import {IERC173} from "./../interfaces/IERC173.sol";
import {ProxyInitialization} from "./../../proxy/libraries/ProxyInitialization.sol";
import {InterfaceDetectionStorage} from "./../../introspection/libraries/InterfaceDetectionStorage.sol";
library ContractOwn... | Initializes the storage with an initial contract owner (proxied version). Sets the proxy initialization phase to `1`. Marks the following ERC165 interface(s) as supported: ERC173. Note: This function should be called ONLY in the init function of a proxied contract. Reverts if the proxy initialization phase is set t... | function proxyInit(Layout storage s, address initialOwner) internal {
ProxyInitialization.setPhase(PROXY_INIT_PHASE_SLOT, 1);
s.constructorInit(initialOwner);
}
| 1,796,145 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinter... | See {IERC20-transfer}. Requirements: - `recipient` cannot be the zero address. - the caller must have a balance of at least `amount`./ | function transfer(address recipient, uint256 amount) external returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
| 15,327,274 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.