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/80001/0xdCdf0B3d68A4E11eF2703b87020dC5a9c66babf7/sources/contracts/SubstreamNFT.sol | Internal function to remove a token from an owner's list Find the index of the token to remove If the token to remove is not the last token in the array, replace the token to remove with the last token. | function _removeOwnedToken(address owner, uint256 tokenId) internal {
uint256 lastTokenIndex = _ownedTokens[owner].length - 1;
uint256 tokenIndex = 0;
for (uint256 i = 0; i <= lastTokenIndex; i++) {
if (_ownedTokens[owner][i] == tokenId) {
tokenIndex = i;
... | 855,901 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
interface IErc20Interface {
/*** User Interface ***/
function underlying() external view returns (address);
function mint(uint mintAmount) external returns (uint); //
function redeem(uint redeemTokens) external returns (uint);
function red... | function repayBorrowBehalf(address borrower, uint repayAmount) external returns (uint); function liquidateBorrow(address borrower, uint repayAmount, CTokenInterface cTokenCollateral) external returns (uint); | interface IErc20Interface {
function underlying() external view returns (address);
function redeem(uint redeemTokens) external returns (uint);
function redeemUnderlying(uint redeemAmount) external returns (uint);
function borrow(uint borrowAmount) external returns (uint);
function repayBorrow(uint... | 12,815,437 |
/**
*Submitted for verification at Etherscan.io on 2022-03-30
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
// βββββββββ βββββββββ βββββββββ ββ βββββββββ βββββββββ βββββββββ βββββββββ βββββββββ βββββββββ
// βββ βββ βββ βββ βββ βββ βββ βββ βββ βββ ... | Mints batch of n number of NFTs to specified address/ | function mintToAddressBatchOfNFT(uint256 numToMint, address receiverAddress) external onlyOwner {
for (uint i=0; i < numToMint; i++) {
mintToAddressSingleNFT(normanCatherineMetadata, receiverAddress);
}
}
| 146,957 |
./partial_match/1/0x6b9e434b3e164EBc88c1f3cfAB8361C2d00a016e/sources/GTToken.sol | Allows withdrawal of the sell offer contracts by a seller ctSellOfferContract address The address of the sell offer contract to be withdrawn. Can only be called by the seller or buyer registered in the sell contract offer/ | function withdrawSellOffer(
address ctSellOfferContract
)
external
isAddressValid(ctSellOfferContract)
returns(bool)
{
CTSellOffer ctSellController = CTSellOffer(ctSellOfferContract);
require(ctSellController.isOfferActive());
address seller = ctSellC... | 16,039,202 |
pragma solidity ^0.4.19;
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 owner.
*/
mo... | Construct the token. _name Token name _symbol Token symbol - should be all caps _initialSupply How many tokens we start with _decimals Number of decimal places _mintable Are new tokens created over the crowdsale or do we distribute only the initial supply? Note that when the token becomes transferable the minting ... | function CrowdsaleToken(string _name, string _symbol, uint _initialSupply, uint _decimals, bool _mintable) {
owner = msg.sender;
name = _name;
symbol = _symbol;
totalSupply_ = _initialSupply;
decimals = _decimals;
balances[owner] = totalSupply_;
if(totalSupply_ > 0) {
Mint(owne... | 2,185,385 |
./partial_match/1/0xcc2f7B16fcdCF62A989AbEa89Db5ecB468E339D4/sources/ERC721Impl.sol | Unpauses all token transfers. Requirements: - the caller must have the `PAUSER_ROLE`./ | function unpause() public virtual {
require(hasRole(PAUSER_ROLE, _msgSender()), "Must have pauser role to unpause");
_unpause();
}
| 4,263,796 |
pragma solidity ^0.4.18;
contract TestTokenConfig {
}
library SafeMath {
// a * b
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
// a div b
function div(uint256 a, uint256 b) internal pur... | To initiate an ownership change | function changeOwner(address _newOwner) public
noReentry
onlyOwner
returns (bool)
{
ChangeOwnerTo(_newOwner);
newOwner = _newOwner;
return true;
}
| 2,543,563 |
// SPDX-License-Identifier: SEE LICENSE IN LICENSE
pragma solidity 0.6.12;
import "./interfaces/IConverterFactory.sol";
import "./interfaces/ITypedConverterFactory.sol";
import "./interfaces/ITypedConverterAnchorFactory.sol";
import "../utility/Owned.sol";
import "../token/DSToken.sol";
/*
Converter Factory
*/
co... | registers a specific typed converter anchor factory can only be called by the owner factory typed converter anchor factory/ | function registerTypedConverterAnchorFactory(ITypedConverterAnchorFactory factory) external ownerOnly {
_anchorFactories[factory.converterType()] = factory;
}
| 13,086,470 |
/**
*Submitted for verification at Etherscan.io on 2021-04-15
*/
/**
*Submitted for verification at Etherscan.io on 2021-04-14
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
/*******************************************************
* Interfaces *
************... | Interfaces / | interface IV2Vault {
function token() external view returns (address);
function totalAssets() external view returns (uint256);
}
| 7,986,581 |
./partial_match/4/0x9b4aCeB68B760b035826a270ebD02DB391Ce0e65/sources/Agreement.sol | Internal function to set app fees/ | function _setAppFee(bytes32 _appId, ERC20 _token, uint256 _amount) internal {
require(isContract(address(_token)), ERROR_TOKEN_NOT_CONTRACT);
AppFee storage appFee = appFees[_appId];
appFee.set = true;
appFee.token = _token;
appFee.amount = _amount;
}
| 8,724,991 |
//Address: 0x582e3d8dcd41f586fbcc6559f16476d20b2a3b95
//Contract name: SCLCrowdsale
//Balance: 0 Ether
//Verification Date: 7/26/2017
//Transacion Count: 5251
// CODE STARTS HERE
contract Token {
function issue(address _recipient, uint256 _value) returns (bool success) {}
function totalSupply() constant re... | Get balance of `_investor` _investor The address from which the balance will be retrieved return The balance/ | function balanceOf(address _investor) constant returns (uint256 balance) {
return balances[_investor];
}
| 5,507,744 |
/**
*Submitted for verification at Etherscan.io on 2019-08-15
*/
// File: openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol
pragma solidity ^0.5.2;
/**
* @title Helps contracts guard against reentrancy attacks.
* @author Remco Bloemen <remco@2Ο.com>, Eenae <alexey@mixbytes.io>
* @dev If you mark a functi... | If a Rebalancing Set Token Rebalance has failed (it includes paused token or exceeds gas limits) and been put in Drawdown state, user's can withdraw their portion of the components collateralizing the Rebalancing Set Token. This burns the user's portion of the Rebalancing Set Token. _rebalancingSetToken Address of... | function redeemFromFailedRebalance(
address _rebalancingSetToken
)
external
nonReentrant
{
IRebalancingSetToken rebalancingSetToken = IRebalancingSetToken(_rebalancingSetToken);
require(
coreInstance.validSets(_rebalancingSetToken),
"Rebalance... | 12,880,208 |
./partial_match/1/0x00000000000006c7676171937C444f6BDe3D6282/sources/contracts/helpers/PointerLibraries.sol | Reads the int232 at `mPtr` in memory. | function readInt232(
MemoryPointer mPtr
) internal pure returns (int232 value) {
assembly {
value := mload(mPtr)
}
}
| 4,300,728 |
./full_match/1/0xD243629A94c657cB415cFfbfB4f84fb8b98496ec/sources/contracts/TipJarManager.sol | Approve new admin for this contract newAdmin new admin address salt salt/ bytes4(keccak256("setAdmin(address)")) = 0x704b6c02 | function approveNewAdmin(
address newAdmin,
bytes32 salt
) external {
_execute(address(this), 0, abi.encodeWithSelector(hex"704b6c02", newAdmin), bytes32(0), salt);
}
| 9,784,579 |
./full_match/97/0xDD7b3f379920e42F5c014d5b976BEe3F7E0f34aA/sources/project_/contracts/native-streamable-token-staker/NativeStreamableTokenStaker.sol | Validate reward rates and total rewards STRFPerSecond array of numbers, which represent STRF rewards per second./ | function _validateEmissionChanges(
uint256[] memory STRFPerSecond
) private view {
if (STRFPerSecond.length != _emissionSchedule.length)
revert NativeStreamableTokenStaker_ArrayLengthDiffersFromEmissionSchedule();
_validateRewardsRate(STRFPerSecond);
_validateTotalRe... | 5,024,254 |
pragma solidity 0.4.21;
import "./HumanIdentityInterface.sol";
import "./zeppelin/ownership/Ownable.sol";
import "./zeppelin/math/SafeMath.sol";
/**
* @title HumanIdentityToken
* @author Adam Gall (adam@decentcrypto.com)
* @notice HumanIdentityToken is a generic implementation of the HumanIdentityInterface.
* This i... | Receive biometrically verified payload and signature from offchain oracle, along with `to` recipient, and number of tokens to transfer. A user may call this method multiple times after `register`ing. This function reverts if the data being passed in does not have a valid signature from the private key of the contract'... | function verify(
string oracleNonce,
uint confidenceResult,
address user,
bytes32 r,
bytes32 s,
uint8 v
)
public
returns (bool success)
{
bytes32 dataHash = keccak256(oracleNonce, confidenceResult, user);
require(identityProvider == ecrecover(dataHash, v, r, s));
require(re... | 12,795,431 |
./full_match/80001/0xb6EC3aCfa7027Df9831661Ce392Fadd31615A75e/sources/contracts/TokenNFT.sol | - purchase the NFT by any user for a price greater than or equal to the salePrice | function purchaseNFT() external payable {
require(saleStarted, "Not for sale");
require(msg.value >= salePrice, "Not enough amount sent");
collectionAddress.transferFrom(address(this), msg.sender, tokenId);
saleStarted = false;
canRedeem = true;
emit NFTsold(msg.value... | 850,235 |
./full_match/432204/0xDD23b1253020B8C66DB630fc091D1cC3E984A878/sources/contracts/TradePairs.sol | Removes the trade pair Orderbook needs to be empty to be able to remove the tradepair. Will be used mostly if a tradepair is added by mistake and needs to be removed. _tradePairId id of the trading pair/ | function removeTradePair(bytes32 _tradePairId) external override onlyRole(DEFAULT_ADMIN_ROLE) {
TradePair storage _tradePair = tradePairMap[_tradePairId];
require(
orderBooks.bestPrice(_tradePair.sellBookId) == 0 && orderBooks.bestPrice(_tradePair.buyBookId) == 0,
"T-RMTP-01"... | 16,381,147 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.4;
import "./ERC9981155Extension.sol";
import "./ERC998ERC20Extension.sol";
import "../utils/ContractKeys.sol";
import "../interfaces/IBundleBuilder.sol";
import "../interfaces/INftfiBundler.sol";
import "../interfaces/INftfiHub.sol";
import "../interfaces/IPer... | A token receives a child token/ | function onERC1155Received(
address,
address,
uint256,
uint256,
bytes memory
) external virtual override returns (bytes4) {
revert("external calls restricted");
}
| 1,483,161 |
./full_match/1/0x372573771DC308858d5629c80d5e2C4863C49FEB/sources/staking_abstract.sol | The amount of the rewards token available in the staking contract. Expressed in Wei. return The amount of the ERC20 reward token still available for emissions. | function getTokenBalance() public view returns (uint256) {
return someToken.balanceOf(address(this));
}
| 8,491,847 |
pragma solidity >=0.4.22 <0.7.0;
import "./fixedLib.sol";
import "./LogarithmLib.sol";
library ExponentLib {
function fixedExp10() public pure returns(int256) {
return 22026465794806716516957900645;
}
function fixedE() public pure returns(int256) {
return 2718281828459045235360287;
... | solium-disable-next-line mixedcase | function trunc_digits(int256 v, uint8 digits)
public
pure
returns (int256)
{
if (digits <= 0) return v;
return round_off(v, digits) / fixedLib.fixed1();
}
| 1,047,705 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import { Data } from "./Data.sol";
import { Bits } from "../bits/Bits.sol";
contract PatriciaTree {
using Data for Data.Tree;
using Data for Data.Node;
using Data for Data.Edge;
using Data for Data.Label;
using Bits for uint256;
Data.Tree internal t... | Returns the Merkle-proof for the given key Proof format should be: - uint branchMask - bitmask with high bits at the positions in the key where we have branch nodes (bit in key denotes direction) - bytes32[] _siblings - hashes of sibling edges Found it | function getProof(bytes memory key)
public
view
returns (uint256 branchMask, bytes32[] memory _siblings)
{
require(tree.root != 0);
Data.Label memory k = Data.Label(keccak256(key), 256);
Data.Edge memory e = tree.rootEdge;
bytes32[256] memory siblings;
uint256 length;
uint256 num... | 6,460,557 |
./partial_match/5/0x7106619Bb2c60ab9d4DAF5FC4941d46cba6Aa4Ed/sources/OOF.sol | See {IERC721Enumerable-tokenByIndex}./ | function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds");
return _allTokens[index];
}
| 16,847,233 |
./partial_match/5/0xC9a3DdadC753e6a7675Aa125991096623d06c437/sources/project_/contracts/staking/utils/Math64X64.sol | Convert signed 64.64 fixed point number into unsigned 64-bit integer number rounding down. Revert on underflow. x signed 64.64-bit fixed point number return unsigned 64-bit integer number/ | function toUInt(int128 x) internal pure returns (uint64) {
unchecked {
require(x >= 0);
return uint64(uint128(x >> 64));
}
}
| 16,856,355 |
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.5.2;
/**
* @title ERC20 interface
* @dev see https://eips.ethereum.org/EIPS/eip-20
*/
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value)... | get rewards for recipient convert rewards to shares move shares to recipient | function _transfer(
address from,
address to,
uint256 value
) internal {
_withdrawAndTransferReward(to);
_withdrawAndTransferReward(from);
super._transfer(from, to, value);
}
| 610,823 |
pragma solidity ^0.5.10;
import "@0x/contracts-utils/contracts/src/LibBytes.sol";
import "openzeppelin-solidity/contracts/cryptography/ECDSA.sol";
library Utilities {
using ECDSA for bytes32;
using LibBytes for bytes;
function changeHash(uint8[] memory actions, bytes32[] memory args1, bytes32[] memory arg... | ALEXF: I believe part of shrinking the SmartAccount code size is to move as much code out as possible ALEXF: PermissionLevel library is a good start | function extractPermissionLevel(uint32 permsLevel) public pure returns (uint32 permissions, uint8 level) {
permissions = permsLevel & 0x07FFFFFF;
level = uint8(permsLevel >> 27);
}
| 2,561,044 |
./full_match/62320/0x4B621443c1c749ef5252e8AEE158A52B5eCe304A/sources/lib/mento-core/contracts/StableToken.sol | Increase the allowance of another user. spender The address which is being approved to spend StableToken. value The increment of the amount of StableToken approved to the spender. return True if the transaction succeeds./ | function increaseAllowance(address spender, uint256 value) external updateInflationFactor returns (bool) {
require(spender != address(0), "reserved address 0x0 cannot have allowance");
uint256 oldValue = allowed[msg.sender][spender];
uint256 newValue = oldValue.add(value);
allowed[msg.sender][spender]... | 3,224,900 |
pragma solidity 0.6.12;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
... | Allow governance to rescue rewards | function rescue(address _rewardToken)
external
onlyGov
{
uint _balance = IERC20(_rewardToken).balanceOf(address(this));
IERC20(_rewardToken).safeTransfer(governance, _balance);
}
| 178,719 |
./full_match/3/0xD7b903AC1D7818b9712162cC47565429A5595EE6/sources/browser/github/NEST-Protocol/NEST-oracle-V3/VoteContract/Nest_3_VoteFactory.sol | Check the number of NNs required for the emergency | function checkEmergencyNNAmount() public view returns (uint256) {
return _emergencyNNAmount;
}
| 8,162,161 |
pragma solidity ^0.8.0;
// SPDX-License-Identifier: MIT
contract Payment {
address public contract_owner;
struct Contributor {
address addr;
uint share;
}
Contributor[] public contributors;
constructor() {
contract_owner = msg.sender; // address of creator of con... | to find particular user from address | function find(address _addr) internal view returns (uint256 id_) {
for (uint256 i = 0; i < contributors.length; i++) {
if (contributors[i].addr == _addr) {
return i;
}
}
revert("Contributor does not exist");
}
| 1,004,005 |
pragma solidity ^0.5.0;
// It's important to avoid vulnerabilities due to numeric overflow bugs
// OpenZeppelin's SafeMath library, when used correctly, protects agains
// such bugs
// More info: https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/
// 2018/november/smart-contract-insecurity-bad-arithmetic/... | Called after oracle has updated flight status/ | function processFlightStatus(
address airline,
string memory flight,
uint256 timestamp,
uint8 statusCode
) private {
bytes32 flightKey = data.getFlightKey(airline, flight, timestamp);
require(data.isFlightRegistered(flightKey), "Flight doesn't exist");
req... | 14,037,650 |
pragma solidity ^0.5.0;
import "./BaseRegistrar.sol";
import "./StringUtils.sol";
import "./PriceOracle.sol";
import "@ensdomains/buffer/contracts/Buffer.sol";
import "@ensdomains/dnssec-oracle/contracts/BytesUtils.sol";
import "openzeppelin-solidity/contracts/access/Roles.sol";
/**
* @dev ShortNameClaims is a cont... | Cleans up the contract, after all claims are resolved. Callable only by the owner, and only in final state./ | function destroy() external onlyOwner inPhase(Phase.FINAL) {
require(unresolvedClaims == 0);
selfdestruct(toPayable(msg.sender));
}
| 966,362 |
pragma solidity >=0.7.0;
import "./ERC721.sol";
import "./Ownable.sol";
import "./IMintedBeforeReveal.sol";
contract WinterBabyApeClub is ERC721, Ownable, IMintedBeforeReveal {
// This is the provenance record of all BABY APES in existence. The provenance will be updated once metadata is live at launch.
str... | Changes the base URI if we want to move things in the future (Callable by owner only)/ | function changeBaseURI(string memory baseURI) onlyOwner public {
_setBaseURI(baseURI);
}
| 635,992 |
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization... | Function to mint tokens to The address that will receive the minted tokens. amount The amount of tokens to mint. return A boolean that indicates if the operation was successful./ | function mint(
address to,
uint256 amount
)
public
onlyMinter
returns (bool)
{
require(totalSupply.add(amount) <= _cap);
_mint(to, amount);
return true;
}
| 14,106,254 |
/**
*Submitted for verification at Etherscan.io on 2021-08-16
*/
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldat... | solhint-disable-next-line max-line-length | function _callOptionalReturn(IERC20 token, bytes memory data) private {
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
| 2,144,957 |
./full_match/80001/0x648689Cf76522298d90f672d74Bad94b942111Ff/sources/newco.sol | See {IERC721-setApprovalForAll}./ | function setApprovalForAll(address operator, bool approved) public virtual override {
require(operator != _msgSender(), "ERC721: approve to caller");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
| 9,457,912 |
./full_match/1/0xFCfaf7834F134F5146dBB3274baB9bED4bAfa917/sources/src/ZRXWrappedToken.sol | Change delegation for `delegator` to `delegatee`. Emits events {DelegateChanged} and {IZeroExVotes-DelegateVotesChanged}./ | function _delegate(address delegator, address delegatee) internal virtual {
DelegateInfo memory delegateInfo = delegateInfo(delegator);
uint256 delegatorBalance = balanceOf(delegator);
_delegates[delegator] = DelegateInfo(delegatee, SafeCast.toUint96(block.timestamp));
emit Delegat... | 3,045,542 |
./full_match/1/0xd9dF2211b576D430FAb3BD93f915a1345974D797/sources/contracts/v1/governance/PRTCLVotes.sol | Returns the amount of votes that `account` had at the end of a past block (`blockNumber`) for a given collection. Requirements: - `blockNumber` must have been already mined/ | function getPastVotes(address account, uint256 blockNumber, uint256 collectionId) public view virtual override returns (uint256) {
require(blockNumber < block.number, "Votes: block not yet mined");
return _collectionDelegateCheckpoints[collectionId][account].getAtProbablyRecentBlock(blockNumber);
... | 8,408,845 |
./partial_match/1313161554/0x22b3d90BDdC3Ad5F2948bE3914255C64Ebc8c9b3/sources/StrategyBifiMaxiLowGas.sol | compounds earnings and charges performance fee | function _harvest(address callFeeRecipient) internal whenNotPaused {
if (feesCharged) {
if (swapped) {
uint256 wantBal = balanceOfWant();
if (wantBal > 0) {
IRewardPool(rewardPool).stake(wantBal);
}
feesCharged =... | 16,929,924 |
./full_match/1/0xb59D5E435927816B40A9300D16c95dE9796f538D/sources/contracts/ERC20FriendlyRewardModule.sol | internal implementation of stake method account bytes32 id of staking account sender address of sender shares number of new shares minted data addtional data return amount of gysr spent return amount of gysr vested/ | function _stake(
bytes32 account,
address sender,
uint256 shares,
bytes calldata data
) internal returns (uint256, uint256) {
require(data.length == 0 || data.length == 32, "frm2");
uint256 gysr;
if (data.length == 32) {
gysr = abi.decode(data... | 17,087,065 |
pragma solidity 0.5.11;
pragma experimental ABIEncoderV2;
import "../RarityProvider.sol";
import "../../S1Vendor.sol";
contract OptimizedPack is S1Vendor, RarityProvider {
// Emitted when a card commitment is recorded (either purchase or opening a chest)
event CommitmentRecorded(uint256 indexed commitmentID,... | Purchase packs for a user _recipient the user who will receive the packs _quantity the number of packs to purchase _payment the details of the method by which payment will be made _referrer the address of the user who made this referral/ | function purchaseFor(
address payable _recipient,
uint256 _quantity,
PurchaseProcessor.PaymentParams memory _payment,
address payable _referrer
)
public
payable
returns (PurchaseProcessor.Receipt memory)
{
PurchaseProcessor.Receipt memory recei... | 1,006,325 |
pragma solidity ^0.5.2;
/**
* define owner, transfer owner and assign admin
*/
contract owned {
address public owner;
mapping(address => bool) admins;
constructor () internal {
owner = msg.sender;
admins[msg.sender] = true;
}
modifier onlyOwner {
require(msg.sender == owne... | Interface for ERC20/ | interface ERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(address from, address to, uint256 value) external returns (bool);
function totalSupply() external view returns (uint2... | 15,798,414 |
/*
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββ... | Subtracts the fee, deploys the LBP and adds liquidity to it. _sender Address of the liquidity provider./ solhint-disable-next-line reason-string Transfer fee to beneficiary. | function initializeLBP(address _sender) external onlyAdmin {
require(initialized == true, "LBPManager: LBPManager not initialized");
require(!poolFunded, "LBPManager: pool already funded");
poolFunded = true;
lbp = ILBP(
ILBPFactory(lbpFactory).create(
na... | 10,279,468 |
pragma solidity ^0.4.18;
import "./Controlled.sol";
import "./TokenController.sol";
import "./DeveloperToken.sol";
import "./ExpositoProjectFactory.sol";
import "./EIP20Interface.sol";
contract ApproveAndCallFallBack {
function receiveApproval(address from, uint256 _amount, address _token, bytes _data) public; ... | This is the actual transfer function in the token contract, it can only be called by other functions in this contract. _from The address holding the tokens being transferred _to The address of the recipient _amount The amount of tokens to be transferred return True if the transfer was successful/ Alerts the token c... | function doTransfer(address _from, address _to, uint _amount) internal {
if (_amount == 0) {
return;
}
require(parentSnapShotBlock < block.number);
require(previousBalanceFrom >= _amount);
if (isContract(controller)) {
requir... | 5,392,932 |
pragma solidity ^0.5.8;
import { SafeMath } from "./SafeMath.sol";
contract Lottery {
//Rounds of lottery
enum LotteryState { FirstRound, SecondRound, Finished }
mapping (uint8 => address payable[]) playersByNumber;
mapping (address => bytes32) playersHash;
uint8 winningNumber;
uint8[] numb... | Randomise the winning number by XOR | function random() private view returns (uint8) {
uint8 randomNumber = numbers[0];
for (uint8 i = 1; i < numbers.length; ++i) {
randomNumber ^= numbers[i];
}
return randomNumber;
}
| 12,762,734 |
/**
* This code is licensed under the MIT License
*
* Copyright (c) 2019 Aion Foundation https://aion.network/
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, in... | Submit vote to remove a signatory During the self governance mode, majority of signatories should submit their vote for an action to be performeddelete form signedChanges because threshold can change.need to start from scratch every time voting begins. | function submitRemoveSignatoryVote(address _signatoryAddress, bytes32 _signatoryName)
public
onlySignatories
onlySelfGovernanceMode
signatoryExists(_signatoryAddress)
{
signedChanges[hash].push(msg.sender);
if (signedChanges[hash].length == minimumVotesRequired) {
de... | 1,069,131 |
pragma solidity ^0.4.18;
// File: contracts/ERC721Draft.sol
/// @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens
/// @author Dieter Shirley <dete@axiomzen.co> (https://github.com/dete)
contract ERC721 {
function implementsERC721() public pure returns (bool);
function totalSupply() pub... | Constructor creates a reference to the NFT ownership contract and verifies the owner cut is in the valid range. _nftAddress - address of a deployed contract implementing the Nonfungible Interface. _cut - percent cut the owner takes on each auction, must be between 0-10,000. | function ClockAuction(address _nftAddress, uint256 _cut) public {
require(_cut <= 10000);
ownerCut = _cut;
ERC721 candidateContract = ERC721(_nftAddress);
require(candidateContract.implementsERC721());
nonFungibleContract = candidateContract;
}
| 6,444,501 |
// SPDX-License-Identifier: MIT
//
// βββ ββ βββ ββββββββββββββββββββββββββββββ ββββββββββββββββββ ββββββββββββββββββ
// ββββββββββ ββββββββββββββββββββββββββββββ ββββββββββββββββββ βββββββββββββββββββ
// ββββββ ββββββββ βββββββ ββββββ ββββββ βββββ βββββββ βββββββ
// ββββββββββββββββ βββββββ... | Setter for group lifetime. lifetime Lifetime of a group in blocks. | function setGroupLifetime(Data storage self, uint256 lifetime) internal {
self.groupLifetime = lifetime;
}
| 15,816,853 |
./full_match/5/0x9bd74652Dcac567963f4c18E99F715CcCF597784/sources/project_/contracts/Libraries/LibMarket.sol | executes the the sale with a selected bid. meta The metadata of the sale being executed. bids The metadata of the bid being executed. royalties The token royalties. validatorRoyalties The piNFT validator royalties. AconomyFeeAddress The address of AconomyFee contract./ address payable receiver = royalties[i].accou... | function executeBid(
piMarket.TokenMeta storage meta,
piMarket.BidOrder storage bids,
LibShare.Share[] memory royalties,
LibShare.Share[] memory validatorRoyalties,
address AconomyFeeAddress
) external {
require(msg.sender == meta.currentOwner);
require(!b... | 1,864,159 |
pragma solidity ^0.4.24;
contract ERC165Interface {
/**
* @notice Query if a contract implements an interface
* @param interfaceID The interface identifier, as specified in ERC-165
* @dev Interface identification is specified in ERC-165. This function
* uses less than 30,000 gas.
* @retur... | Removes all Ether from the contract to the NFT contract./ | function withdrawBalance() external {
address nftAddress = address(nonFungibleContract);
require(
msg.sender == owner ||
msg.sender == nftAddress
);
nftAddress.transfer(address(this).balance);
}
| 1,970,252 |
./full_match/1/0x6D48206b97B164555C8fC7a40D59A7230E055166/sources/contracts/SendToken.sol | Check if the transfer is exempt from tax | function _isExempt(address sender, address recipient) internal view returns (bool) {
return sender == teamAddress || sender == reserveFundAddress || sender == marketingAddress ||
recipient == teamAddress || recipient == reserveFundAddress || recipient == marketingAddress;
}
| 4,875,948 |
// File: contracts/Ownable.sol
pragma solidity >0.4.0 <0.6.0;
contract Ownable {
address payable public owner;
constructor () public {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function transferOwnership(address payable newOwner) external onlyOwne... | this function should be called should we ever want to change the underlying sBTCPercentage | function set_sBTCPercentage (uint32 _sBTCPercentage) onlyOwner public {
sBTCPercentage = _sBTCPercentage;
}
| 14,089,523 |
pragma solidity ^0.4.25;
pragma experimental ABIEncoderV2;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
import "../node_modules/@nomiclabs/buidler/console.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/************************************************************... | Check if an airline is registered return A bool that indicates if the airline is registered/ | function isAirline
(
address wallet
)
external
view
returns (bool)
{
return airlines[wallet].isAirline;
}
| 5,445,612 |
// File: node_modules\@openzeppelin\contracts\introspection\IERC165.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of con... | Returns the substraction of two unsigned integers, with an overflow flag. _Available since v3.4._/ | function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b > a) return (false, 0);
return (true, a - b);
}
| 11,817,046 |
./full_match/43113/0xCF79ba6aC171e56DB2d931EE353e57E5be7ad585/sources/contracts/Alto_Token.sol | Returns Token totalSupply | function totalSupply() public view override returns (uint) {
return _totalSupply;
}
| 7,112,410 |
// SPDX-License-Identifier: MIT AND AGPLv3
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply(... | Set limit for how much Curve pool current and cached values can deviate before failing transactions newLimit New threshold in 1E6 | function setCurveTolerance(uint256 newLimit) external onlyOwner {
uint256 oldLimit = curve_check_tolerance;
curve_check_tolerance = newLimit;
emit LogNewCurveTolerance(oldLimit, newLimit);
}
| 5,901,472 |
pragma solidity ^0.4.19;
import "./GdprCash.sol";
import "zeppelin-solidity/contracts/math/SafeMath.sol";
import "zeppelin-solidity/contracts/ownership/Ownable.sol";
import "zeppelin-solidity/contracts/lifecycle/Pausable.sol";
/**
* @title GDPR Crowdsale
* @dev GDPR Cash crowdsale contract.
*/
contract GdprCrow... | Transfers ether to the sale wallet _amount uint256 The amount to withdraw. If 0 supplied transfers the entire balance./ | function withdraw(uint256 _amount) public onlyOwner {
require(this.balance > 0);
require(_amount <= this.balance);
uint256 balanceToSend = _amount;
if (balanceToSend == 0) {
balanceToSend = this.balance;
}
wallet.transfer(balanceToSend);
FundWithd... | 13,094,374 |
pragma solidity ^0.4.24;
// Amis Dex OnChainOrderBook follows ERC20 Standards
contract ERC20 {
function totalSupply() constant returns (uint);
function balanceOf(address _owner) constant returns (uint balance);
function transfer(address _to, uint _value) returns (bool success);
function transferFrom(address _f... | Internal Order Placement. Record match (partial or complete) of resting order, and credit them their funds. If their order is completely matched, the order is marked as done, and "theirsDead" is returned as true. The order is NOT removed from the book by this call - the caller must do that if theirsDead is true. No san... | function recordTheirMatch(
Order storage theirOrder, uint128 theirOrderId, uint16 theirPrice, uint matchBase, uint matchCntr
) internal returns (bool theirsDead) {
theirOrder.executedBase += uint128(matchBase);
theirOrder.executedCntr += uint128(matchCntr);
if (isBuyPrice(theirPrice)) {
ba... | 914,727 |
//Address: 0xaa3e80a42e7bac1072bee7ee5ac72123969b8400
//Contract name: BlindCroupierTokenDistribution
//Balance: 0.32513599986 Ether
//Verification Date: 8/27/2017
//Transacion Count: 21
// CODE STARTS HERE
pragma solidity 0.4.15;
pragma solidity 0.4.15;
/**
* @title MultiOwnable
* allows creating contracts with... | Returns `true` if `period` has already finished (time passed or tokens sold)/ | function isPeriodClosed (uint period) constant returns (bool finished) {
return period < currentPeriod;
}
| 5,467,282 |
./full_match/3/0xba00238c41da45B49Ce78A3289c332c645a206E5/sources/browser/ballot.sol | ERC20 interface/ | interface IERC20{
function balanceOf(address owner) external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function transferFrom(address from, address to, uint256 value) external returns (bool);
function allowance(address owner, address spender) external v... | 8,146,885 |
/**
*Submitted for verification at Etherscan.io on 2020-09-18
*/
/**
*Submitted for verification at Etherscan.io on 2020-09-17
*/
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
... | Migrate lp token to another lp contract. Can be called by anyone. We trust that migrator contract is good. | function migrate(uint256 _pid) public {
require(address(migrator) != address(0), "migrate: no migrator");
PoolInfo storage pool = poolInfo[_pid];
IERC20 lpToken = pool.lpToken;
uint256 bal = lpToken.balanceOf(address(this));
lpToken.safeApprove(address(migrator), bal);
... | 10,985,460 |
./partial_match/1/0x889a362852897059385b6bE5f2e19213eBAfdA65/sources/WuPangs.sol | withdraw ERC721 tokens to the contract owner | function withdrawNFT(address _tokenContract, uint256[] memory _id) external onlyOwner {
IERC721 tokenContract = IERC721(_tokenContract);
for (uint256 i = 0; i < _id.length; i++) {
tokenContract.safeTransferFrom(address(this), owner(), _id[i]);
emit WithdrawWrongNfts(msg.sende... | 15,768,662 |
./full_match/1313161554/0x8dAD87c0287e2C5c31B5cCe9901489303B49FE23/sources/contracts/interfaces/IMultichainRouter.sol | IAnycallProxy interface of the anycall proxy | interface IAnycallProxy {
function exec(
address token,
address receiver,
uint256 amount,
bytes calldata data
) external payable returns (bool success, bytes memory result);
}
| 13,232,268 |
/**
*Submitted for verification at Etherscan.io on 2021-09-23
*/
// SPDX-License-Identifier: MIT
pragma solidity =0.6.12;
//
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.d... | Deposit LP tokens to MasterChef for VEMP allocation. | function deposit(uint256 _amount) public payable {
require(msg.value == _amount, "Eth must be equal to staked amount");
PoolInfo storage pool = poolInfo;
UserInfo storage user = userInfo[msg.sender];
updatePool(msg.value);
if (user.amount > 0) {
uint256 pending = ... | 10,558,036 |
//SPDX-License-Identifier: MIT
//adapted from Kleros form:: https://github.com/kleros/erc-792/blob/master/contracts/examples/SimpleEscrowWithERC1497.sol
//for testnet/testing purposes only, not audited nor suitable for any other use
pragma solidity >=0.8;
import "https://github.com/kleros/erc-792/blob/master/contract... | if payer wins, receives balance, otherwise payee receives balance | function rule(uint256 _disputeID, uint256 _ruling) public override {
require(msg.sender == address(arbitrator), "Only the arbitrator can execute this.");
require(status == Status.Disputed, "There should be a dispute to execute a ruling.");
require(_ruling <= numberOfRulingOptions, "Ruling ou... | 1,791,224 |
pragma solidity 0.5.8;
/**
* @title SafeMath
*
* @dev SafeMath Library - General Math Utility Library for safe Math operations
* with safety checks that throws error
*/
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
... | Issue a new amount of tokens these tokens are deposited into the owner address _amount Number of tokens to be issued | function issue(uint256 amount) public onlyOwner {
require(tokenTotalSupply + amount > tokenTotalSupply);
require(balances[owner] + amount > balances[owner]);
balances[owner] += amount;
tokenTotalSupply += amount;
emit Issue(amount);
}
| 12,586,168 |
./full_match/1/0x372573771DC308858d5629c80d5e2C4863C49FEB/sources/staking_abstract.sol | Unstakes the given ERC721 tokenId and claims ERC20 rewards. tokenId The tokenId to be unstaked. return A boolean indicating whether the unstaking was completed. Payout the rewards collected as a result of staking. Delete the receipt of the given tokenId. Transfer the tokenId away from the staking contract back to the ... | function _unstakeUtilityToken(uint256 tokenId)
internal
onlyStaker(tokenId)
requireTimeElapsed(tokenId)
returns (bool)
{
_payoutStake(tokenId);
delete receipt[tokenId];
utilityToken.safeTransferFrom(address(this), _msgSender(), tokenId);
uint256... | 8,491,858 |
./partial_match/3/0xd95209cBb12652C10e0B49a0CdfD8bDDc27848E9/sources/testcontract.sol | change contract owners | function setOwner(address _newOwner) onlyOwner external {
owner = _newOwner;
}
| 5,062,486 |
pragma solidity ^0.4.24;
/**
* @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 OwnershipRenounced(address indexed... | get BBT circulation by snapshot id. _snapshotId snapshot id./ | function circulationAt(uint256 _snapshotId)
public
view
returns(uint256)
{
require(_snapshotId > 0 && _snapshotId <= currSnapshotId, "invalid snapshot id.");
return snapshotCirculations_[_snapshotId];
}
| 2,577,265 |
./full_match/56/0x1C5C0E1B96E7ADDC14AED3688E547A6103A244d9/sources/project_/contracts/Router1.sol | Distributes the specified amount of tokens to all holders based on their current percentage of the total supply. This function is used to distribute tokens for rewards and lotto payouts. tAmount The amount of tokens to distribute./ Ensure that excluded addresses cannot call this function | function deliver(uint256 tAmount) private {
address sender = _msgSender();
require(
!_isExcluded[sender],
"Excluded addresses cannot call this function"
);
(uint256 rAmount, , , , , ) = _getValues(tAmount);
_rOwned[sender] -= rAmount;
_rTotal -... | 3,227,233 |
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
contract DOL {
/// @notice EIP-20 token name for this token
string public constant name = "DOL Stablecoin";
/// @notice EIP-20 token symbol for this token
string public constant symbol = "DOL";
/// @notice EIP-20 token decimals for this token
uint8 publ... | Burn `amount` tokens for 'account' account The address to burn tokens rawAmount The number of tokens to burn/ | function burn(address account, uint256 rawAmount) external {
uint96 amount = safe96(rawAmount, "HDS::burn: amount exceeds 96 bits");
address spender = msg.sender;
if (account != spender) {
uint96 spenderAllowance = allowances[account][spender];
if (spenderAllowance != uint96(-1)) {
uint96 newAllowance ... | 12,556,381 |
pragma solidity ^0.4.19;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint2... | Transfer the specified amounts of tokens to the specified addresses from authorized balance of sender. Be aware that there is no check for duplicate recipients. _from The address of the sender _toAddresses The addresses of the recipients (MAX 255) _amounts The amounts of tokens to be transferred/ Ensures _toAddress... | function multiSendFrom(address _from, address[] _toAddresses, uint256[] _amounts) public {
require(_toAddresses.length <= 255);
require(_toAddresses.length == _amounts.length);
for (uint8 i = 0; i < _toAddresses.length; i++) {
transferFrom(_from, _toAddresses[i], _amounts[i]);
... | 989 |
//SPDX-License-Identifier: Unlicensed
pragma solidity ^0.6.8;
pragma experimental ABIEncoderV2;
// Chainlink Contracts
import "./chainlink/VRFConsumerBase.sol";
import "./libraries/SVGBuffer.sol";
import "./libraries/StringUtilsLib.sol";
import "./TinyBoxesPricing.sol";
contract TinyBoxesStore is TinyBoxesPricing, ... | Create a new TinyBox Token _seed of token counts of token colors & shapes dials of token renderer mirrors active boolean of token return _requestId of the VRF call/ convert user seed from string to uint create a new box object | function buy(
string calldata _seed,
uint8[2] calldata counts,
int16[13] calldata dials,
bool[3] calldata mirrors
) external payable notSoldOut returns (bytes32) {
handlePayment(false, msg.value, msg.sender);
uint256 seed = _seed.stringToUint();
TinyBox ... | 973,762 |
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return... | roll the dice for a player | function rollDie(address player) private {
uint N = 7;
uint delay = 0;
bytes32 _queryId = oraclize_newRandomDSQuery(delay, N, rngCallbackGas);
uint rollId = uint(keccak256(_queryId));
require(failedRolls[rollId] != rollId);
rollIdToGameAddress[rollId] = player;
}
... | 12,000,140 |
pragma solidity ^0.4.17;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
... | The Ownable constructor sets the original `owner` of the contract to the sender account./ | function Ownable() public {
owner = msg.sender;
}
| 8,003,382 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.6;
import "./Stakeholders.sol";
import "./Community.sol";
import "./FurLib.sol";
/// @title Governance
/// @author LFG Gaming LLC
/// @notice Meta-tracker for Furballs; looks at the ecosystem (metadata, wallet counts, etc.)
/// @dev Shares is an ERC20; stake... | Allow a player to play? Throws on error if not. This is core gameplay security logic | function approveSender(address sender) external virtual override view onlyFurballs returns(uint) {
if (sender == companyWalletProxy && sender != address(0)) return FurLib.PERMISSION_OWNER;
return _permissions(sender);
}
| 13,868,275 |
./full_match/80001/0xDD7E62725f586166995d048e797E6D05413B2D70/sources/contracts/protocol/markets/basic/library/MarketLib.sol | Withdraws Verification Reward m Market info v Verification info power Power of vNFT used for verification verificationFee Verification Fee return toVerifier Amount of tokens for verifier return toDisputeCreator Amount of tokens for dispute creator return toHighGuard Amount of tokens for HG return vNftBurn If vNFT n... | function withdrawVerificationReward(
Market memory m,
Verification memory v,
uint256 power,
uint256 verificationFee
)
external
returns (
uint256 toVerifier,
uint256 toDisputeCreator,
uint256 toHighGuard,
bool vNftBur... | 837,677 |
./partial_match/1/0xE61fDAF474Fac07063f2234Fb9e60C1163Cfa850/sources/CoinToken.sol | approveAndCallPreSigned allows a user to approve a contract and call a function on it in the same transaction. As with the other presigneds, a delegate calls this with signed data from user. This function is the big reason we're using gas price and calculating gas use. Using this with the investment contract can res... | function approveAndCallPreSigned(
bytes _signature,
address _to,
uint256 _value,
bytes _extraData,
uint256 _gasPrice,
uint256 _nonce)
public
returns (bool)
{
uint256 gas = gasleft();
address from = recoverPreSigned(_signature, approveA... | 9,313,072 |
./partial_match/42/0xD9e3bcC05A64C1630BE69dc7793181dEcA10BF42/sources/ICO.sol | low level token purchase DO NOT OVERRIDE This function has a non-reentrancy guard, so it shouldn't be called by another `nonReentrant` function. beneficiary Recipient of the token purchase/ nonReentrant payable view returns(uint256) calculate token amount to be created update state emit TokensPurchased(msg.sender, ... | function buyTokens(address beneficiary) public nonReentrant payable{
uint256 weiAmount =msg.value;
_preValidatePurchase(beneficiary, weiAmount);
uint256 tokens = _getTokenAmount(weiAmount);
_weiRaised = _weiRaised.add(weiAmount);
_processPurchase(beneficiary, tokens);
... | 3,417,493 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import { SafeMath } from "@openzeppelin/contracts/math/SafeMath.sol";
import { IFaucet } from "../../interfaces/IFaucet.sol";
contract Faucet is IFaucet, Ownable {
using SafeMath ... | Sets `account` as whitelisted or not. Can only be called by the contract owner. Emits an {Whitelist} event./ | function setWhitelist(address account, bool whitelisted) external onlyOwner {
whitelist[account] = whitelisted;
emit Whitelist(account, whitelisted);
}
| 5,346,714 |
//Address: 0x0193cba9762dfe203a34bd895d0ddf4d876e0f98
//Contract name: SixtyNine
//Balance: 0 Ether
//Verification Date: 12/28/2017
//Transacion Count: 3
// CODE STARTS HERE
pragma solidity ^0.4.18;
/**
* Math operations with safety checks
*/
contract SafeMath {
function safeMul(uint256 a, uint256 b) internal ... | Atomic decrement of approved spending./ | function subApproval(address _spender, uint256 _subtractedValue)
onlyPayloadSize(2 * 32)
public returns (bool success) {
uint256 oldVal = allowed[msg.sender][_spender];
if (_subtractedValue > oldVal) {
allowed[msg.sender][_spender] = 0;
allowed[msg.sender][_spender] = safeSub(old... | 12,750,403 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.9;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin... | Adds asset to the list key The address of token to look for val The asset to add/ | function _addAsset(address key, Asset val) private {
if (_assets.inserted[key]) {
_assets.values[key] = val;
_assets.inserted[key] = true;
_assets.values[key] = val;
_assets.indexOf[key] = _assets.keys.length;
_assets.keys.push(key);
}
... | 1,776,268 |
pragma solidity 0.4.24;
/**
* @title SafeMathInt
* @dev Math operations for int256 with overflow safety checks.
*/
library SafeMathInt {
int256 private constant MIN_INT256 = int256(1) << 255;
int256 private constant MAX_INT256 = ~(int256(1) << 255);
/**
* @dev Multiplies two int256 variables and f... | ZOS upgradable contract initialization method. It is called at the time of contract creation to invoke parent class initializers and initialize the contract's state variables./ deviationThreshold = 0.05e18 = 5e16 | function policyInitialize(address _owner)
internal
{
rebaseLag = 10;
minRebaseTimeIntervalSec = 1 days;
rebaseWindowLengthSec = 15 minutes;
lastRebaseTimestampSec = 0;
epoch = 0;
OracleBase.tokenInitialize(_owner);
... | 6,944,723 |
./full_match/1/0x567c09B55294998d7a6F2A3A948e8fD331531B88/sources/contracts/UMA/common/implementation/FixedPoint.sol | Whether `a` is greater than or equal to `b`. a a FixedPoint.Signed. b a FixedPoint.Signed. return True if `a >= b`, or False./ | function isGreaterThanOrEqual(Signed memory a, Signed memory b)
internal
pure
returns (bool)
{
return a.rawValue >= b.rawValue;
}
| 9,749,049 |
// File: @openzeppelin/contracts/utils/EnumerableSet.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.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 c... | Set Github account proof Requirements: - the caller must have the `ADMIN_ROLE`./ | function setGithubProof(bytes calldata _githubProof) external {
require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Error: github proof can only be set by admin");
socialGithubProof = _githubProof;
}
| 13,717,141 |
./full_match/62320/0xf84111D3FdF49FB13db9eABf0Bb64CD8Fc9AA748/sources/lib/mento-core-2.2.0/contracts/swap/BiPoolManager.sol | Valitates a PoolExchange's parameters and configuration Reverts if not valid exchange The PoolExchange to validate/ | function validate(PoolExchange memory exchange) private view {
require(reserve.isStableAsset(exchange.asset0), "asset0 must be a stable registered with the reserve");
require(
reserve.isStableAsset(exchange.asset1) || reserve.isCollateralAsset(exchange.asset1),
"asset1 must be a stable or collater... | 3,225,215 |
/*
Copyright 2017-2018 RigoBlock, Rigo Investment Sagl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or a... | Checks whether a pool is registered and active _ofPool Id of the pool return Bool the pool is active | function isActive(uint _ofPool)
internal view
returns (bool)
{
DragoRegistry registry = DragoRegistry(dragoRegistry);
address thePool;
(thePool, , , , , ) = registry.fromId(_ofPool);
if (thePool != address(0)) {
return true;
}
}
| 15,809,833 |
/**
*Submitted for verification at Etherscan.io on 2021-12-02
*/
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.9;
/// @title Tangle, a token implementation using EIP-2535: Multi-Facet Proxy
/// @author Brad Brown
/// @notice Pieces of this contract can be updated without needing to redeploy
/// the entir... | Add/replace/remove any number of functions and optionally execute a function with delegatecall _diamondCut Contains the facet addresses and function selectors _init The address of the contract or facet to execute _calldata _calldata A function call, including function selector and arguments _calldata is executed wit... | function diamondCut(
FacetCut[] calldata _diamondCut,
address _init,
bytes calldata _calldata
) external {
require(msg.sender == owner, "not owner");
bool changesMade = false;
for (uint i = 0; i < _diamondCut.length; i++) {
FacetCut memory facetCut = _... | 2,114,461 |
pragma solidity ^0.4.24;
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender)
... | Reject all ERC23 compatible tokens/ | function tokenFallback(address /* from_ */, uint256 /* value_ */, bytes /* data_ */) external pure {
revert();
}
| 12,811,030 |
./full_match/5/0x43d3DF6f8F668FA6177cAc7577282188e9AD23A9/sources/contracts/CrowdFunder.sol | check validity of given deadline | function createCampaign(address _owner, string memory _title, string memory _description, uint256 _target, uint256 _deadline, string memory _image) public returns (uint256) {
Campaign storage campaign = campaigns[numberOfCampaigns];
require(campaign.deadline < block.timestamp, "The Deadline should ... | 11,592,608 |
./partial_match/1/0x6D061EBFd8BDF5D574A7029E918341B1736d6F6c/sources/SmolTingPot.sol | adds two unsigned integers, reverts on overflow./ | function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "safemath#add: OVERFLOW");
return c;
}
| 3,893,416 |
//Address: 0x4f1adC39f25B67146bA15d8BF453A7F502e58a79
//Contract name: Moviecoin
//Balance: 0 Ether
//Verification Date: 3/23/2018
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity ^0.4.18;
// ----------------------------------------------------------------------------------------------
// Moviecoin Token b... | token's symbol/ | function symbol() public constant returns (string){
return symbol_;
}
| 15,805,488 |
pragma solidity ^0.5.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint2... | See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}; Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for... | function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
| 2,804 |
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.5.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
... | we can accept 1 as the minimum because this will be called only by a trusted worker now we have DAI | function liquidate() internal {
if (!liquidationAllowed) {
emit NotLiquidating();
return;
}
notifyProfit(0, IERC20(pickleToken).balanceOf(address(this)));
uint256 pickleBalance = IERC20(pickleToken).balanceOf(address(this));
if (pickleBalance > 0) {
IERC20(pickleToken).safeApprov... | 6,851,596 |
./partial_match/4/0x9db6B7803eFb24Ffe19fCCbb97dfF8e5a96e6526/sources/LPReward.sol | set fix time to start reward | function startReward(uint256 startTime)
external
onlyGovernance
updateReward(address(0))
{
require(_hasStart == false, "has started");
_hasStart = true;
_startTime = startTime;
_rewardRate = _initReward.div(DURATION);
_artd.mint(address(... | 8,502,906 |
./partial_match/5/0x7aAC0f092F7b961145900839Ed6d54b1980F200c/sources/PostageStamp.sol | Returns the current total outpayment/ | function currentTotalOutPayment() public view returns (uint256) {
uint256 blocks = block.number - lastUpdatedBlock;
uint256 increaseSinceLastUpdate = lastPrice * (blocks);
return totalOutPayment + (increaseSinceLastUpdate);
}
| 16,885,249 |
./full_match/1/0x07B0226465A50300F91c8A7930f90aEcae3D6Ed4/sources/contracts/staking/Series.sol | Transfer the given ETH and OGN to the given user from the vault userAddress - Recipient of the rewards rewardETH - Amount of ETH to transfer rewardOGN - Amount of OGN to transfer/ | function _transferRewards(
address userAddress,
uint256 rewardETH,
uint256 rewardOGN
) internal {
IFeeVault rewards = IFeeVault(vault);
if (rewardETH > 0) {
rewards.sendETHRewards(userAddress, rewardETH);
}
if (rewardOGN > 0) {
re... | 16,523,440 |
./full_match/1/0xEa7238160b15Eb238A06AAFBD267dA8519E38682/sources/onchainRobots.sol | get string attributes of properties, used in tokenURI call | function getTraits(Ape memory ape) internal view returns (string memory) {
string memory o=string(abi.encodePacked(tr1,uint256(ape.bg).toString(),tr2,uint256(ape.fur).toString(),tr3,uint256(ape.earring).toString()));
return string(abi.encodePacked(o,tr4,uint256(ape.hat).toString(),tr5,uint256(ape.eyes).toStri... | 3,093,113 |
./partial_match/1/0x85cdDcE5C1889D84e10d97074b7Af007f2CaDCC5/sources/BankrollNetworkStackPlus.sol | Subtracts two numbers, else returns zero / | function safeSub(uint a, uint b) internal pure returns (uint) {
if (b > a) {
return 0;
return a - b;
}
}
| 11,023,214 |
// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8.10;
pragma abicoder v2;
import "../libraries/SafeERC20.sol";
import "../interfaces/ITreasury.sol";
import "../interfaces/ITreasuryV1.sol";
import "../interfaces/IERC20.sol";
import "../interfaces/IExodusAuthority.sol";
import "../types/ExodusAccessControlled.... | Manages LUSD from treasury V1 and swaps for LUSD _amountLUSD Amount of LUSD that will be managed from treasury V1 and swapped _minAmountDAI Minimum amount of DAI to receive _amountDAIToV1Treasury Amount of DAI that was received from swap to be sent to V1 treasury Manage LUSD from v1 treasury A... | function swapLUSDForDAI(
uint256 _amountLUSD,
uint256 _minAmountDAI,
uint256 _amountDAIToV1Treasury
) external onlyGuardian {
treasuryV1.manage(LUSD, _amountLUSD);
IERC20(LUSD).approve(address(curveFactory), _amountLUSD);
uint256 daiReceived = curveFactory.excha... | 910,361 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.