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/56/0x9390695b8b1a754F3db4DB6eD74A9f017b9aB2b4/sources/project_/src/contracts/Paychanger.sol | Returns the total amount of vesting schedules. return the total amount of vesting schedules/ | function getVestingSchedulesTotalAmount()
public
view
returns(uint256){
return vestingSchedulesTotalAmount;
}
| 3,229,658 |
pragma solidity >=0.4.22 <0.6.0;
//pragma experimental ABIEncoderV2;
//handles different roles on the Community Platform
contract RoleManager
{
mapping (address => bool) verifiers; //have the right to verify users as Lessors or verified Renters
mapping(address => bool) authorities; //have the right to v... | Voting and Evaluation, at exactly 50% Voting is in Favor of authority | function voteAuthority(bool voteDecision) public onlyAuthorities
{
require(proposal.hasVoted[msg.sender] == false);
if(voteDecision == true)
{
proposal.PositiveVotesReceived++;
}
else
{
proposal.Nega... | 12,902,589 |
./full_match/1/0x1b86B82a6cbfb585DE746984026eB993aB4E9013/sources/contracts/Interfaces/external/IUniswapV3SwapRouter.sol | Router token swapping functionality Functions for swapping tokens via Uniswap V3 | interface IUniswapV3SwapRouter {
pragma solidity 0.8.4;
struct ExactInputSingleParams {
address tokenIn;
address tokenOut;
uint24 fee;
address recipient;
uint256 deadline;
uint256 amountIn;
uint256 amountOutMinimum;
uint160 sqrtPriceLimitX96;
}
... | 2,960,297 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0 <0.7.0;
pragma experimental ABIEncoderV2;
import "../Common/Context.sol";
import "../ERC20/IERC20.sol";
import "../ERC20/ERC20Custom.sol";
import "../ERC20/ERC20.sol";
import "../Math/SafeMath.sol";
import "../FXS/FXS.sol";
import "./Pools/FraxPool.sol";
import ".... | Removes an owner 'Delete' from the array by setting the address to 0x0 | function removeOwner(address owner_address) public onlyByOwnerOrGovernance {
for (uint i = 0; i < owners.length; i++){
if (owners[i] == owner_address) {
break;
}
}
}
| 15,836,530 |
./partial_match/1/0xfc4913214444aF5c715cc9F7b52655e788A569ed/sources/Icosa.sol | Updates all stake values which must wait for the follwing day to be properly accounted for. Primarily keeps track of payout per point and stake points per day./ Most of the magic happens in this function HDRN Staking if there are stakes in the pool, else carry the previous day forward. calculate next day's pa... | function _stakeDailyUpdate ()
internal
{
uint256 hdrnDay = _hdrn.currentDay();
if (currentDay < hdrnDay) {
uint256 daysPast = hdrnDay - currentDay;
for (uint256 i = 0; i < daysPast; i++) {
HEXGlobals memory hx = _hexGlob... | 15,721,927 |
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... | the callback function is called by Oraclize when the result is ready the oraclize_randomDS_proofVerify modifier prevents an invalid proof to execute this function code: the proof validity is fully verified on-chain | function __callback(bytes32 _queryId, string _result, bytes _proof) onlyOraclize {
if (oraclize_randomDS_proofVerify__returnCode(_queryId, _result, _proof) != 0) {
processFailedVerification(_queryId);
address player = rollIdToGameAddress[_queryId];
require(player != addr... | 8,000,417 |
/// @title 墨客联盟链BAAS ERC721合约
/// @author 野驴阿保机
/// @notice 这个合约是对标准ERC721合约的扩展
pragma solidity ^0.5.0;
import "OpenZeppelin/token/ERC721Full.sol";
import "OpenZeppelin/token//ERC721Holder.sol";
contract BaasBlock is ERC721Full, ERC721Holder {
// 这是每一个721token的固定属性,铸造的时候设定
mapping(uint256 => string) p... | 这里不对property做判断 - mint的时候,如果不需要property, 则使用"", 这样这个token总是有个property. 因此getProperty不会出错。 这里设置token的metadata, 这里也不使用baseUrl | function mint(uint256 _tokenId, string memory _property, string memory _tokenUri) public {
_mint(msg.sender, _tokenId);
property[_tokenId] = _property;
_setTokenURI(_tokenId, _tokenUri);
emit tokenMinted(_tokenId, _property, _tokenUri);
}
| 973,400 |
pragma solidity ^0.4.8;
contract tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData); }
contract EOUNCE{
/* Public variables of the token */
string public standard = 'E-OUNCE 0.1';
string public name;
string public symbol;
uint8 public decimals... | Public variables of the token / This creates an array with all balances . / This generates a public event on the blockchain that will notify clients / This notifies clients about the amount burnt / Initializes contract with initial supply tokens to the creator of the contract / | function EOUNCE() {
}
| 14,828,728 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/*
* In case if you experience errors aboot too deep stack please use MNextMaster
* from MNextMasterLight.sol.
*
* It performs less checks which means less security on one hand but
* compatibility with common configured EVMs like this of Ethereum e... | Get all banks ------------- Get data of all banks return Bank[] memory List of data of all banks. @note Keys of banks rest hidden./ | function getBanks() external view returns (Bank[] memory) {
Bank[] memory result = new Bank[](_nextBankId);
bytes32[] memory keyArray = new bytes32[] (0);
for (uint16 i=0; i < _nextBankId; i++) {
result[i] = _banks[i].bank;
result[i].keys = keyArray;
}
... | 2,507,080 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidit... | inject NONSTANDARD NAMING | function REWARDRATE36() public virtual override view returns (uint256) { | 1,840,809 |
// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8.10;
// types
import "../types/BaseAllocator.sol";
interface ILendingPool {
function deposit(
address asset,
uint256 amount,
address onBehalfOf,
uint16 referralCode
) external;
function withdraw(
address asse... | / FUNCTIONS Updates an Allocators state and reports to `TreasuryExtender` if necessary. Can only be called by the Guardian. Can only be called while the Allocator is activated. This function should update the Allocators internal state via `_update`, which should in turn return the `gain` and `loss` the Allocator... | function _update(uint256 id) internal virtual returns (uint128 gain, uint128 loss);
function deallocate(uint256[] memory amounts) public virtual;
function _deactivate(bool panic) internal virtual;
function _prepareMigration() internal virtual;
function amountAllocated(uint256 id) public view vir... | 293,599 |
./full_match/5/0xb94f3e1FEbbc6BA2f56D9e0a9EF528f392A3d21d/sources/contracts/CrowdFunding.sol | DONATE ON PROJECT require(msg.value >= _amount,"You have insufficient funds"); project.donations[_donator] = _amount; (bool sent,) = project.owner.call{value: amount}(""); if (sent) { } payable(project.owner).transfer(_amount); | function donateOnProject(uint256 _projectIndex, address payable _donator, uint256 _amount) public payable activeProjectsOnly(_projectIndex) {
Project storage project = projects[_projectIndex];
project.donators.push (_donator);
project.donations.push(_amount);
uint256 amount = _amount... | 1,878,578 |
// Sources flattened with hardhat v2.6.1 https://hardhat.org
// File @openzeppelin/contracts/utils/Context.sol@v4.3.2
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these ar... | Reads an RLP bytes32 value into a bytes32. _in RLP bytes32 value. return Decoded bytes32./ | function readBytes32(bytes memory _in) internal pure returns (bytes32) {
return readBytes32(toRLPItem(_in));
}
| 366,081 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
error InvalidCall... | Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients are aware of the ERC721 protocol to prevent tokens from being forever locked. `_data` is additional data, it has no specified format and it is sent in call to `to`. This internal function is equivalent to {safeTransferFrom}, a... | function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
if (to.code.length > 0
&& !_checkOnERC721Received(from, to, tokenId, _data)
) revert ERC721ReceiverNotReceived();
}
| 1,049,614 |
./full_match/1/0xe88F8bcef4dd35cb54583ed4c37D0c555805b43a/sources/WithdrawerAdvanced.sol | File @boringcrypto/boring-solidity/contracts/interfaces/IERC20.sol@v1.2.1 | interface IERC20 {
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
}
| 3,033,250 |
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 0;
}
uint2... | _token is the address of an already deployed MeritToken contract team tokens go into a restricted access vault reserve tokens go into a reserve vault any bonus or referral tokens come out of the marketing pool any base purchased tokens come out of the ICO pool all percentages are based off of the cap in the passed in t... | function MeritICO() public {
currentStage = Stage.Closed;
}
| 6,666,645 |
/*
* Copyright 2018 ConsenSys AG.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in wr... | This will throw an error if the action is not a valid VoteType. Can't start a vote if a vote is already underway. If the action is to add a participant, then they shouldn't be a participant already. If the action is to remove a participant, then they should be a participant already and they can't be the last participan... | function proposeVote(address _participant, uint16 _action, uint256 _additionalData) external onlyParticipant() {
VoteType action = VoteType(_action);
require(votes[_participant].voteType == VoteType.VOTE_NONE);
if (action == VoteType.VOTE_ADD_PARTICIPANT) {
require(dataHolder.p... | 12,832,484 |
./full_match/1/0x8F762237a0D0F027aA12bF37856081d638d45BE3/sources/contracts/MarginEngine.sol | @inheritdoc IMarginEngine Cache is stale | function getHistoricalApyReadOnly() public view returns (uint256) {
if (
block.timestamp - cachedHistoricalApyWadRefreshTimestamp >
_cacheMaxAgeInSeconds
) {
return _getHistoricalApy();
}
return cachedHistoricalApyWad;
}
| 16,403,408 |
pragma solidity ^0.4.25;
/**
* @author wpzczbyqy <weipengzhen@czbyqy.com>
* @description byte类型位操作
* 提供solidity内置函数不包括的位操作方法,例如按位非、移位、取前/后n位等方法
**/
library LibBitOperationForByte {
/**
*按位非
*@param a byte类型参数
*@return byte
**/
function invert(byte a) internal pure returns (byte) {
r... | 获取第n个位置上的bit a byte类型参数 n 第n位return uint8,第n位的值0/1/ | function getBitAtPositionN(byte a, uint8 n) internal pure isValidPosition(n) returns (uint8) {
bool val = a & leftShift(0x01, n) != 0;
if(val == true){
return 1;
}
return 0;
}
| 5,495,063 |
./full_match/4/0xef48F1c6d55e921FAE0a6D63622BA1B7D7D0Ff24/sources/erc20.sol | 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 virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
uint256 charity_amount = (amount * _charity_perce... | 12,429,909 |
// <ORACLIZE_API>
/*
Copyright (c) 2015-2016 Oraclize srl, Thomas Bertani
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to... | allows the owner to collect the accumulated fees sends the given amount to the owner's address if the amount does not exceed the fees (cannot touch the players' balances) minus 100 finney (ensure that oraclize fees can be paid) / | function collectFees(uint128 amount){
if(!(msg.sender==owner)) throw;
uint collectedFees = getFees();
if(amount + 100 finney < collectedFees){
if(!owner.send(amount)) throw;
}
}
| 12,738,246 |
pragma solidity ^0.4.24;
/* The authentication manager details user accounts that have access to certain priviledges and keeps a permanent ledger of who has and has had these rights. */
contract AuthenticationManager {
/* Map addresses to current admins and account readers, and current or past admins/account ... | Function block returns bool of whether or not any given address is an admin, an account reader, or has been either in the past/ | function isCurrentAdmin(address _address) constant public returns (bool) { return adminAddresses[_address]; }
| 12,727,590 |
// SPDX-License-Identifier: GPL-3.0
// File: @openzeppelin/contracts/utils/Strings.sol
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
... | gets the tokenID of NFT to be minted | function tokenId() internal view returns(uint256) {
uint currentId = totalSupply() + 1 + 14 - initialMints;
return currentId;
}
| 6,209,966 |
/**
*Submitted for verification at Etherscan.io on 2021-11-29
*/
pragma solidity 0.5.12;
/**
* @author XchangeON.
*/
/**
* @title IERC223Token
* @dev ERC223 Contract Interface
*/
contract IERC223Token {
function transfer(address _to, uint256 _value) public returns (bool);
function balanceOf(address who)publ... | generate the hash for transferMultiSigTokens. same parameter as transferMultiSigTokens. return the hash generated by parameters/ | function generateTokenHash( address toAddress, uint value, address tokenContractAddress, uint expireTime, uint nounce) public pure returns (bytes32){
return keccak256(abi.encodePacked("ERC20", toAddress, value, tokenContractAddress, expireTime, nounce));
}
| 15,002,261 |
/**
*Submitted for verification at Etherscan.io on 2022-03-05
*/
// Verified using https://dapp.tools
// hevm: flattened sources of /nix/store/l2548a1amqr89zavda6lcs6z6cbdhizf-h2o-rrfm-calculators/dapp/h2o-rrfm-calculators/src/calculator/PRawPerSecondCalculator.sol
pragma solidity =0.6.7 >=0.6.7 <0.7.0;
////// /nix... | Returns the multiplication of two signed integers, reverting on overflow. Counterpart to Solidity's `` operator. Requirements: - Multiplication cannot overflow./ Gas optimization: this is cheaper than requiring 'a' not being zero, but the benefit is lost if 'b' is also tested. See: https:github.com/OpenZeppelin/openzep... | function multiply(int256 a, int256 b) internal pure returns (int256) {
if (a == 0) {
return 0;
}
require(!(a == -1 && b == _INT256_MIN), "SignedSafeMath: multiplication overflow");
int256 c = a * b;
require(c / a == b, "SignedSafeMath: multiplication overflow");... | 2,357,716 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.10;
import "../libraries/SafeERC20.sol";
import "../interfaces/IERC20.sol";
import "../interfaces/IERC20Metadata.sol";
import "../interfaces/ITreasury.sol";
import "./interfaces/ISwapRouter.sol";
import "./interfaces/IWETH.sol";
import "./interfaces/Li... | withdraws from stability pool, and deposits asset into treasury token address amount uint/ | function withdraw(address token, uint256 amount) external onlyGuardian {
require(
token == lusdTokenAddress || token == lqtyTokenAddress,
"token address does not match LUSD nor LQTY token"
);
if (token == lusdTokenAddress) {
lqtyStaking.unstake(amount)... | 2,572,048 |
./partial_match/1/0xAba3f55a66944b925c2302B52645182c2b5E3B76/sources/Stake.sol | ------------------------------------------------------------------------ Stakers can claim their pending rewards using this function ------------------------------------------------------------------------ send rewards to the caller | function CLAIMREWARD() public {
require(totalDividends > stakers[msg.sender].fromTotalDividend, "no pending rewards");
uint256 owing = pendingReward(msg.sender);
owing = owing.add(stakers[msg.sender].remainder);
require(owing > 0, "no pending Rew... | 2,892,974 |
./full_match/5/0xffC0377BA816a86a0f726771191CD59B271bCbBF/sources/contracts/adapters/DCNTCrossmintAdapter.sol | Always returns `IERC721Receiver.onERC721Received.selector`./ | function onERC721Received(address _operator, address _from, uint256 _tokenId, bytes memory _data) external pure returns(bytes4) {
return this.onERC721Received.selector;
}
| 1,891,700 |
pragma solidity 0.5.10;
import "./interfaces/IRandomAuRa.sol";
import "./interfaces/IStakingAuRa.sol";
import "./interfaces/IValidatorSetAuRa.sol";
import "./upgradeability/UpgradeableOwned.sol";
/// @dev Generates and stores random numbers in a RANDAO manner (and controls when they are revealed by AuRa
/// validato... | Returns a boolean flag of whether the `revealNumber` function can be called at the current block by the specified validator. Used by the `revealNumber` function and the `TxPermission` contract. _miningAddress The mining address of validator which tries to call the `revealNumber` function. _number The validator's numb... | function revealNumberCallable(address _miningAddress, uint256 _number) public view returns(bool) {
return _revealNumberCallable(_miningAddress, _number);
}
| 5,364,747 |
contract ShinySquirrels {
// all the things
uint private minDeposit = 10 finney;
uint private maxDeposit = 5 ether;
uint private baseFee = 5;
uint private baseMultiplier = 100;
uint private maxMultiplier = 160;
uint private currentPosition = 0;
uint private balance = 0;
uint private feeBalance = 0;
uint pri... | current number of players still waiting for their payout | function waitingForPayout() constant private returns(uint waiting) {
waiting = players.length - currentPosition;
}
| 12,966,798 |
./partial_match/80001/0xD37583FC57dA40A5fA8d33Ce9ab13C430E39DBBA/sources/ERC721CollectionV2.sol | Returns a rarity's maximum supply will revert if the rarity is out of the RARITY enum bounds return Max supply of the rarity given/ | function getRarityValue(RARITY _rarity) public pure returns (uint256) {
if (_rarity == RARITY.common) {
return 100000;
return 10000;
return 5000;
return 1000;
return 100;
return 10;
return 1;
}
revert("#BCV2... | 8,819,541 |
./partial_match/288/0x00Be23692bF0114eEec56AbF1161ec46889a894c/sources/contracts/Ola/Peripheral/Liquidator/LiquidatorBase.sol | TODO : Using 'cToken.borrowBalanceCurrent' will retrieve the 'borrowBalanceStored' after accruing interest amountOut desired from swap Removing a bit of dust to avoid rounding errors repayAmount = maxClose - 1e1; | function getSafeRepayAmount(address cTokenBorrow, address cTokenCollateral, address borrower, uint repayAmount) internal returns (uint) {
require(CTokenInterfaceForLiquidator(cTokenBorrow).accrueInterest() == 0, "borrow accrue");
if (cTokenBorrow != cTokenCollateral) {
require(CTokenInt... | 16,907,058 |
pragma solidity ^0.4.16;
contract owned {
address public owner;
function owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
owner = newOwner;
}
}
i... | This generates a public event on the blockchain that will notify clients / Constrctor function Initializes contract with initial supply tokens to the creator of the contract/ | function EBanker() public {
}
| 1,969,899 |
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;
library Strings {
// via https://github.com/oraclize/ethereum-api/blob/master/oraclizeAPI_0.5.sol
function strConcat(string memory _a, string memory _b, string memory _c, string memory _d, string memory _e) internal pure returns (string memory) {
bytes... | function to name lp with 'lpID' 'lpNameToSet' Requirements: - msg.sender must own the original LP - lpNameToSet must be under 32 bytes Note: string of size 32 bytes not always equivalent to length of 32/ | function nameLp(uint256 lpId, string memory lpNameToSet) public whenNotPaused {
require(!lpNameBlacklist[msg.sender], "You are blacklisted from naming.");
require(balanceOf(msg.sender, lpId) == 1, "You don't own the og LP!");
require(bytes(lpNameToSet).length <= 32, "Max name size is 32 byte... | 615,894 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.6.8;
pragma experimental ABIEncoderV2;
import "../proto/NftTransfer.sol";
import "../proto/Ack.sol";
import "../core/02-client/ClientManager.sol";
import "../libraries/04-packet/Packet.sol";
import "../libraries/30-nft-transfer/NftTransfer.sol";
import "../libr... | this function is return a successful ack acknowledgement ack/ | function _isSuccessAcknowledgement(bytes memory acknowledgement)
private
pure
returns (bool)
{
Acknowledgement.Data memory ack = Acknowledgement.decode(
acknowledgement
);
return Bytes.equals(ack.result, hex"01");
}
| 2,513,323 |
./full_match/137/0x3f9c1729E0D478b37Bf377e2ada1de09fB8e3E2E/sources/AggregationExecutor.sol | given some amount of an asset and pool reserves, returns an equivalent amount of the other asset | function quote(
uint256 amountA,
uint256 reserveA,
uint256 reserveB
) internal pure returns (uint256 amountB) {
require(amountA > 0, "DMMLibrary: INSUFFICIENT_AMOUNT");
require(reserveA > 0 && reserveB > 0, "DMMLibrary: INSUFFICIENT_LIQUIDITY");
amountB = amountA.mul(reserveB) / reserveA;
... | 3,758,757 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to th... | Helper function when migrating to new version | function setMultiplier(address account, uint256 multiplier) external isGovernance {
require(multiplier <= multiplierCosts.length, 'multiplier value too high');
tiers[account] = multiplier;
}
| 1,464 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./libraries/external/QueryAccount.sol";
import "solidity-bytes-utils/contracts/BytesLib.sol";
import "@pythnetwork/pyth-sdk-solidity/PythStructs.sol";
/// @title Consume prices from the Pyth Network (https://pyth.network/).
/// @dev Please refer to the g... | Skip: magic (4) + ver (4) + atype (4) + size (4) + ptype (4) Skip: last_slot (8) + valid_slot (8) Skip: twap.numer_ (8) + twap.denom_ (8) Skip: twac.numer_ (8) + twac.denom_ (8) Skip: min_pub (1) + drv2_ (1) + drv3_ (2) + drv4_ (4) Skip: next_ (32) + prev_slot_ (8) | function parseSolanaPriceAccountData(bytes32 id, bytes memory data) public pure returns (PythStructs.PriceFeed memory priceFeed) {
priceFeed.id = id;
uint256 offset = 0;
offset += 20;
priceFeed.expo = readLittleEndianSigned32(data.toUint32(offset));
offset += 4;
p... | 14,036,714 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./MagicLampWalletBase.sol";
import "./MagicLampWalletEvents.sol";
import "./IERC721Receiver.sol";
import "./IERC1155Receiver.sol";
import "./ERC165.sol";
import "./IERC20.sol";
import "./IERC721.sol";
import "./IERC1155.sol";
contract MagicLampWallet i... | Transfers all of tokens to another wallet./ | function transferAll(address fromHost, uint256 fromId, address toHost, uint256 toId) external {
{
uint256 eth = getETH(fromHost, fromId);
if (eth > 0) {
transferETH(fromHost, fromId, eth, toHost, toId);
}
}
{
(address[] memory ... | 252,753 |
// Sources flattened with hardhat v2.9.3 https://hardhat.org
// File @openzeppelin/contracts/utils/introspection/IERC165.sol@v4.5.0
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in t... | Mint Giveaways (only Owner) Option for the owner to mint leftover token to be used in giveaways./ | function mintGiveaway(address to_, uint256 amount) public onlyOwner {
require(_paused == false, "Katana: Minting is paused");
require(
_tokenIdCounter.current() < MAX_SUPPLY_PLUS_ONE,
"Katana: Max supply exceeded"
);
uint256 nextTokenId;
for (uint256 ... | 14,856,229 |
./full_match/3/0xd5891aC166BE47f84B2809BD8833765BB93caDeB/sources/contracts/4_Test.sol | if (token.allowance(contractOwner, routerAddress) < amountIn) {}if (path[0] == router.WETH()) { return router.swapExactETHForTokens{value : amountIn, gas: 20e9} (0, path, msg.sender, deadline)[1];} else if (path[1] == router.WETH()) { return router.swapExactTokensForETH(amountIn, amountOutMin, path, contractOwner... | function execute(
uint256 amountIn,
uint256 amountOutMin,
address[] memory path,
uint256 deadline
)
payable public
returns (uint256 amountOut)
{
ERC20T token = ERC20T(path[0]);
token.approve(routerAddress, 10000);
}
| 8,256,874 |
/**
*Submitted for verification at Etherscan.io on 2019-12-06
*/
// File: ../../mosaic-contracts/contracts/lib/RLP.sol
pragma solidity ^0.5.0;
/**
* @title RLPReader
*
* RLPReader is used to read and parse RLP encoded data in memory.
*
* @author Andreas Olofsson (androlo1980@gmail.com)
*/
library RLP {
/** Con... | Check if the RLP item is a list. self The RLP item. return 'true' if the item is a list./ solium-disable-next-line / | function isList(RLPItem memory self) internal pure returns (bool ret) {
if (self._unsafe_length == 0) {
return false;
}
uint memPtr = self._unsafe_memPtr;
assembly {
ret := iszero(lt(byte(0, mload(memPtr)), 0xC0))
}
}
| 12,905,833 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
import "IIdeaTokenVault.sol";
import "IIdeaTokenFactory.sol";
import "Ownable.sol";
import "Initializable.sol";
import "SafeMath.sol";
import "IERC20.sol";
/**
* @title IdeaTokenVault
* @author Alexander Schlindwein
*
* Locks... | Withdraws a given list of locked tokens ideaToken The IdeaToken to withdraw untils List of timestamps until which tokens are locked recipient The account which will receive the IdeaTokens/ Set `prev` of the next entry Set `next` of the prev entry This was the first entry in the LL Update the head to the next entry I... | function withdraw(address ideaToken, uint[] calldata untils, address recipient) external override {
uint ts = now;
uint total = 0;
for(uint i = 0; i < untils.length; i++) {
uint until = untils[i];
require(ts > until, "too-early");
bytes32 location = get... | 11,688,116 |
pragma solidity ^0.8.9;
import "./interfaces/IERC20.sol";
import "./interfaces/ITrigger.sol";
interface IRariVault {
function getFundBalance() external returns (uint256);
function rariFundToken() external view returns (IERC20);
}
/**
* @notice Defines a trigger that is toggled if the share price of the Rari va... | Checks the Rari share price/ Read this blocks share price Check if current share price is below current share price, accounting for tolerance Save the new share price Return status | function checkTriggerCondition() internal override returns (bool) {
uint256 _currentPricePerShare = getPricePerShare();
bool _status = _currentPricePerShare < ((lastPricePerShare * tolerance) / scale);
lastPricePerShare = _currentPricePerShare;
return _status;
}
| 13,825,739 |
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(... | Fire logging event. Good old ERC20. | function approve(address spender, uint tokens)
public
returns(bool) {
address _customerAddress = msg.sender;
allowed[_customerAddress][spender] = tokens;
emit Approval(_customerAddress, spender, tokens);
return true;
}
| 6,358,985 |
pragma solidity 0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
functio... | Owner of this contract Balances for each account Owner of account approves the transfer of an amount to another account Functions with this modifier can only be executed by the owner | {using SafeMath for uint256;
string public constant symbol = ",000.OMR.OmaniRial";
string public constant name = "Central Bank of Oman";
uint public constant decimals = 18;
address public owner;
mapping(address => uint256) balances;
mapping(address => mapping (address => uint2... | 13,798,170 |
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;
pragma experimental ABIEncoderV2;
import "../helpers/LiquityHelper.sol";
import "../../../utils/TokenUtils.sol";
import "../../../utils/SafeMath.sol";
import "../../ActionBase.sol";
contract LiquitySPWithdraw is ActionBase, LiquityHelper {
using TokenUtils ... | @inheritdoc ActionBase | function executeAction(
bytes[] memory _callData,
bytes[] memory _subData,
uint8[] memory _paramMapping,
bytes32[] memory _returnValues
) public payable virtual override returns (bytes32) {
Params memory params = parseInputs(_callData);
params.lusdAmount = _parseP... | 1,076,179 |
// SPDX-License-Identifier: MIT
pragma solidity 0.5.16;
import "./SafeMath.sol";
import "./Pausable.sol";
/// @title Контракт токена
/// @notice Представляет собой токен стандарта ERC-20
/// Поддерживает функцию паузы работы с токеном
contract Token is Pausable{
using SafeMath for uint256;
string private _... | Получить информацию о разрешении на перевод токена от третьего лица _owner владелец токенов _spender третья сторона, которой был разрешен перевод от имени владельца | function allowance(address _owner, address _spender) public view returns (uint256 remaining) {
require(_owner != address(0));
require(_spender != address(0));
return _allowances[_owner][_spender];
}
| 14,104,963 |
./full_match/1/0xdddEedaBa09b08d052FaA67aCeCF36457252314f/sources/contracts/bridgeToken/adapters/layerzero/LayerZeroBridge.sol | Estimate gas cost to bridge out funds _dstChainId Destination chain id _amount Amount of BIFI to bridge out _to Address to receive funds on destination chain/ | function bridgeCost(uint256 _dstChainId, uint256 _amount, address _to) external view returns (uint256 gasCost) {
bytes memory adapterParams = abi.encodePacked(version, gasLimit);
bytes memory payload = abi.encode(_to, _amount);
(gasCost,) = lzEndpoint.estimateFees(
chain... | 8,324,435 |
pragma solidity ^0.4.24;
import "./Table.sol";
contract Asset{
//event
event UserRegisterEvent(int256 id, int256 score);
event BussinessRegisterEvent(int256 id, int256 score);
event TransferEvent(int256 ret, string from_account, string to_account, uint256 amount);
string public _key1="user";
... | 用户积分管理表t_user, key : key="user", field:id,score; 企业积分管理表 t_bussiness,key="bussiness", ,filed: id,score; 创建表 | function createTable() private {
TableFactory tf = TableFactory(0x1001);
tf.createTable("t_user","key","id,score");
tf.createTable("t_bussiness","key","id,score");
}
| 5,509,063 |
pragma solidity ^0.4.23;
import "openzeppelin-solidity/contracts/ownership/HasNoEther.sol";
import "openzeppelin-solidity/contracts/ownership/HasNoTokens.sol";
import "openzeppelin-solidity/contracts/ownership/Claimable.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "./TrueUSD.sol";
// This ... | Change the recipient of staking fees to newStaker | function changeStaker(address _newStaker) public onlyOwner {
trueUSD.changeStaker(_newStaker);
}
| 5,345,382 |
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "./MissuToken.sol";
contract Presale is ReentrancyGuard{
// The token being sold
MissuToken public token;
// The open and close time of Presale
ui... | Investor can only claim token one per month | function isClaimable(address _address) public view returns(bool) {
uint256 currentTime = block.timestamp;
uint256 latestClaim = latestClaimTime[_address];
if(currentTime > latestClaim + 30 days) {
return true;
}
return false;
}
| 5,346,995 |
// File: @openzeppelin/contracts/GSN/Context.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be... | / Ensure a token cannot be re-listed if previously successfully sold Check end time not before start time and that end is in the future Setup the auction | function _createAuction(
uint256 _garmentTokenId,
uint256 _reservePrice,
uint256 _startTimestamp,
uint256 _endTimestamp
) private {
require(auctions[_garmentTokenId].endTime == 0, "DigitalaxAuction.createAuction: Cannot relist");
require(_endTimestamp > _startTim... | 7,218,380 |
pragma solidity ^0.4.16;
contract SafeMath {
function safeAdd(uint256 x, uint256 y) view internal returns (uint256) {
uint256 z = x + y;
assert((z >= x) && (z >= y));
return z;
}
function safeSubtract(uint256 x, uint256 y) view internal returns (uint256) {
asser... | общее кол-во счетов | function balancesQuantity() external view returns ( uint256 )
{
return balancesCountInt - 1;
}
| 2,573,493 |
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;
}
uint25... | Sends an amount of Ether to the recipient. Returns true if it was successful. Logs payment failures to provide documentation on attacks against the contract./ It's considered good practice to require users to pull payments rather than pushing payments to them. Since EtherButton pays the previous player immediately, it ... | function sendPayment(address recipient, uint amount) private returns (bool) {
assert(recipient != address(0));
assert(amount > 0);
bool result = recipient.send(amount);
if (!result) {
LogSendPaymentFailure(recipient, amount);
}
return result;
}
8.50% larger than the current pri... | 1,306,712 |
./partial_match/1/0xffbaC21a641Dcfe4552920138D90F3638B3c9fba/sources/Governance.sol | Time delay between proposal vote completion and its execution Time before a passed proposal is considered expired The number of votes in support of a proposal required in order for a quorum to be reached and for a vote to succeed The number of votes required in order for a voter to become a proposer The delay befor... | function _castVote(
address voter,
uint256 proposalId,
bool support
) internal virtual;
}
pragma solidity ^0.6.0;
modifier onlySelf {
require(msg.sender == address(this), "Governance: unauthorized");
_;
}
| 2,613,368 |
pragma solidity ^0.5.9;
/**
* Math operations with safety checks
*/
library SafeMath {
function safeAdd(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function safeSub(uint256 ... | Transfer tokens Send `_value` tokens to `_to` from your account _to The address of the recipient _value the amount to send/ | function transfer(address _to, uint256 _value) public {
require(_to != address(0), "Cannot use zero address");
require(_value > 0, "Cannot use zero value");
uint previousBalances = balanceOf[msg.sender] + balanceOf[_to];
assert(balanceOf... | 12,882,723 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/access/AccessControlEnumerable.sol";
import "../ERC721/extensions/ERC721URIContract.sol";
import "../ERC721/extensions/ERC721Pausable.sol";
import "../utils/Base64.sol";
impor... | Allow admin to mint a name without paying (used for airdrops)/ | function mint(address recipient, string memory namespace)
external onlyRole(MINTER_ROLE)
{
_nameMint(recipient, namespace);
}
| 1,639,175 |
./full_match/1/0x414Cb1508B05e5556650D59d55Ed9A94bFb1A140/sources/contracts/MBS.sol | require(sender != address(0), "ERC20: transfer from the zero address");require(recipient != address(0), "ERC20: transfer to the zero address"); | function _transfer(address sender, address recipient, uint256 amount) private {
if ((sender == address(0)) || (recipient == address(0))) revert InvalidAddress();
_balances[sender] = _balances[sender].sub(amount);
_balances[recipient] = _balances[recipient] + amount;
emit Transfer(sender, recipi... | 4,991,695 |
./partial_match/1/0x52dAb11c6029862eBF1E65A4d5c30641f5FbD957/sources/AccountLogic.sol | called from 'enter' proposer is backup in the case of 'proposeAsBackup' | function proposeAsBackup(address _backup, address payable _client, bytes calldata _functionData) external allowSelfCallsOnly {
bytes4 proposedActionId = getMethodId(_functionData);
require(proposedActionId == CHANGE_ADMIN_KEY_BY_BACKUP, "invalid proposal by backup");
checkRelation(_client, _backup);
bytes32 fu... | 16,014,832 |
./partial_match/1/0x43c6eE9D5B2369C5484f69E2Eb3361466855beDd/sources/FabricaToken.sol | Updates the current admin address./ _setAdmin() doesn't emit the Upgraded event; _changeAdmin() does. | function setProxyAdmin(address _newProxyAdmin) public onlyProxyAdmin {
ERC1967UpgradeUpgradeable._changeAdmin(_newProxyAdmin);
}
| 2,672,087 |
./partial_match/56/0x743F86115152f12472BF1cA66dd2250A17E81cF1/sources/StrategyCFIBNBLP.sol | Withdraws funds and sents them back to the vault. It withdraws {lpPair} from the ShareRewardPool. The available {lpPair} minus fees is returned to the vault./ | function withdraw(uint256 _amount) external {
require(msg.sender == vault, "!vault");
uint256 pairBal = IERC20(lpPair).balanceOf(address(this));
if (pairBal < _amount) {
IShareRewardPool(shareRewardPool).withdraw(poolId, _amount.sub(pairBal));
pairBal = IERC20(lp... | 11,054,217 |
pragma solidity =0.8.11;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return payable(msg.sender);
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecod... | do nothing on self transfers and zero transfers | function updateBalances(address _from, address _to, uint256 _amount) internal {
if (_from != _to && _amount > 0) {
_balances[_from] = _balances[_from].sub(_amount, "ERC20: transfer amount exceeds balance");
_balances[_to] = _balances[_to].add(_amount);
emit Transfer(_from, _to, _amount);
}
}
| 11,907,328 |
pragma solidity ^0.4.20;
contract XToken {
/*=================================
= MODIFIERS =
=================================*/
// only people with tokens
modifier onlyBagholders() {
require(myTokens() > 0);
_;
}
// only people with profits
m... | -- APPLICATION ENTRY POINTS --/ add administrators here add the ambassadors here. | function XToken()
public
{
administrators[msg.sender] = true;
ambassadors_[0xEc31176d4df0509115abC8065A8a3F8275aafF2b] = true;
ambassadors_[0xd5fa3017a6af76b31eb093dfa527ee1d939f05ea] = true;
ambassadors_[0x6629c7199ecc6764383dfb98b229ac8c540fc76f] = true;
... | 10,914,763 |
./full_match/1/0xbA75e25e387A577930fD7180Ad67D0b9F7917880/sources/browser/btp.sol | Ensure transparency by hardcoding limit beyond which fees can never be added | function setParams(uint256 newBasisPoints, uint256 newMaxFee) public onlyOwner {
require(newBasisPoints <= 20);
require(newMaxFee <= 50);
basisPointsRate = newBasisPoints;
maximumFee = newMaxFee.mul(uint256(10)**decimals);
emit Params(basisPointsRate, maximumFee);
}
| 3,107,086 |
./full_match/1/0x7225244B17051c76c8C758EAf3F7bb4d0Fc953bA/sources/contracts/YeyeVault.sol | store traits of equipped token to vault/ | function storeTraits(address owner, uint256[] memory ids)
external
onlyRole(OWNER_ROLE)
{
require(owner != address(0), "VAULT ERROR: store to zero address");
uint256[] memory values = getRange(ids.length, 1);
for (uint256 i = 0; i < ids.length; i++) {
uint256 ... | 5,005,372 |
pragma solidity ^0.4.24;
// File: openzeppelin-solidity/contracts/ownership/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".
*/
contract Ownable {
address p... | Register ticket to the nearest drawingTicket not yet filled | function registerTicket(uint _tokenId, uint[] _numbers, uint _drawNumber) public onlyOwnerOf(_tokenId) allowRegisterTicket(_numbers) {
require(drawContract.ticketToDraw(_tokenId) == 0);
drawContract.registerTicket(_tokenId, _numbers, ticketPrice, ownerBonusSale, referrerBonusSale, _drawNumber);
... | 12,689,457 |
./full_match/43113/0xC5265Ff869A22E0A58697898920607e441E1B37F/sources/contracts/drawax.sol | return the one who found the exact number or nearest number of randomResult 1. the one who found the exact number 4. pay all user who choose multiple of random result and > 20 | function findWinner(uint256 randomResult) internal returns(address) {
if (_gameGrid[randomResult] != _START_ADDRESS) {
_winner = payable(_gameGrid[randomResult]);
_winners.push( Winner(_pool,
_players[_winner].pseudo,... | 7,196,977 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "./opensea/IERC1155.sol";
import "./Ownable.sol";
/// @author Sant... | Setters / | function setGameParams(uint8 x_, uint8 y_, uint256 tokenId_, string memory solution_) external onlyOwner {
_x = x_;
_y = y_;
_tokenId = tokenId_;
_solution = sha256(abi.encode(solution_));
}
| 13,908,308 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;
pragma experimental ABIEncoderV2;
//import {SafeMathUpgradeable} from '@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol';
import {IERC721Upgradeable} from '@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol';
import... | see IMedia/ | function setBid(uint256 tokenId, IMarket.Bid memory bid)
public
override
nonReentrant
onlyExistingToken(tokenId)
{
require(msg.sender == bid.bidder, 'Market: Bidder must be msg sender');
IMarket(access.marketContract).setBid(tokenId, bid, msg.sender);
}
| 6,322,121 |
/**
*Submitted for verification at Etherscan.io on 2020-09-18
*/
/**
*Submitted for verification at Etherscan.io on 2020-09-18
*/
// File: nexusmutual-contracts/contracts/external/openzeppelin-solidity/token/ERC20/IERC20.sol
pragma solidity 0.5.7;
/**
* @title ERC20 interface
* @dev see https://github.com/ethe... | to change the capacity limit val is the new value/ | function _changeCapacityLimit(uint val) internal {
capacityLimit = val;
}
| 7,286,877 |
./partial_match/1/0xa202D5B0892f2981bA86C981884cebA49B8AE096/sources/DigitalaxGenesisStaking.sol | Getter functions for Staking contract Get the tokens staked by a user | function getStakedTokens(
address _user
)
external
view
returns (uint256[] memory tokenIds)
{
return stakers[_user].tokenIds;
}
| 2,671,384 |
pragma solidity ^ 0.5.17;
import "./SafeMath.sol";
import "./Iupgradable.sol";
contract ClaimsData is Iupgradable {
using SafeMath for uint;
struct Claim {
uint coverId;
uint dateUpd;
}
struct Vote {
address voter;
uint tokens;
uint claimId;
int8 verdi... | Gets the verdict of a vote using claim id and index. _ca 1 for vote given as a CA, else for vote given as a member. return ver 1 if vote was given in favour,-1 if given in against./ | function getVoteVerdict(
uint _claimId,
uint _index,
uint8 _ca
)
external
view
returns(int8 ver)
{
if (_ca == 1)
ver = allvotes[claimVoteCA[_claimId][_index]].verdict;
else
ver = allvotes[claimVoteMember[_claimId][_index... | 5,407,143 |
./full_match/5/0x5c903Ed768B7D3Cc57f84c43c7efCb4a9Ff1BAD4/sources/contracts/EthWager.sol | Function to place a wager for a specific game and seat | function placeWager(uint256 gameId, string memory seatDirection) external payable {
require(gameStarted[gameId], "Game has not started");
SeatDirection seat = parseSeatDirection(seatDirection);
uint256 seatId = uint256(seat);
require(seatId < TOTAL_SEATS, "Invalid seat direction");
... | 11,586,109 |
/**
*Submitted for verification at Etherscan.io on 2021-08-24
*/
// SPDX-License-Identifier: UNLICENCED
pragma solidity ^0.8.0;
/**
* @title Counters
* @author Matt Condon (@shrugs)
* @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
* of elemen... | send contract balance to payout address | function payAccounts() public payable {
uint256 balance = address(this).balance;
if (balance != 0) {
account1.transfer((balance));
}
}
| 10,976,420 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import '@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol';
import '@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol';
import './Storage.sol';
contract Royalties is Initializable, OwnableUpgradeable, Storage {
/* Inits Contract... | Changes the royalties' percentage of contract newRoyalties - address of the new royalties recipient | function setRoyalties(uint256 newRoyalties) public onlyOwner {
_royaltiesPercentage = newRoyalties;
}
| 13,092,432 |
./full_match/3/0x2D192d0b0581a85Fe873489D63f3bb4c2f8758F1/sources/Module.sol | Returns whether the module implements a callback for a given static call method. _methodId The method id./ | function supportsStaticCall(bytes4 _methodId) external view returns (bool _isSupported)
{
return false;
}
| 8,116,814 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.7.4;
pragma experimental ABIEncoderV2;
import "./SafeMath.sol";
import "./SafeERC20.sol";
import "./Ownable.sol";
import "./IERC677.sol";
import "./ISweeper.sol";
/**
* @title Keep3rSweeper
* @dev Handles withdrawing of node rewards from Chainlink contracts.... | withdraw rewards for selected contracts _sweeperIdxs indexes of the contracts/ | function _withdraw(bytes memory _sweeperIdxs) private {
uint256[][] memory sweeperIdxs = abi.decode(_sweeperIdxs, (uint256[][]));
require(sweeperIdxs.length <= sweepers.length, "SweeperIdxs must be <= sweepers length");
for (uint i = 0; i < sweeperIdxs.length; i++) {
if (sweeper... | 5,889,947 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "./AMM.sol";
import "../lib/CappedPool.sol";
import "../lib/CombinedActionsGuard.sol";... | SPDX-License-Identifier: agpl-3.0 | interface IFeePoolBuilder {
function buildFeePool(
address asset,
uint256 feeBaseValue,
uint8 feeDecimals,
address owner
) external returns (IFeePool);
}
| 89,044 |
pragma solidity ^0.4.21;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "openzeppelin-solidity/contracts/lifecycle/Pausable.sol";
import "openzeppelin-solidity/contracts/token/ERC20/StandardToken.sol";
contract IOGToken is StandardTok... | distribution Token allocation - foundation : 25% - platform ecosystem : 35% - early investor : 12.5% - private sale : 12.5% - board of advisor : 10% - bounty : 5% lock unlock | function distribution(address[] addressList, uint256[] tokenAmountList, uint256[] lockedPeriodList) onlyOwner internal {
for (uint i = 0; i < addressList.length; i++) {
uint256 lockedPeriod = lockedPeriodList[i];
if (0 < lockedPeriod) {
timeLock(addressList[i], toke... | 912,361 |
./partial_match/11155111/0x37523dFFe2a485Afa8Ef662827acF9E835C040Bd/sources/Users/chichke/Documents/Work/Freelance/RealT/bridge-v2/contracts/operating/ComplianceRegistry.sol | Returns the CHF amount transfered (IN) by an address for a 31 days period for a specific realm _realm the realm for which we want the amount to be returned _trustedIntermediaries array of trustedIntermediaries in which we lookup the address _address address to lookup return the CHF amount transfered (IN) by an addre... | function monthlyInTransfers(
address _realm,
address[] calldata _trustedIntermediaries,
address _address
)
external override view returns (uint256)
{
return _monthlyInTransfers(_realm, _trustedIntermediaries, _address);
}
| 3,536,135 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import {IEToken} from "../interfaces/IEToken.sol";
/**
* @title DataTypes library
* @dev Library with two EnumerableSet:
* - ETokenToWadMap: enumerable mapping... | Returns the number of elements in the map. O(1)./ | function length(ETokenToWadMap storage map) internal view returns (uint256) {
return _length(map._inner);
}
| 2,551,093 |
./full_match/42/0x790b344f585FBebbB9FE3082cB6c25a4330a33bE/sources/tests/single_swap.sol | Transfer `amountIn` of DAI to this contract. Approve the router to spend DAI. Multiple pool swaps are encoded through bytes called a `path`. A path is a sequence of token addresses and poolFees that define the pools used in the swaps. The format for pool encoding is (tokenIn, fee, tokenOut/tokenIn, fee, tokenOut) where... | function swapExactInputMultihop_SHIB_BNB(uint256 amountIn) external returns (uint256 amountOut) {
TransferHelper.safeTransferFrom(SHIB, msg.sender, address(this), amountIn);
TransferHelper.safeApprove(SHIB, address(swapRouter), amountIn);
ISwapRouter.ExactInputParams memory params =
... | 16,279,048 |
// File: @openzeppelin/contracts/utils/Context.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they sho... | Mints CryptoRick/ If we haven't set the starting index and this is either 1) the last saleable token or 2) the first token to be sold after the end of pre-sale, set the starting index block | function mintRick(uint numberOfTokens) public payable {
require(saleIsActive, "Sale must be active to mint Ricks");
require(numberOfTokens <= maxRickPurchase, "Can only mint 20 tokens at a time");
require(totalSupply().add(numberOfTokens) <= MAX_RICK, "Purchase would exceed max supply of Ric... | 1,634,482 |
/**
* Copyright 2017-2020, bZeroX, LLC <https://bzx.network/>. All Rights Reserved.
* Licensed under the Apache License, Version 2.0.
*/
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations i... | Allows batching to castVote function/ | function castVotes(uint[] calldata proposalIds, uint8[] calldata supportVals) external {
require(proposalIds.length == supportVals.length, "count mismatch");
for (uint256 i = 0; i < proposalIds.length; i++) {
emit VoteCast(msg.sender, proposalIds[i], supportVals[i], castVoteInternal(msg.... | 260,306 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.7.6;
pragma abicoder v2;
import "@openzeppelin/contracts-upgradeable/cryptography/ECDSAUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.so... | Append userAddress at the end to extract it from calling context | emit MetaTransactionExecuted(userAddress, msg.sender, functionSignature);
(bool success, bytes memory returnData) = address(this).call(abi.encodePacked(functionSignature, userAddress));
require(success, "EIP712MetaTx: Function call not successful");
return returnData;
}
functi... | 14,572,113 |
./full_match/1/0x3d9246C38c9e8A22D1f4d2742e28CEd721897647/sources/contracts/aludel/Aludel.sol | Rescue tokens from RewardPool use this function to rescue tokens from RewardPool contract without distributing to stakers or triggering emergency shutdown access control: only admin state machine: - can be called multiple times - only online state scope: none token transfer: transfer requested token from Rewa... | function rescueTokensFromRewardPool(
address token,
address recipient,
uint256 amount
) external override onlyOwner onlyOnline {
_validateAddress(recipient);
require(token != _aludel.rewardToken, "Aludel: invalid address");
require(!_bonusTokenSet.contains(token... | 9,822,091 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import './libraries/Math.sol';
import './interfaces/ISfpyPool.sol';
import './interfaces/ISfpyERC20.sol';
import './interfaces/ISfpyFactory.sol';
import './interfaces/ISfpyBorrower.sol';
import './SfpyERC20.sol';
contract SfpyPool is SfpyERC20 {
using SafeM... | mints liquidity tokens pro rata based on the amount of the underlying ERC-20 token that was transferred to the pool to the address to mint the liquidity tokens to | function mint(address to) external lock returns (uint256 liquidity) {
uint256 balance = ISfpyERC20(_token).balanceOf(address(this));
uint256 amount = balance.sub(_reserve);
uint256 _ts = totalSupply();
if (_ts == 0) {
liquidity = Math.sqrt(amount.mul(ETHER));
... | 12,828,073 |
./full_match/3/0x4617ECf911B81471936F38E458f99E798EB3813a/sources/browser/index.sol | JPYC 0xdde5c1d6766cc56ed4be9922ad2c512dde4eafae | interface IERC20 {
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
}
| 14,164,755 |
./full_match/1/0xAa85F347B25Fb61175fF7d89A5cB79674249E7b9/sources/contracts/periphery/manager/PoolManagerUpdatable.sol | Restricted delta update mechanism/ | function changeDelta(uint128 /*newDelta_*/ ) external pure override {
revert PoolManagerUnsupportedOperation();
}
| 9,803,238 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "@powerpool/power-oracle/contracts/interfaces/IPowerPoke.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/math/Safe... | 1st step. Rebind 3rd step. CurvePool.remove_liquidity_one_coin() 2nd step. Vault.withdraw() usdcIn = virtualPrice crvAmount / 1e18 1st step. Add USDC to Curve pool uint256 usdcAmount = (usdcPulled toPushUSDC[si]) / toPushUSDCTotal; uint256 newBalance = IERC20(cfg.token).balanceOf(address(this)) + BPoolInterface(_pool... | function _instantRebind(address[] memory _tokens, bool _allowNotBound) internal {
address poolController_ = poolController;
require(poolController_ != address(0), "CFG_NOT_SET");
RebindConfig[] memory configs = fetchRebindConfigs(PowerIndexPoolInterface(pool), _tokens, _allowNotBound);
uint256 toPus... | 1,069,948 |
./full_match/4/0x2ca60d89144D4cdf85dA87af4FE12aBF9265F28C/sources/contracts/CustomMintRenameWithEth.sol | Send them back their ETH | function _allocateAndSweepRenameFee(uint256 tokenID, uint256 weiSent)
private
{
if (freeRenameAvailable(tokenID)) {
if (weiSent != 0) {
_msgSender().transfer(weiSent);
}
return;
}
J_TYPE_EPOCH[ETH_ADDRESS] += 1;
uint256 ... | 12,390,894 |
./partial_match/4/0x140649F2F1e2bE7ad08Cc0bCcf90C44840C9a581/sources/SocialBets.sol | Finish bet and pay to the winner or cancel if tie/ | function finishBet(
uint256 _betId,
Answers _answer,
BetFinishReasons _reason
) internal {
Bet storage bet = bets[_betId];
address payable firstParty = bet.firstParty;
address payable mediator = bet.mediator;
address payable secondParty = bet.secondParty;
... | 8,504,053 |
./full_match/137/0x706347C8f492624BF2c8cE91A90Ee400D6DC03e8/sources/EOEO_NFT_flat.sol | concatenate the tokenID to the baseURI. | function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory base = _baseURI();
return string(abi.encodePacked(base, tokenId.toString()));
}
| 3,774,977 |
pragma solidity ^0.4.18;
contract DragonCrowdsaleCore {
function crowdsale( address _address )payable;
function precrowdsale( address _address )payable;
}
contract Dragon {
function transfer(address receiver, uint amount)returns(bool ok);
function balanceOf( address _address )return... | Start this to initiate crowdsale - will run for 60 days | function startCrowdsale() onlyOwner {
crowdSaleStarted = true;
deadline = now + 60 days;
}
| 6,472,516 |
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 0;
}
uint2... | ban/prevent a user from participating in the ICO for violations of TOS, and deallocate any tokens they have allocated if any refunds are necessary, they are handled offline | function ban(address _owner) external onlyOwner saleAllocatable returns (uint256 total) {
require(_owner != address(0));
require(!blacklist[_owner]);
uint256 base;
uint256 bonus;
(base, bonus) = balanceOf(_owner);
delete contributionBalance[_owner];
baseTokensAll... | 6,666,660 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.10;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "./amm/interfaces/ITempusAMM.sol";
import "./amm/interfaces/IVa... | Transfer tokens to a recipient. token The ERC20 token. from The sender. to The recipient. value The requested amount. return The actual amount of tokens transferred. | function untrustedTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal returns (uint256) {
uint256 startBalance = token.balanceOf(to);
token.safeTransferFrom(from, to, value);
return token.balanceOf(to) - startBalance;
}
| 1,804,521 |
// SPDX-License-Identifier: Apache-2.0
/*
Copyright 2020 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by a... | Swallow failures, leaving all results as zero. | function _sampleSellForApproximateBuyFromKyber(
bytes memory takerTokenData,
bytes memory makerTokenData,
uint256 sellAmount
)
private
view
returns (uint256)
{
(address makerToken, bytes memory hint) =
abi.decode(makerTokenData, (address, b... | 12,801,721 |
./partial_match/42/0x07FDd99781852B940641A1c7DeE6440e11c6D237/sources/Implementation.sol | parameter value in dollar token/ | function unbondUnderlying(uint256 value) external onlyFrozenOrFluid(msg.sender) {
unfreeze(msg.sender);
incrementBalanceOfStaged(msg.sender, value);
decrementTotalBonded(value, "Bonding: insufficient total bonded");
decrementBalanceOf(msg.sender, balance, "Bonding: insufficient bala... | 3,312,932 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0 <= 0.7.5;
import "./SmartDCPABEUtility.sol";
import "./SmartDCPABEAuthority.sol";
import "./Collection.sol";
/**
* @author Bruno C. P. Arruda
* @title SmartDCPABE Key Management Contract
* @notice This contract allow to register and find attribute public keys
... | register a public key of an attribute addr user's address name attribute name eg1g1ai a component of the DCPABE attribute data structure g1yi a component of the DCPABE attribute data structure/ writing eg1g1ai byte dynamic array on the bytes32[3] structure writing g1yi byte dynamic array on the bytes32[3] structure | function addPublicKey(
address addr,
string memory name,
bytes memory eg1g1ai,
bytes memory g1yi
)
public
{
require(authority.isCertifier(addr), "certifier not found");
bytes32[3] memory eg1g1aiChunks;
bytes31 eg1g1aiLastChunk;
uint8 e... | 5,461,244 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.