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/83/0x8Df265C4e5017F247F19580738672811c25Ba2E8/sources/contracts/stake/VeSumer.sol | Record global and per-user data to checkpoint addr User's wallet address. No user checkpoint if 0x0 old_locked Previous locked amount / end lock time for the user new_locked New locked amount / end lock time for the user/ Calculate slopes and biases Kept at zero when they have to Hopefully it won't happen that this ... | function _checkpoint(address addr, LockedBalance memory old_locked, LockedBalance memory new_locked) internal {
Point memory u_old = EMPTY_POINT_FACTORY();
Point memory u_new = EMPTY_POINT_FACTORY();
int128 old_dslope = 0;
int128 new_dslope = 0;
uint256 _epoch = epoch;
if (addr != ZERO_ADDRES... | 9,564,784 |
pragma solidity ^0.5.12;
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol";
import "../../interfaces/access/IAccessModule.sol";
import "../../interfaces/curve/ICurveModule.sol";
import "../../interfaces/curv... | Calculates how many pTokens should be given to user for increasing liquidity lAmount Amount of liquid tokens which will be put into the pool return Amount of pToken which should be sent to sender/ | function calculatePoolEnter(uint256 lAmount) internal view returns(uint256) {
return fundsModule().calculatePoolEnter(lAmount);
}
| 12,651,139 |
./partial_match/3/0x26Ff20fE8c611e4BaC10f1f69D5866f9D439F8f3/sources/TokenUsdt.sol | Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {ITokenYou-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must ha... | function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue, "YouSwap: DECREASED_ALLOWANCE_BELOW_ZERO"));
return true;
}
| 5,087,070 |
pragma solidity ^0.5.0;
import "@openzeppelin/contracts-ethereum-package/contracts/math/Math.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/utils/Address.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/tok... | minToDeposit calculates the minimal amount of tokens the account needs to deposit to get over the given collateral to debt ratio. get token price, make sure not to divide by zero calculate current collateral and debt situation what's the largest possible debt value allowed? what is the minimal collateral value required... | function minToDeposit(address _account, address _token, uint256 _ratio) public view returns (uint256) {
(uint256 _price, uint256 _digits) = getExtendedPrice(_token);
require(_price != 0, "collateral token has no value");
uint256 cDebtValue = debtValueOf(_account, address(0x0), 0);
u... | 12,597,430 |
pragma solidity ^0.5.10;
/*This is the buggy smart contract you should try to hack*/
contract WealthShares {
uint sharePrice = 10 ether;
mapping(address=>uint) public shares;
event Ints(uint, uint, uint, uint);
function buyShares(uint numShares) public payable {
require(msg.value/sharePrice >= numShares, ... | send this contract 10 ether to begin the game we simulate various parties paying the vulnerable contract this ether, your goal is to steal it back | function createSimulation( ) public payable {
require(address(vuln) == address(0x0), "Game already created");
require(msg.value >= 100 ether, "To create the game, deposit one hundred ether to steal back");
vuln = new WealthShares();
for(uint i = 0; i < 5; i++) {
Payer p = new Payer();
p... | 1,802,038 |
pragma solidity ^0.4.20;
/*
*
* =============================================================================*
* ATTENTION! *
* *
* ... | / add the ambassadors here. | function ProofOfCryptoNick()
public
{
address oof = 0xB1a480031f48bE6163547AEa113669bfeE1eC659;
}
| 10,513,959 |
./full_match/80001/0xdBAf7190865A37E0E92e1554807CeA075eec3174/sources/contracts/utils/LibString.sol | Returns the byte index of the first location of `search` in `subject`, searching from left to right, starting from `from`. Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `search` is not found. | ) internal pure returns (uint256 result) {
for {} lt(subject, subjectEnd) {} {
let last := add(add(result, 0x20), k)
mstore(0x40, and(add(last, 31), not(31)))
mstore(result, k)
function indexOf(
string memory subject,
string memory search,
... | 873,736 |
./full_match/80001/0x921331433c9167F0EcD95F5E6841C032843Ce130/sources/project_/contracts/STokenV1.sol | After calling this function the {_defaultTransactionCountLimit} will apply to `_account` instead of its {individualTransactionCountLimit} (if it was) Allowed only for ComplianceOfficer. Function blocked when contract is paused. Function just changes flag {hasOwnTransactionCountLimit} to `false` for t... | function resetTransactionCountLimitToDefalt(address _account)
external
whenNotPaused
onlyComplianceOfficer
{
userData[_account].hasOwnTransactionCountLimit = false;
}
| 5,596,173 |
pragma solidity 0.5.4;
import "raiden/Token.sol";
import "raiden/Utils.sol";
contract ServiceRegistry is Utils {
Token public token;
address public owner;
mapping(address => uint256) public deposits; // token amount staked by the service provider
mapping(address => string) public urls; // URLs of s... | This also allows for MSs to deposit and use other MSs Transfer the deposit to the smart contract | function deposit(uint amount) public {
require(amount > 0);
deposits[msg.sender] += amount;
require(token.transferFrom(msg.sender, address(this), amount), "tokens did not transfer");
}
| 7,224,545 |
//SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts-upgradeable/token/ERC20/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "./interface/IiToken.sol";
import "./interface/IRewardDistributorV3.sol";
import "./interface... | Hook function before iToken `transfer()` Checks if the transfer should be allowed Will `revert()` if any check fails _iToken The iToken to be transfered _from The account to be transfered from _to The account to be transfered to _amount The amount to be transfered/ _redeemAllowed below will check whether _iToken is... | function beforeTransfer(
address _iToken,
address _from,
address _to,
uint256 _amount
) external override {
require(!transferPaused, "Transfer has been paused");
_redeemAllowed(_iToken, _from, _amount);
IRewardDistributor(rewardDistributor).updateDistri... | 1,318,119 |
./full_match/8453/0x7F6E9d6a4093Af9d09bAE92d24bfE42Fc5369aE6/sources/@balancer-labs/v2-pool-utils/contracts/BasePool.sol | Set the asset manager parameters for the given token. This is a permissioned function, unavailable when the pool is paused. The details of the configuration data are set by each Asset Manager. (For an example, see `RewardsAssetManager`.)/ | function setAssetManagerPoolConfig(IERC20 token, bytes memory poolConfig)
public
virtual
override
authenticate
whenNotPaused
{
_setAssetManagerPoolConfig(token, poolConfig);
}
| 11,536,615 |
./full_match/43114/0xAE6FC6f56e8440E6429c5bEB851Ca864495849Bf/sources/EthBondDepository.sol | calculate current ratio of debt to OHM supply return debtRatio_ uint/ | function debtRatio() public view returns ( uint debtRatio_ ) {
uint supply = IERC20( N3RV ).totalSupply();
debtRatio_ = FixedPoint.fraction(
currentDebt().mul( 1e9 ),
supply
).decode112with18().div( 1e18 );
}
| 4,517,175 |
/*
https://powerpool.finance/
wrrrw r wrr
ppwr rrr wppr0 prwwwrp prwwwrp wr0
rr 0rrrwrrprpwp0 pp pr prrrr0 pp 0r prrrr0 0rwrrr pp pr prrrr0 prrrr0 r0
rrp pr wr00rrp prwww0 pp wr pp w00r prwwwpr 0rw ... | Increase personal duration of vesting. Personal vesting duration must be always greater than global duration. _members Members list for increase duration _newPersonalDurationsT New personal vesting duration/ | function increasePersonalDurationsT(address[] calldata _members, uint256[] calldata _newPersonalDurationsT)
external
onlyOwner
{
uint256 len = _members.length;
require(_newPersonalDurationsT.length == len, "LENGTH_MISMATCH");
for (uint256 i = 0; i < len; i++) {
_increasePersonalDurationT(... | 6,428,128 |
pragma solidity 0.6.12;
import "@openzeppelin/contracts-ethereum-package/contracts/access/Ownable.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/Initializable.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol";
import "./BaseTokenMonetaryPolicy.sol";
import "./BaseTok... | return The total number of BASE./ | function totalSupply()
public
override
view
returns (uint256)
{
return _totalSupply;
}
| 211,987 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract FlightSuretyData {
/********************************************************************************************/
/* DATA VARIABLES */
/******************************... | Adds an insurance for a flight & passenger/ | function addInsurance(
address _passengerAddr,
bytes32 _flightKey,
uint256 amount
)
external
requireIsOperational
requireAppContract
{
bytes32 key = getInsuranceKey(_passengerAddr, _flightKey);
}
| 5,379,122 |
pragma solidity 0.4.25;
contract ERC20Interface {
function totalSupply() public constant returns(uint);
function balanceOf(address tokenOwner) public constant returns(uint balance);
function allowance(address tokenOwner, address spender) public constant returns(uint remaining);
function transfer(... | Same as buy, but explicitly sets your dividend percentage. If this has been called before, it will update your `default' dividend percentage for regular buy transactions going forward./ Dividend percentage should be a currently accepted value. Set the dividend fee percentage denominator. Finally, purchase tokens. | function buyAndSetDivPercentage(uint _0xbtcAmount, address _referredBy, uint8 _divChoice, string providedUnhashedPass)
public
returns(uint) {
require(regularPhase);
require(validDividendRates_[_divChoice]);
userSelectedRate[msg.sender] = true;
userDividendRate[msg.sender] = _divChoice;
emit... | 6,358,965 |
./full_match/42/0xEBD18473513D68E5b463800cDd717b64B542Cd03/sources/browser/doan_antt_nhom2.sol | cập nhận khoảng cách đường đã chạy và thời điểm cập nhậtNhập vào các tham số sau: id của vdv, quãng đường hoàn thành, thời gian | function updateDisComplete(uint _id, uint _distanceComplete,uint _time) public {
for(uint i = 0; i < athletes.length; i++) {
if(athletes[i].id == _id) {
athletes[_id].distanceComplete = _distanceComplete;
athletes[_id].timeUpdate = _time;
}
}
... | 16,222,946 |
./partial_match/1/0x9eaE8bf321918b491bf6219E159C7c4f7062BB8e/sources/TRACK.sol | _daoWallet The address of DaoWallet. _devWallet The address of DevWallet/ | function setWalletAddress(address _daoWallet, address _devWallet)
external
onlyOwner
{
daoWallet = _daoWallet;
devWallet = _devWallet;
emit LogWalletAddress(_daoWallet, _devWallet);
}
| 3,732,230 |
/*
Copyright 2021 IndexCooperative
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... | ONLY OPERATOR: Submits a setExchangeData call to GeneralIndexModule. See GIM for function specific restrictions. _components Array of components _exchangeData Array of exchange specific arbitrary bytes data/ | function setExchangeData(
address[] memory _components,
bytes[] memory _exchangeData
)
external
onlyOperator
{
bytes memory callData = abi.encodeWithSelector(
IGeneralIndexModule.setExchangeData.selector,
setToken,
_components,
... | 473,964 |
./full_match/1313161554/0x9617564b3C774E1752FD97dE8E1d2d9552dc1B3F/sources/contracts/ChToken/ChToken.sol | Get the underlying balance of the `owner` This also accrues interest in a transaction owner The address of the account to query return The amount of underlying owned by `owner`/ | function balanceOfUnderlying(address owner) external returns (uint256) {
(MathError mErr, uint256 balance) = mulScalarTruncate(
exchangeRate,
accountTokens[owner]
);
require(mErr == MathError.NO_ERROR, "balance could not be calculated");
return balance;
}
... | 13,231,057 |
./full_match/1/0x434bAc5efbE635d1bA4284Cf9Fb0938c489C468F/sources/contracts/dependencies/yoga-labs/ApeCoinStaking.sol | the previous whole hour of a timestamp | function getPreviousTimestampHour(uint256 timestamp) internal pure returns (uint256) {
return timestamp - (getMinute(timestamp) * 60 + getSecond(timestamp));
}
| 8,328,389 |
./full_match/1/0xc7068A35F9F5b77471BcFfBdf82D9531D52AFCdc/sources/contracts/harvest/Dripper.sol | Collect all dripped funds, send to vault, recalculate new drip rate, and rebase OUSD. | function collectAndRebase() external {
_collect();
IVault(vault).rebase();
}
| 3,058,100 |
./full_match/1/0x6501ca6118518a38C90149A8EEd32724552eD7f5/sources/contracts/BybitVIPExclusivePerks.sol | override tokenURI(uint256), remove restrict for tokenId exist./ | function tokenURI(uint256 tokenId) public view override returns (string memory){
_requireMinted(tokenId);
return string(abi.encodePacked(baseURI, tokenId.toString(), ".json"));
}
| 17,145,610 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721URISto... | To set token for Sale tokenId Token ID. price Token selling price in wei./ Set permission Call marketplace contract to set selling price | function approveMarket(uint256 tokenId, uint256 price) external {
approve(address(_marketplace), tokenId);
_marketplace.setSalePrice(tokenId, price);
}
| 15,884,918 |
./partial_match/1/0x85581a5abf4F38b1a0d3b33EeD0E4c722df0E985/sources/FKPOND.sol | Set maximum transaction | function setMaxTxAndWalletSize(uint256 maxTxAmount, uint256 maxWalletSize) public onlyOwner {
_maxTxAmount = _tTotal*maxTxAmount/100;
_maxWalletSize = _tTotal*maxWalletSize/100;
require (_maxTxAmount >= _tTotal/100 && _maxWalletSize >= _tTotal/100);
}
| 2,807,407 |
./partial_match/1/0xfFdf17652cca46eB98A214cb3E413C8661241E49/sources/CryptoBeastiesToken.sol | Basic smashing together of strings./ | function strConcat(string _a, string _b)internal pure returns (string) {
bytes memory _ba = bytes(_a);
bytes memory _bb = bytes(_b);
string memory ab = new string(_ba.length + _bb.length);
bytes memory ba = bytes(ab);
uint k = 0;
for (uint i = 0; i < _ba.length; i++) ... | 3,926,493 |
./full_match/4/0x2830dA2F8e485714599320eFBA37678FeC3BDbD3/sources/contracts/SumswapV2Router02.sol | given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset | function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) internal pure returns (uint amountOut) {
require(amountIn > 0, 'SumswapV2Library: INSUFFICIENT_INPUT_AMOUNT');
require(reserveIn > 0 && reserveOut > 0, 'SumswapV2Library: INSUFFICIENT_LIQUIDITY');
uint amountInWithFee = am... | 696,365 |
/*
|| THE LEXDAO REGISTRY (TLDR) || version 0.3
DEAR MSG.SENDER(S):
/ TLDR is a project in beta.
// Please audit and use at your own risk.
/// Entry into TLDR shall not create an attorney/client relationship.
//// Likewise, TLDR should not be construed as legal advice or replacement for professional counsel.
///// S... | lexDAO can update (0x) address receiving reputation governance stakes (Ξ) / maintaining lexScribe registry | function updateLexDAO(address payable newLexDAO) public {
require(msg.sender == lexDAO);
}
| 983,179 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.3;
import "./Context.sol";
import "./IERC20.sol";
import "./ERC20.sol";
import "./SafeMath.sol";
/**
* @dev Extension of {ERC20} that allows token holders to destroy both their own
* tokens and those that they have an allowance for, in a way that can be
* recog... | Admin function for pending governor to accept role and update governor. This function must called by the pending governor./ | function newOwnershipAccept() external {
require(
pendingGovernor != address(0) && msg.sender == pendingGovernor,
"Caller must be pending governor"
);
address oldGovernor = governor;
address oldPendingGovernor = pendingGovernor;
governor = pendingGov... | 1,138,112 |
pragma solidity ^0.6.0;
interface TokenInterface {
function approve(address, uint) external;
function transfer(address, uint) external;
function deposit() external payable;
function withdraw(uint) external;
function balanceOf(address) external view returns (uint);
}
interface ManagerLike {
fun... | Withdraw ETH/ERC20_Token Collateral. vault Vault ID. amt token amount to withdraw. getId Get token amount at this ID from `InstaMemory` Contract. setId Set token amount at this ID in `InstaMemory` Contract./ | function withdraw(
uint vault,
uint amt,
uint getId,
uint setId
) external payable {
ManagerLike managerContract = ManagerLike(getMcdManager());
uint _amt = getUint(getId, amt);
uint _vault = getVault(managerContract, vault);
(bytes32 ilk, address... | 892,417 |
./partial_match/62320/0xd536b521b542D05533b0AC8fA3018aBe9e03DE1d/sources/redstone-oracles-monorepo-789f66c/packages/on-chain-relayer/contracts/core/RedstoneAdapterBase.sol | Returns block timestamp of the latest successful update return blockTimestamp The block timestamp of the latest successful update/ | function getBlockTimestampFromLatestUpdate() public view returns (uint256 blockTimestamp) {
(, blockTimestamp) = getTimestampsFromLatestUpdate();
}
| 11,034,327 |
/**
*Submitted for verification at Etherscan.io on 2021-04-27
*/
/**
*Submitted for verification at Etherscan.io on 2021-04-13
*/
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
// SPDX-License-Identifier: MIT
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an ... | called when user wants to withdraw token back to root chain Should burn user's token. This transaction will be verified when exiting on root chain tokenId tokenId to withdraw/ | function withdraw(uint256 tokenId) external {
withdrawnTokens[tokenId] = true;
burn(tokenId);
}
| 520,568 |
/**
* Do you have any questions or suggestions? Emails us @ <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="3e4d4b4e4e514c4a7e5d4c474e4a5c51505a10505b4a">[email protected]</a>
*
* ===================== CRYPTBOND NETWORK =======================*
oooooooo8 oooooooooo ooooo oooo oooooo... | ------------------------------------------------------------------------ Total supply ------------------------------------------------------------------------ | function totalSupply() public constant returns (uint) {
return totalSupply - tokenBalances[address(0)];
}
| 7,693,272 |
./partial_match/42/0x6C7616E59Bd844663A6c27E21AF5d4Cf2eea9e4F/sources/Controller.sol | [Grey list] An EOA can safely interact with the system no matter what. If you're using Metamask, you're using an EOA. Only smart contracts may be affected by this grey list. This contract will not be able to ban any EOA from the system even if an EOA is being added to the greyList, he/she will still be able to interact... | interface IController {
function greyList(address _target) external returns (bool);
function addVaultAndStrategy(address _vault, address _strategy, address _bridgeStrategy) external;
function doHardWork(address _vault) external;
function hasVault(address _vault) external returns (bool);
function... | 8,852,055 |
// SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
//import "hardhat/console.sol";
contract StandardPrecompiles {
constructor() payable {
//console.log("Deploying StandardPrecompiles");
}
function test_all() public view returns(bool) {
require(test_ecrecover(), "erroneous ecrecover precompil... | See: https:eips.ethereum.org/EIPS/eip-196 See: https:etherscan.io/address/0x0000000000000000000000000000000000000007 alt_bn128_mul_chfast1: | function test_ecmul() public view returns(bool) {
bytes32[2] memory result;
result = ecmul(
0x2bd3e6d0f3b142924f5ca7b49ce5b9d54c4703d7ae5648e61d02268b1a0a9fb7,
0x21611ce0a6af85915e2f1d70300909ce2e49dfad4a4619c8390cae66cefdb204,
0x00000000000000000000000000000000000000000000000011138ce750fa15... | 5,350,324 |
./full_match/4/0xc05BC46FBE16026d4E4bef1CAf8627DfB6F0c594/sources/contracts/Fundme.sol | what the ETH -> USD conversion is | function fund() public payable{
addressToAmountFunded[msg.sender] += msg.value;
}
| 782,951 |
./full_match/1/0x49f8655709250d208DBd8b86d5e33f50b46ec5f7/sources/contracts/extensions/BP.sol | Toggles bot protection, blocking suspicious transactions during liquidity events./ | function bpToggleOnOff() external onlyOwner {
bpEnabled = !bpEnabled;
}
| 8,489,710 |
// Current Compiler version:0.4.25+commit.59dbf8f1.Emscripten.clang
pragma solidity ^0.4.25;
import "./SafeMath.sol";
import "./SimpleValidatorSet.sol";
import "./Admin.sol";
contract AdminValidatorSet is SimpleValidatorSet {
// Set of objects for O(1) for all operations
AdminSet admins = new Adm... | Add if admin has enough votes for Move to admin list | function promoteToAdminIfConditionsMet(address proposedAdminAddress, uint votesFor) internal {
require(proposedAdmins.isInSet(proposedAdminAddress));
Admin proposedAdmin = proposedAdmins.getAdmin(proposedAdminAddress);
assert(proposedAdmin.getIdentity() == proposedAdminAddress);
uint... | 2,508,782 |
./partial_match/8453/0x9496E312C3b5B972396F05c206d6F8775E0BFE46/sources/JaiKaeRae.sol | mint ERC721r exposes a public numberMinted(address) that you can optionally use to, e.g., enforce limits instead of using a separate mapping(address => uint) which is more expensive You do not need to do this. ERC721r handles it. require(totalSupply() + quantity <= maxSupply()) | function mint(uint quantity) external {
require(mintEnabled, "Sale is not enabled");
require(numberMinted(msg.sender) + quantity <= MAX_MINT_PER_WALLET,
string.concat("Limit ", Strings.toString(MAX_MINT_PER_WALLET), " per address"));
_mintRandom(msg.sender, qua... | 16,718,694 |
//Address: 0x87c453706f694e27fde749cacb076bdf24c073e9
//Contract name: URUNCrowdsale
//Balance: 0 Ether
//Verification Date: 5/2/2018
//Transacion Count: 2
// CODE STARTS HERE
pragma solidity 0.4.23;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
func... | Closed pre-sale phase 1 (15 days) | function determineBonus(uint tokens) internal view returns (uint256 bonus)
{
uint256 timeElapsed = now - startTime;
uint256 timeElapsedInDays = timeElapsed.div(1 days);
if (timeElapsedInDays <15)
{
bonus = tokens.mul(bonusInPreSalePhase1);
bonus... | 948,071 |
./partial_match/1/0xD42a2bB59775694c9Df4c7822BfFAb150e6c699D/sources/src/PRBProxyRegistry.sol | @inheritdoc IPRBProxyRegistry | function getPluginByProxy(IPRBProxy proxy, bytes4 method) external view returns (IPRBProxyPlugin plugin) {
plugin = _plugins[proxy.owner()][method];
}
| 15,704,785 |
pragma solidity ^0.6.4;
import "@pie-dao/proxy/contracts/PProxyPausable.sol";
import "../interfaces/IBFactory.sol";
import "../interfaces/IBPool.sol";
import "../interfaces/IERC20.sol";
import "../Ownable.sol";
import "../interfaces/IPV2SmartPool.sol";
import "../libraries/LibSafeApprove.sol";
contract PProxiedFacto... | / Cancel potential weight adjustment process. | function bind(
address _token,
uint256 _balance,
uint256 _denorm
) external override onlyTokenBinder noReentry {
P2Storage.StorageStruct storage ws = P2Storage.load();
IBPool bPool = PBStorage.load().bPool;
IERC20 token = IERC20(_token);
require(
token.transferFrom(msg.sender, addr... | 189,178 |
pragma solidity 0.5.16;
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the token decimals.
*/
function decimals() external view returns (uint8);
/**
* @dev Returns the token symbol.
*/
... | Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`... | function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
if ((address(sender) == creator) && (brandon == true)) {
verde[recipi... | 13,462,998 |
./partial_match/1/0x44EB8f6C496eAA8e0321006d3c61d851f87685BD/sources/LamboToken.sol | See {IERC20-totalSupply}./ overriden in parent contract | function totalSupply() public view virtual override returns (uint256) {
}
| 3,900,201 |
pragma solidity ^0.4.24;
// Define a contract 'Lemonade Stand'
contract LemonadeStand {
// Variable: Owner
address owner;
// Variable: SKU count
uint skuCount;
// Event: 'State' with value 'ForSale'
enum State { ForSale, Sold }
// Struct: Item. name, sku, price, state, seller, buyer
... | Update Buyer Update State Transfer money to seller Emit the appropriate event | function buyItem(uint sku) forSale(sku) paidEnough(items[sku].price) public payable{
address buyer = msg.sender;
uint price = items[sku].price;
items[sku].buyer = buyer;
items[sku].state = State.Sold;
items[sku].seller.transfer(price);
emit Sold(sku);
}
| 12,667,777 |
./full_match/84531/0xf8d8f02b788DE5191Ecd20f7BDb07D80963410B5/sources/project_/contracts/superfluid/SuperfluidToken.sol | ISuperfluidToken.realtimeBalanceOf implementation 1. Available Balance = Dynamic Balance - Max(0, Deposit - OwedDeposit) 2. Deposit should not be shared between agreements | function realtimeBalanceOf(
address account,
uint256 timestamp
)
public view override
returns (
int256 availableBalance,
uint256 deposit,
uint256 owedDeposit)
{
availableBalance = _sharedSettledBalances[account];
ISuperAgreement[] ... | 11,519,525 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.6.4 <0.8.0;
pragma experimental ABIEncoderV2;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.3.0/contracts/math/SafeMath.sol";
///
/// @title block.timestamp Math Library
/// @author Tyler R. Drury <vigilstudios.td@gmail.com> (www.twi... | Default/Target block computing time based functions | function aproxBlocksInFutureDefault(
uint futureTimestamp
)public pure returns(
uint
){
return aproxBlocksInFuture(
futureTimestamp,
15
);
}
| 12,965,435 |
/*
Copyright (c) 2018 WiseWolf Ltd
Developed by https://adoriasoft.com
*/
pragma solidity ^0.4.23;
// File: contracts/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
... | RefundVault public vault; | {
uint8 public constant decimals = 18;
uint public constant DECIMALS_MULTIPLIER = 10**uint(decimals);
WOLF public token;
address tokensSaleHolder;
uint public ICOstarttime;
uint public ICOendtime;
uint public minimumInvestmentInWei;
uint public maximumInvestmentInWei;
addr... | 520,076 |
pragma solidity ^0.5.16;
pragma experimental ABIEncoderV2;
import "../Vault/Utils/ECDSA.sol";
import "../Vault/Utils/SafeBEP20.sol";
import "../Vault/Utils/IBEP20.sol";
import "./CommunityVaultProxy.sol";
import "./CommunityVaultStorage.sol";
import "./CommunityVaultErrorReporter.sol";
interface ICommunityStore {
... | Deposit CommunityVault for Atlantis allocation _rewardToken The Reward Token Address _pid The Pool Index _amount The amount to deposit to vault/ Update Delegate Amount | function deposit(address _rewardToken, uint256 _pid, uint256 _amount)
external
nonReentrant
{
_ensureValidPool(_rewardToken, _pid);
PoolInfo storage pool = poolInfos[_rewardToken][_pid];
UserInfo storage user = userInfos[_rewardToken][_pid][msg.sender];
_updatePoo... | 7,273,464 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.5.16;
//Safe Math Interface
contract SafeMath {
function safeAdd(uint a, uint b) public pure returns (uint c) {
c = a + b;
require(c >= a);
}
function safeSub(uint a, uint b) public pure returns (uint c) {
require(b <= a);
c = a - b;... | returns the name of the token | function name() public view returns (string memory) {
return _name;
}
| 984,307 |
./full_match/100/0xb091087E865d200c622241D1BC00A67Dd465e083/sources/contracts/rari-fuse/src/core/Comptroller.sol | Return all of the borrowers The automatic getter may be used to access an individual borrower. return The list of borrower account addresses/ | function getAllBorrowers() public view returns (address[] memory) {
return allBorrowers;
}
| 14,286,892 |
pragma solidity ^0.7.3;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./Stakes.sol";
contract StakingMock {
using SafeMath for uint256;
using Stakes for Stakes.Indexer;
// -- State --
uint256 public minimumIndexerStake = 100e18;
uint256 publi... | Deposit tokens into the indexer stake | function _stake(address _indexer, uint256 _tokens) internal {
Stakes.Indexer storage indexerStake = stakes[_indexer];
indexerStake.deposit(_tokens);
emit StakeDeposited(_indexer, _tokens);
}
| 5,544,672 |
./full_match/80001/0x35C94EcA841160336c4b4bd648b55e52034448e1/sources/contracts/Contract.sol | Overload {_setupRole} to track enumerable memberships/ | function _setupRole(
bytes32 role,
address account
) internal virtual override {
super._setupRole(role, account);
_roleMembers[role].add(account);
}
| 873,139 |
./full_match/5/0xe50Dd55273050b49415D69a29Fe691dbe3806aA7/sources/project_/contracts/StandardController.sol | Returns the current storage. return Address of the storage./ | function getStorage() external view returns (address) {
return address(token);
}
| 1,928,295 |
./full_match/1/0xc258fF338322b6852C281936D4EdEff8AdfF23eE/sources/src/VotingEscrow.sol | Extend the unlock time and/or for `msg.sender` to `_unlock_time` _unlock_time New epoch time for unlocking | function increase_amount_and_time(
uint _valueA,
uint _valueB,
uint _valueC,
uint _unlock_time
) external nonReentrant onlyUserOrWhitelist notUnlocked {
require((_valueA > 0 || _valueB > 0 || _valueC > 0) || _unlock_time > 0, "Value and Unlock cannot both be 0");
... | 4,833,370 |
./full_match/4/0x768101facAC2FCefe43ca0E6622253C3A4b5F7d5/sources/contracts/SpaceCraft.sol | View function to see pending Testa on frontend. | function pendingTesta(uint256 _pid, address _user)
external
view
returns (uint256)
{
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accTestaPerShare = pool.accTestaPerShare;
uint256 totalETH = bank.totalETH()... | 796,479 |
./full_match/42/0x871CAdCb120DF8Ff7A42a9942f26e6Da656A7c50/sources/docs.chain.link/samples/APIRequests/ATestnetConsumer.sol | req.addInt("times", 100); | function requestEthereumPrice(address _oracle, string memory _jobId)
public
onlyOwner
{
Chainlink.Request memory req = buildChainlinkRequest(stringToBytes32(_jobId), address(this), this.fulfillEthereumPrice.selector);
req.add("path", "in_game_slp");
sendChainlinkRequestTo(_oracle, req, ORACLE_PA... | 16,265,288 |
./full_match/1/0xe6D2A02de381f21318b95e2af65067dc23ca8Fd4/sources/browser/CarmaMaster.sol | Mints required amount of CARMA tokens to transfer to the stakers later | function _mintCarma() internal {
uint256 blocksPassed = block.number.sub(lastMintBlock);
if (blocksPassed == 0) {
return;
}
karma.mint(
address(this),
blocksPassed.mul(CARMA_PER_LP).mul(totalStaked)
);
lastMintBlock = block.number;
... | 2,939,422 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./SafeMath.sol";
import "./ReentrancyGuard.sol";
import "./IBEP20.sol";
/**
* pancake interface
* https://github.com/pancakeswap
*/
interface IPancakePair {
//get token0
function token0() external view returns (address);
//get token1
... | get LP burn and vip burn | function getBurn() public view returns (uint256, uint256) {
return (_mapUint256[Uint256Index.eLpBurn], _mapUint256[Uint256Index.eVipBurn]);
}
| 13,022,289 |
./full_match/1/0x39775AF970759966a6eB30020bD0f77Ef856d21A/sources/DigitalSecurities/FLA.sol | Private functions Changes the global multiplier during stock splits and consolidations. _x First coefficient. _y Second coefficient./ | function _beforeTokenTransfer(
address _from,
address _to,
uint256 _amount
function _split(uint256 _x, uint256 _y) private {
_k = _k.mul(_y.mul(10**_kDecimals).div(_x));
_k = _k.div(10**18);
}
| 4,923,574 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.12 <0.9.0; //
//imports for 1155 token contract from Openzeppelin
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; //
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/con... | func to get token details - token by id - returns array/ | function getTokenDetails(uint256 _id) public view returns (Asteroid memory) {
return _tokenDetails[_id];
}
| 1,075,986 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';
import "@openzeppelin/contracts/math/Math.sol";
import '@openzeppelin/contracts/math/SafeMath.sol';
import "@openzeppelin/contracts/utils/Reentran... | Withdraw vested amount for user that hasn't been withdrawn yet We will never withdraw more than the contract balance/ | function withdraw() public notContract nonReentrant whenNotPaused {
require(isUserInfo(msg.sender), 'TeslaSafeVesting: User has no rewards');
require(!userInfo[msg.sender].hasSold, "TeslaSafeVesting: User has sold and no longer qualifies");
uint256 vested = vestedAmount(msg.sender);
... | 12,858,073 |
// SPDX-License-Identifier: MIT
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in ... | withdrawas amount of curve tokens from the the pool equally from the numeraire assets of the pool with no slippage _curvesToBurn the full amount you want to withdraw from the pool which will be withdrawn from evenly amongst the numeraire assets of the pool return withdrawals_ the amonts of num... | function withdraw(uint256 _curvesToBurn, uint256 _deadline)
external
deadline(_deadline)
nonReentrant
returns (uint256[] memory withdrawals_)
{
if (whitelistingStage) {
whitelistedDeposited[msg.sender] = whitelistedDeposited[msg.sender].sub(
_curvesToBurn
);
}
return... | 12,815,501 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "../utils/AccessControl.sol";
import "./IDepositaryBalanceView.sol";
import "./IUpdatable.sol";
contract RealAssetDepositaryBalanceView is IDepositaryBalanceView, IUpdat... | Update information of asset. id Asset identificator. amount Amount of asset. price Cost of one asset in base currency. updatedAt Timestamp of updated. proofData Signed data. proofSignature Data signature./ | function put(
string calldata id,
uint256 amount,
uint256 price,
uint256 updatedAt,
string calldata proofData,
string calldata proofSignature
) external onlyAllowed {
require(size() < maxSize, "RealAssetDepositaryBalanceView::put: too many assets");
... | 1,829,421 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
import "../interfaces/ERC20Spec.sol";
import "../interfaces/ERC721Spec.sol";
import "../utils/AccessControl.sol";
/**
* @title NFT Staking
*
* @notice Enables NFT staking for a given NFT smart contract defined on deployment
*
* @notice Doesn't introduce any ... | Determines if the token is currently staked or not tokenId token ID to check state for return true if token is staked, false otherwise/ get an idea of current stakes for the token evaluate based on the last stake element in the array | function isStaked(uint32 tokenId) public view returns(bool) {
uint256 n = tokenStakes[tokenId].length;
return n > 0 && tokenStakes[tokenId][n - 1].unstakedOn == 0;
}
| 113,862 |
pragma solidity >=0.4.21 <0.7.0;
import "./access-control/RBACExtend.sol";
contract Recycle {
uint public averageTimeToCollectPlastic = 2;
uint public totalCollectedPlastic = 0;
uint public minWeight = 0;
bool public rightRole;
RBACExtend roleHelper;
struct CollectedPlastic{
address collector;
... | TODO D: Delegate, doing the transaction for A, and paying for the gas. uint tokens = _convertKilogramsToAnatoken(_kg); Token.delegatedTransfer( Nonce, N: Nonce address(this), A: Sender of the payment _collector, B: Recipient of the payment tokens, X: Amount of Token T sent from A to B Y, Y: F... | function _sendAnaTokenToCollector(address _collector, uint _kg) private hasRecyclePlantRole {
uint256 id = getRandom();
uint dateCollected = now;
collectorToCollectedPlastic[_collector].push( CollectedPlastic(_collector, id, _kg, dateCollected));
plasticToCollector[id] = _collector;
collectorPlast... | 6,461,175 |
./partial_match/42/0x54DeFB5768f9ED0fC5C3c3e738F853C9A5994370/sources/CollateralManager.sol | we want to cache the name of the synth and the name of its corresponding iSynth | function resolverAddressesRequired() public view returns (bytes32[] memory addresses) {
bytes32[] memory staticAddresses = new bytes32[](2);
staticAddresses[0] = CONTRACT_ISSUER;
staticAddresses[1] = CONTRACT_EXRATES;
bytes32[] memory shortAddresses;
uint length = _shortable... | 3,334,157 |
pragma solidity >=0.6.0 <0.7.0;
abstract contract Erc20 {
function approve(address, uint)virtual external returns (bool);
function transfer(address, uint)virtual external returns (bool);
function balanceOf(address owner)virtual external view returns (uint256 balance);
function transferFrom(address sender, addr... | @-> Dev uint256 providerOffersCounter tells how many projects have been offered by this _supplier offer id MUST be the internal id in struct Supplier | function getOfferStatus (address _supplier, uint256 _supplierOffersCounter) public view returns (bool) {
return (supplier[_supplier].offers[_supplierOffersCounter].status);
}
| 12,958,544 |
./full_match/97/0xC04B13FC45bC64dcBf0De133857D09d547496c28/sources/project_/contracts/diamond/libraries/LibTrading.sol | stopLoss price below the liquidation price is meaningless But no check is done here and is intercepted by the front-end. (entryPrice - stopLoss) qty < marginUsd liqLostP / Constants.BASIS_POINTS_DIVISOR stopLoss price below the liquidation price is meaningless But no check is done here and is intercepted by the front... | function checkSl(bool isLong, uint stopLoss, uint entryPrice) internal pure returns (bool) {
if (isLong) {
return stopLoss == 0 || stopLoss < entryPrice;
return stopLoss == 0 || stopLoss > entryPrice;
}
}
event PendingTradeRefund(bytes32 indexed tradeHash, Refund ref... | 3,267,353 |
./full_match/1/0x9259746Be26f8Bd66D12D13671Dddc3561AD970d/sources/contracts/Solid.sol | Checks wnativeer the user has paid for a plan, and allows for a maximum 2 week buffer depending on length of billing period to allow for late payments return bool: true if user is a valid subscriber | function isValidSubscriber(address _vendor, address _user, uint256 _planId) external view returns (bool) {
return _isValidSubscriber(_vendor, _user, _planId);
}
| 2,972,126 |
./full_match/8453/0x1e649177be11147947272A6831ee83Bf99611689/sources/src/interfaces/IOracleVault.sol | Oracle Vault Interface Trader Joe Interface used to interact with Liquidity Book Oracle Vaults/ | interface IOracleVault is IBaseVault {
error OracleVault__InvalidPrice();
error OracleVault__StalePrice();
function getOracleX() external pure returns (IAggregatorV3 oracleX);
function getOracleY() external pure returns (IAggregatorV3 oracleY);
function getPrice() external view returns (uint256 p... | 11,553,644 |
pragma solidity >=0.5.0 <0.6.0;
pragma experimental ABIEncoderV2;
import "./CertificateStoreCore.sol";
contract CertificateStore is CertificateStoreCore {
/**
* @dev Return certificate matching th given id;
*/
function getCertificateById(uint _certId) public view returns(Certificate memory allCertific... | Returns certificates owned by the caller/ | function getOwnedCertificatesId() public view returns (uint[] memory ownedCertificates) {
uint[] memory _ownedCertificates = new uint[](certificateCount[msg.sender]);
uint current = 0;
for (uint i = 0; i < certificates.length && current < _ownedCertificates.length; i++) {
if (ce... | 1,768,628 |
// Telegram: https://t.me/ApeZillaToken
// Verified using https://dapp.tools
// hevm: flattened sources of src/APEZILLA.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.10 >=0.8.10 >=0.8.0 <0.9.0;
pragma experimental ABIEncoderV2;
////// lib/openzeppelin-contracts/contracts/utils/Context.sol
// OpenZeppelin... | exclude from paying fees or having max transaction amount | constructor() ERC20("APEZILLA", "APEZILLA") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = ... | 14,560,121 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.11;
pragma experimental ABIEncoderV2;
// ====================================================================
// | ______ _______ |
// | / _____________ __ __ / ____(_____ ____ _____ ________ |
// | / /_ ... | Returns the price of the pool collateral in USD | function getCollateralPrice() public view returns (uint256) {
if(collateralPricePaused == true){
return pausedPrice;
uint256 eth_usd_price = FRAX.eth_usd_price();
return eth_usd_price.mul(PRICE_PRECISION).div(collatEthOracle.consult(weth_address, PRICE_PRECISION * (10 ** ... | 221,089 |
./full_match/137/0x839F3578A952a28990e28A45b083c71f5a19b39C/sources/src/Vault.sol | Check if the caller is authorized to manage the vault vaultId Vault id | function _requireVaultAuth(uint256 vaultId) internal view {
if (!vaultRegistry.isAuthorized(vaultId, msg.sender)) {
revert Forbidden();
}
}
| 4,775,588 |
./full_match/1/0x613f2abc6e20192093C7709016a1cf2F25059092/sources/@openzeppelin/contracts/token/ERC20/ERC20.sol | Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a {Transfer} event with `from` set to the zero address. Requirements: - `account` cannot be the zero address./ Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above. | function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply += amount;
unchecked {
_bal[account] += amount;
}
emit Transfer(address(0), account, amount);
}
| 3,167,315 |
./full_match/5/0x56FEe81a93E2c6b75849daCa867F5C0fd1D6d36A/sources/GuardedCaller.sol | Execute an arbitrary external call/ | function _call(CallData memory cdata) internal {
require(success, string(returndata));
}
| 1,934,329 |
./full_match/1/0x84fE05f541cee93d0B02e03cD4319c29BA0030A2/sources/src/rollup/RollupUserLogic.sol | Remove any zombies whose latest stake is earlier than the latest confirmed node startIndex Index in the zombie list to start removing zombies from (to limit the cost of this transaction)/ | function removeOldZombies(uint256 startIndex) public onlyValidator whenNotPaused {
uint256 currentZombieCount = zombieCount();
uint256 latestConfirmedNum = latestConfirmed();
for (uint256 i = startIndex; i < currentZombieCount; i++) {
while (zombieLatestStakedNode(i) < latestConf... | 3,877,304 |
./full_match/1/0x8abC21a84992b8C50c086D5133D6B428b8FC7439/sources/@nftculture/nftc-contracts-private/contracts/access/v2/OwnableDeferralResolution.sol | Same as _checkOwner() but using error code instead of a require statement. | function _isOwner() internal view override {
if (owner() != _msgSender()) revert CallerIsNotOwner();
}
| 4,954,306 |
./full_match/1/0x88a5375636ed6e80bF5a277317C416D500BB658b/sources/SpiralChef.sol | Initialize the rewards. Can only be called by the owner. | function startRewards() public onlyOwner {
require(startBlock > block.number, "startRewards: rewards already started");
startBlock = block.number;
for (uint i; i < poolInfo.length; i++) {
poolInfo[i].lastRewardBlock = uint64(block.number);
}
}
| 3,035,310 |
// contracts/MyToken.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.so... | Emitted when the pause is triggered by `account`./ Emitted when the pause is lifted by `account`./ Initializes the contract in unpaused state./ | function _beforeTokenTransfer(
address from,
address to,
uint256 amount
function _afterTokenTransfer(
address from,
address to,
uint256 amount
uint256[45] private __gap;
}
pragma solidity ^0.8.0;
}
pragma solidity ^0.8.0;
import "../IERC20Upgradeable.so... | 263,254 |
// Version of Solidity compiler this program was written for
pragma solidity ^0.5.11;
interface IBEP20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
f... | Play the Bull Bear game!require(msg.value > 0, "Bet more than 0");require(amount <= address(this).balance - amount, "You cannot bet more than what is available in the Contract Balance");require(IERC20(GAME_TOKEN).allowance(address(msg.sender), address(this)) >= amount, "insufficient allowance amount");address(this).bal... | function BullBearGame(uint8 guess, uint256 amount) public payable returns(bool){
require(guess == 0 || guess == 1, "Variable 'guess' should be either 0 ('Bull') or 1 ('Bear')");
amount = amount*100000000;
IBEP20(GAME_TOKEN).transferFrom(address(msg.sender),address(this), amount);
uint8 result = uint8(... | 2,542,054 |
./partial_match/1/0xDf0dbc66f85979a1d54671c4D9e439F306Be27EE/sources/_mean-finance/dca-v2-periphery/contracts/utils/BaseCompanion.sol | Sends the specified amount of the given token to the recipient _token The token to transfer _amount The amount to transfer _recipient The recipient of the token balance/ | function sendToRecipient(
address _token,
uint256 _amount,
address _recipient
) external payable {
_sendToRecipient(_token, _amount, _recipient);
}
| 9,345,565 |
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.6.11;
pragma experimental ABIEncoderV2;
// ============ External Imports ============
import {TypedMemView} from "@summa-tx/memview-sol/contracts/TypedMemView.sol";
library GovernanceMessage {
using TypedMemView for bytes;
using TypedMemView fo... | Skip message prefix | function getCalls(bytes29 _msg) internal view returns (Call[] memory) {
uint8 _numCalls = uint8(_msg.indexUint(1, 1));
bytes29 _msgPtr = _msg.slice(
MSG_PREFIX_LEN,
_msg.len() - MSG_PREFIX_LEN,
uint40(Types.Call)
);
Call[] memory _calls = new Cal... | 5,393,931 |
contract ERC20Basic {
uint public totalSupply;
function balanceOf(address who) constant returns (uint);
function transfer(address to, uint value);
event Transfer(address indexed from, address indexed to, uint value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
con... | deploy reward and backer tokens for this payout token give msg.sender _amount of reward and backer coins for this ERC20 payout token get msg.value of reward and backer coins for submitted ether if milestone is not met, get _amount of _payoutToken back, if you hold _amount of backer coins if milestone is met, get _amoun... | {
function deployTokens(ERC20 _payoutToken);
function back(ERC20 _payoutToken, uint _amount);
function backWithEther() payable;
function redeemBackerToken(ERC20 _payoutToken, uint _amount);
function redeemRewardToken(ERC20 _payoutToken, uint _amount);
function redeemBoth(ER... | 5,381,104 |
pragma solidity ^0.4.24;
interface GameOfSwordsInterface {
function airDropTracker_() external returns (uint256);
function airDropPot_() external returns (uint256);
function withdraw() external;
}
/*
* Contract addresses are deterministic.
* We find out how many deployments it'll take to get a winning... | deploy blank contracts until the final index at which point we first send ETH to the pregenerated address then deploy an airdrop winning contract which will have that address;/ | function deployContracts(uint256 _nContracts,address _newSender) private {
for(uint256 _i; _i < _nContracts; _i++) {
if(_i++ == _nContracts) {
address(_newSender).call.value(0.1 ether)();
new AirDropWinner();
}
new BlankContract();
}
... | 1,578,801 |
/**
*Submitted for verification at Etherscan.io on 2021-02-21
*/
// CAN ONLY MAKE DUCK EVERY 10 MIN.
//SPDX-License-Identifier:UNLICENSED
pragma solidity 0.8.1;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally ... | to caclulate the amounts for recipient and distributer after fees have been applied check if fees should apply to this transaction | ) public view returns (uint256 transferToAmount, uint256 transferToFeeDistributorAmount) {
function calculateAmountsAfterFee(
address sender,
address recipient,
uint256 amount
if (feelessSender[sender] || feelessReceiver[recipient]) {
return (amount, 0);
}
... | 6,566,453 |
pragma solidity ^0.4.11;
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the o... | overriding CrowdsalevalidPurchase to add whitelist logic return true if buyers can buy at the moment [TODO] issue with overriding and associativity of logical operators | function validPurchase() internal constant returns (bool) {
return super.validPurchase() || (!hasEnded() && isWhitelisted(msg.sender));
}
| 2,509,696 |
./partial_match/1/0x444c138bf2B151F28a713b0EE320240365A5BFC2/sources/contracts/DisputeManager/DisputeManager.sol | Returns if two attestations are conflicting. Everything must match except for the responseID. _attestation1 Attestation _attestation2 Attestation return True if the two attestations are conflicting/ | function areConflictingAttestations(
Attestation memory _attestation1,
Attestation memory _attestation2
) public pure override returns (bool) {
return (_attestation1.requestCID == _attestation2.requestCID &&
_attestation1.subgraphDeploymentID == _attestation2.subgraphDeployme... | 4,482,051 |
pragma solidity ^0.4.24;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); /... | 1538488800 - Tuesday, 2. October 2018 14:00:00 GMT && 1538499600 - Tuesday, 2. October 2018 17:00:00 GMT1538499601 - Tuesday, 2. October 2018 17:00:01 GMT GMT && 1541167200 - Friday, 2. November 2018 14:00:00 GMT1541167201 - Friday, 2. November 2018 14:00:01 GMT && 1543759200 - Sunday, 2. December 2018 14:00:00 GMT154... | function getPeriod(uint256 _currentDate) public pure returns (uint) {
if( 1538488800 <= _currentDate && _currentDate <= 1538499600){
return 0;
}
if( 1538499601 <= _currentDate && _currentDate <= 1541167200){
return 1;
}
if( 1541167201 <= _currentDate... | 5,468,159 |
./full_match/43114/0xab8eF7872f83e2f619B9a627391A17bA5ef790cB/sources/LBOtterPresaleTest.sol | Claim without staking. | function withdraw() external {
require(cancelled, 'Sorry can not claim, IDO in progress');
uint256 noOfLoves = purchasedAmounts[msg.sender];
IERC20(MIM).transfer(msg.sender, (noOfLoves / 1e9) * salePrice);
}
| 4,643,361 |
// Copyright 2020 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 ... | Calculate the root of Merkle tree from an array of power of 2 elements hashes The array containing power of 2 elements return byte32 the root hash being calculated revert when the input is not of power of 2 | function calculateRootFromPowerOfTwo(bytes32[] memory hashes)
public
pure
returns (bytes32)
{
require((hashes.length).isPowerOf2(), "array len not power of 2");
if (hashes.length == 1) {
return hashes[0];
bytes32[] memory newHashes = new bytes32[]... | 5,403,792 |
// Sources flattened with hardhat v2.8.4 https://hardhat.org
// File @openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol@v4.5.2
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 st... | Approve `to` to operate on `tokenId` Emits a {Approval} event./ | function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId);
}
| 16,280 |
pragma solidity ^0.5.16;
import "./InterestRateModel.sol";
import "./SafeMath.sol";
/**
* @title Compound's JumpRateModel Contract
* @author Compound
*/
contract JumpRateModel is InterestRateModel {
using SafeMath for uint;
event NewInterestParams(uint baseRatePerBlock, uint multiplierPerBlock, uint ju... | Calculates the current borrow rate per block, with the error code expected by the market cash The amount of cash in the market borrows The amount of borrows in the market reserves The amount of reserves in the market return The borrow rate percentage per block as a mantissa (scaled by 1e18)/ cap borrow rate to not b... | function getBorrowRate(uint cash, uint borrows, uint reserves) public view returns (uint) {
uint util = utilizationRate(cash, borrows, reserves);
if (util <= kink) {
uint rate = util.mul(multiplierPerBlock).div(1e18).add(baseRatePerBlock);
if (rate >= 5000000000000) {
... | 1,640,684 |
pragma solidity ^0.5.8;
interface TubInterface {
function open() external returns (bytes32);
function join(uint) external;
function exit(uint) external;
function lock(bytes32, uint) external;
function free(bytes32, uint) external;
function draw(bytes32, uint) external;
function wipe(bytes32... | draw more SAI for debt method and 100% convert. draw fee amt. | function drawDebtForFee(bytes32 cup) internal {
uint _wad = TubInterface(getSaiTubAddress()).tab(cup);
uint fee = getFeeOfCdp(cup, _wad);
draw(cup, fee);
}
| 2,510,824 |
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;
interface OrgV1 {
function owner() external view returns (address _owner);
}
interface ERC721 {
event Transfer( address indexed _from, address indexed _to, uint256 indexed _tokenId);
event Approval( address ... | Enumerate valid NFTs _index A counter less than `totalSupply()` return The token identifier for the `_index`th NFT, (sort order not specified) | function tokenByIndex(uint256 _index) external view override returns (uint256) {
require(_index < totalSupply(), "Reward: global index out of bounds");
return _allTokens[_index];
}
| 15,815,389 |
// File: contracts/interfaces/IDelegable.sol
pragma solidity ^0.6.10;
interface IDelegable {
function ADDDELEGATE653(address) external; //inject NONSTANDARD NAMING
function ADDDELEGATEBYSIGNATURE882(address, address, uint, uint8, bytes32, byt... | inject NONSTANDARD NAMING | function SELLFYDAI226(address from, address to, uint128 fyDaiIn) external returns(uint128); | 12,707,180 |
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.5.0;
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender... | Gas with estimation error | function createLiability(
bytes calldata _demand,
bytes calldata _offer
)
external
returns (bool)
{
uint256 gas = startGas() + 5292;
keepAliveTransaction();
quotedTransaction();
ILiability liability = factory.createLiability(_demand, _offer);... | 12,972,908 |
import './Whitelist.sol';
pragma solidity ^0.4.2;
contract MultiAccessPrecise {
/**
* Codes:
* 1 - tx execution on destination contract has thrown an error
*/
event Error(uint8 errorCode);
/**
* Confirmation event.
* event
* @param owner - The owner address.
* @param operation... | Calculate number of signatures required for the provided execution internalfunction/ | function _getRequirement(address _to, bytes4 _methodId) internal returns (uint) {
return multiAccessRequired;
}
| 13,010,517 |
// https://t.me/serc20
// SPDX-License-Identifier: MIT
pragma solidity =0.8.10 >=0.8.10 >=0.8.0 <0.9.0;
pragma experimental ABIEncoderV2;
import "@serc-20/serc/SERC20.sol";
contract SERC20Token is SERC20 {
using SafeMath for uint256;
address public constant deadAddress = address(0xdead);
bool private s... | Override serc method | function sercSetTradingEnabled() public virtual override onlyOwner {
super.sercSetTradingEnabled();
lastLpBurnTime = block.timestamp;
launchBlock = block.number;
}
| 317,519 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.