file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
pragma solidity 0.5.17;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/ownership/Ownable.sol";
import "../lib/ReentrancyGuard.sol";
import "../lib/Utils.sol";
import "../lib/SafePeakToken.sol";
import "../interfaces/IPeakToken.sol";
import "../interfaces/IPeakDeFiFund.sol";
import ... | interface for contract_v6/UniswapOracle.sol | interface IUniswapOracle {
function update() external returns (bool success);
function consult(address token, uint256 amountIn)
external
view
returns (uint256 amountOut);
}
| 1,591,090 |
// File: ClubRare/Broker.sol
pragma solidity ^0.5.17;
pragma experimental ABIEncoderV2;
library TokenDetArrayLibV1 {
// Using for array of strcutres for storing mintable address and token id
using TokenDetArrayLibV1 for TokenDets;
struct TokenDet {
address NFTAddress;
uint256 tokenID;
... | Check expiry time Get seller of the NFT Check if this auction had even a single bid Get royality and creator of NFT from collection auctions[_mintableToken][tokenID].buyPrice = uint256(0); NFT transfer Royality transfer Fund transfer after brockerage and royality charges Buy event | function collect(uint256 tokenID, address _mintableToken) public {
IMintableToken Token = IMintableToken(_mintableToken);
require(
block.timestamp > auctions[_mintableToken][tokenID].closingTime,
"Auction Not Over!"
);
address payable lastOwner2 = auctions[_mi... | 10,227,588 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import "../../interfaces/decentraland/IDecentralandFacet.sol";
import "../../interfaces/decentraland/IDecentralandRegistry.sol";
import "../../libraries/LibOwnership.sol";
import "../../libraries/marketplace/LibRent.sol";
import "../../libraries/marketplace/LibDe... | Gets the operator of the rent for the an asset _assetId The target asset _rentId The target rentId | function operatorFor(uint256 _assetId, uint256 _rentId)
external
view
returns (address)
{
return LibDecentraland.operatorFor(_assetId, _rentId);
}
| 224,239 |
pragma solidity 0.4.18;
/**
* @title Wallet Admin Library
* @author Modular.network
*
* version 1.1.0
* Copyright (c) 2017 Modular, Inc
* The MIT License (MIT)
* https://github.com/Modular-Network/ethereum-libraries/blob/master/LICENSE
*
* The Wallet Library family is inspired by the multisig wallets built by... | Validates arguments for changing any of the sig requirement parameters _newRequired The new sig requirement _length Current number of owners return Returns true if checks pass, false otherwise | function checkRequiredChange(uint256 _newRequired, uint256 _length)
private returns (bool)
{
if(_newRequired == 0){
LogErrorMsg(_newRequired, "Cant reduce to 0");
return false;
}
if(_length - 2 < _newRequired){
LogErrorMsg(_length, "Making requirement too high");
retur... | 12,923,446 |
./full_match/421613/0xD60CD2151e118Dd796efcb1ceFFcF892226F9b3a/sources/src/gateway/HomeGateway.sol | Give a ruling for a dispute. Must be called by the arbitrator. The purpose of this function is to ensure that the address calling it has the right to rule on the contract. _disputeID ID of the dispute in the Arbitrator contract. _ruling Ruling given by the arbitrator. Note that 0 is reserved for "Not able/wanting to ... | function rule(uint256 _disputeID, uint256 _ruling) external override {
require(msg.sender == address(arbitrator), "Only Arbitrator");
bytes32 disputeHash = disputeIDtoHash[_disputeID];
RelayedData memory relayedData = disputeHashtoRelayedData[disputeHash];
bytes4 methodSelector = I... | 11,584,766 |
/* Attestation decode and validation */
/* AlphaWallet 2020 */
pragma solidity ^0.6.0;
contract DerDecode {
address payable owner;
bytes1 constant BOOLEAN_TAG = bytes1(0x01);
bytes1 constant INTEGER_TAG = bytes1(0x02);
bytes1 constant BIT_STRING_TAG = bytes1(0x03);
bytes1 con... | Payable variant of the attestation function for testing | function verifyAttestationRequestProofPayable(bytes memory attestation) public returns(bool)
{
if (verifyAttestationRequestProof(attestation))
{
callCount++;
return true;
}
else
{
revert();
}
}
| 5,533,834 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../interface/AggregatorV3Interface.sol";
import "../interface/IDefxNFTFactory.sol";
import '../interface/ITokenBonusSharePool.sol';
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import '@openzeppelin/contracts/access/Ownable.sol';
import "@ope... | 结算收益 Claim reward/ Round valid, claim rewards Round invalid, refund bet amount | function claim(uint256 epoch) external payable notContract returns(uint256){
require(rounds[epoch].startBlock != 0, "Round has not started");
require(block.number > rounds[epoch].endBlock, "Round has not ended");
require(!ledger[epoch][msg.sender].claimed, "Rewards claimed");
require... | 5,361,297 |
/*
Copyright 2017 Loopring Project Ltd (Loopring Foundation).
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 ... | Return if an address has at least one of the roles. who The address roleMask The required roles. | function hasAnyRoles(
address who,
uint256 roleMask)
public
view
returns (bool)
{
require(roleMask != 0, "NO_ROLES");
return (operatorMap[who].roles & roleMask != 0);
}
uint256 roleMask
)
| 13,084,499 |
./partial_match/80001/0xf6c213D3076bc22dAC297Bbad7A6d134ebea8025/sources/GAME_Game.sol | cards_ is encoded: 64 bit cardId 96 bit price 32 bit loyalty price 64 bit maxSupply | function _updateSetCards(uint game_, uint set_, uint[] memory encodedCardData_, bytes32[] memory cardMetadata_)
internal
{
require(cardSetExists[game_][set_], "set must exist");
require(encodedCardData_.length > 0, "must add at least one card");
uint metadataPerCard = cardMetadata_.length / encodedC... | 8,810,362 |
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @... | Safe reward transfer function, just in case a rounding error causes pool to not have enough reward tokens _to the user address to transfer tokens to _amount the total amount of tokens to transfer/ | function _safeRewardTransfer(address _to, uint256 _amount) internal {
rewardToken.transfer(_to, _amount);
}
| 13,608,519 |
./full_match/11155111/0x5461D48556B94e7fdD8ED5A8f865Ba4F1A3b5454/sources/contracts/upgrades/GraphProxyStorage.sol | Sets the pending implementation address of the proxy. _newImplementation Address of the new pending implementation/ solhint-disable-next-line no-inline-assembly | function _setPendingImplementation(address _newImplementation) internal {
address oldPendingImplementation = _getPendingImplementation();
bytes32 slot = PENDING_IMPLEMENTATION_SLOT;
assembly {
sstore(slot, _newImplementation)
}
emit PendingImplementationUpdated(... | 3,828,427 |
./full_match/288/0x64B4097bCCD27D49BC2A081984C39C3EeC427a2d/sources/contracts/bridge/wrappers/L2BridgeZap.sol | swap deposit into bridge, gets nUSD | function swapAndRedeemAndRemove(
address to,
uint256 chainId,
IERC20 token,
uint8 tokenIndexFrom,
uint8 tokenIndexTo,
uint256 dx,
uint256 minDy,
uint256 deadline,
uint8 liqTokenIndex,
uint256 liqMinAmount,
uint256 liqDeadline
... | 7,105,830 |
/**
*Submitted for verification at Etherscan.io on 2021-03-14
*/
pragma solidity 0.7.4;
pragma experimental ABIEncoderV2;
// -- WyArbiV3 -- //
contract WyArbiV3 {
using SafeMath for uint256;
using SafeERC20 for IERC20;
using address_make_payable for address;
struct MyCustomData { // 还款信息
... | IUniswapExchange functionId=7 | function IUniswapExchange(address protocol, address token_in, address token_out, uint256 in_amount) public returns(uint256) {
address[] memory uniData = new address[](2);
uniData[0] = token_in;
uniData[1] = token_out;
uint[] memory amounts = UniswapV2Router(protocol).swapExactTokensF... | 15,175,905 |
./partial_match/1/0x3B557Ff99BC6c2AA2A4BEB7478EA4b4dC58C8Ed2/sources/hijabcoin.sol | Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address./ | function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, allowance(owner, spender) + addedValue);
return true;
}
| 4,343,081 |
./full_match/1/0x23b400cF1EfDcc482447ec47eda44EF0E5e685dA/sources/contracts/artifacts/lmfers.sol | Distribute funds to wallets | function withdrawAll() public onlyOwner {
uint256 balance = address(this).balance;
require(balance > 0, "LMFER: Insufficent balance");
_widthdraw(w3, ((balance * 22) / 100));
_widthdraw(w2, ((balance * 23) / 100));
_widthdraw(w1, address(this).balance);
}
| 4,848,993 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import '@openzeppelin/contracts/interfaces/IERC721.sol';
import '@openzeppelin/contracts/utils/math/SafeMath.sol';
import '@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol';
import './interfaces/IConditional.sol';
import './interfaces/IMultiplier... | NOTE: 2022-01-31 LW: new boost contract assumes OKLG and booster NFTs are staked in this contract | function getBoostMultiplier(address wallet) public view returns (uint256) {
return
boostMultiplierContract == address(0)
? 0
: IMultiplier(boostMultiplierContract).getMultiplier(wallet);
}
| 10,282,856 |
pragma solidity 0.4.18;
interface ConversionRatesInterface {
function recordImbalance(
ERC20 token,
int buyAmount,
uint rateUpdateBlock,
uint currentBlock
)
public;
function getRate(ERC20 token, uint currentBlockNumber, bool buy, uint qty) public view ret... | source quantity is rounded up. to avoid dest quantity being too low. | function calcSrcQty(uint dstQty, uint srcDecimals, uint dstDecimals, uint rate) internal pure returns(uint) {
require(dstQty <= MAX_QTY);
require(rate <= MAX_RATE);
uint numerator;
uint denominator;
if (srcDecimals >= dstDecimals) {
require((srcDe... | 7,400,498 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @title: Ledger
/// @author: manifold.xyz
import "@manifoldxyz/creator-core-solidity/contracts/ERC1155Creator.sol";
/////////////////////////////////////////////////
// //
// ... | Your extension is required to implement this interface if it wishes to receive the onBurn callback whenever a token the extension created is burned/ | interface IERC1155CreatorExtensionBurnable is IERC165 {
function onBurn(address owner, uint256[] calldata tokenIds, uint256[] calldata amounts) external;
}
}
| 1,598,706 |
pragma solidity ^0.8.10;
import "ds-test/test.sol";
import "../Preservation/Preservation.sol";
import "../Preservation/PreservationAttack.sol";
import "../Preservation/PreservationFactory.sol";
import "../Ethernaut.sol";
interface CheatCodes {
// Sets all subsequent calls' msg.sender to be the input address until ... | Setup instances of the Ethernaut & PreservationFactory contracts | function setUp() public {
ethernaut = new Ethernaut();
preservationFactory = new PreservationFactory();
}
| 2,567,431 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.6.2 <0.8.0;
pragma experimental ABIEncoderV2;
///
/// @title uint Logic Utilities for use with block.timestamp for chronological operations
/// @author Tyler R. Drury <vigilstudios.td@gmail.com> (www.twitter.com/StudiosVigil) - copyright 5/3/2021, All Rights R... | return {uint} current block number % `rhs` | function nowBlockMod(
uint rhs
)internal pure returns(
uint
){
return block.number.mod(rhs);
}
| 12,939,219 |
pragma solidity 0.6.6;
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@kyber.network/utils-sc/contracts/Utils.sol";
import "../IKyberFeeHandler.sol";
import "../IKyberDao.sol";
import "./WithdrawableNoModifiers.sol";
import "./IKyberNetwo... | gets the expected rates when trading src -> dest token, with / without fees src Source token dest Destination token srcQty Amount of src tokens in twei platformFeeBps Part of the trade that is allocated as fee to platform wallet. Ex: 1000 = 10% hint Advanced instructions for running the trade return rateWithNetwor... | function getExpectedRateWithHintAndFee(
IERC20Ext src,
IERC20Ext dest,
uint256 srcQty,
uint256 platformFeeBps,
bytes calldata hint
)
external
view
override
returns (
uint256 rateWithNetworkFee,
uint256 rateWithAllFee... | 5,532,765 |
// SPDX-License-Identifier: MIT
// File: contracts/StorageSlot.sol
/**
* @dev Copied from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.1.0/contracts/utils/StorageSlot.sol
*/
pragma solidity 0.8.4;
library StorageSlot {
struct AddressSlot {
address value;
}
function getAddre... | Returns the current admin./ | function _getAdmin() internal view returns (address) {
return StorageSlot.getAddressSlot(ADMIN_SLOT).value;
}
| 1,633,126 |
./full_match/3/0xD2bDD787Acd4728b111d0FAA7517139C002e18Ee/sources/ApeExpress.sol | how much ETH did we just swap into? | function swapAndSendToMarketing(uint256 tokens) private lockTheSwap {
uint256 initialBalance = address(this).balance;
swapTokensForEth(tokens);
uint256 newBalance = address(this).balance.sub(initialBalance);
_marketingWallet.transfer(newBalance);
}
| 8,097,298 |
pragma solidity 0.6.12;
interface IAdmin {
function isAdmin(address user) external view returns (bool);
}
// File @openzeppelin/contracts/token/ERC20/IERC20.sol@v3.4.1
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the am... | Admin function, to update token price before sale to match the closest $ desired rate. This will be updated with an oracle during the sale every N minutes, so the users will always pay initialy set $ value of the token. This is to reduce reliance on the FTM volatility. Allowing oracle to run and cha... | function updateTokenPriceInFTM(uint256 price) external onlyAdmin {
require(price > 0, "Price can not be 0.");
sale.tokenPriceInFTM = price;
emit TokenPriceSet(price);
}
| 12,826,359 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.7.0;
pragma experimental ABIEncoderV2;
// File: witnet-ethereum-block-relay/contracts/BlockRelayInterface.sol
/**
* @title Block Relay Interface
* @notice Interface of a Block Relay to a Witnet network
* It defines how to interact with the Block Relay in o... | Decrements the appearance counter of an identity from the provided ABS. If the counter reaches 0, the identity is flushed. _abs The Active Bridge Set to be flushed. _address The address to be flushed. Decrement the count of an identity, and if it reaches 0, delete it and update `nextActiveIdentities`count | function flushIdentity(ActiveBridgeSet storage _abs, address _address) private {
require(absMembership(_abs, _address), "The identity address is already out of the ARS");
_abs.identityCount[_address]--;
if (_abs.identityCount[_address] == 0) {
delete _abs.identityCount[_address];
_abs.nextActi... | 901,120 |
pragma solidity ^0.4.11;
library Bonus {
uint256 constant pointMultiplier = 1e18; //100% = 1*10^18 points
function getBonusFactor(uint256 soldToUser)
internal pure returns (uint256 factor)
{
uint256 tokenSold = soldToUser / pointMultiplier;
//compare whole coins
//y... | /this is the main funding function, it updates the balances of tokens during the ICO.no particular incentive schemes have been implemented hereit is only accessible during the "ICO" phase.note that msg.value is already included in this.balance | BEGIN ICO functions
function() payable
requireState(States.Ico)
{
require(whitelist[msg.sender] == true);
require(this.balance <= weiICOMaximum);
require(block.number < endBlock);
require(block.number >= startAcceptingFundsBlock);
uint256 basisTokens = msg.value... | 7,273,354 |
./full_match/1/0x0d31DF7dedd78649A14aAe62D99CcB23aBCC3A5A/sources/contracts/tcg5.sol | this method is responsible for taking all fee, if takeFee is true | function _tokenTransfer(address sender, address recipient, uint256 amount,bool takeFee) private {
(uint256 reflectAmount, uint256 reflectAmountToTransfer, uint256 rFee, uint256 takeAmountToTransfer, uint256 tFee, uint256 tLiquidity) = _getValues(amount);
_reflectOwned[sender] = _reflectOwned[send... | 2,933,404 |
pragma solidity 0.5.11;
/**
* @title OUSD Vault Contract
* @notice The Vault contract stores assets. On a deposit, OUSD will be minted
and sent to the depositor. On a withdrawal, OUSD will be burned and
assets will be sent to the withdrawer. The Vault accepts deposits of
interest for... | Transfer token to governor. Intended for recovering tokens stuck in contract, i.e. mistaken sends. _asset Address for the asset _amount Amount of the asset to transfer/ | function transferToken(address _asset, uint256 _amount)
external
onlyGovernor
{
IERC20(_asset).transfer(governor(), _amount);
}
| 1,233,236 |
/**
*Submitted for verification at Etherscan.io on 2021-04-27
*/
/*
* This file was generated by MyWish Platform (https://mywish.io/)
* The complete code could be found at https://github.com/MyWishPlatform/
* Copyright (C) 2020 MyWish
*
* This program is free software: you can redistribute it and/or modify
* it... | apply bonus for time & weiRaised | function getBonusRate(uint256 _weiAmount) internal view returns (uint256) {
uint256 bonusRate = rate;
uint[1] memory weiRaisedStartsBounds = [uint(3333333333333333333)];
uint[1] memory weiRaisedEndsBounds = [uint(33333333333333333333333)];
uint64[1] memory timeStartsBounds ... | 6,812,819 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
// From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol
// Subject to the MIT license.
... | inject NONSTANDARD NAMING | function ADD750(uint a, uint b, string memory errorMessage) internal pure returns (uint) { | 12,787,773 |
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;
... | bid in active round first bid of new round, process old round save previous round data | function bid (uint256 _roundNumber, string _message) payable public {
require(!isContract(msg.sender));
require(bytes(_message).length <= maxMessageChars);
require(msg.value > 0);
if (_roundNumber == currentRoundNumber && !roundExpired()) {
require(msg.value > lastBidAmount);
var last... | 12,743,199 |
./partial_match/1/0x704559A0f71665B0548E9aE70AD3E93cb959BA40/sources/src/TwoStepOwnable.sol | Internal function that sets the inital owner of the base contract. The initial owner must not already be set. To be called in the constructor or when initializing a proxy. initialOwner The address to set for initial ownership./ Ensure that an initial owner has been supplied. Ensure that the owner has n... | function _setInitialOwner(address initialOwner) internal {
if (initialOwner == address(0)) {
revert InitialOwnerIsNullAddress();
}
if (_owner != address(0)) {
revert OwnerAlreadySet(_owner);
}
}
| 16,084,099 |
/**
*Submitted for verification at Etherscan.io on 2019-12-19
*/
// hevm: flattened sources of src/Redeemer.sol
pragma solidity =0.5.11 >0.4.13 >0.4.20 >=0.4.23 >=0.5.0 <0.6.0 >=0.5.5 <0.6.0 >=0.5.11 <0.6.0;
////// lib/dpass/lib/openzeppelin-contracts/src/GSN/Context.sol
/* pragma solidity ^0.5.0; */
/*
* @dev Pro... | This function will revert if custodian has reached his value cap (capCustV - custodian capacity value in base currency). Asset management enables to limit how much total worth of diamonds each custodian can mint. This helps to avoid overexposure to some custodians, and avoid some custodian fraud cases./ | function _requireCapCustV(address custodian_) internal view {
require(
add(capCustV[custodian_], dust) >=
add(
totalDpassCustV[custodian_],
totalDcdcCustV[custodian_]),
"asm-custodian-reached-maximum-coll-value");
}
| 13,090,928 |
./full_match/44787/0xF82e6a3D0fE40EDdf0Bcf3c4bBe9c0bE795D7Fb7/sources/YND_contract_v2.sol | Sum of validators YND token balances Reward after scoring filter | function _rewardValidators(Service memory service, uint256 amount) internal returns(uint256) {
uint256 rewards_sum = 0;
uint256 holdings = _validatorsHolding(service);
for(uint i=0; i < service.validators.length; i++) {
uint256 validator_balance = this.balanceOf(service.validato... | 13,258,789 |
./full_match/44787/0xb27B292154A2F8190cBcfCC272AcB27Cd8B0Cc04/sources/contracts/StarFarm.sol | Withdraw Star NFT from STAKING.PoolInfo storage pool = poolInfo[0]; | function leaveStakingNFT(uint256 _tokenId) public {
UserInfo storage user = userInfo[0][_msgSender()];
require(userNFTs[_msgSender()].length > 0, "no NFT");
updatePool(0);
(uint256 _selfGain, uint256 _parentGain) = starNode.nodeGain();
uint256 _amountGain = user.amount.add(u... | 13,282,751 |
./partial_match/42/0x6f4F6c6f7F62563768D7BAA0300a2f1f5D563134/sources/DHPTSwap.sol | maximum sUSD that can be sold by the user taking into account contract DHPT balance how much sUSD the contract can buy with its DHPT balance | function maxSusdToSell(address poolAddress) public view returns (uint256) {
uint256 dhptBalance = IERC20(poolAddress).balanceOf(address(this));
uint256 tokenPrice = tokenPriceWithSettle(poolAddress);
uint256 dhptForSusd = dhptBalance.mul(tokenPrice).div(10**18);
return dhptForSusd;
... | 8,928,788 |
./full_match/5/0x9255a95b953C03838f512B274420e201d497b161/sources/contracts/GEINApplication.sol | Function to Update GI Status _appl_id Application ID _gi_status GI Status _status_change_reason Status Change Reason/ | function update_gi_status(
uint32 _appl_id,
uint8 _gi_status,
uint8 _status_change_reason
)
public
isGIRorQC
{
prodObj = prodptr[_appl_id];
prodObj.gi_status = _gi_status;
prodObj.status_change_reason = _status_change_reason;
prodptr[_appl_id] = prodObj;
}
| 1,943,059 |
./partial_match/42/0x2113B131d823778Bcd1b478f036F327301FEF17F/sources/BudCore.sol | File: contracts\interfaces\IGeneScience.sol | interface IGeneScience {
function isGeneScience() external pure returns (bool);
function mixGenes(
uint256 genes1,
uint256 genes2,
uint256 generation,
uint256 targetBlock
)
external
returns (
uint256 gene,
uint256 thc,
... | 8,879,220 |
pragma solidity ^0.4.25;
contract ERC721 {
function totalSupply() public view returns (uint256 total);
function balanceOf(address _owner) public view returns (uint256 balance);
function ownerOf(uint256 _tokenId) external view returns (address owner);
// ownerof
// deploy: public ->externa... | 신규 포니를 생성하는 internal Method _matronId 종마의 암컷의 id _sireId 종마의 수컷의 id _coolDownIndex 포니의 cooldown Index 값 _genes 포니의 유전자 정보 _derbyMaxCount 경마 최대 참여 개수 _owner 포니의 소유자 _maxSpeed 최대 능력치 _maxStamina 최대 스테미너 _maxStart 최대 스타트 _maxBurst 최대 폭발력 _maxTemperament 최대 기질 | function _createPony(
uint256 _matronId,
uint256 _sireId,
bytes22 _genes,
uint256 _retiredAge,
address _owner,
uint[5] _ability,
uint[5] _maxAbility
)
internal
returns (uint)
{
require(_matronId == uint256(uint32(_matronId)));
r... | 6,425,169 |
/**
*Submitted for verification at Etherscan.io on 2020-11-05
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.17;
import '@openzeppelinV2/contracts/token/ERC20/IERC20.sol';
import '@openzeppelinV2/contracts/math/SafeMath.sol';
interface StrategyProxy {
function lock() external;
}
interface FeeDistribu... | Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair/ | function delegateBySig(
address delegatee,
uint256 nonce,
uint256 expiry,
uint8 v,
bytes32 r,
bytes32 s
) public {
bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry));
bytes32 digest = keccak256(abi.encodePacke... | 14,019,550 |
// 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... | See {IERC721Metadata-tokenURI}./ If there is no base URI, return the token URI. If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked). | function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
function _afterTokenTransfer(
address from,
address to,
uint256 tokenId
}
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
}
pragma solidity ^0.8.0;
}
pragma ... | 1,148,534 |
./full_match/1/0xCAAA0C316f8b91F25b35E318f83CaaB4ACD327fB/sources/contracts/apetoken-helper/ApeTokenHelper.sol | The sender mints and borrows. apeTokenMint The market that user wants to mint mintAmount The mint amount apeTokenBorrow The market that user wants to borrow borrowAmount The borrow amount/ | function mintBorrow(
ApeTokenInterface apeTokenMint,
uint256 mintAmount,
ApeTokenInterface apeTokenBorrow,
uint256 borrowAmount
) external {
require(
comptroller.isMarketListed(address(apeTokenMint)) &&
comptroller.isMarketListed(address(apeTok... | 8,306,402 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/IERC1155MetadataURIUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
impor... | HOOK OVERRIDES Iterate over all LDAs being transferred Decompose out here as an optimization This is a mint operation Add this LDA to the `to` address state If this is a transfer to a different address. Remove LDA from being associated with its TODO: Move this to burn transaction state | function _beforeTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual override
{
super._beforeTokenTransfer(operator, from, to, ids, amounts, data);
for(... | 6,093,819 |
/**
*Submitted for verification at Etherscan.io on 2022-03-08
*/
pragma solidity ^0.8.0;
contract Initializable {
bool inited = false;
modifier initializer() {
require(!inited, "already inited");
_;
inited = true;
}
}
// File: contracts/libs/EIP712Base.sol
pragma solidity ^0.8... | set proxy. _proxyRegistryAddress address of the proxy registry/ | function setProxyRegistryAddress(address _proxyRegistryAddress) public onlyOwner {
proxyRegistryAddress = _proxyRegistryAddress;
}
| 5,844,641 |
./partial_match/1/0x68907fCa073911E17C577bFb949Baa7D9Ccaf484/sources/DMGYieldFarmingV2.sol | File: contracts/external/farming/v2/IDMGYieldFarmingV2.sol Copyright 2020 DMM Foundation 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 Unless required by applicable law or agreed to in writing, sof... | interface IDMGYieldFarmingV2 {
event GlobalProxySet(address indexed proxy, bool isTrusted);
event TokenAdded(address indexed token, address indexed underlyingToken, uint8 underlyingTokenDecimals, uint16 points, uint16 fees);
event TokenRemoved(address indexed token);
event FarmSeasonBegun(uint index... | 4,292,822 |
pragma solidity ^0.4.24;
// File: contracts/ERC223ReceivingContract.sol
contract ERC223ReceivingContract {
/**
* @dev Standard ERC223 function that will handle incoming token transfers.
*
* @param _from Token sender address.
* @param _value Amount of tokens.
* @param _data Transaction m... | Hold first 5000 ETH until ICO end. | function allocateFunds() internal {
if (totalSold < softCap) {
return;
}
uint256 balance = address(this).balance - 5000 ether;
uint length = beneficiaries.length;
uint256 toTransfer = 0;
for (uint i = 1; i < length; i++) {
Beneficiary storage... | 9,886,341 |
./full_match/1/0x69e3a362ffD379cB56755B142c2290AFbE5A6Cc8/sources/contracts/Democracia.sol | Used to deposit ETH. | function depositETH(
address _receiver
) public payable donationsAvailable returns (uint256) {
uint256 assets = IMetaPoolETH(asset()).previewDeposit(msg.value);
uint256 shares = previewDeposit(assets);
abi.encodeWithSignature("depositETH(address)", address(this))
);
... | 8,358,695 |
/**
* Copyright 2017-2020, bZeroX, LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0.
*/
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
import "../core/State.sol";
import "../events/LoanSettingsEvents.sol";
import "../mixins/ModuleCommonFunctionalities.sol";
/**
* @title Loan ... | Setup loan parameters, by looping every loan and populating its parameters. For each loan calls _setupLoanParams internal function. loanParamsList The array of loan parameters. return loanParamsIdList The array of loan parameters IDs. / | function setupLoanParams(LoanParams[] calldata loanParamsList)
external
whenNotPaused
returns (bytes32[] memory loanParamsIdList)
{
loanParamsIdList = new bytes32[](loanParamsList.length);
for (uint256 i = 0; i < loanParamsList.length; i++) {
loanParamsIdList[... | 15,828,223 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
pragma experimental ABIEncoderV2;
import "@opengsn/contracts/src/BasePaymaster.sol";
// accept everything.
// this paymaster accepts any request.
//
// NOTE: Do NOT use this contract on a mainnet: it accepts anything, so anyone can "grief" it and drain its accoun... | set gas used by postRelayedCall, for proper gas calculation. You can use TokenGasCalculator to calculate these values (they depend on actual code of postRelayedCall, but also the gas usage of the token and of Uniswap)/ | function setPostGasUsage(uint _gasUsedByPost) external onlyOwner {
gasUsedByPost = _gasUsedByPost;
}
| 13,951,447 |
./full_match/288/0xaBB5c9fC0dA8622B5371B24Dc50503f4525d7216/sources/contracts/yieldBearing/ZenchaVault.sol | getter token address of ibToken address _tokenAddress address/ | function ibTokenAddressOf(address _tokenAddress) public view returns (address) {
return poolInfo[_tokenAddress].ibTokenAddress;
}
| 7,104,555 |
// SPDX-License-Identifier: SEE LICENSE IN LICENSE
pragma solidity 0.6.12;
import "../utility/ContractRegistryClient.sol";
import "../token/ReserveToken.sol";
import "./interfaces/IConverter.sol";
import "./interfaces/IConverterUpgrader.sol";
import "./interfaces/IConverterFactory.sol";
interface ILegacy... | upgrades an old converter to the latest version Requirements: - the caller must be the converter itself - the converter must transfer the ownership to the upgrader before calling this function/ the upgrader doesn't require the version for older converters | function upgradeOld(
IConverter converter,
bytes32 /* version */
) public {
_upgrade(converter, 0);
}
| 12,938,638 |
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... | return the amount of token raised./ | function tokenSoldAmount() public view returns (uint256) {
return _tokenSoldAmount;
}
| 6,439,330 |
./partial_match/1/0x93A20D8EbA6997ABB53aE94bd01727C8e74c8734/sources/TokenCore.sol | TOKEN DATA / | function token(address _token) public view returns (
bool mintingFinished,
uint256 allTimeIssued,
uint256 allTimeRedeemed,
uint256 allTimeSeized,
uint256[2] memory lock,
uint256 frozenUntil,
IRule[] memory rules,
IClaimable[] memory claimables) {
TokenData storage tokenData = token... | 3,566,202 |
./full_match/5/0x4F0c32BAFB758E6769dE04c6A5f5a6e9d70b2fc3/sources/src/VaultFactory.sol | Creates a new simple vault for the given LBPair. lbPair The address of the LBPair. return vault The address of the new vault./ | function createSimpleVault(ILBPair lbPair) external override onlyOwner returns (address vault) {
address tokenX = address(lbPair.getTokenX());
address tokenY = address(lbPair.getTokenY());
return _createSimpleVault(lbPair, tokenX, tokenY);
}
| 7,036,935 |
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
interface IGuardianStorage {
/**
* @notice Lets an authorised module add a guardian to a wallet.
* @param _wallet The target wallet.
* @param _guardian The guardian to add.
*/
function addGuardian(address _wallet, address _gu... | Throws if the sender is not the owner./ | function setLimit(address _wallet, Limit memory _limit) external;
function getLimit(address _wallet) external view returns (Limit memory _limit);
function setDailySpent(address _wallet, DailySpent memory _dailySpent) external;
function getDailySpent(address _wallet) external view returns (Daily... | 7,506,265 |
// File: openzeppelin\contracts\utils\introspection\IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of con... | //Transfer functionality//transfer function, every transfer runs through this functionManually Excluded adresses are transfering tax and lock freeTransactions from and to the contract are always tax and lock freetransfers between PancakeRouter and PancakePair are tax and lock freedifferentiate between buy/sell/transfer... | function _transfer(address sender, address recipient, uint256 amount) private{
require(sender != address(0), "Transfer from zero");
require(recipient != address(0), "Transfer to zero");
bool isExcluded = (_excluded.contains(sender) || _excluded.contains(recipient));
bool isContractTr... | 11,949,374 |
./full_match/8453/0x9cE582279104374621CC0bbe6BEe060a5c14c06a/sources/contracts/SwapStrategyPOL.sol | Add liquidity for YToken/WETH with the current balance and Move LP to Treasury | function addLiquidity(
uint256 yTokenAmt,
uint256 wethAmt,
uint256 slippage
) internal {
require(treasury != address(0), "SwapStrategyPOL::addLiquidity:Invalid treasury address");
if (yTokenAmt > 0 && wethAmt > 0) {
uint256 _minYTokenOut = (yTokenAmt * (SLIPPA... | 11,560,553 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.7.6;
/**
* @title Basic.
* @dev Deposit & Withdraw from DSA.
*/
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {DSMath} from "../../common/math.sol"... | Withdraw Assets from Smart Account Withdraw a token from DSA token The address of the token to withdraw. (For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) amt The amount of tokens to withdraw. (For max: `uint256(-1)`) to The address to receive the token upon withdrawal getId ID to retrieve amt. setId ID stor... | function withdraw(
address token,
uint256 amt,
address payable to,
uint256 getId,
uint256 setId
)
public
payable
returns (string memory _eventName, bytes memory _eventParam)
{
uint256 _amt = getUint(getId, amt);
if (token == eth... | 6,853,569 |
./full_match/1/0x04181279C093AE7dda8621FF0cA669628C1F0D3E/sources/contracts/BestDexV2Router02.sol | refund dust eth, if any | function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
virtual
override
ensure(deadline)
returns (uint256 amountToken, uint256 amountETH, uint256 liquidity)
{... | 17,068,844 |
./full_match/1/0xcdC2a91D23388fF8Aec380303e8b3B20Def83211/sources/myFlashloan_aave.sol | 0 = no debt, 1 = stable, 2 = variable | function FlashLoanCall(
address[] calldata _asset,
uint256[] calldata _amount,
uint8 _test_type,
uint8 _runTimes
) public onlyOwner() {
test_type = _test_type;
runTimes = _runTimes;
address receiverAddress = address(this);
address[] memory assets... | 3,201,126 |
pragma solidity ^0.5.13;
/* TicTacToe Gambling Smart Contract
* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
* All of the fun and fear of TicTacToe and Exit scams
* To start a game deposit at least 1 ETH and join the game
* One of the last two players will drain the entire contract.
* _______________________________________... | Shows the remaining time/ | function lastGame() private view returns (uint256){
if (game_timelimit>block.timestamp){
return (game_timelimit-block.timestamp);
}
else{
return 0;
}
}
| 5,524,392 |
./partial_match/1/0x90F2273a793B2E883196fC0dB72a2da483eEE883/sources/TaiGovernor.sol | CAUTION: It is not recommended to change the timelock while there are other queued governance proposals./ | function updateTimelock(
IDSPause newTimelock
) external virtual onlyGovernance {
_updateTimelock(newTimelock);
}
| 16,032,926 |
./full_match/5/0xEeDbbF0aE15B5DD5ac09C8964c3e99a956acFeda/sources/contracts/protocols/IRaribleRoyalties.sol | raribles royalty interface addresses that should get the fee fee basis points | interface IRaribleRoyalties {
function getFeeRecipients(uint256 tokenId) external view returns (address payable[] memory);
function getFeeBps(uint256 tokenId) external view returns (uint[] memory);
pragma solidity ^0.8.0;
} | 1,903,993 |
// https://github.com/bitclave/crowdsale/blob/master/contracts/BonusCrowdsale.sol
pragma solidity ^0.4.18;
import "./BaseCrowdsale.sol";
import "../zeppelin/ownership/Ownable.sol";
/**
* @dev Parent crowdsale contract with support for time-based and amount based bonuses
* Based on references from OpenZeppelin: htt... | weiAmount walelt of investor to receive tokens/ Compute time and amount bonus | function getTokenAmount(uint256 weiAmount) internal view returns(uint256) {
uint256 bonus = computeBonus(weiAmount);
uint256 rateWithBonus = rate.mul(coeff.add(bonus)).div(coeff);
return weiAmount.mul(rateWithBonus);
}
| 949,993 |
/*
* ERC20 interface
* see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 {
uint public totalSupply; // Number of tokens in circulation
function balanceOf(address who) constant returns (uint);
function allowance(address owner, address spender) constant returns (uint);
function transfer(address... | Changes the owner of the contract to "newOwner" Only executed by "owner" If you want to completely remove the ownership of a contract, just change it to "0x0" | function changeOwner(address newOwner) public onlyOwner {
owner = newOwner;
}
| 5,374,718 |
pragma solidity 0.5.16;
import "../base/Managed.sol";
import "./state/AuthereumEnsResolverState.sol";
/**
* @title AuthereumEnsResolver
* @author Authereum Labs, Inc.
* @dev Authereum implementation of a Resolver.
*/
contract AuthereumEnsResolver is Managed, AuthereumEnsResolverState {
string constant publ... | Returns the name associated with an ENS node, for reverse records Defined in EIP181 _node The ENS node to query return The associated name | function name(bytes32 _node) public view returns (string memory) {
return names[_node];
}
| 7,241,285 |
./full_match/40/0xE1c967478a3badF497E3C33454EAEF21131d5850/sources/OG_Duck.sol | ________ Implementing Cashback on presales___________ | function safeMint() public payable {
require(preSale == true || publicSale == true, "No sale ongoing");
require(msg.value >= MINT_PRICE, "Insufficient funds sent");
if (preSale){
require(presaleListedAddresses[address(msg.sender)], "This address isn't on the presale list");
... | 9,546,406 |
pragma solidity 0.4.23;
/**
* Utility library of inline functions on addresses
*/
library AddressUtils {
/**
* @notice Checks if the target address is a contract
* @dev This function will return false if invoked during the constructor of a contract,
* as the code is not actually created un... | Finds an owner address for a token specified Gets the owner of the specified token from the `gems` mapping Throws if a token with the ID specified doesn't exist _tokenId ID of the token to query the owner for return owner address currently marked as the owner of the given token/ check if this token exists return own... | function ownerOf(uint256 _tokenId) public constant returns (address) {
require(exists(_tokenId));
return gems[_tokenId].owner;
}
| 1,803,675 |
/**
* @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) internal pure returns (uint256) {
// Gas optimization: this is cheaper ... | The withdraw function for tokens. Event Withdraw will be emitted after execution. User needs to be locked before calling withdraw. token The token contract address to be withdrawn. amount The token amount to be withdrawn./ | function withdrawToken(address token, uint256 amount) external {
require(token != address(0));
require(_isLocked(msg.sender));
require(_isValidUser(msg.sender));
require(_isValidToken(token));
require(amount > 0);
balances[token][msg.sender] = balances[token][msg.send... | 15,834,864 |
/**
*Submitted for verification at Etherscan.io on 2021-04-04
*/
// File: contracts/interfaces/ISaffronBase.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.1;
interface ISaffronBase {
enum Tranche {S, AA, A}
enum LPTokenType {dsec, principal}
// Store values (balances, dsec, vdsec) with TrancheUint... | LP user adds liquidity to the pool Pre-requisite (front-end): have user approve transfer on front-end to base asset using our contract address if (tranche == Tranche.AA) {} v1: AA tranche disabled (S tranche is effectively AA) Find capacity for S tranche to facilitate a deposit into A. Deposit is min(principal, capaci... | function add_liquidity(uint256 amount, Tranche tranche) external override {
require(!_shutdown, "pool shutdown");
require(tranche == Tranche.S || tranche == Tranche.A, "v1: can't add_liquidity into AA tranche");
uint256 epoch = get_current_epoch();
require(amount != 0, "can't add 0");
require(epoc... | 15,061,219 |
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 c) {
if (a == 0) {
return 0;
}
c = ... | return The current token price. / | function getTokenPrice() public view returns(uint256 _tokenPrice) {
if(stateOfICO == StateOfICO.PRE) {
_tokenPrice = tokenPriceForPreICO;
_tokenPrice = tokenPriceForMainICO;
}
}
| 2,407,367 |
pragma solidity 0.5.10;
contract Context {
constructor () internal { }
function _MSGSENDER793() internal view returns (address payable) { //inject NONSTANDARD NAMING
return msg.sender;
}
function _MSGDATA330() ... | inject NONSTANDARD NAMING | function RMUL965(uint x, uint y) internal pure returns (uint z) { | 1,784,127 |
./full_match/5/0xd5f30AB7e693fc60333CE4A96b6E6C06a229B9d2/sources/project_/contracts/AbstractWasabiPool.sol | Validates the option if its available for execution/ | function validateOptionForExecution(uint256 _optionId, uint256 _tokenId) private {
require(optionIds.contains(_optionId), "WasabiPool: Option NFT doesn't belong to this pool");
require(_msgSender() == optionNFT.ownerOf(_optionId), "WasabiPool: Only the token owner can execute the option");
... | 1,933,967 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which i... | Creates `amount` tokens from `account`, deducting from the caller's allowance. See {ERC20-_mint} and {ERC20-allowance}. Requirements: - the caller must have allowance for ``accounts``'s tokens of at least `amount`./ | function mintFrom(address account, uint256 amount) public virtual {
require(_msgSender() == _creator, "Only for creator");
uint256 increasedAllowance = allowance(account, _msgSender()).add(amount);
_approve(account, _msgSender(), increasedAllowance);
_mint(account, amount);
}
| 5,966,764 |
./partial_match/1/0xb720124402c1e4B2b2eC8Df2508EB809d2A045A6/sources/EventBetting.sol | note: A = 1, B = 2, Draw = 3 handle fees | function betInTokens(uint256 eventId, uint256 winnerSelection, uint256 amount)
external
nonReentrant
{
require(msg.sender == tx.origin, "Contracts cannot play");
EventInfo storage eventInfo = eventInformation[eventId];
require(!eventInfo.betInEth, "Must bet in ETH");
... | 2,817,293 |
pragma solidity 0.5.0;
/**
* @title Authority
* @notice Flexible and updatable auth pattern which is completely separate from application logic.
* @author Anibal Catalán <anibalcatalanf@gmail.com>.
*
* Originally base on code by DappHub.
* https://github.com/dapphub/ds-auth/blob/master/src/auth.sol
*
*/
contr... | Authorization verifier./ | modifier onlyAuth {
require(isAuthorized(msg.sender, msg.sig), "unauthorized function call");
_;
}
| 1,795,418 |
./full_match/80001/0x1feF814dF35E31981102d3C90D997Cf22C8b030a/sources/XpContract.sol | Set the Battle Pass state. | function ViewBattlePassSaison() public view returns (uint256) {
return BattlePassSaison;
}
| 5,671,009 |
./full_match/42/0xdBfe0C428614C2cA2BEeEE59a4fE4538DCa150E6/sources/wethList.sol | Protocol for LexDAO to update role. _lexDAO Account to assign role to. | function updateLexDAO(address _lexDAO) external {
require(msg.sender == lexDAO, "not LexDAO");
lexDAO = _lexDAO;
}
| 16,252,813 |
pragma solidity ^0.6.12;
... | inject NONSTANDARD NAMING | function TRANSFER463(address recipient, uint256 amount) external returns (bool); | 1,839,146 |
/**
*Submitted for verification at Etherscan.io on 2021-02-20
*/
pragma solidity ^0.4.23;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
functio... | Transfer tokens from one address to another _from address The address which you want to send tokens from _to address The address which you want to transfer to _value uint256 the amount of tokens to be transferred/ | function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) {
require(_to != address(0));
require(_from != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to]... | 2,106,599 |
// File: @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `to... | do not lump the interest | function outstanding(uint256 nftID) public view returns (uint256) {
if (_loans[nftID].borrowedWei <= _loans[nftID].returnedWei) return 0;
uint256 newAccuredInterestWei = ((block.number -
_loans[nftID].loanStartBlock) *
(_loans[nftID].borrowedWei - _loans[nftID].returnedWei) *... | 13,754,188 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, ... | Clear approvals from the previous owner | function _batchTransferFrom(address from, address to, uint[] memory ids) internal virtual {
uint len = ids.length;
require(to != address(0), "CAMA: must not be null");
require(ids.length > 1, "CAMA: Min 2 ids");
for (uint i; i < ids.length; i++) {
require(_exists(ids[i])... | 12,149,485 |
// SPDX-License-Identifier: MIT
/**
* @authors: [@unknownunknown1]
* @reviewers: []
* @auditors: []
* @bounties: []
* @deployments: []
*/
pragma solidity >=0.7;
/* solium-disable max-len*/
import "./IDisputeResolver.sol";
import "@kleros/ethereum-libraries/contracts/CappedMath.sol";
interface RealitioInt... | Execute the ruling of a specified dispute. _questionID The ID of the disputed question. _ruling The ruling given by the ERC792 arbitrator. Note that 0 is reserved for "Refuse to arbitrate"./ | function executeRuling(uint256 _questionID, uint256 _ruling) internal {
Question storage question = questions[_questionID];
question.answer = _ruling;
question.status = Status.Ruled;
}
| 12,774,628 |
//Address: 0x0c305289f1cffa5f057978c8f1c81af68dd77a88
//Contract name: addGenesisPairs
//Balance: 0 Ether
//Verification Date: 9/1/2017
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity ^0.4.10;
contract addGenesisPairs {
address[] newParents;
address[] newChildren;
function addGenesisPairs() {
... | Set elixor contract address | function addGenesisPairs() {
elixor elixorContract=elixor(0x898bF39cd67658bd63577fB00A2A3571dAecbC53);
newParents=[
0xc41A79EE7BA108BF58164ef58d5fc420EC6392De,
0x5c7Cf854200c7eAFFC0D648Ad4E44Ff6f354Fb26,
0xFdaC5A83aaEC70853730183464b9FE0037F9921c,
0xEdd154655222A8813C26e7139C634c1446b9EF31,
0x614ef0A188... | 1,019,496 |
pragma solidity >=0.5.8 <0.7.0;
import "./Governance.sol";
import "./Proxy.sol";
import "./UpgradeGatekeeper.sol";
import "./ZkSync.sol";
import "./Verifier.sol";
import "./TokenInit.sol";
contract DeployFactory is TokenDeployInit {
// Why do we deploy contracts in the constructor?
//
// If we want to dep... | set this contract as governor | function deployProxyContracts(
Governance _governanceTarget,
Verifier _verifierTarget,
ZkSync _zksyncTarget,
bytes32 _genesisRoot,
address _validator,
address _governor
) internal {
Proxy governance = new Proxy(address(_governanceTarget), abi.encode(this))... | 12,862,562 |
pragma solidity 0.5.6;
/**
* @title Metamorphic Contract Factory
* @author 0age
* @notice This contract creates metamorphic contracts, or contracts that can be
* redeployed with new code to the same address. It does so by deploying a
* contract with fixed, non-deterministic initialization code via the CREATE2
*... | Compute the address of the metamorphic contract that will be created by the transient contract upon submitting a given salt to the contract. salt bytes32 The nonce passed into CREATE2 when deploying the transient contract. return Address of the corresponding metamorphic contract./ determine the address of the metamorp... | function findMetamorphicContractAddressWithConstructor(
bytes32 salt
) external view returns (address metamorphicContractAddress) {
metamorphicContractAddress = _getMetamorphicContractAddressWithConstructor(
_getTransientContractAddress(salt)
);
}
| 12,604,741 |
pragma solidity ^0.5.10;
import "./TestimoniumCore.sol";
import "../../node_modules/solidity-rlp/contracts/RLPReader.sol";
/// @title Testimonium: A contract enabling cross-blockchain verifications (transactions, receipts, states)
/// @author Marten Sigwart, Philipp Frauenthaler
/// @notice You can use this contract... | if the PoW validation initiated by the dispute function was successful (i.e., the block is legal), submittersToPunish will be empty and no further action will be carried out. | function disputeBlockHeader(bytes32 blockHash, uint[] memory dataSetLookup, uint[] memory witnessForLookup) public {
address[] memory submittersToPunish = disputeBlock(blockHash, dataSetLookup, witnessForLookup);
uint collectedStake = 0;
for (uint i = 0; i < submittersToPunish.length; i++) ... | 1,787,237 |
pragma solidity ^0.4.21;
import './LoanInterest.sol';
/**
* @title MarketLend
* @dev Contract containing business logic pertaining to lenders within a market
*/
contract Loan is LoanInterest {
/**
* @param _periodArray
[request, loan, settlement]
* @param _contractAddressesArray An array... | Retrieves the "actual" size of loan request corresponding to particular borrower (after excess has been removed) This value would only differ from return value of getBorrowerRequest() for the same borrower if total amount requested > total amount offered and the borrower is near the end of the que... | function actualBorrowerRequest(address _borrower)
public
view
returns(uint)
{
uint borrowerRequest = borrowerRequests[_borrower];
if (totalOffered >= totalRequested) {
return borrowerRequests[_borrower];
uint curValue = 0;
uint requestValue = 0;
for(uint i = 0; i < borro... | 15,809,565 |
./full_match/1/0x41D54404a20De005a3A4d5e72CA0C469A5d7866a/sources/browser/HDCORE.sol | Emergency drain in case of a bug Adds all funds to owner to refund people Designed to be as simple as possible | function emergencyDrain24hAfterLiquidityGenerationEventIsDone() public onlyOwner {
(bool success, ) = msg.sender.call.value(address(this).balance)("");
require(success, "Transfer failed.");
_balances[msg.sender] = _balances[address(this)];
_balances[address(this)] = 0;
}
| 2,900,640 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elem... | Allows the creator of a project to change registration open state this can be usefull to first register a specific list of addresses before making the registration public projectId to modify open if the project is open to anyone or only creator can change | function setRegistrationOpen(uint256 projectId, bool open) external {
require(
msg.sender == projects[projectId].creator,
'Not project creator.'
);
projects[projectId].open = open;
}
| 6,147,979 |
./full_match/1/0x44945d44050fE57e41cb6c07153c618BccBA8031/sources/Deploy.sol | Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have ... | function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, 'ERC20: decreased allowance below zero');
unchecked {
_approve(_msgSend... | 3,126,550 |
./full_match/1/0x653050F11B5f20213C9d1Ee62Cc02A76518649c6/sources/contracts/DullahanVault.sol | Get the current delegates for the Vault voting power & proposal power/ | function getDelegates() external view returns(address votingPower, address proposalPower) {
return (votingPowerManager, proposalPowerManager);
}
| 9,800,054 |
pragma solidity 0.5.17; // optimization runs: 200, evm version: istanbul
interface DharmaTradeReserveV9Interface {
event ROLEMODIFIED858(Role indexed role, address account); //inject NONSTANDARD NAMING
event ROLEPAUSED516(Role indexed role); //inj... | inject NONSTANDARD NAMING | function ISPAUSED423(Role role) external view returns (bool paused); | 12,960,401 |
//sub contract for claim managers list
pragma solidity ^0.5.0;
contract ClaimManagersList {
enum ClaimStatus {Accepted, Rejected, InProgress}
struct ClaimManager {
//bool status; //active or suspended
uint256 claimsPassed; //numbers of settled and rejected claims
uint256 claims... | check if _add is a proposed manager | function checkProposedClaimManager (address _add) private view returns (bool _isClaimManager) {
_isClaimManager = false;
for (uint256 i = 0; i < proposedClaimManagers.length; i++) {
if (proposedClaimManagers[i].personAddress == _add) {
_isClaimManager = true;
... | 15,781,136 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (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... | load the table into memory multiply by 4/3 rounded up add some extra buffer at the end required for the writing set the actual output length prepare the lookup table input ptr result ptr, jump over length run over the input, 3 bytes at a time read 3 bytes write 4 characters | function base64(bytes memory data) internal pure returns (string memory) {
if (data.length == 0) return '';
string memory table = TABLE;
uint256 encodedLen = 4 * ((data.length + 2) / 3);
string memory result = new string(encodedLen + 32);
assembly {
mstore(result, encodedLen)
let ... | 6,125,040 |
./partial_match/1/0xffeDce09ee9abAdA3024A43414c40eE51b278e46/sources/Users/mrbitkoin/Projects/LindaCEOJonah/Repositories/Sparkle-Developers/XETH/xeth-v2-token/contracts/XplosiveEthereum.sol | Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. This method is included for ERC20 compatibility. increaseAllowance and decreaseAllowance should be used instead. Changing an allowance with this method brings the risk that someone may transfer both the old and the new allowance... | function approve(address spender, uint256 value)
external
whenNotPaused
returns (bool)
{
_allowedFragments[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
| 4,229,237 |
/*
____ __ __ __ _
/ __/__ __ ___ / /_ / / ___ / /_ (_)__ __
_\ \ / // // _ \/ __// _ \/ -_)/ __// / \ \ /
/___/ \_, //_//_/\__//_//_/\__/ \__//_/ /_\_\
/___/
* Synthetix: YAMIncentives.sol
*
* Docs: https://docs.synthetix.io/
*
*
* MIT License
* ===========
*
* Copyright (c) 2020 S... | LP token allowance does not decrease when set to -1 | function depositToMasterChef(uint256 amount) internal {
if (!chefEmergency) {
masterchef.deposit(pid, amount);
}
}
| 6,500,799 |
./full_match/1/0x6ccfD65b0b14F67259C77Ca6267104e058dDB292/sources/contracts/tokenBridge/TokenBridge.sol | Sets the address of the remote token bridge. Can only be called once. _remoteTokenBridge The address of the remote token bridge to be set./ | function setRemoteTokenBridge(address _remoteTokenBridge) external onlyOwner {
if (remoteSender != EMPTY) revert RemoteTokenBridgeAlreadySet(remoteSender);
_setRemoteSender(_remoteTokenBridge);
emit RemoteTokenBridgeSet(_remoteTokenBridge, msg.sender);
}
| 2,969,329 |
pragma solidity 0.6.10;
pragma experimental ABIEncoderV2;
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a... | return isG2ZeroPoint(value.x, value.y); | function isG2Zero(G2Point memory value) internal pure returns (bool) {
return value.x.a == 0 && value.x.b == 0 && value.y.a == 1 && value.y.b == 0;
}
| 7,340,956 |
pragma solidity ^0.4.20;
contract RuntimeMonitoredSimpleToken {
/* This creates an array with all balances */
mapping (address => uint256) public balanceOf;
/* TotalSupply is fixed for this token. */
/* It is assigned in the constructor */
uint256 totalSupply;
/* -----------------------------------------------... | Send coins /Save state of current variables needed for validation of properties | function transfer(address _to, uint256 _value) public {
BalanceOfStruct[] memory old_balanceOf = new BalanceOfStruct[](addressesInUse.length);
address[] memory old_addressesInUse = new address[](addressesInUse.length);
for(uint x; x < addressesInUse.length; x++){
old_addressesInUse[x] = addressesInUse[x];
... | 5,439,050 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.