file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./partial_match/42/0x047F07C9b93d74F5b64D26E300E7404A5200c3f6/sources/P2PLending.sol | richiesta per il prelievo | function withdraw(uint amount) payable public {
require(amount/1000000000000000000 <= balances[msg.sender], 'Not enough funds');
balances[msg.sender] -= amount;
msg.sender.transfer(amount*1000000000000000000);
}
| 8,926,337 |
./partial_match/1/0x491f8d040E90A8a9681F6aFE9DFb114F2dbB960c/sources/contracts/ERC4907.sol | Get the user address of an NFT The zero address indicates that there is no user or the user is expired tokenId The NFT to get the user address for return The user address for this NFT | function userOf(uint256 tokenId)public view virtual returns(address){
if( uint256(_users[tokenId].expires) >= block.timestamp){
return _users[tokenId].user;
}
else{
return address(0);
}
}
| 9,135,843 |
// Sources flattened with hardhat v2.0.5 https://hardhat.org
// File deps/@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20Upgradeable {
/**
* ... | If withdrawal fee is active, take the appropriate amount from the given value and transfer to rewards recipient return The withdrawal fee that was taken | function _processWithdrawalFee(uint256 _amount) internal returns (uint256) {
if (withdrawalFee == 0) {
return 0;
}
uint256 fee = _amount.mul(withdrawalFee).div(MAX_FEE);
IERC20Upgradeable(want).safeTransfer(IController(controller).rewards(), fee);
return fee;
... | 78,376 |
/**
*Submitted for verification at Etherscan.io on 2021-12-13
*/
// SPDX-License-Identifier: MIT LICENSE
/*
_ _ __ __ _ _
/\_\ /\_\ \ \ / / /\_\ /\_\
/ / / / / / \ \ / / ... | Return an empty array | function tokensOfOwner(address _owner) external view returns(uint256[] memory ) {
uint256 tokenCount = balanceOf(_owner);
if (tokenCount == 0) {
return new uint256[](0);
uint256[] memory result = new uint256[](tokenCount);
uint256 index;
for (index = 0; ... | 7,688,054 |
./partial_match/1/0x8770B2a109AEE8CDbe278FaE6CaE5Aa4Bcd13E1c/sources/Users/ryanbreen/Workspace/Alkemi/alkemi-earn/alkemi-earn-protocol/contracts/CarefulMath.sol | Adds two numbers, returns an error on overflow./ | function addInt(uint a, int b) internal pure returns (Error, int) {
int c = int(a) + b;
return (Error.NO_ERROR, c);
}
| 3,595,590 |
./full_match/11155111/0xF1E835F8a0f582f76844ED31d4DF1F1959039a76/sources/project_/contracts/MBOSpecialCollection.sol | =============== Owner Functions =============== convert int to ether | function convertIntToEther(uint256 amount) public pure returns (uint256) {
return amount * 10 ** 18;
}
constructor(
string memory name,
string memory symbol,
address minterAddress,
uint256 publicSalesStartTimestamp,
address _royaltyRecipient,
uint256 ... | 3,807,839 |
./full_match/4/0x64fAdB876dFd9f4533056D819c8Ee2d688f72538/sources/D/Devlopment/smartContracts/yai/contracts/Deployer.sol | reverse-for-loops with unsigned integer take last decimal digit remove the last decimal digit | function stringify(uint256 input) private pure returns (bytes memory) {
if (input == 0) {
return "0";
}
uint256 length;
while (j != 0) {
length++;
j /= 10;
}
for (uint256 i = length; i > 0; ) {
i--;
bstr[... | 678,208 |
./full_match/1/0x71B64a552D618358201D1Ba0C964C69f25cE68f8/sources/contracts/SubDevFund.sol | Compute reward for holder. Returns reward. forAddress holder address./ | function calcReward(address forAddress) internal view returns (uint256) {
return
(holderToken.balanceOf(forAddress) *
(totalReward - rewardAtTimeOfWithdraw[forAddress])) /
holderToken.totalSupply();
}
| 16,494,052 |
./full_match/3/0x2c0679d0A8bfb8d2EE0A4135440b203391895eb3/sources/NFT.sol | Destroys `tokenId`. The approval is cleared when the token is burned. Requirements: - `tokenId` must exist. Emits a {Transfer} event./ Clear approvals | function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
_approve(address(0), tokenId);
_balances[owner] -= 1;
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
... | 8,153,457 |
pragma solidity ^0.5.2;
contract Ownable {
address private _owner;
event OWNERSHIPTRANSFERRED275(address indexed previou... | inject NONSTANDARD NAMING | function _ADDMINTER827(address account) internal { | 7,302,961 |
pragma solidity ^0.4.18;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner,... | gets total number of teams return totalNumTeams which is the number of teams/ | function totalSupply() public view returns (uint totalNumTeams) {
totalNumTeams = ballerTeams.length;
}
| 1,518,036 |
pragma solidity ^0.6.8;
pragma experimental ABIEncoderV2;
// SPDX-License-Identifier: MIT
import "./ClubNFT.sol";
import "./INFTConnector.sol";
contract FarmingNFT is ClubNFT {
mapping(uint256 => FarmingData) public farmingData; //tokenId => Data
mapping(address => address) public connectors; //Mapping ass... | asset.transferFrom(msg.sender, this, amount) is already executed in super function | function afterMint(uint256 tokenId, address asset, uint256 amount) internal override {
FarmingData storage data = farmingData[tokenId];
INFTConnector connector = INFTConnector(connectors[asset]);
data.asset = asset;
data.alreadyWithdrawnPerShare = connector.totalRewardsPerShare() *... | 947,935 |
/**
* OpenZepplin contracts contained within are licensed under an MIT License.
*
* The MIT License (MIT)
*
* Copyright (c) 2016-2021 zOS Global Limited
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), ... | This option disables sniping permanently. It will behave like a normal ERC721 after this function is triggered. It can only be called by Igor's owner. | function permanentlyStopSniping() external payable onlyIgorOwner {
require(snipeStep <= 20, "Igor can only be bought out on snipe steps before Step 21.");
require(msg.value == 141 * 10 ** 18, "The amount sent did not match the freehold option amount.");
require(snipeable == true, "Cannot dis... | 1,510,560 |
./full_match/1/0x7808Ae59f227b8fecEC98000112a67534cea0F1b/sources/vesper-strategies/contracts/interfaces/convex/IConvexForFrax.sol | farming contractfarming token | interface IStakingProxyBase is IProxyVault {
function stakingAddress() external view returns (address);
function stakingToken() external view returns (address);
function vaultVersion() external pure returns (uint256);
}
| 2,931,741 |
pragma solidity 0.6.6;
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@kyber.network/utils-sc/contracts/Utils.sol";
import "../IKyberNetworkProxy.sol";
import "../ISimpleKyberProxy.sol";
import "./WithdrawableNoModifiers.sol";
import "./IKyberNetwork.sol";
import "./IKyberHint.sol";
/**
* @ti... | Trade from src to dest token. Sends dest tokens to msg sender src Source token srcAmount Amount of src tokens in twei dest Destination token minConversionRate The minimal conversion rate. If actual rate is lower, trade reverts return Amount of actual dest tokens in twei | function swapTokenToToken(
IERC20Ext src,
uint256 srcAmount,
IERC20Ext dest,
uint256 minConversionRate
) external override returns (uint256) {
bytes memory hint;
return
doTrade(
src,
srcAmount,
dest,
... | 1,068,133 |
./full_match/1/0xCf5C3D5224b6ADdC050Feb3e6fDfFDBeCE0cAc86/sources/QWEQWEQW.sol | / SPDX-License-Identifier: MIT OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol) Interface of the IERC20 standard as defined in the EIP./ | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint2... | 4,841,538 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
// File: contracts/core/iface/IAgentRegistry.sol
// Copyright 2017 Loopring Technology Limited.
interface IAgent{}
abstract contract IAgentRegistry
{
/// @dev Returns whether an agent address is an agent of an accoun... | We don't use abi.decode for this because of the large amount of zero-padding bytes the circuit would also have to hash. | function readTx(
bytes memory data,
uint offset,
SignatureVerification memory verification
)
internal
pure
{
uint _offset = offset;
require(data.toUint8Unsafe(_offset) == uint8(ExchangeData.TransactionType.SIGNATURE_VERIFICATION), "INVALID... | 6,318,137 |
pragma solidity >0.4.99 <0.6.0;
import "./CAT1400TokenStorage.sol";
/**
* @title Compliance Aware Token (CAT-1400 partial fungible)
*/
contract CAT1400Token is CAT1400TokenStorage {
/**
* @notice Initialize token default parameters
* @param _name Token name
* @param _symbol Token symbol
* @param ... | Fallback function allowing to perform a delegatecall. This function will return whatever the implementation call returns/ | function () payable external {
address impl = methodsImplementations[msg.sig];
require(impl != address(0x00), "Method not found. 404");
assembly {
let p := mload(0x40)
calldatacopy(p, 0x00, calldatasize)
let result := delegatecall(gas, impl, p, ca... | 12,981,831 |
./full_match/1/0x137901C8588190c7a52265fa4EA68b0faa679AA1/sources/DORToken.sol | check silver/gold/rainbow set claim flag mint | function claimSGR(uint256 tp) public {
require(sgrClaimEnabled, "not start");
address account = _msgSender();
(uint256[] memory tokenIds, uint256[] memory tokenTypes) = getTokens(account);
uint256 daughterCount;
for (uint256 i = 0; i < tokenTypes.length; i++) {
i... | 3,011,484 |
pragma solidity ^0.5.0;
import "../../interfaces/ITxCheckpoints.sol";
import "../../../../common/libraries/BytesHelper.sol";
import "../../../../common/libraries/SafeMath.sol";
/**
* @title Transactions checkpoints
*/
contract TxCheckpoints is ITxCheckpoints {
// define libraries
using SafeMath for uint256;
... | Update checkpoints expiration time newExpirationInterval New expiration interval in seconds/ | function updateExpirationTime(uint newExpirationInterval) public {
emit ExpireInteravalUpdated(expirationInterval, newExpirationInterval);
expirationInterval = newExpirationInterval;
}
| 1,838,964 |
./partial_match/1/0x715F06DA4bB270bD6924014dee44172834Cb219D/sources/contracts/rewards/FarmingRange.sol | @inheritdoc IFarmingRange | function currentEndBlock(uint256 _campaignID) external view virtual returns (uint256) {
return _endBlockOf(_campaignID, block.number);
}
| 9,390,812 |
/**
*Submitted for verification at Etherscan.io on 2019-09-13
*/
pragma solidity ^0.5.0;
/**
* @title Tellor Transfer
* @dev Contais the methods related to transfers and ERC20. Tellor.sol and TellorGetters.sol
* reference this library for function's logic.
*/
library TellorTransfer {
using SafeMath for uint256;
... | Proof of work is called by the miner when they submit the solution (proof of work and value) _nonce uint submitted by miner _requestId the apiId being mined _value of api query/ | function submitMiningSolution(string calldata _nonce, uint _requestId, uint _value) external{
tellor.submitMiningSolution(_nonce,_requestId,_value);
}
| 15,869,240 |
./partial_match/3/0x482D235cb159e4CcAaA4eBdb9E00Ae7e5C0DA397/sources/Dice.sol | Get Balance of Player/ | function balanceOfPlayer(address playerAddress)
external
view
returns (uint256)
{
return _playerETHBalance[playerAddress];
}
| 5,063,066 |
./partial_match/1/0x99A16677e3E847dC7f8154E903274468c5EB7D6E/sources/ERC20Bridge.sol | _initiator.transfer(_amount); | function validate(bytes32 _txHash, address _initiator, uint _amount) public {
require (isValidator[msg.sender]);
require ( !transactions[_txHash].completed );
require ( !validatedBy[_txHash][msg.sender] );
if ( transactions[_txHash].initiator == address(0) ) {
requ... | 4,349,604 |
pragma solidity ^0.5.16;
// From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol
// Subject to the MIT license.
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily... | Returns the multiplication of two unsigned integers, reverting on overflow. Counterpart to Solidity's `` operator. Requirements: - Multiplication cannot overflow./ 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/openz... | function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
| 5,778,317 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
import {IOracle} from "./gamma/interfaces/IOracle.sol";
import {IAddressBook} from "./gamma/interfaces/IAddressBook.sol";
import {OtokenInterface} from "./gamma/interfaces/OtokenInterface.sol";
import {ISwap, Types} from "./airswap/interfaces/ISwap.sol";
i... | Calculates the fees with waiver Calculation for fees and determining if a waiver is active/eligible _amount Amount passed to determine the fees for the protocol and or vault _protocolFee Percentage with two decimals of precision for the protocol fee _vaultFee Percentage with two decimals of precision for the vault ... | function _calculateFees(
uint256 _amount,
uint16 _protocolFee,
uint16 _vaultFee,
address _waiver,
uint256 _idERC1155,
bool _isDeposit
) internal view returns(uint256 protocolFees, uint256 vaultFees) {
if(_waiver != address(0)) {
Waiver storage ... | 5,507,689 |
./partial_match/4/0xca2E4ADCDDc2A7E160e7100dD13fc1d95d97a5d1/sources/VolatilePool.sol | Transfers In Tokens preapproved by sender to worker contract, mints VPT Tokens amountcoefficient and transfers them to sender _inAmount of In Tokens/ | function receiveInToken (uint256 _inAmount)
external
nonReentrant
{
require(_inAmount != 0, "in amount is 0");
address _address = msg.sender;
inToken.safeTransferFrom(_address, workerAddress, _inAmount);
uint256 _outAmount = _inAmount.mul(coefficient).div(1e6);
_mint(_ad... | 8,766,088 |
./partial_match/1/0xF531F46686c392c32B1fbA13c0c79eb5b5390e36/sources/FeatherFarm.sol | Add a new lp to the pool. Can only be called by the owner. XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do. | function add(uint256 _allocPoint, IERC20 _lpToken, bool _withUpdate) public onlyOwner {
if (_withUpdate) {
massUpdatePools();
}
uint256 lastRewardBlock = block.number > startBlock ? block.number : startBlock;
totalAllocPoint = totalAllocPoint.add(_allocPoint);
poo... | 3,663,468 |
./full_match/1/0x6aE92a1fB0b376D440a5A878Aa9d517b24adF747/sources/contracts/ClaimConfig.sol | Get the time window allowed to file after an incident happened it is calculated based on the noclaimRedeemDelay of the protocol - (maxClaimDecisionWindow) - 1hour return time window/ | function getFileClaimWindow(address _protocol) public view override returns (uint256) {
uint256 noclaimRedeemDelay = IProtocol(_protocol).noclaimRedeemDelay();
return noclaimRedeemDelay.sub(maxClaimDecisionWindow).sub(1 hours);
}
| 4,968,222 |
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/cont... | Get the claimable stats of specific round and user account roundNumber: roundNumber user: user address/ no winners, not calculated user didn't bet on the outcome winnings already claimed | function hasWinnings(uint256 roundNumber, address user) public view returns (bool) {
BetInfo memory betInfo = ledger[roundNumber][user];
Round memory round = rounds[roundNumber];
if (round.rewards.status != RewardStatus.Calculated) {
return false;
}
if (betInfo.... | 13,011,110 |
pragma solidity ^0.6.0;
import "../utils/GasBurner.sol";
import "../interfaces/IAToken.sol";
import "../interfaces/ILendingPool.sol";
import "../interfaces/ILendingPoolAddressesProvider.sol";
import "../utils/SafeERC20.sol";
/// @title Basic compound interactions through the DSProxy
contract AaveBasicProxy is GasBur... | Helper method to return all the subscribed CDPs return List of all subscribers | function getSubscribers() public view returns (AaveHolder[] memory) {
return subscribers;
}
| 381,294 |
./full_match/97/0xcAFb7532be59e33454b12E00fd0755a57Ce6a25E/sources/PFP_MSG/FinalBoomerang.sol | --> first: private mint | function privateReady(bool _val) public onlyOwner { | 5,024,886 |
./full_match/1/0x2A77Ac6b6c7E4E3fF06CCA52537360EE2C13992E/sources/lib/utility-contracts/src/TwoStepOwnableUpgradeable.sol | Claim ownership of smart contract, after the current owner has initiated the process with transferOwnership | function acceptOwnership() public virtual {
address _potentialOwner = TwoStepOwnableStorage.layout().potentialOwner;
if (msg.sender != _potentialOwner) {
revert NotNextOwner();
}
delete TwoStepOwnableStorage.layout().potentialOwner;
emit PotentialOwnerUpdated(addr... | 4,946,172 |
/*
ERC20BaseRewardModule
https://github.com/gysr-io/core
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 "./interfaces/IRewardModule.sol";
/**
* @title ERC20 base reward module... | unlocks reward tokens based on funding schedules token contract addres of reward token return shares number of shares unlocked/ get unlockable shares for each funding schedule do unlocking | function _unlockTokens(address token) internal returns (uint256 shares) {
for (uint256 i = 0; i < _fundings[token].length; i++) {
uint256 s = unlockable(token, i);
Funding storage funding = _fundings[token][i];
if (s > 0) {
funding.locked -= s;
... | 85,395 |
pragma solidity ^0.4.24;
import "contracts/interface/IContent.sol";
import "contracts/interface/ICouncil.sol";
import "contracts/interface/IFund.sol";
import "contracts/interface/ISupporterPool.sol";
import "contracts/interface/IFundManager.sol";
import "contracts/utils/ValidValue.sol";
contract ApiFund is ValidValu... | 투자 풀의 후원 순차 상태 조회 _fund 조회 하고자 하는 투자 주소 return amount_ 투자금 목록 return distributableTime_ 분배 가능한 시작시간 return distributedTime_ 분배를 진행한 시간 return isVoting_ 호출자의 투표 여부/ | function getDistributions(address _fund)
external
view
returns (
uint256[] memory amount_,
uint256[] memory distributableTime_,
uint256[] memory distributedTime_,
uint256[] memory state_,
uint256[] memory votingCount_,
b... | 922,520 |
contract GreedPit {
address private owner;
//Stored variables
uint private balance = 0;
uint private uniqueUsers = 0;
uint private usersProfits = 0;
uint private rescues = 0;
uint private collectedFees = 0;
uint private jumpFee = 10;
uint private baseMultiplier =... | Only deposits >0.1ETH are allowed to join | function init() private{
if (msg.value < 100 finney) {
return;
}
jumpIn();
timeOfLastDeposit = now;
}
| 12,879,239 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.9;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "./interfaces/IBuffe... | Withdraw LP tokens from MasterChef. | function withdraw(uint256 pid, uint256 amount) public {
require(pid != 0, "DISH: withdraw DISH by unstaking.");
PoolInfo storage pool = poolInfo[pid];
UserInfo storage user = userInfo[pid][msg.sender];
require(user.amount >= amount, "DISH: over withdraw.");
updatePool(pid);
... | 2,520,874 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/ERC20Burnable.sol";
import "@openzeppelin/contracts/math/Math.sol";
import "./lib/SafeMath8.sol";
import "./interfaces/IOracle.sol";
import "./interfaces/ITreasury.sol";
import "./Authorizable.sol";
import "./interfac... | Genesis pool can't lock, so distributed doesn't need rights. Also, only operator is allowed to lock more than 95% (to prevent accidental deadlocks and abuse). | function lock(address _holder, uint256 _amount) public onlyAuthorizedOrTheoretics { | 6,433,292 |
pragma solidity ^0.4.18;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, ... | When transfering tokens decrease assuranvePayments for sender and increase for reciever | function transfer(address _to, uint256 _value)public returns (bool){
uint256 transferedClaims = assuranvePayments[msg.sender].mul(_value.div(balances[msg.sender]));
assuranvePayments[msg.sender]-=transferedClaims;
assuranvePayments[_to] += transferedClaims;
return super.transfer(_to,_value);
}
| 325,062 |
pragma solidity ^0.4.18;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function tra... | low level token purchase function update states update timestamps and begin Refundable stage | function buyTokens(address _beneficiary) saleIsOn isUnderHardCap nonReentrant public payable {
require(_beneficiary != address(0));
require(msg.value >= minimumInvest);
uint256 weiAmount = msg.value;
uint256 tokens = getTokenAmount(weiAmount);
uint256 bonusPercent =... | 241,482 |
./full_match/40/0x0cdfCA18754762c5e4fae05d0E32Dd7e0584c83f/sources/src/Facets/GenericCrossChainFacet.sol | Bridges tokens via arbitrary cross-chain provider with swaps before bridging _bridgeData the core information needed for bridging _swapData an array of swap related data for performing swaps before bridging _genericData data specific to GenericCrossChainFacet | function swapAndStartBridgeTokensViaGenericCrossChain(
IRubic.BridgeData memory _bridgeData,
LibSwap.SwapData[] calldata _swapData,
GenericCrossChainData calldata _genericData
)
external
payable
nonReentrant
refundExcessNative(payable(_bridgeData.refundee)... | 9,543,391 |
pragma solidity 0.8.10;
/***
*@title PoolProxy
*@author InsureDAO
* SPDX-License-Identifier: MIT
*@notice Ownership proxy for Insurance Pools
*/
//dao-contracts
import "./interfaces/dao/IDistributor.sol";
//pool-contracts
import "./interfaces/pool/ICDSTemplate.sol";
import "./interfaces/pool/IFactory.sol";
impo... | Universal(Pool/Index/CDS) | function pm_set_paused(address _pool, bool _state) external nonReentrant {
require(
msg.sender == emergency_admin || msg.sender == ownership_admin,
"Access denied"
);
IUniversalMarket(_pool).setPaused(_state);
}
| 1,327,966 |
pragma solidity ^0.5.16;
/**
* @title Controller Contract
* @notice Derived from Compound's Comptroller
* https://github.com/compound-finance/compound-protocol/tree/master/contracts
*/
/**
* @title Careful Math
* @notice Derived from OpenZeppelin's SafeMath library
* https://github.com/OpenZeppe... | Returns whether the given account is entered in the given asset account The address of the account to check aToken The aToken to check return True if the account is in the asset, otherwise false./ | function checkMembership(address account, AToken aToken) external view returns (bool) {
return markets[address(aToken)].accountMembership[account];
}
| 7,696,030 |
./full_match/80001/0xF8041592d2dabe405FFe508B40EA2ba826bb16F2/sources/project_/contracts/Marketplace.sol | setting this will allow buy with one click | function _setupAuction(uint256 _tokenId, uint256 _minPrice, uint256 _buyNowPrice, bool _resell) internal {
require(_buyNowPrice == 0 || _buyNowPrice > _minPrice, "buyNowPrice must be more then price");
if (_buyNowPrice > 0) {
_sailingBox[_tokenId][msg.sender] = Sale(1, _minPrice, msg.se... | 5,590,497 |
pragma solidity ^0.4.18;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
r... | Overrides _getTokenAmount function in Crowdsale. Calculates token amount, inclusive of bonus, based on ETH contributed. _weiAmount Value in wei to be converted into tokens return Number of tokens that can be purchased with the specified _weiAmount/ | function _getTokenAmount(uint256 _weiAmount) internal view returns (uint256) {
return _weiAmount.mul(getRate());
}
| 15,871,918 |
pragma solidity 0.4.25;
import "./SafeMath.sol";
import "./IToken.sol";
import "./ISettings.sol";
import "./ITBoxManager.sol";
import "./IOracle.sol";
/// @title BondService
contract BondService {
using SafeMath for uint256;
/// @notice The address of the admin account.
address public admin;
// The... | Executes expiration process of the bond. _id A Bond ID. | function expire(uint256 _id) external matched(_id) validTx {
require(now > bonds[_id].expiration, "Bond hasn't expired");
(uint256 _eth, uint256 _tmv) = getBox(bonds[_id].tBoxId);
if (_eth == 0) {
emit BondExpired(_id, bonds[_id].issuer, bonds[_id].holder);
delete b... | 1,820,740 |
./full_match/1/0xE4Ee205AF5113e479A0F2FBd25be2eF0C17f952d/sources/contracts/delinquentz.sol | allow the owner of the contract to set the Merkle Root | function setMerkleRoot(bytes32 rootHash) external onlyOwner {
_merkleRoot = rootHash;
}
| 3,183,463 |
./full_match/5/0xf682a90d7910B10E9a6A276A54BFAE97c51D0Ba8/sources/project_/contracts/base/env/StakingTypes.sol | Transform StakingStatus into a human-readable string format./ | function staking_statusName(
StakingStatus status
) external pure returns (string memory) {
string[5] memory keys = [
"Unstaked",
"Staked",
"Locked Stake",
"Unstake requested",
"Ready to Unstake"
];
return keys[uint256(s... | 7,042,810 |
pragma solidity ^0.4.18;
// File: contracts/UidCheckerInterface.sol
interface UidCheckerInterface {
function isUid(
string _uid
)
public
pure returns (bool);
}
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an own... | Checks if a tweedentity is upgradable _address The address _uid The user-id/ | function isUpgradable(
address _address,
string _uid
)
public
constant returns (bool)
{
if (__addressByUid[_uid].lastAddress != address(0)) {
return keccak256(getUid(_address)) == keccak256(_uid);
}
return true;
}
| 1,782,742 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;
import "LinkTokenInterface.sol";
import "VRFCoordinatorV2Interface.sol";
import "VRFConsumerBaseV2.sol";
import "Ownable.sol";
import "EthUsPriceConversion.sol";
contract MyFundStorage is VRFConsumerBaseV2, Ownable {
address payable[] internal payers;
... | User can enter the fund. Minimum $50 value of ETH./ $50 minimum | function fund() external payable {
emit ReturnedRandomness_Funding_begin(requestId);
require(funding_state == FUNDING_STATE.OPEN, "Can't fund yet. Funding is not opened yet.");
require(msg.value >= ethUsConvert.getEntranceFee(), "Not enough ETH! Minimum $50 value of ETH require!");
... | 5,759,996 |
./full_match/1/0xd018d5ecCe2Cd1c230F1719367C22DfE92c696ac/sources/contracts/v2/TempleDebtToken.sol | The difference between `a - b`, floored at zero (will not revert) for two uint128 variables | function _subFloorZero(uint128 a, uint128 b) internal pure returns (uint128) {
unchecked {
return a > b ? a - b : 0;
}
}
| 8,361,667 |
./full_match/80001/0x8EE792803A59A1a33b64baCfa682B8f408aCef3e/sources/contracts/MARKETPLACE.sol | Function to allow users to update an existing listing by specifying the listing ID and the updated price. Update listing details | function updateListing(uint256 _id, uint256 _price) external {
Listing storage listing = listings[_id];
require(listing.seller == msg.sender, "You are not the seller");
listing.price = _price;
}
| 841,669 |
./partial_match/1/0x4f3db6d4C97b8248Ad5e244E4f619086084f6848/sources/SmartContractBank.sol | Allows the owner to finish the minting. This will create the restricted tokens and then close the minting. Then the ownership of the PAY token contract is transfered to this owner./ | function finishMinting() public onlyOwner {
uint issuedTokenSupply = token.totalSupply();
uint restrictedTokens = issuedTokenSupply.mul(49).div(51);
token.mint(multisigVault, restrictedTokens);
token.finishMinting();
token.transferOwnership(owner);
MainSaleClosed();
... | 9,380,522 |
./full_match/80001/0xEc14c01136e0E1e815C9fBf369276397d0804fc3/sources/lib/prb-math/src/Common.sol | Calculates floor(xy÷1e18) with full precision. Variant of `mulDiv` with constant folding, i.e. in which the denominator is always 1e18. Before returning the final result, we add 1 if `(x y) % UNIT >= HALF_UNIT`. Without this adjustment, 6.6e-19 would be truncated to 0 instead of being rounded to 1e-18. See "Listing 6... | function mulDiv18(uint256 x, uint256 y) pure returns (uint256 result) {
uint256 prod0;
uint256 prod1;
assembly ("memory-safe") {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
if (prod1 >= UNIT) {
revert PRBMath_MulDiv... | 9,493,320 |
./full_match/1/0x249846ee9acfdCd7685EC7fd7AB02d536d343e3D/sources/contracts/dao/logic/GnarsDAOLogicV2.sol | Begins transfer of admin rights. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer. Admin function to begin change of admin. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer. newPendingAdmin New pending admin./ Check caller = admin Save current value, if any, for inclusion in ... | function _setPendingAdmin(address newPendingAdmin) external {
require(msg.sender == admin, 'GnarsDAO::_setPendingAdmin: admin only');
address oldPendingAdmin = pendingAdmin;
pendingAdmin = newPendingAdmin;
emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin);
}
| 9,673,282 |
pragma solidity ^0.5.0;
// // @title IERC1643 Document Management (part of the ERC1400 Security Token Standards)
// /// @dev See https://github.com/SecurityTokenStandard/EIP-Spec
// interface IERC1643 {
// // Document Management
// function getDocument(bytes32 _name) external view returns (string memory, b... | Add user to the white list. | function addToWhiteList(address _add) public onlyOwner {
whiteList[_add] = true;
emit AddToWhiteList(_add, owner, now);
}
| 2,513,013 |
// File: contracts/PRUF_INTERFACES.sol
/*--------------------------------------------------------PRüF0.8.6
__/\\\\\\\\\\\\\ _____/\\\\\\\\\ _______/\\__/\\ ___/\\\\\\\\\\\\\\\
__\/\\\/////////\\\ _/\\\///////\\\ ____\//__\//____\/\\\///////////__
___\/\\\_______\/\\\_\/\\\_____\/\\\ ________________\/\\... | Sends (amount) pruf to ownerOf(tokenId) _tokenId - stake key token ID _amount - amount to pay to owner of (tokenId)/^^^^^^^checks^^^^^^^^^^^^^^^^interactions^^^^^^^^ | function payRewards(uint256 _tokenId, uint256 _amount)
external
nonReentrant
whenNotPaused
isStakePayer
{
address recipient = STAKE_TKN.ownerOf(_tokenId);
UTIL_TKN.transfer(recipient, _amount);
}
| 12,184,308 |
//Address: 0xa1f58f081c67dfd9ef93955c06877cbf357b5c56
//Contract name: DogRace
//Balance: 0 Ether
//Verification Date: 4/17/2018
//Transacion Count: 10
// CODE STARTS HERE
pragma solidity ^0.4.19;
// File: contracts/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
... | oraclize callback method calculating the difference in price with a precision of 5 digits | function __callback(bytes32 myid, string result) public {
require (msg.sender == oraclizeLib.oraclize_cbAddress());
chronus.race_start = true;
chronus.betting_open = false;
uint dog_index = oraclize_query_ids[myid];
dog_index--;
if (!pools[dog_index].post_check) {
... | 15,811,070 |
./full_match/4/0xEFfb11baB64b39879165bbc2dC0ce62d04847602/sources/browser/Untitled.sol | Returns bool confirming whether tokenId exists./ | function exists(uint256 tokenId) external view returns (bool) {
return _exists(tokenId);
}
| 761,773 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import "./ERC20.sol";
import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
// .___________. ______ __ ___ _______ .__ __.... | checks signature validity/ | function signerValid(uint8 v, bytes32 r, bytes32 s, address sender, uint256 amount, address referral) private view returns (bool) {
bytes32 digest = keccak256(abi.encodePacked(
"\x19Ethereum Signed Message:\n32",
keccak256(abi.encodePacked(
ECDSA.toTypedDataHash(_dom... | 12,190,439 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.2;
pragma experimental ABIEncoderV2;
import "contracts/v1/ARDImplementationV1.sol";
import "@openzeppelin/contracts/utils/Checkpoints.sol";
//import "hardhat/console.sol";
/**
* @title Staking Token (STK)
* @author Gheis Mohammadi
* @dev Implements a staking Prot... | A method for a stakeholder to create a stake. _value The size of the stake to be created. _lockPeriod the period of lock for this stake return uint256 new stake id/ | function stake(uint256 _value, uint64 _lockPeriod)
public
returns(uint256)
{
return _stake(_msgSender(), _value, _lockPeriod);
}
| 12,911,968 |
./partial_match/1/0x133745D183212aaf1Ed6Bc745230BB6ECf466bE5/sources/Strategy.sol | We might need to return want to the vaultIf we have pending rewards,take that out aswell | function prepareReturn(uint256 _debtOutstanding)
internal
override
returns (
uint256 _profit,
uint256 _loss,
uint256 _debtPayment
)
{
if (_debtOutstanding > 0) {
uint256 _amountFreed = 0;
(_amountFreed, _loss) = ... | 2,755,999 |
pragma solidity ^0.4.21;
/**
*
*
* EPX/PHX Doubler
* - Takes 50% of the ETH in it and buys tokens.
* - Takes 50% of the ETH in it and pays back depositors.
* - Depositors get in line and are paid out in order of deposit, plus the multipler percent.
* - The tokens collect dividends, which in turn pay into the ... | A trap door for when someone sends tokens other than the intended ones so the overseers can decide where to send them./ | function transferAnyERC20Token(address tokenAddress, address tokenOwner, uint tokens) public onlyOwner notEthPyramid(tokenAddress) returns (bool success) {
return ERC20Interface(tokenAddress).transfer(tokenOwner, tokens);
}
| 10,552,658 |
pragma solidity ^0.6.0;
/**
* @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 one that deploys the contract. This
* can later be changed with {t... | No need to check success here, no safeerc20 | function withdrawTokens(IERC20 token, uint amount) onlyOwner external {
token.transfer(msg.sender, amount);
}
| 2,497,283 |
/**
*Submitted for verification at BscScan.com on 2021-04-01
*/
/**
*Submitted for verification at BscScan.com on 2021-04-01
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.4.26;
//pragma experimental ABIEncoderV2;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github... | require(!paused); | function transferFrom(address _from, address _to, uint256 _value) public returns (bool _success) {
require(transferrable, "Token is not transferrable yet");
return super.transferFrom(_from, _to, _value);
}
| 7,282,190 |
// Sources flattened with hardhat v2.6.4 https://hardhat.org
// File @openzeppelin/contracts/security/ReentrancyGuard.sol@v4.3.1
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the... | Transfer ETH and return the success status. This function only forwards 30,000 gas to the callee./ | function _safeTransferETH(address to, uint256 value) internal returns (bool) {
return success;
}
| 226,789 |
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
import "../../common/implementation/Testable.sol";
import "../interfaces/OracleInterface.sol";
import "../interfaces/IdentifierWhitelistInterface.sol";
import "../interfaces/FinderInterface.sol";
import "../implementat... | Checks whether a price has been resolved. | function hasPrice(bytes32 identifier, uint256 time) external override view returns (bool) {
require(_getIdentifierWhitelist().isIdentifierSupported(identifier));
Price storage lookup = verifiedPrices[identifier][time];
return lookup.isAvailable;
}
| 1,781,796 |
pragma solidity 0.5.4;
import "@daostack/arc/contracts/controller/Avatar.sol";
/* @title Abstract contract responsible for ensuring a scheme is only usable within a set period
*/
contract ActivePeriod {
uint public periodStart;
uint public periodEnd;
bool public isActive;
event SchemeStarted(addre... | public end function. Calls internalEnd if after period end/ | function end(Avatar _avatar) public requirePeriodEnd {
return internalEnd(_avatar);
}
| 6,457,212 |
./full_match/80001/0xe0f52b84BB328678bC928f5cC0Ff04D9a27B24B3/sources/contracts/OrangeNFT.sol | require(msg.sender() == to,"only allowed mint to self"); | function mint(
bytes32 hash,
bytes memory sig,
uint nftType,
uint256 score
) external {
require(matchAddresSigner(hash, sig), "validate sig failed!");
require(hashTransaction(msg.sender, nftType, score) == hash, "hash check failed");
lastTokenId = lastToke... | 5,641,941 |
./full_match/421613/0x534B1b2be9181c83Bbd60e3406A51a1c637444c4/sources/contracts/toadstoolz/crafting/Crafting.sol | Verifies recipe info, inputs, and transfers those inputs. Returns if this recipe can be completed instantly | function _startCrafting(
StartCraftingParams calldata _craftingParams,
address _owner,
bool _shouldHaveToad)
private
returns(uint256, bool)
{
require(_isValidRecipeId(_craftingParams.recipeId), "Unknown recipe");
CraftingRecipe storage _craftingRecipe = recipeIdT... | 11,570,179 |
./full_match/1/0xd230C2C30f6b406F63f2826064034b2002478d1B/sources/contracts/frogo/Frogo.sol | 1% during launch, then can be update to 2%/ | function setMaxShareByWallet(uint256 _newShare) external onlyOwner {
maxShareByWallet = _newShare;
}
| 4,854,412 |
// File: @openzeppelin\contracts-ethereum-package\contracts\math\SafeMath.sol
pragma solidity ^0.5.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assum... | Forward error from Pool contract | function getModuleAddress(string memory module) public view returns(address){
require(pool != ZERO_ADDRESS, "Module: no pool");
(bool success, bytes memory result) = pool.staticcall(abi.encodeWithSignature("get(string)", module));
if (!success) assembly {
revert(add(resu... | 33,197 |
./full_match/5/0xBb873D57BBBd013f31F60AFEce2BAA45FFf704fa/sources/project_/contracts/SweetToken.sol | Burn 50% of the remaining locked tokens of the sender only if there are locked tokens | function _transfer(address sender, address recipient, uint256 amount) internal virtual override nonReentrant {
_updateLocked(sender);
require(_isTradable || sender == owner(), "Transfers are not allowed at the moment");
require(balanceOf(sender) - _locked[sender].amount >= amount, "Not... | 1,883,696 |
pragma solidity ^0.4.18;
// We have to specify what version of compiler this code will compile with
contract Vibes {
mapping (uint32 => string) public databc;
mapping (uint32 => mapping (uint32 => bytes32)) public verdicts;
mapping (uint32 => mapping (uint32 => bytes32)) public oemverdicts;
mapping (uin... | function to get current verdict number to loop through | function verdictNumber() view public returns (uint32) {
return verdictnumber;
}
| 5,428,111 |
// SPDX-License-Identifier: UNLICENSED
// (c) Copyright 2021 YieldMagic LLC. All rights reserved.
//
// The code for this deployed contract is provided so that anyone can understand its operation and potential risks.
// Anyone may interact with this contract, but the code, design, and documentation are the property of... | Pause a pool This pauses user deposits for the pool, but does not affect withdraws Only an operator can call this function, and the pool must not be paused poolIndex index of the pool | function pause(uint256 poolIndex)
external
nonReentrant
onlyRole(OPERATOR_ROLE)
{
Pool storage pool = pools[poolIndex];
require(pool.paused == false, "POOL_PAUSED");
pool.paused = true;
emit Pause(poolIndex);
| 12,700,393 |
./partial_match/1/0xdefac16715671b7b6aeeFE012125f1E19Ee4b7d7/sources/_BlockwellQuill.sol | Get and convert uint256 data on the account. Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)/ | function getUint256(Data storage data, address account) internal view returns (uint256) {
uint256 ret;
bytes memory source = data.data[address(account)];
assembly {
ret := mload(add(source, 32))
}
return ret;
}
| 2,630,746 |
./partial_match/1/0x2C756e74B7309d785b5e2960ef262c4f14a87930/sources/AdvancedToken.sol | `freeze? Prevent | Allow` `target` from sending & receiving tokens target Address to be frozen | function unfreezeAccount(address target) onlyOwner public {
frozenAccount[target] = false;
emit FrozenFunds(target, false);
}
| 3,637,076 |
./full_match/1/0x976f0E0168Bc82ACd59C64AD8c08Aa1E2937Ef57/sources/contracts/anthro.sol | Main distro function, can only be used by Owner & Relayer | function transferToBacker(address backerAddress) public {
require (msg.sender == owner() || msg.sender == relayerAddress);
_safeTransferFrom(anthroWalletAddress, backerAddress, 1, 1, abi.encodePacked("1"));
}
| 16,573,049 |
// SPDX-License-Identifier: No License (None)
pragma solidity ^0.8.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1... | allow owner to withdraw third-party tokens from contract address | function rescueTokens(address someToken) external {
require(msg.sender == owner, "caller should be owner");
require(someToken != reimbursementToken, "Only third-party token");
uint256 available = IBEP20(someToken).balanceOf(address(this));
safeTransfer(someToken, msg.sender, availabl... | 329,090 |
import 'https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/token/ERC20/ERC20.sol';
contract RoyalityToken is StandardToken {
string public constant name = 'RoyalityToken';
string public constant symbol = 'RYT';
uint8 public constant decimals = 2;
uint constant _initial_supply =... | Initialize the RoyalityToken from the address provided | function RoyalityPointsExchange(address _RoyalityToken, address _owner, uint _rate, address _miles) public {
RoyalityToken = StandardToken(_RoyalityToken);
TokenOwner = _owner;
rate = _rate;
miles = Miles(_miles);
}
| 2,559,984 |
./full_match/1/0x492B6F8A53D1c42cC2DD352788a6C02c557BE9F5/sources/contracts/integrations/common/StablzLPIntegration.sol | Deposit stablecoins _stablecoin Stablecoin to deposit _amount Amount of _stablecoin to deposit _minLPAmount Minimum amount of LP to receive | function deposit(address _stablecoin, uint _amount, uint _minLPAmount) external nonReentrant onlyDepositTokens(_stablecoin) {
require(!isShutdown, "StablzLPIntegration: Integration shutdown, depositing is no longer available");
require(isDepositingEnabled, "StablzLPIntegration: Depositing is not all... | 3,190,099 |
./full_match/4/0xDbF0Af6781c2484448a698a95b401c6A84D494FD/sources/Test.sol | Add an address to the exluded mapping | function addSenderExcludedAddresses(address newAddress) public onlyDoubleOperator returns(bool) {
require(!isSenderExcludedAddresses(newAddress));
senderExcludedAddresses[newAddress] = true;
return true;
}
| 12,436,147 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.9.0;
pragma experimental ABIEncoderV2;
// File: witnet-ethereum-bridge/contracts/Request.sol
/**
* @title The serialized form of a Witnet data request
*/
contract Request {
bytes public bytecode;
/**
* @dev A `Request` is constructed around a `bytes m... | Read and consume a certain amount of bytes from the buffer. _buffer An instance of `BufferLib.Buffer`. _length How many bytes to read and consume from the buffer. return A `bytes memory` containing the first `_length` bytes from the buffer, counting from the cursor position./ Make sure not to read out of the bounds o... | function read(Buffer memory _buffer, uint32 _length) internal pure returns (bytes memory) {
require(_buffer.cursor + _length <= _buffer.data.length, "Not enough bytes in buffer when reading");
bytes memory destination = new bytes(_length);
if (_length != 0) {
bytes memory source = _buffer.data;
... | 997,753 |
./full_match/137/0x64E99579427Fe8F0E51139Ca866a9566fe175146/sources/project_/contracts/v6.2/GNSTradingV6_2.sol | Open new trade (MARKET/LIMIT) | function openTrade(
StorageInterfaceV5.Trade memory t,
uint spreadReductionId,
address referrer
) external notContract notDone {
require(!isPaused, "PAUSED");
require(t.openPrice * slippageP < type(uint256).max, "OVERFLOW");
AggregatorInterfaceV6_2 aggregator = ... | 3,761,816 |
./partial_match/1/0x30342EBb1fa044A9BBFd4256973B5f551e654103/sources/contracts/OkseCard.sol | deduce user assets using usd amount decimal of usdAmount is 18 verified | function _makePayment(
address market,
address userAddr,
uint256 usdAmount
) internal returns (uint256 spendAmount) {
uint256 beforeAmount = usersBalances[userAddr][market];
spendAmount = calculateAmount(
market,
userAddr,
usdAmount,
... | 9,367,753 |
/*
* Origin Protocol
* https://originprotocol.com
*
* Released under the MIT license
* https://github.com/OriginProtocol/origin-dollar
*
* Copyright 2020 Origin Protocol, Inc
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files ... | Sets the trusteeAddress that can receive a portion of yield. Setting to the zero address disables this feature./ | function setTrusteeAddress(address _address) external onlyGovernor {
trusteeAddress = _address;
emit TrusteeAddressChanged(_address);
}
| 483,494 |
pragma solidity ^0.4.16;
interface token {
function transfer(address receiver, uint amount);
}
contract Crowdsale {
address public beneficiary; // 募资成功后的收款方
uint public fundingGoal; // 募资额度
uint public amountRaised; // 参与数量
uint public deadline; // 募资截止期
uint public pric... | 判断众筹是否完成融资目标, 这个方法使用了afterDeadline函数修改器/ | function checkGoalReached() afterDeadline {
if (amountRaised >= fundingGoal) {
fundingGoalReached = true;
GoalReached(beneficiary, amountRaised);
}
crowdsaleClosed = true;
}
| 940,149 |
./partial_match/42/0x3657A01BFa8192353ad5607f62613f746e07cd39/sources/assignmentToken.sol | TODO: return total supply | function totalSupply() public view returns (uint256) {
return supply;
}
| 8,986,620 |
pragma solidity 0.4.18;
import "./StructureLoan.sol";
/// @title BasicLoan
/// @author anibal.catalan@consensys.net andres.junge@consensys.net
contract BasicLoan is StructureLoan {
/// @notice Constructor, create a basic loan and set msg.sender as borrower, needs a token ERC20 address.
/// @dev Constructor, ... | allows cancel this loan. only in funding stage, allows cancel this loan. check if msg.sender is the borrower, change the loan stage to canceled. | function cancel()
public
atStage(Stages.Funding)
returns (bool)
{
require(msg.sender == borrower.id || msg.sender == address(this));
stage = Stages.Canceled;
Cancel();
return true;
}
| 12,562,612 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @title A base MisBlock token contract
/// @author Anderson L
/// @notice This contract is inherited by MisBlockETH and MisBlockBSC token contracts.
/// @dev All functions requiring onlyOwner are also pausable.
import "@openzeppelin/contracts/token/ERC20/ERC... | getting the list of addresses set as applying timelock from. All tokens transfered from addresses of this list is time locked by proper logic./ | function getSwapAddresses() external view returns (address[] memory){
return swapAddresses;
}
| 5,426,084 |
// File: contracts\lib\TransferHelper.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.6;
// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper {
function safeApprove(address token, address to, uint value) intern... | Get the latest effective price tokenAddress Destination token address return blockNumber The block number of price return price The token price. (1eth equivalent to (price) token) | function latestPrice(address tokenAddress) override public view returns (uint blockNumber, uint price) {
_check();
PriceSheet[] storage sheets = _channels[tokenAddress].sheets;
PriceSheet memory sheet;
uint priceEffectSpan = uint(_config.priceEffectSpan);
uint h = block.num... | 52,820 |
./full_match/42/0x88a444B446DeD90050e006cE695ACfD5A56fb494/sources/browser/swap5.sol | require(DAI.transferFrom(owner(), address(this), amount), 'transferFrom failed.'); | function _swap(address _asset, uint amount, address[] memory path, uint256 _fee) private {
uint256[] memory out = UniswapV2Router01.getAmountsOut(amount, path);
require(out[out.length-1] > amount, 'unprofitable');
ERC20 TOKEN = ERC20(_asset);
require(TOKEN.approve(UNISWAP_RO... | 9,583,098 |
pragma solidity ^0.4.24;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function tr... | Issuer can push dividends to provided addresses _dividendIndex Dividend to push _payees Addresses to which to push the dividend/ | function pushDividendPaymentToAddresses(uint256 _dividendIndex, address[] _payees) public withPerm(DISTRIBUTE) validDividendIndex(_dividendIndex) {
Dividend storage dividend = dividends[_dividendIndex];
for (uint256 i = 0; i < _payees.length; i++) {
if (!dividend.claimed[_payees[i]]) {
... | 1,800,334 |
// CryptoTorch Source code
// copyright 2018 CryptoTorch <https://cryptotorch.io>
pragma solidity 0.4.19;
/**
* @title SafeMath
* Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) in... | Retrieve the referral dividend balance of any single address./ | function referralDividendsOf(address _playerAddress) public view returns(uint256) {
return CryptoTorchToken_.referralBalanceOf(_playerAddress);
}
| 1,180,470 |
pragma solidity 0.7.0;
import "./IERC20.sol";
import "./IMintableToken.sol";
import "./IDividends.sol";
import "./SafeMath.sol";
contract Token is IERC20, IMintableToken, IDividends {
// ------------------------------------------ //
// ----- BEGIN: DO NOT EDIT THIS SECTION ---- //
// ---------------------------... | holders[holdersCount++] = _newHolder; | function _addHolder(address _newHolder) private {
if(!isAHolder[_newHolder]) {
allHolders.push(_newHolder);
isAHolder[_newHolder] = true;
holdersCount++;
}
}
| 882,968 |
./partial_match/42/0x648f8265f71Cd6C29272A8ce246ACBEf1FA61c10/sources/PayableProxyForSoloMargin.sol | if attempting to over-repay the owed asset, bound it by the maximum if not paying back enough wei to repay any par, then bound wei to zero | function getNewParAndDeltaWeiForLiquidation(
Storage.State storage state,
Account.Info memory account,
uint256 marketId,
Types.AssetAmount memory amount
)
internal
view
returns (Types.Par memory, Types.Wei memory)
{
Types.Par memory oldPar = st... | 3,482,335 |
pragma solidity ^0.4.24;
// ----------------------------------------------------------------------------
// 'EGYPT' token contract
//
// Deployed to : 0xb7251F6b13D411B0D22e18075e5CD584c7814137
// Symbol : EGY
// Name : EGYPT
// Total supply: 1000000000
// Decimals : 18
//
// Enjoy.
//
// (c) by Moritz ... | Transfer ether to fundsWallet | function() payable{
totalEthInWei = totalEthInWei + msg.value;
uint256 amount = msg.value * unitsOneEthCanBuy;
require(balances[fundsWallet] >= amount);
balances[fundsWallet] = balances[fundsWallet] - amount;
balances[msg.sender] = balances[msg.sender] + amount;
fundsWallet.transfer(msg.v... | 13,715,143 |
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
// -----------... | Set payment nominal relative fee and discount tiers and values at given block number tier fromBlockNumber Block number from which the update applies nominal Nominal relative fee nominal Discount tier levels nominal Discount values | function setPaymentFee(uint256 fromBlockNumber, int256 nominal, int256[] discountTiers, int256[] discountValues)
public
onlyOperator
onlyDelayedBlockNumber(fromBlockNumber)
{
paymentFeeByBlockNumber.addDiscountedEntry(fromBlockNumber, nominal, discountTiers, discountValues);
emit Set... | 415,255 |
// SPDX-License-Identifier: LGPL-3.0-or-later
pragma solidity ^0.7.6;
import "./interfaces/GPv2Authentication.sol";
import "./libraries/GPv2EIP1967.sol";
import "./mixins/Initializable.sol";
import "./mixins/StorageAccessible.sol";
/// @title Gnosis Protocol v2 Access Control Contract
/// @author Gnosis Developers
co... | Interface of the ERC20 standard as defined in the EIP./ | interface IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns ... | 6,258,491 |
./full_match/288/0x0aba698445c9Ff35AB966c811E8F5B730aC75034/sources/contracts/Presale.sol | --------------------- SETTERS --------------------- / | function setCanClaim (bool canClaim_) external onlyOwner {
canClaim = canClaim_;
}
| 7,103,840 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.