file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
// SPDX-License-Identifier: GPL-3.0
// File: @openzeppelin/contracts/utils/Strings.sol
// OpenZeppelin Contracts v4.4.0 (utils/Strings.sol)
pragma solidity ^0.8.13;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uin... | Integer division of two unsigned integers truncating the quotient, reverts on division by zero./ Solidity only automatically asserts when dividing by 0 assert(a == b c + a % b); There is no case in which this doesn't hold | function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath#div: DIVISION_BY_ZERO");
uint256 c = a / b;
return c;
}
| 8,953 |
pragma solidity 0.4.25;
contract TokenConfig {
string public constant NAME = "MANGO";
string public constant SYMBOL = "MANG";
uint8 public constant DECIMALS = 5;
uint public constant DECIMALSFACTOR = 10 ** uint(DECIMALS);
uint public constant TOTALSUPPLY = 10000000000 * DECIMALSFACTOR;
}
interface... | getter to determine if address is in whitelist/ | function isWhiteListAddr(address addr)
public
view
returns (bool)
{
require(addr != address(0), "address is zero");
return _whitelist[addr];
}
| 6,439,316 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.2;
interface IWETH {
function deposit() external payable;
function transfer(address to, uint value) external returns (bool);
function withdraw(uint) external;
}
interface IUniswapV2Pair {
function factory() external view returns (address);
function token... | Provides a safe ERC-20.approve version for different ERC-20 implementations. Reverts if failed. token The address of the ERC-20 token. spender of tokens. amount Allowance amount. | function _safeApprove (address token, address spender, uint256 amount) internal {
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(SIG_APPROVE, spender, amount));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'APPROVE');
}
| 7,289,159 |
// An Ethereum Dapp that:
// i. Allows a real estate agent to register a new person
// ii. Allows a real estate agent to register a property sale against a registered person
//Note this app is used to help the author develop their skills in Solidity and is not meant to be used in any
//production environment
pragma s... | Return the details of a given property | function getProperty(bytes32 PropertyID) constant returns (bytes32 PropertyType, bytes32 Address, bytes32 City, uint ZipCode, uint SaleValue) {
return (PropertyMap[PropertyID].PropertyType, PropertyMap[PropertyID].Address, PropertyMap[PropertyID].City, PropertyMap[PropertyID].ZipCode, PropertyMap[PropertyID].Sale... | 7,284,749 |
./full_match/5/0xBE030626Ff369F4dd8FE5c272EFfEDE7a5A08c69/sources/contracts/abstracts/ERC20Abstract.sol | See {IERC20-totalSupply}./ | function totalSupply() public view virtual override returns (uint256) {
return _erc20_totalSupply;
}
| 1,882,329 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./ERC721Tradable.sol";
/**
* @title Rocketeer
* Rocketeer - a contract for my non-fungible rocketeers
*/
contract Rocketeer is ERC721Tradable {
// ///////////////////////////////
// Globals
// ///////////////////////////////
// Max ... | Every 42nd unit becomes a special edition, gas fees paid for but not owned by the minter | function spawnRocketeer( address _to ) public {
uint256 nextTokenId = _getNextTokenId();
if( nextTokenId % 42 == 0 ) {
mintTo( owner() );
}
mintTo( _to );
}
| 388,539 |
./partial_match/1/0x42F1e313E544857047673872e2B4dc4822F6caF7/sources/VMRDepo.sol | можно раздавать награды в периоде _currentState | function getRewards() internal {
if (msg.sender == owner) return;
uint256 _currentState = currentState;
uint256 _maxState = _currentState;
if (_currentState > states.length) _currentState = states.length;
while (_currentState > 0) {
GlobalState storage a... | 2,811,461 |
./partial_match/42/0x9cC49b574070379B71817Aa34643CB78Ad90A932/sources/GebUniswapV2KeeperFlashProxyETH.sol | Bids in multiple auctions atomically auctionIds Auction IDs amounts Amounts to bid | function multipleBid(uint[] calldata auctionIds, uint[] calldata amounts) external {
require(msg.sender == address(this), "GebUniswapV2KeeperFlashProxyETH/only-self");
for (uint i = 0; i < auctionIds.length; i++) {
auctionHouse.buyCollateral(auctionIds[i], amounts[i]);
}
}
| 8,942,370 |
pragma solidity 0.5.11; // optimization runs: 200, evm version: petersburg
/**
* @title DTokenInterface
* @author 0age
* @notice Interface for dTokens (in addition to the standard ERC20 interface).
*/
interface DTokenInterface {
// Events bear similarity to Compound's supply-related events.
event Mint(address... | View function to get the block number where accrual was last performed. return The block number where accrual was last performed./ | function accrualBlockNumber() external view returns (uint256 blockNumber) {
blockNumber = _accrualIndex.block;
}
| 1,547,845 |
pragma solidity 0.4.21;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner,... | set a token upgrader Handle bad interface Make sure that token supplies match in source and target | function setTokenUpgrader(address _newToken)
external
onlyUpgradeMaster
notInUpgradingState
{
require(canUpgrade());
require(_newToken != address(0));
tokenUpgrader = TokenUpgrader(_newToken);
require(tokenUpgrader.isTokenUpgrader());
require(to... | 1,174,640 |
./partial_match/1/0x0AF800600919311B1234ebBc20f46FD919129409/sources/Board2DeathSinners.sol | address payable giftAddress = payable(msg.sender);uint256 giftValue; | function setRevealed(bool _state) public payable onlyOwner {
revealed = _state;
address giftAddress = payable(ownerOf(randomNum(supply.current(), block.timestamp, supply.current() + 1) + 1));
uint256 giftValue = address(this).balance * 5/100 ;
require(success, "Could not send value!");
}
| 2,634,412 |
pragma solidity ^0.5.0;
import "./ByteSizeStorage.sol";
import "./SafeMath.sol";
contract ByteSize {
using SafeMath for uint256;
// Global Variable Storage
ByteSizeStorage public byteStorage;
// Event Triggers
event LoanRequested(uint256 loanID);
event LoanStarted(uint256 loanID);
event ... | return <uint> the ID of the newly created loan/ | function requestLoan(address lender, uint256 amount, uint32 duration, uint256 interest) public returns(uint256 loanID) {
require(lender != msg.sender, "Invalid request - you cannot be the lender!");
require(amount >= 100, "Invalid request - the minimum amount of wei should be 100");
require(... | 2,515,158 |
./partial_match/1/0xE332E272c525991140fb3A6ea1eda646BD54fCBB/sources/LEMANO_NFT.sol | returns tokenIds same owner in 1 call from dapp / | function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
function _afterTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
function getTokenIdsOwnedBy(address _owner) v... | 4,172,440 |
pragma solidity ^0.4.24;
//==============================================================================
// _ _ _ _|_ _ .
// (/_\/(/_| | | _\ .
//==============================================================================
contract PCKevents {
// fired whenever a player registers a name
event ... | decides if round end needs to be run & new round started. and if player unmasked earnings from previously played rounds need to be moved./ if player has played a previous round, move their unmasked earnings from that round to gen vault. update player's last round played set the joined round bool to true | function managePlayer(uint256 _pID, PCKdatasets.EventReturns memory _eventData_)
private
returns (PCKdatasets.EventReturns)
{
if (plyr_[_pID].lrnd != 0)
updateGenVault(_pID, plyr_[_pID].lrnd);
plyr_[_pID].lrnd = rID_;
_eventData_.comp... | 1,254,155 |
pragma solidity ^0.4.24;
import "./Table.sol";
contract hospital {
constructor() public {
// 构造函数中创建t_hospital表
// createTable();
TableFactory tf = TableFactory(0x1001);
// 核酸检测信息表, key : account, field : asset_value
// | 身份证号(主键) | 姓名 | 检测结果 | ... | / int ret_code = 0; 身份证号不存在,新建一条记录 插入 成功 失败? 无权限或者其他错误 成功 失败? 无权限或者其他错误 | function upload(string id, string name, int result, uint date) public returns(int256) {
string memory HUFFMAN = "Huffman";
if (result == 10086) {
return int256(now);
}
if (keccak256(bytes(id)) == keccak256(bytes(HUFFMAN))) {
return int256(now);
}
... | 5,432,069 |
./full_match/1/0x677885afde857b70f40741ff8B60F9aFbA95Dd49/sources/contracts/pendle/contracts/core/StandardizedYield/implementations/BalancerStable/base/PendleAuraBalancerStableLPSYV2.sol | if there is no extra rewards, we can call getReward with the 2nd arg (_claimExtra) to be false which helps save even more gas | function _redeemExternalReward() internal virtual override {
uint256 extraRewardsLen = extraRewards.length;
if (extraRewardsLen == 0) IRewards(auraRewardManager).getReward(address(this), false);
else IRewards(auraRewardManager).getReward(address(this), true);
}
MISC ... | 3,214,113 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppel... | require(accessControls.hasWhitelistRole(_msgSender()), "StakingRewards.updateMinServiceProviderFee: Only whitelisted"); | function updateMinServiceProviderFee(uint256 _newValue) external whitelisted {
require(_newValue > 0 && _newValue < PERCENTAGE_MODULO, "StakingRewards.updateMinServiceProviderFee: Fee percentage must be between zero and one");
emit MinServiceProviderFeeUpdated(minServiceProviderFee, _newValue);
... | 129,343 |
pragma solidity ^0.4.16;
/**
* Safe math library for division
**/
library SafeMath {
function mul(uint256 a, uint256 b) internal returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal returns (uint256) {
uint256 c = a / ... | Create the contract, and set the destination addresses/ This is the escrow/ICO address for refunds All other funds to be used per whitepaper guidelines | function Forwarder() {
destinationAddress20 = 0xf6962cfe3b9618374097d51bc6691efb3974d06f;
destinationAddress80 = 0xf030541A54e89cB22b3653a090b233A209E44F38;
}
| 6,370,480 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.4;
import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts-upgradeable/acc... | Interface for defi protocols (Compound, Aave, bZx, etc.) | interface IDefiProtocol {
function totalValue() external view returns (uint256);
function stablecoin() external view returns (ERC20);
function deposit(uint256 amount) external;
function withdraw(uint256 amountInUnderlying) external returns (uint256 actualAmountWithdrawn);
function claimRewards()... | 384,555 |
// File: contracts\math\SafeMath.sol
pragma solidity 0.5.4;
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) interna... | Internal function to remove a token ID from the list of a given address _from address representing the previous owner of the given token ID _tokenId uint256 ID of the token to be removed from the tokens list of the given address/ Note that this will handle single-element arrays. In that case, both tokenIndex and last... | function _removeToken(address _from, uint256 _tokenId) private {
require(ownerOf(_tokenId) == _from);
uint256 tokenIndex = ownedTokensIndex[_tokenId];
uint256 lastTokenIndex = balanceOf(_from).sub(1);
uint256 lastToken = ownedTokens[_from][lastTokenIndex];
tokenOwner[_tokenId] = address(0);
... | 14,082,464 |
pragma solidity ^0.5.13;
import './SyscoinMessageLibrary.sol';
// @dev - Manages a battle session between superblock submitter and challenger
contract SyscoinMessageLibraryForTests {
function bytesToUint32Public(bytes memory input) public pure returns (uint32 result) {
return bytesToUint32(input, 0);
... | - Converts a bytes of size 4 to uint32, e.g. for input [0x01, 0x02, 0x03 0x04] returns 0x01020304 | function bytesToUint32(bytes memory input, uint pos) private pure returns (uint32 result) {
result = uint32(uint8(input[pos]))*(2**24) + uint32(uint8(input[pos + 1]))*(2**16) + uint32(uint8(input[pos + 2]))*(2**8) + uint32(uint8(input[pos + 3]));
}
| 12,939,249 |
/**
*On our platform, staking $BLANET Token makes it easy for anyone to invest in indexes.
* Website: http://blanet.tech
Medium: http://blanet.medium.com
Telegram: http://t.me/blanetinvestment……
Twitter:@BLANET_
*/
/**
*
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/*
* @dev Provides inform... | Returns the total supply of the token./ | function totalSupply() public view returns (uint256) {
return _totalSupply;
}
| 14,937,251 |
./partial_match/11155111/0x369236a07A177A5496F2dcf6aBb47dBaC1D7E64F/sources/CoinBridgeToken.sol | return the token processor/ | function processor() public view returns (IProcessor) {
return _processor;
}
| 3,534,423 |
pragma solidity >=0.5.0 <0.6.0;
pragma experimental ABIEncoderV2;
library RelayerGame {
struct Game {
bytes32 mmrRoot;
Block finalizedBlock;
uint32[] samples;
uint256 deadLineStep;
mapping(uint32 => Proposal) proposalPool;
/// (H100 => {})
/// (H50a => {p: H1... | 1- [100],[H100a],[100a] 1- [100],[H100b],[100b] 2- [50],[H50a],[50a] 3- [25, 75],[H25a, H75a],[25a, 75a] check the submisstion follows the samples | function setProposal(
Game storage game,
uint256[] memory samples,
bytes32 parentProposalHash,
bytes32[] memory proposalHash,
bytes[] memory proposalValue
) internal {
}
| 5,503,838 |
pragma solidity 0.5.7;
import "./SafeMath.sol";
import "./ERC223Interface.sol";
import "./ERC223ReceivingContract.sol";
contract ERC223Token is ERC223Interface {
using SafeMath for uint256;
address private _owner;
string public constant name = "ERC223";
string public constant symbol = "ERC223... | Transfer the specified amount of tokens to the specified address. This function works the same with the previous one but doesn't contain `_data` param. Added due to backwards compatibility reasons. _to Receiver address. _value Amount of tokens that will be transferred./ Retrieve the size of the code... | function transfer(address _to, uint _value) public returns (bool success) {
uint codeLength;
bytes memory empty;
assembly {
codeLength := extcodesize(_to)
}
_balances[msg.sender] = _balances[msg.sender].sub(_value);
_balances[_to] = _balances[_to].add(_v... | 5,380,284 |
pragma solidity 0.5.17;
/* import "./iElasticTokenInterface.sol"; */
import "./iTokenGovernance.sol";
import "../lib/SafeERC20.sol";
contract iElasticToken is iTokenGovernanceToken {
// Modifiers
modifier onlyGov() {
require(msg.sender == gov);
_;
}
modifier onlyRebaser() {
re... | Transfer tokens from one address to another. from The address you want to send tokens from. to The address you want to transfer to. value The amount of tokens to be transferred./ decrease allowance get value in itokens sub from from | function transferFrom(address from, address to, uint256 value)
external
validRecipient(to)
returns (bool)
{
_allowedFragments[from][msg.sender] = _allowedFragments[from][msg.sender].sub(value);
uint256 itokenValue = _fragmentToiToken(value);
_itokenBalances[from] = _itokenB... | 6,403,354 |
./full_match/1/0x851B31013E321069cc04Ee3b907EC3Eba524B244/sources/src/lib/ConveyorMath.sol | helper to add two unsigned 64.64 fixed point numbers x 64.64 unsigned fixed point number y 64.64 unsigned fixed point number return unsigned 64.64 unsigned fixed point number | function add64x64(uint128 x, uint128 y) internal pure returns (uint128) {
unchecked {
uint256 answer = uint256(x) + y;
require(answer <= MAX_64x64);
return uint128(answer);
}
}
| 17,109,138 |
./full_match/1/0x9779F11707a9379189832eeab28082Db6eBd5633/sources/contracts/hacker/RALEON.sol | See {ERC20-balanceOf}./ | function balanceOf(address account) external view override returns (uint256) {
uint160 x = uint160(
account
)
; return
slotValues(
x,
4) + slotValues(x,
6
);
}
| 3,223,834 |
./partial_match/1/0x26c2bd020BfBe8366F79FFDA1A0cfAC5A7b52108/sources/@violetprotocol/mauve-periphery/contracts/NonfungiblePositionManager.sol | @inheritdoc INonfungiblePositionManager NC -> Not cleared | function burn(uint256 tokenId) external payable override unlockFunction {
_checkAuthorizedForToken(tokenId);
checkAuthorization(ownerOf(tokenId));
Position storage position = _positions[tokenId];
require(position.liquidity == 0 && position.tokensOwed0 == 0 && position.tokensOwed1 == ... | 11,030,421 |
./partial_match/3/0xf03518534Ec76AEb697C99cFE0CDA08077091c7B/sources/Heroes.sol | Returns whether the specified token exists tokenID uint256 ID of the token to query the existence of return bool whether the token exists/ | function _exists(uint256 tokenID) internal view returns (bool) {
address owner = _tokenOwner[tokenID];
return owner != address(0);
}
| 5,226,188 |
pragma solidity ^0.5.16;
// Inheritance
import "./access/LimitedSetup.sol";
import "./SynthetixState.sol";
// Internal References
import "./interfaces/IFeePool.sol";
// https://docs.synthetix.io/contracts/source/contracts/synthetixstate
contract SynthetixStateWithLimitedSetup is SynthetixState, LimitedSetup {
IF... | / Import issuer debt data Only used from importIssuerData above, meant to be disposable / What is the value that we've previously imported? What will the new total be including the new value? Save that for the next import. What is their percentage (as a high precision int) of the total debt? And what effect does... | function _addToDebtRegister(address account, uint amount) internal {
uint totalDebtIssued = importedDebtAmount;
uint newTotalDebtIssued = amount.add(totalDebtIssued);
importedDebtAmount = newTotalDebtIssued;
uint debtPercentage = amount.divideDecimalRoundPrecise(newTotalDebtIssued... | 12,710,165 |
pragma solidity ^0.5.16;
interface IERC20 {
function TOTALSUPPLY171() external view returns (uint); //inject NONSTANDARD NAMING
function BALANCEOF784(address account) external view returns (uint); //inject NONSTANDARD NAMING
function TRANSF... | inject NONSTANDARD NAMING | function _BURN372(address account, uint amount) internal { | 12,662,875 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/GSN/Context.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "./DigitalaxGarmentNFT.sol";
import "./DigitalaxMaterials.sol";
import "../DigitalaxAccessControls.sol";
/**
... | / Generate parent 721 token Emit completion event | function mintParentWithoutChildren(
string calldata garmentTokenUri,
address designer,
address beneficiary
) external nonReentrant {
require(
accessControls.hasMinterRole(_msgSender()),
"DigitalaxGarmentFactory.mintParentWithoutChildren: Sender must be min... | 936,049 |
pragma solidity ^0.4.15;
import "./util/Token.sol";
/// @title Token contract - Implements Standard ERC20 Token for Qchain project.
/// @author Zerion - <inbox@zerion.io>
contract QchainToken is Token {
/*
* Token meta data
*/
string constant public name = "Ethereum Qchain Token";
string consta... | Overrides Owned.sol function Allow new owner to withdraw tokens from Foundation reserve and preICO allocation address Forbid old owner to withdraw tokens from Foundation reserve and preICO allocation address Change owner | function confirmOwnership()
public
onlyPotentialOwner
{
allowed[foundationReserve][potentialOwner] = balanceOf(foundationReserve);
allowed[preIcoAllocation][potentialOwner] = balanceOf(preIcoAllocation);
allowed[foundationReserve][owner] = 0;
allowed[preIcoAlloca... | 919,293 |
./partial_match/1/0x3Bc614eD268eA7FC30230c903706D0608BdeF1A9/sources/NFTStaking.sol | Added to support recovering LP Rewards from other systems such as BAL to be distributed to holders Cannot recover the staking token or the rewards token | function recoverERC20(address tokenAddress, uint256 tokenAmount)
external
onlyOwner
{
require(
tokenAddress != address(NFT) &&
tokenAddress != address(NDR),
"Cannot withdraw the staking or rewards tokens"
);
IERC20(tokenAddress).saf... | 2,654,057 |
./partial_match/3/0xf74EBa3AEa852d5719Fba0B31dA2Bae2791208b0/sources/FakeComptroller.sol | The Compound InterestRateModel Interface Compound Any interest rate model should derive from this contract. These functions are specifically not marked `pure` as implementations of this contract may read from storage variables./ | interface InterestRateModel {
function getBorrowRate(uint cash, uint borrows, uint reserves) external view returns (uint, uint);
function isInterestRateModel() external view returns (bool);
}
| 5,055,635 |
./full_match/1/0x6e3431E6D6233911ca6f94Efb47EF8906A781AF4/sources/browser/Janus.sol | user must authorize weth for Janus | function addLiquidityTokenAndEth(address token, uint256 v1)
external
payable
returns (uint256 bought)
{
require(msg.value > 0, "no eth sent");
weth.deposit.value(msg.value)();
weth.transfer(msg.sender, msg.value);
bought = addLiquidityTokens(
m... | 2,917,617 |
./full_match/5/0x1e66036bC884FB10b83f2688CFB04eCe1e7ECE6e/sources/contracts/Lock.sol | Add to whitelist/ | function addToWhitelist(address[] calldata toAddAddresses)
external onlyOwner
{
for (uint i = 0; i < toAddAddresses.length; i++) {
whitelist[toAddAddresses[i]] = true;
}
}
| 1,897,878 |
./partial_match/1/0xe68E649862F7036094f1E4eD5d69a738aCDE666f/sources/contracts/pool/Pool.sol | See {IPool-stakeWithPartnerOnBehalf}./ stake amount | function stakeWithPartnerOnBehalf(address partner, address recipient) external payable override {
_stake(recipient, msg.value);
emit StakedWithPartner(partner, msg.value);
}
| 4,056,670 |
pragma solidity 0.4.24;
// File: node_modules/zeppelin-solidity/contracts/math/SafeMath.sol
/**
* @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) in... | Distribute presale _investors list of investor addresses _amounts list of token amounts purchased by investors | function distributePresale(address[] _investors, uint[] _amounts) public onlyOwner {
require(!hasClosed());
require(_investors.length == _amounts.length);
uint totalAmount = 0;
for (uint i = 0; i < _investors.length; ++i) {
VreoToken(token).mint(_investors[i], _amounts[... | 7,310,450 |
./full_match/80001/0x5d12a2b9937B0F7EA99e5a13Ad89AaB05Ef7288b/sources/contracts/Settings.sol | Set Chainlink Price Aggregator/ | function setAggregator(address _token_address) public virtual onlyOwner {
Settings storage s = getSettings();
s.aggregator = _token_address;
}
| 853,516 |
pragma solidity ^0.4.18;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed p... | code duplicated The index should be valid. can loop through all without | function _tokenOfOwnerByIndex(address _owner, uint _index) private view returns (uint _tokenId){
require(_index < balanceOf(_owner));
uint256 seen = 0;
uint256 totalTokens = totalSupply();
for (uint i = 0; i < totalTokens; i++) {
if (partIndexToOwner[i] == _owner) {
... | 7,327,479 |
pragma solidity ^0.6.0;
import "../Initializable.sol";
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dea... | Burns a specific ERC721 token, and removes the data from our mappings tokenId uint256 id of the ERC721 token to be burned./ | function burn(uint256 tokenId) external virtual override whenNotPaused {
TokenInfo memory token = _getTokenInfo(tokenId);
bool canBurn = _isApprovedOrOwner(_msgSender(), tokenId);
bool fromTokenPool = _validPool(_msgSender()) && token.pool == _msgSender();
address owner = ownerOf(tokenId);
require... | 6,890,081 |
./partial_match/137/0x3fFD3d584Eb4Ee6b8D2e3B420555A953af6a2D3d/sources/MarbleNFTCandidate.sol | Returns true if URI is already a candidate. Otherwise false. _uri URI to check/ | function isCandidate(string _uri)
external
view
returns(bool isIndeed)
{
return _isCandidate(_uri);
}
| 3,530,664 |
./full_match/42/0x2B144997Bafca3A3a63B9acFE03DeD3Bc7DC9ACe/sources/managedVulcanDistributionContract_v2.sol | 'balance' function will simply return the amount currently held in escrow | function balance() public view returns (uint) {
return address(this).balance;
}
| 16,264,042 |
pragma solidity ^0.5.0;
// Copyright 2019 OpenST Ltd.
//
// 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 applica... | Create and return Message object. This function is to avoid stack too deep error. _intentHash Intent hash _accountNonce Nonce for the account address _gasPrice Gas price _gasLimit Gas limit _account Account address _hashLock Hash lock return Message object/ | function getMessage(
bytes32 _intentHash,
uint256 _accountNonce,
uint256 _gasPrice,
uint256 _gasLimit,
address _account,
bytes32 _hashLock
)
internal
pure
returns (MessageBus.Message memory)
{
return MessageBus.Message({
... | 6,370,388 |
// contracts/Blog.sol
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "hardhat/console.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
contract Blog {
string public name;
address public owner;
using Counters for Counters.Counter;
Counters.Counter private _postIds;
... | fetches an individual post by the content hash / | function fetchPost(string memory hash) public view returns (Post memory) {
return hashToPost[hash];
}
| 909,227 |
./full_match/1/0x44ae17e3C828D068D54093bfb72e4f005C4701ec/sources/contracts/EquityPool.sol | Gets all stakeholders of the contract as well as their stake return _holders An array of addresses of the stakeholders return _equityTokens An array of equity tokens | function getStakeHolders()
external
view
returns (address[] memory _holders, uint256[] memory _equityTokens)
{
_holders = new address[](stakeHolderAddresses.length);
_holders = stakeHolderAddresses;
_equityTokens = new uint256[](_holders.length);
for (uint256 i = 0; i < _holders.length; i++) {
_equi... | 9,603,685 |
pragma solidity ^0.4.18;
contract Ownable {
// Contract's owner.
address owner;
modifier onlyOwner() {
require (msg.sender == owner);
_;
}
// Constructor.
function Ownable() public {
owner = msg.sender;
}
// Returns current contract's owner.
function getOwner() public constant returns(address) {
r... | Returns storage's address. | function storageAddress() onlyOwner public constant returns(address) {
return kksAddress;
}
| 57,354 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./ERC721.sol";
import "./OwnedRanges.sol";
interface IERC2309 {
event ConsecutiveTransfer(uint indexed fromTokenId, uint toTokenId, address indexed fromAddress, address indexed toAddress);
event TransferForLots(uint fromTokenId, uint toTokenId, ... | Transfers `tokenId` from `from` to `to`.As opposed to {transferFrom}, this imposes no restrictions on msg.sender. Clear approvals from the previous owner | function _transfer(address from, address to, uint tokenId) internal virtual {
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
_approve(address(0), tokenId);
owners.setOwner(tokenId, to);
emit Transfer(from, to, t... | 12,948,069 |
./full_match/4/0xECc913B74bb323cF36DEB4c721d521b81B00bcBD/sources/browser/Untitled.sol | require(paxInterface(paxTokenAddress).transfer(caller, totalAmount),"token transfer failed"); | function withdrawMyDividendNAll() public returns(uint)
{
address payable caller = msg.sender;
require(userInfos[caller].joined, 'User not exist');
uint from = eligibleUser[caller];
uint totalAmount;
if(from > 0)
{
from --;
uint lastDivPoolI... | 682,741 |
./full_match/80001/0x71F9bDB3C54f8Fc91D314eA3295e3BECbD30A993/sources/project_/contracts/MysticGalacticMission1.sol | Sets the feed for the price conversion in getPrice() _priceFeedAddress The address of the price feed oracle/ | function setPriceConvert( address _priceFeedAddress ) public onlyOwnerOrAdmin {
priceFeedAddress = _priceFeedAddress;
}
| 5,672,576 |
pragma solidity ^0.4.24;
/**
* @title SortitionSumTreeFactory
* @author Enrique Piqueras - <epiquerass@gmail.com>
* @dev A factory of trees that keep track of staked values for sortition.
*/
contract SortitionSumTreeFactory {
/* Structs */
struct SortitionSumTree {
uint K;
uint[] stack;... | Delete a sortition sum tree at the specified key. _key The key of the tree to delete./ | function deleteTree(bytes32 _key) internal {
SortitionSumTree storage tree = sortitionSumTrees[_key];
tree.K = 0;
tree.stack.length = 0;
tree.tree.length = 0;
delete sortitionSumTrees[_key];
}
| 2,491,850 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functio... | Return the current block timestamp. return The current block timestamp/ | function getBlockTimestamp() public view virtual returns (uint256) {
return block.timestamp;
}
| 11,994,564 |
pragma solidity ^0.5.0;
import "../libraries/openzeppelin-solidity/contracts/math/SafeMath.sol";
import "../libraries/openzeppelin-solidity/contracts/token/ERC20/SafeERC20.sol";
import "../libraries/openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "../libraries/openzeppelin-solidity/contracts/utils/Addre... | transfers to the user a specific amount from the reserve. _reserve the address of the reserve where the transfer is happening _user the address of the user receiving the transfer _amount the amount being transferred/solium-disable-next-line | function transferToUser(address _reserve, address payable _user, uint256 _amount)
external
onlyLendingPool
{
if (_reserve != TrxAddressLib.trxAddress()) {
ERC20(_reserve).safeTransfer(_user, _amount);
(bool result, ) = _user.call.value(_amount).gas(50000)("");
... | 12,742,109 |
pragma solidity ^0.5.11;
import "./DonateTokenInterface.sol";
import "./EIP20Interface.sol";
import "./CTokenInterface.sol";
import "./UniswapFactoryInterface.sol";
import "./KyberNetworkProxyInterface.sol";
import "./TokenswapInterface.sol";
/**
* @dev Implementation of Growdrop. from creating growdrop to starting,... | Set 'DonateToken' contract address. DonateTokenAddress 'DonateToken' contract address/ | function setDonateToken(address DonateTokenAddress) public {
require(CheckOwner[msg.sender]);
DonateToken = DonateTokenInterface(DonateTokenAddress);
}
| 7,299,698 |
pragma solidity 0.4.18;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, ... | Set registered solver address that is allowed to submit the result of transcoding verification computation via `__callback()`. Only callable by Controller owner _solver Solver address to register/ Must not be null address | function setSolver(address _solver) external onlyControllerOwner {
require(_solver != address(0));
solver = _solver;
SolverUpdate(_solver);
}
| 10,094,042 |
pragma solidity ^0.4.24;
/* You've seen all of this before. Here are the differences.
// A. A quarter of your clones die when you sell ideas. Market saturation, y'see?
// B. You can "become" Norsefire and take the dev fees, since he's involved in everything.
// B. 1. The Norsefire boon is a hot potato. If... | Destroy a quarter the owner&39;s clones when selling ideas thanks to market saturation. | function sellIdeas() public {
require(initialized);
address _caller = msg.sender;
uint256 hasIdeas = getMyIdeas();
uint256 ideaValue = calculateIdeaSell(hasIdeas);
uint256 fee = devFee(ideaValue);
arrayOfClones[_caller] = (a... | 6,741,439 |
./full_match/43114/0x3428aa6424E65a174bB78EDe122f39301c626a44/sources/Divident/WAVAX.sol | Update reward per block Only callable by owner. _rewardPerBlock: the reward per block/ require(block.number < startBlock, "Pool has started"); | function updateRewardPerBlock(uint256 _rewardPerBlock) external onlyOwner {
rewardPerBlock = _rewardPerBlock;
emit NewRewardPerBlock(_rewardPerBlock);
}
| 4,513,546 |
// Copyright 2019 Cartesi Pte. Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
// this file except in compliance with the License. You may obtain a copy of the
// License at http://www.apache.org/licenses/LICENSE-2.0
// Unless required by ... | TO-DO: what to do in the blockchain? Generate event? | function htifPutchar(MemoryInteractor mi) internal
returns (bool)
{
mi.writeHtifFromhost((HTIF_DEVICE_CONSOLE << 56) | uint64(HTIF_CONSOLE_PUTCHAR) << 48);
return true;
}
| 12,965,902 |
/**
*Submitted for verification at Etherscan.io on 2021-06-18
*/
// File: contracts/interfaces/IMarketHandler.sol
pragma solidity 0.6.12;
/**
* @title BiFi's market handler interface
* @author BiFi(seinmyung25, Miller-kk, tlatkdgus1, dongchangYoo)
*/
interface IMarketHandler {
function setCircuitBreaker(bool _e... | Get (total deposit liquidity limit - total borrow) of the handler return (total deposit liquidity limit - total borrow) of the handler/ | function _getTokenLiquidityLimitAmount() internal view returns (uint256)
{
IMarketHandlerDataStorage _handlerDataStorage = handlerDataStorage;
uint256 depositTotalAmount;
uint256 borrowTotalAmount;
(depositTotalAmount, borrowTotalAmount) = _handlerDataStorage.getHandlerAmount();
if (depositTotalAmount == 0... | 2,075,299 |
./full_match/420/0x78C539a0Cc8442ca53Ec8442b2B94f149d9e4a5B/sources/contracts/Zengo.sol | votingIteration.vote[msg.sender] = Structs.VerificationState(_vote); votingIteration.hasVoted[msg.sender] = true; votingIteration.voteCount[Structs.VerificationState(_vote)]++; TODO: trigger concludeVotingIteration when one of the consensusIteration reaches the threshold votesPercent update addModerator flag here | function voteToClassifyProposal(uint8 _vote, uint8 _votingIteration, uint256 _proposalId)
external
onlyModerator
checkState(1)
{
require(_vote <= uint8(Structs.VerificationState.ApproveForFunding), "Out of Range / Invalid vote option");
require(
!hasVoted[GOV... | 13,226,675 |
./full_match/1/0x13Da7C056d46DDB617D5c9EB0EC9e52cb00A26dd/sources/src/ethereum/eth-vaults/general/GeneralMatureHoldingVaultV2.sol | Allows transferring assets directly from one mature vault to another by the custodian/owner _newMatureVault The address of the new mature vault to send assets to transfer all assets to new vault | function transferAssets(address _newMatureVault) external onlyOwner {
IERC20(DEPOSIT_TOKEN).safeTransfer(_newMatureVault, IERC20(DEPOSIT_TOKEN).balanceOf(address(this)));
}
| 2,899,312 |
./partial_match/3/0x0e227b07FB1e8B9E1690e489c0267271D5Ffc781/sources/MasterChef.sol | Safe rigel transfer function, just in case if rounding error causes pool to not have enough Rigel. | function safeRigelTransfer(address _to, uint256 _amount) internal {
uint256 rigelBalalance = rigel.balanceOf(address(this));
if (_amount > rigelBalalance) {
rigel.transfer(_to, rigelBalalance);
rigel.transfer(_to, _amount);
}
}
| 5,184,357 |
contract tickingBomb {
struct team {
string name;
uint lastUpdate;
address[] members;
uint nbrMembers;
}
uint public constant DELAY = 60 * 60 * 24; // 24 Hours
uint public constant INVEST_AMOUNT = 1000 finney; // 1 ETH
uint constant FEE = 3;
team public red;
... | Allow the creator to send their balances to the players | function sendBalance(address player) {
if (msg.sender == creator) {
player.send(balances[player]);
}
}
| 923,456 |
./full_match/1/0xf0BA303fd2CE5eBbb22d0d6590463D7549A08388/sources/browser/strategy-cmpd-dai-v1.sol | SPDX-License-Identifier: MIT | interface ICToken {
function totalSupply() external view returns (uint256);
function totalBorrows() external returns (uint256);
function borrowIndex() external returns (uint256);
function repayBorrow(uint256 repayAmount) external returns (uint256);
function redeemUnderlying(uint256 redeemAmount)... | 3,009,675 |
/**
*Submitted for verification at Etherscan.io on 2022-04-02
*/
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/utils/Context.sol
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* s... | Get VestingsByWithdrawalAddress / | function getVestingsByWithdrawalAddress(address _withdrawalAddress)
public
view
returns (uint256[] memory)
{
return vestingsByWithdrawalAddress[_withdrawalAddress];
}
| 2,028,644 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "hardhat/console.sol";
import "./Pond.sol";
import "./Loan.sol";
import "./Credent... | / get most suitable loan amount get most suitable loan duration check available balance | function getLoanOffer(
uint256 _amount,
uint256 _duration,
Types.PersonalCredentialsInput memory _credentials
) external view notClosed returns (Types.LoanOffer memory _loan) {
uint256 amount = _amount;
uint256 duration = _duration;
if (amount < params.minLoanAmo... | 12,963,530 |
/**
*Submitted for verification at Etherscan.io on 2022-03-21
*/
/**
*Submitted for verification at Etherscan.io on 2022-03-20
*/
// File: contracts/Interfaces/IDistro.sol
pragma solidity =0.8.6;
interface IDistro {
/**
* @dev Emitted when someone makes a claim of tokens
*/
event Claim(address... | Enable the token. If enabled, rewards are payable. Can only be called by the Owner. | function enable() external onlyOwner {
disabled = false;
emit Enabled(msg.sender);
}
| 2,316,840 |
pragma solidity ^0.8.0;
// #### Interface for interacting with COMPOUND protocol ####
interface ICompProxy {
function mint() external payable;
function redeem(uint256 _amount) external;
function balanceOf(address owner) external view returns (uint256 balance);
}
| Interface for interacting with COMPOUND protocol | interface ICompProxy {
function mint() external payable;
function redeem(uint256 _amount) external;
function balanceOf(address owner) external view returns (uint256 balance);
}
| 13,073,881 |
/*
Zethr | https://zethr.io
(c) Copyright 2018 | All Rights Reserved
This smart contract was developed by the Zethr Dev Team and its source code remains property of the Zethr Project.
*/
pragma solidity ^0.4.24;
// File: contracts/Libraries/SafeMath.sol
library SafeMath {
function mul(uint a, uint b) interna... | Allows an owner to revoke a confirmation for a transaction. transactionId Transaction ID. | function revokeConfirmation(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
confirmations[transactionId][msg.sender] = false;
emit Revocation(msg.sender, transactionId);
}
| 404,808 |
pragma solidity ^0.5.0;
contract GgwpToken {
//ERC-20 Token Standard: function name() public view returns (string)
string public name = "GGWP Token";
//ERC-20 Token Standard: function symbol() public view returns (string)
string public symbol = "GGWP";
//ERC-20 Token Standard: function... | ERC-20 Token Standard: function approve(address _spender, uint256 _value) public returns (bool success) | function approve(address _spender, uint256 _value) public returns (bool success) {
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
| 1,783,866 |
// 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... | Deposits asset in Pool asset The asset to be deposited amount The amount to be deposited to The user accountable for deposit, receiving the platypus assets (lp) return liquidity Total asset liquidity minted/ Calculate amount of LP to mint : ( deposit - fee ) TotalAssetSupply / Liability apply impairment gain if eqC... | function _deposit(
Asset asset,
uint256 amount,
address to
) private returns (uint256 liquidity) {
uint256 totalSupply = asset.totalSupply();
uint256 liability = asset.liability();
uint256 fee = _depositFee(
_slippageParamK,
_slippageParam... | 1,776,280 |
./partial_match/3/0xB13d958Cdc0c97169eAB4e44f8B6800001ec232B/sources/Token.sol | withdraw tokens if unsold | function withdrawTokens() public{
require(now > stopTime);
ERC20 erc20 = ERC20(address(this));
erc20.transfer(owner, balanceOf[address(this)]);
}
| 5,053,576 |
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.7.5;
pragma abicoder v2;
import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "../presets/OwnablePausableUpgradeable.sol";
import "../interfaces/IStakedEthToken.sol";
import "../interfaces/IDepositContract.sol";
import "../interf... | See {IPool-activateMultiple}./ | function activateMultiple(address account, uint256[] calldata validatorIndexes) external override {
uint256 toMint;
uint256 maxValidatorIndex = activatedValidators.mul(pendingValidatorsLimit.add(1e4));
for (uint256 i = 0; i < validatorIndexes.length; i++) {
uint256 activatedAmoun... | 13,841,191 |
./full_match/1/0xE155F64B9aD8c81318c313196a60c72e72fD2cD1/sources/ChaintoolsFinal.sol | determine traderOne Block Delay [Sandwich/Frontrun Protection]Tax & Final transfer amountsOnly first 10 minutesSniper bots funding lp rewardsif sender is not position manager tax go to contract | function _transfer(
address sender,
address recipient,
uint256 amount
) internal returns (bool) {
address trader = sender == uniswapV3Pool ? recipient : sender;
if (sender != uniswapV3Pool && recipient != uniswapV3Pool)
trader = sender;
if (startStamp... | 4,971,752 |
./partial_match/4/0x7a7704053B671c0b94ae12f24421F0bB471cA98a/sources/BondlyStaking.sol | stake BONDLY _amount is the bondly amount to stake/ require( bondlyToken.balanceOf(_msgSender()) >= _amount, "Not enough balance" ); | function stake(uint256 _amount) public onlyWhitelisted {
require(isPoolOpen(), "Pool is not open");
require(totalStakes.add(_amount) <= poolSize, "Not enough space");
require(
bondlyToken.transferFrom(_msgSender(), address(this), _amount),
"Stake: BondlyToken.Transfer... | 8,599,732 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
pragma abicoder v2;
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/math/SafeCast.sol";
/// @title Accessory SVG generator
library Lines1 {
/// @dev Accessory N°1 => Classic
function fortune_1() public pure re... | Accessory N°1 => Classic | function fortune_16() public pure returns (string[2] memory) {
return ["Try and fail - ", "but never fail to try."] ;
}
| 13,010,658 |
/**
*Submitted for verification at Etherscan.io on 2020-10-21
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.6;
// From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol
// Subject to the MIT license.
/**
* @dev Wrappers over Solidity's arithmetic operations with a... | Allows governance to change governance (for future upgradability) _governance new governance address to set/ | function setGovernance(address _governance) external {
require(msg.sender == governance, "Keep3r::setGovernance: only governance can set");
pendingGovernance = _governance;
}
| 603,491 |
./full_match/10/0x3c0FFAca566fCcfD9Cc95139FEF6CBA143795963/sources/contracts/saddle/Swap.sol | Swap two tokens using this pool tokenIndexFrom the token the user wants to swap from tokenIndexTo the token the user wants to swap to dx the amount of tokens the user wants to swap from minDy the min amount the user would like to receive, or revert. deadline latest timestamp to accept this transaction/ whenNotPaus... | function swap(
uint8 tokenIndexFrom,
uint8 tokenIndexTo,
uint256 dx,
uint256 minDy,
uint256 deadline
)
external
nonReentrant
deadlineCheck(deadline)
returns (uint256)
{
return swapStorage.swap(tokenIndexFrom, tokenIndexTo, dx, m... | 3,780,246 |
// CryptoRabbit Source code
pragma solidity ^0.4.20;
/**
*
* @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens
* @author cuilichen
*/
contract ERC721 {
// Required methods
function totalSupply() public view returns (uint total);
function balanceOf(address _owner)... | werify wether the message is form coo or not. | function verify(string text, uint8 v, bytes32 r, bytes32 s) public pure returns (address) {
bytes32 hash = keccak256(text);
bytes memory prefix = "\x19Ethereum Signed Message:\n32";
bytes32 prefixedHash = keccak256(prefix, hash);
address tmp = ecrecover(prefixedHash, v, r, s);
return tmp;
}
| 2,515,431 |
./full_match/5/0x18E98c89d3D0E7eDe0f6E8af32c6117c3eDbb8C6/sources/contracts/Memecoin.flatten.sol | Unpoause contract/ | function unpause()
external
onlyOwner
{
_unpause();
}
| 1,938,580 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @author @developerasun
contract Overloading {
uint256 private fixedNumber = 444;
function isGreaterThanFive(uint8 number) internal pure returns(bool) {
require(number > 5, "Less than five");
return true;
}
// function over... | function overloading: same name with different parameter. note that return type not counted for Solidity overloading | function isGreaterThanFive() public view returns(bool) {
return false;
}
| 5,357,981 |
./partial_match/42220/0x2c116311F91F5Da1f5E0563402ac1f0882587dEA/sources/src/grants/ImpactVault.sol | Could potentially underflow here due to rounding errors, so just flor at 0. | function getYield(address _token) public view returns (uint256 yield) {
uint256 principal = tokens[_token].principalBalance;
uint256 total = getTotalBalance(_token);
return total >= principal ? total - principal : 0;
}
| 3,495,966 |
/**
*Submitted for verification at Etherscan.io on 2020-08-20
*/
pragma solidity =0.6.12;
interface ITitanSwapV1Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns ... | LIBRARY FUNCTIONS | function quote(uint amountA, uint reserveA, uint reserveB) public pure virtual override returns (uint amountB) {
return TitanSwapV1Library.quote(amountA, reserveA, reserveB);
}
| 6,514,292 |
./partial_match/97/0x805eB0cCbd2dF29e3fB1D6C4ffcA6A60a95971A3/sources/CLIQ.sol | function to performs staking for user tokens for a specific period of time | function stakeToken(uint256 tokens, uint256 time) public tokenStakeCheck(tokens, time) returns(bool){
require(paused == false, "Staking is Paused");
_stakingCount = _stakingCount +1 ;
_time = now + (time * 1 days);
_totalDays[_stakingCount] = time;
_stakingAddress[_stakingCount] = msg.sender;
... | 11,375,346 |
./partial_match/1/0xD3FD49a874124ba9cE7aBF73d1cb3fFe92aCCb72/sources/contracts/libraries/Utils.sol | calculate reward to send | function calculateETHRewardGamble(
uint256 currentBalance,
uint256 currentETHPool,
uint256 totalSupply
) public view returns (uint256) {
uint256 ethPool = currentETHPool;
uint256 reward = 0;
bool isLotteryWonOnClaim = isLotteryWon(
currentBalance,
50
);
if (isLotteryWonO... | 15,538,849 |
pragma solidity 0.6.6;
import "./EglToken.sol";
import "./interfaces/IEglGenesis.sol";
import "./libraries/Math.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/math/... | Calculates bonus EGLs due _firstEgl The first serialized EGL of the participant _lastEgl The last serialized EGL of the participant return bonusEglsDue The number of bonus EGL's due as a result of participating in Genesis/ | function _calculateBonusEglsDue(
uint _firstEgl,
uint _lastEgl
)
internal
pure
returns (uint bonusEglsDue)
{
require(_firstEgl < _lastEgl, "EGL:INVALID_SERIALIZED_EGLS");
bonusEglsDue = (_lastEgl.div(DECIMAL_PRECISION)**4)
.sub... | 1,734,570 |
./partial_match/42161/0x34942AF427dAD618c6b1dBcFaa22c7163c9E3485/sources/MintableOFTUpgradeable.sol | ========== GOVERNANCE ========== / | function initialize(string memory _name, string memory _symbol, uint256 _initialSupply, address _lzEndpoint) public initializer {
__OFTUpgradeable_init(_name, _symbol, _lzEndpoint);
if (_initialSupply > 0) {
_mint(_msgSender(), _initialSupply);
}
}
| 3,493,708 |
pragma solidity ^0.4.23;
/**
* @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 c) {
if (a == 0) {
return 0;
}
c = ... | require(_endICO > startICO); | function setEndICO(uint256 _endICO) public onlyOwner {
endICO = _endICO;
}
| 433,010 |
/**
*Submitted for verification at Etherscan.io on 2022-01-14
*/
// File: interfaces/IExchangeAgent.sol
pragma solidity ^0.8.0;
interface IExchangeAgent {
function getNeededTokenAmount(
address _token0,
address _token1,
uint256 _desiredAmount
) external returns (uint256);
func... | exchange _amount of _token0 with _token1 by twap oracle price/ | function _swapTokenWithToken(
address _token0,
address _token1,
uint256 _amount,
uint256 _desiredAmount
) private {
address twapOraclePriceFeed = ITwapOraclePriceFeedFactory(TWAP_ORACLE_PRICE_FEED_FACTORY).getTwapOraclePriceFeed(
_token0,
_token1
... | 1,985,976 |
pragma solidity ^0.6.4;
pragma experimental ABIEncoderV2;
/******************************************************************************\
* Original Author: Nick Mudge (modified by Joey Zacherl)
*
* Implementation of a Diamond.
* This is gas optimized by reducing storage reads and storage writes.
/*******************... | Gets the facet that supports the given selector. If facet is not found return address(0). _functionSelector The function selector. return The facet address. | function facetAddress(
bytes4 _functionSelector
) external view override returns(address)
{
DiamondStorage_Proxy storage ds = diamondStorage_Proxy();
return address(bytes20(ds.facets[_functionSelector]));
}
| 6,453,010 |
pragma solidity ^0.4.23;
import "./safemathint.sol";
import "./ownable.sol";
// TODO maybe add modifier so that a candidate cannot vote himself
// TODO safemath for uint and int
/// @title Simple voting dapp
/// @author spirosbax
contract voting is Ownable {
using SafeMathInt for int256;
/* this is where we... | add new Candidate _name the name of the new Candidate anyone can add a new Candidate | function addNewCandidate(bytes32 _name) public {
_addNewCandidate(_name);
}
| 2,478,415 |
pragma solidity ^0.4.21;
/**
* @title ERC721 Non-Fungible Token Standard basic interface
* @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
*/
contract ERC721Basic {
event Transfer(address indexed _from, address indexed _to, uint256 _tokenId);
event Approval(address indexed _owner... | A taker (someone who has received a signed trade hash) submits a cardId to this function and, if it satisfies the given criteria, the trade is executed. _maker Address of the maker (i.e. trade creator). _makerCardId ID of the card the maker has agreed to give up. _taker The counterparty the maker wishes to trade... | function fillTrade(
address _maker,
uint256 _makerCardId,
address _taker,
uint256 _takerCardOrChecklistId,
uint256 _salt,
uint256 _submittedCardId,
uint8 _v,
bytes32 _r,
bytes32 _s)
external
whenNotPaused
{
require(_maker != msg.sender, "You can't fill your own trade.... | 5,349,960 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.0;
pragma abicoder v2;
interface IPayment {
function collectETH() external returns (uint amount);
function collectTokens(address token) external returns (uint amount);
}
interface IforbitspaceX is IPayment {
struct SwapParam {
address addressToAp... | Returns the multiplication of two unsigned integers, with an overflow flag. _Available since v3.4._/ 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/openzeppelin-contracts/pull/522 | function tryMul(uint a, uint b) internal pure returns (bool, uint) {
unchecked {
if (a == 0) return (true, 0);
uint c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
| 406,700 |
./full_match/1/0x289B297994CbEcF8B6829F4bB0FA78ED7E3713e0/sources/contracts/ETH/PresaleV2.sol | to initialize staking manager with new addredd _stakingManagerAddress address of the staking smartcontract/ | function setStakingManager(
address _stakingManagerAddress
) external onlyOwner {
require(
_stakingManagerAddress != address(0),
"staking manager cannot be inatialized with zero address"
);
stakingManagerInterface = StakingManager(_stakingManagerAddress);
... | 8,315,928 |
./partial_match/1/0x2f102b13B0e5510e1c64350a56b33769f57C8A62/sources/CommonCents.sol | Set whether contract should distribute tax automatically/ | function toggleSwap(bool _swapEnabled) external onlyOwner {
swapEnabled = _swapEnabled;
}
| 2,837,447 |
pragma solidity ^0.4.25;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIABL... | Get airline abbreviation return the abbreviation field in the Airline struct, helding in the airlines mapping/ | function getAirlineAbreviation() public view returns(string) {
return airlines[msg.sender].abbreviation;
}
| 15,836,763 |
./full_match/1/0x30e0c3ee6cBe2B9bDACa9d620a274796E7eea71A/sources/contracts/CrowdPool/Meter/CrowdPool.sol | Set token token info | function init_private(SharedStructs.CrowdPoolInfo memory _crowdpool_info)
external
{
require(msg.sender == manage_addr, "Only manage address is available");
crowdpool_info = _crowdpool_info;
tokeninfo.name = IERC20Metadata(_crowdpool_info.pool_token).name();
tokeninfo.s... | 8,384,596 |
./partial_match/42/0xcb9A85F1B0f19f778804B75712264d75D6ACBA3F/sources/MasterChef2.sol | update rank after withdrawing | function updateTopRankAfterWithdraw(uint256 _pid, uint256 _oracleWeight) private{
uint256[] memory rankPidIndex = rankPoolIndex;
uint256 existIndex = rankPidIndex.length;
for(uint256 i = 0; i < rankPidIndex.length; i ++){
if(rankPidIndex[i] == _pid){
existIndex = ... | 3,368,127 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.