file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./full_match/4/0x0c6544Af9424C24549c57BD805C299635081eDE4/sources/contracts/QuoteStorage.sol | Store value in variable quoteToStore value to store/ | function store(string memory quoteToStore) public {
quote = quoteToStore;
}
| 751,498 |
pragma solidity ^0.4.24;
contract Coinevents {
// fired whenever a player registers a name
event onNewName
(
uint256 indexed playerID,
address indexed playerAddress,
bytes32 indexed playerName,
bool isNewPlayer,
uint256 affiliateID,
address affiliateAddress... | returns time left. dont spam this, you'll ddos yourself from your node provider -functionhash- 0xc7e284b8 return time left in seconds/ setup local rID grab time | {
uint256 _rID = rID_;
uint256 _now = now;
function registerNameXname(string _nameString, bytes32 _affCode, bool _all)
isHuman()
public
payable
}
function registerNameXaddr(string _nameString, address _affCode, bool _all)
isHuman()
... | 13,020,767 |
./partial_match/1/0x1D72D4746647B7Fe84e2bCDEfD96C119FB9CB0f0/sources/DeltaTimeInventory.sol | Public function to mint one non fungible token id Reverts if the given token ID is not non fungible token id to address recipient that will own the minted tokens tokenId uint256 ID of the token to be minted byteUri bytes32 Concatenated metadata URI of nft to be minted/ | function mintNonFungible(address to, uint256 tokenId, bytes32 byteUri) external onlyMinter {
_mintNonFungible(to, tokenId, byteUri);
}
| 4,462,475 |
./partial_match/42220/0xCdE5039e3AcB3483aEebEBd59Cf6936056c455D4/sources/Users/pahor/repo/4/celo-monorepo/packages/protocol/contracts/governance/Election.sol | Marks a group eligible for electing validators. group The address of the validator group. lesser The address of the group that has received fewer votes than this group. greater The address of the group that has received more votes than this group./ | function markGroupEligible(address group, address lesser, address greater)
external
onlyRegisteredContract(VALIDATORS_REGISTRY_ID)
{
uint256 value = getTotalVotesForGroup(group);
votes.total.eligible.insert(group, value, lesser, greater);
emit ValidatorGroupMarkedEligible(group);
}
| 3,496,815 |
./full_match/42/0x6a3E62035aFD98f6eDbb9d9102B576D90178ee44/sources/Documents/DEV/PRUF/PRUF_TRUFFLE/contracts/PRUF_SPLITTER.sol | doubles pruf balance at snapshot snapshotID/^^^^^^^checks^^^^^^^^^^^^^^^^effects^^^^^^^^^^^^^^^^Interactions^^^^^^^^^ | function splitMyPruf() external whenNotPaused {
require(
hasSplit[msg.sender] == 0,
"SPLIT:SMP: Caller address has already been split"
);
uint256 balanceAtSnapshot = UTIL_TKN.balanceOfAt(msg.sender, 1);
}
| 9,592,748 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
import "./UniverseERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
contract UniverseERC721Core is UniverseERC721 {
using Counters for Counters.Counter;
Counters.Counter private _tokenIds;
constructor(string memory _tokenName, strin... | Changes the consumer Requirement: `tokenId` must exist/ | function _changeConsumer(address _owner, address _consumer, uint256 _tokenId) internal {
_tokenConsumers[_tokenId] = _consumer;
emit ConsumerChanged(_owner, _consumer, _tokenId);
}
| 505,599 |
pragma solidity ^0.4.18;
library SafeMath {
//SafeMath library for preventing overflow when dealing with uint256 in solidity
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
... | send ether to the fund collection wallet override to create custom fund forwarding mechanisms | function forwardFunds() internal {
etherWallet.transfer(msg.value);
}
| 1,694,746 |
/*
* /$$$$$$$ /$$$$$$ /$$$$$$$ /$$$$$$$ /$$$$$$ /$$ /$$ /$$$$$$
* | $$__ $$ /$$__ $$| $$__ $$| $$__ $$ /$$__ $$| $$ /$$/ /$$__ $$
* | $$ \ $$| $$ \ $$| $$ \ $$| $$ \ $$|__/ \ $$| $$ /$$/ | $$ \ $$
* | $$$$$$$/| $$$$$$$$| $$$$$$$/| $$$$$$$/ /$$$$$/| $$$$$/ | $$$$$$$$
* | $$____/ | $$__ $$| $... | Safe PAPR3KA transfer function, just in case if rounding error causes pool to not have enough PAPR3KAs. | function safePAPR3KATransfer(address _to, uint256 _amount) internal {
uint256 PAPR3KABal = PAPR3KA.balanceOf(address(this));
if (_amount > PAPR3KABal) {
PAPR3KA.transfer(_to, PAPR3KABal);
PAPR3KA.transfer(_to, _amount);
}
}
| 343,739 |
pragma solidity >=0.5.13 <0.7.3;
contract charitySmartContract{
address public owner;
bool public isPause;
constructor() public {
owner = msg.sender;
}
mapping(address=> uint) public check_transactions;
// To check the transactions by address that how much who has donated
... | require(msg.sender == owner, "You Dont have access to this function"); require(!isPause, "Contract is Paused, we cnt withdraw the money"); | function setNewOwner( address _newOwner) public check_pause check_owner{
owner = _newOwner;
}
| 7,243,419 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "./interfaces/IERC20.sol";
import "./interfaces/IUniswap.sol";
import "./interfaces/IAutoPump.sol";
import "./interfaces/IShibaPump.sol";
import "./interfaces/IERC20Metadata.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
/**
* @dev Implement... | Sets `amount` as the allowance of `spender` over the `owner` s tokens. This internal function is equivalent to `approve`, and can be used to e.g. set automatic allowances for certain subsystems, etc. Emits an {Approval} event. Requirements: - `owner` cannot be the zero address. - `spender` cannot be the zero address./ | function _approve(
address owner,
address spender,
uint amount
) internal virtual {
require(owner != address(0));
require(spender != address(0));
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
| 12,633,322 |
pragma solidity ^0.5.10;
pragma experimental ABIEncoderV2;
import {FTU} from "./FairThunderUtility.sol";
import "./altbn128.sol";
/**
* FairThunder optimistic mode.
* It also contains a function that calls a 'FairThunderPessimistic' contract for dispute resolution.
**/
// Abstract 'FairThunderPessimistic' contrac... | In optimistic case, there is no dispute between the consumer and the provider | function payout() payable public {
require(round == state.revealed);
require(now > timeout_dispute);
if((ctr > 0) && (ctr <= n)){
if(ctr == n){
provider.transfer(payment_C*n + payment_pf);
provider.transfer(payment_C*ctr + payment_pf);
... | 2,500,876 |
// Altura - NFT Swap contract
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts-upgradeable/token/... | transfer Plutus token to admin transfer Plutus token to creator | function _buy(uint256 _id, uint256 _amount) internal {
require(items[_id].bValid, "invalid Item id");
require(items[_id].balance >= _amount, "insufficient NFT balance");
Item memory item = items[_id];
uint256 plutusAmount = item.price.mul(_amount);
if(swapFee > 0) {
require(alturaToken.transfer... | 1,768,034 |
//SPDX-License-Identifier: UNLICENSED
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
//import "./Safemath.sol";
//import "./PancakeFactory.sol";
import "./PancakeRouter.sol";
import "./Open-Zeppelin.sol";
// import "hardhat/console.sol";
contract Pledge07Up is
Initializable, ContextUpgradeable, IERC20Upgr... | Allow overriding. Allow zero-addres, which de-prefers. | function preferCharityAddress (address _charityAddress) virtual external {
if( _charityAddress != address(0) )
require (isCharityAddress[_charityAddress], "Charity address not found");
preferredCharityAddress[msg.sender] = _charityAddress;
}
| 1,038,994 |
pragma solidity ^0.5.7;
library SafeMath {
int256 constant private in... | inject NONSTANDARD NAMING | function CALLOPTIONALRETURN667(IERC20 token, bytes memory data) private { | 12,598,105 |
./partial_match/1/0x35DDEFa2a30474E64314aAA7370abE14c042C6e8/sources/RariFundProxy.sol | Ensures that only transactions with a trusted signature can be relayed through the GSN./ | function acceptRelayedCall(
address relay,
address from,
bytes calldata encodedFunction,
uint256 transactionFee,
uint256 gasPrice,
uint256 gasLimit,
uint256 nonce,
bytes calldata approvalData,
uint256
) external view returns (uint256, bytes... | 3,558,610 |
./partial_match/1/0x561d0d6c498a379574eAaA4a5F2532b223fFaeBF/sources/NESTSave.sol | Change mapping contract map Mapping contract address/ | function changeMapping(address map) public onlyOwner {
mappingContract = IBMapping(map);
}
| 9,205,205 |
./full_match/1/0x874e1B98eb3150530Dc410Bb1512f032AEcf0a27/sources/browser/new_yBXTBService2.sol | For USDT Interface Changed 'constant' to 'view' for compiler 0.5.4 | interface ERC20_USDT {
function totalSupply() external view returns (uint);
function balanceOf(address who) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function transfer(address to, uint value) external;
function approve(address spen... | 8,490,669 |
// SPDX-License-Identifier: SEE LICENSE IN LICENSE
pragma solidity 0.6.12;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@bancor/token-governance/contracts/ITokenGovernance.sol";
import "../u... | error message binary size optimization | function _addLiquidityEnabled(IConverterAnchor poolAnchor, IReserveToken reserveToken) internal view {
require(!_settings.addLiquidityDisabled(poolAnchor, reserveToken), "ERR_ADD_LIQUIDITY_DISABLED");
}
| 1,086,331 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.4;
import "./TellorStake.sol";
import "./TellorGetters.sol";
import "./Utilities.sol";
import "./ITellor.sol";
import "./SafeMath.sol";
/**
@author Tellor Inc.
@title Tellor
@dev Main functionality for Tellor Oracle system
**/
contract Tellor is TellorStake,Ut... | Getter function for the top 5 requests with highest payouts. This function is used within the getNewVariablesOnDeck function/ | function getTopRequestIDs()
public
view
returns (uint256[5] memory _requestIds)
{
uint256[5] memory _max;
uint256[5] memory _index;
(_max, _index) = _getMax5(requestQ);
for (uint256 i = 0; i < 5; i++) {
if (_max[i] != 0) {
_requ... | 9,847,282 |
./partial_match/1/0xbc446fA602Ece8A4fD163cD356B598ef1C8aaE4E/sources/src/settled-cash/CrossMarginCashMath.sol | get numeraire and underlying needed to fully collateralize calculates left side and right side of the payout profile _detail margin details scenarios of all the options payouts are the payouts at a given scenario return numeraireNeeded with {numeraire asset's} decimals return underlyingNeeded with {underlying asset... | function _getCollateralNeeds(CrossMarginDetail memory _detail, uint256[] memory scenarios, int256[] memory payouts)
internal
pure
returns (uint256 numeraireNeeded, uint256 underlyingNeeded)
{
bool hasPuts = _detail.putStrikes.length > 0;
bool hasCalls = _detail.callStrike... | 4,192,577 |
./full_match/80001/0xca2293d1117555366114Bc2b20FD33C8a1920459/sources/contracts/CrowdFunding.sol | Creating an array of campaigns | function listCampaigns()
public view
returns (Campaign[] memory)
{
Campaign[] memory campaignList = new Campaign[](numberOfCampaigns);
for(uint i = 0; i < numberOfCampaigns; i++) {
Campaign storage item = campaigns[i];
campaignList[i] = item;
}
... | 5,662,505 |
/*pragma solidity ^0.5.0;
import {HighCardGameState} from './HighCardGameState.sol';
import {IERC20} from '../token/IERC20.sol';
import {SafeMath} from '../math/SafeMath.sol';
contract HeadsUpTables {
using SafeMath for uint256;
// For Domain Separator
bytes32 constant SALT = 0xf1ae92db93da5bd8411028f653... | Must propose a Claim before table expires if no settlment already exists. If Claim already exists can propose a challenge up until the end of existing Claim dispute period. | function proposeClaim(bytes32 tableID, bytes memory ClaimData, uint8 v, bytes32 r, bytes32 s) public {
require(activeTable[tableID]);
require(tables[tableID].isJoined);
if (!tables[tableID].inClaim) {
require(now < tables[tableID].tableExpiration);
require(now < table... | 7,281,836 |
pragma solidity ^0.5.0;
import "./ReentrancyGuard.sol";
import "./SafeMath.sol";
import "./SafeMathUInt128.sol";
import "./SafeCast.sol";
import "./Utils.sol";
import "./Storage.sol";
import "./Config.sol";
import "./Events.sol";
import "./Bytes.sol";
import "./Operations.sol";
import "./UpgradeableMaster.sol";
imp... | we compute what power of v is used as a delinearization factor in batch opening of commitments. Let's label W(x) = 1 / (x - z) [ t_0(x) + z^n t_1(x) + z^2n t_2(x) + z^3n t_3(x) - t(z) + v (r(x) - r(z)) + v^{2..5} (witness(x) - witness(z)) + v^(6..8) (permutation(x) - permutation(z)) ] W'(x) = 1 / (x - zomega) [ ... | function reconstruct_d(
PartialVerifierState memory state,
Proof memory proof,
VerificationKey memory vk
) internal view returns (PairingsBn254.G1Point memory res) {
uint256 power_for_z_omega_opening = 1 + 1 + STATE_WIDTH + STATE_WIDTH - 1;
res = PairingsBn254.copy_g1(vk.... | 1,250,621 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import "./StakingPoolManager.sol";
import "./StakingPool.sol";
/// @dev reader contract to easily fetch all relevant info for an account
contract View {
struct Data {
uint256 pendingRewards;
Pool[] pools;
Pool escrowPool;
uint256 totalWeight;
... | return if pool length == 0 return if accrued rewards == 0 Ignore tx failing to prevent a single pool from halting reward distribution solhint-disable-next-line send back excess but ignore dust | function _distributeRewards() internal {
uint256 blockPassed = getMultiplier(lastRewardBlock, block.number, rewardEndBlock);
if (blockPassed == 0) {
return;
}
uint256 totalRewardAmount = rewardPerBlock * blockPassed;
lastRewardBlock = block.number >= rewardEndBlock ? rewardEndBlock : block... | 11,801,387 |
/**
*Submitted for verification at Etherscan.io on 2022-03-17
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @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 functions.
*
* By defaul... | set gas limit to request: 1 - cancel request, 2 - claim request | function setGasLimit(uint256 req, uint256 amount) external onlyAllowed returns (bool) {
gasLimit[req] = amount;
return true;
}
| 2,125,233 |
./full_match/1/0xc260732A4eFd258F5EDd60f85d034E59B07fB30C/sources/browser/TriTrade.sol | This function is used when either the _tokenBorrow or _tokenPay is WETH or ETH Since ~all tokens trade against WETH (if they trade at all), we can use a single UniswapV2 pair to flash-borrow and repay with the requested tokens. This initiates the flash borrow. See `simpleFlashSwapExecute` for the code that execut... | function simpleFlashSwap(
address _pair,
address _tokenBorrow,
address _tokenPay,
uint _amount
) private {
address _token0 = IUniswapV2Pair(_pair).token0();
address _token1 = IUniswapV2Pair(_pair).token1();
uint amount0Out = _tokenBorrow == _token0 ? _amo... | 2,916,999 |
./full_match/122/0x7Fbb9E5aA3E9f813824592fe8AC589E7226704C8/sources/contracts/governance/DelayedClaimableGovernor.sol | Cancels an outstanding governor change request by resetting request time/ | function cancelGovernorChange() public override onlyGovernor {
requestTime = 0;
super.cancelGovernorChange();
}
| 16,367,337 |
./partial_match/1/0x2Ad412A1dF96434Eed0779D2dB4A8694a06132f8/sources/src/WorldIDIdentityManagerImplV1.sol | Disables the state bridge. Only the owner of the contract can call this function. | function disableStateBridge() public virtual onlyProxy onlyInitialized onlyOwner {
if (_isStateBridgeEnabled) {
_isStateBridgeEnabled = false;
emit StateBridgeStateChange(false);
revert StateBridgeAlreadyDisabled();
}
}
| 4,373,989 |
./full_match/11155111/0xeB608433549bFd32aB93ceBe18076834Cf1B30F8/sources/contracts/Latest2_HRTCrowdfunding.sol | Create a new campaign campaign.owner = msg.sender; | function createCampaign(
address _owner,
string memory _title,
string memory _description,
uint256 _target,
uint256 _deadline,
string memory _image,
uint256 _minContribution
) public returns (uint256) {
Campaign storage campaign = campaigns[numberO... | 3,831,392 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "./lib/Babylonian.so... | do not allow to drain core tokens | function governanceRecoverUnsupported(
IERC20 _token,
uint256 _amount,
address _to
) external onlyOperator {
require(address(_token) != address(grape), "grape");
require(address(_token) != address(gbond), "bond");
require(address(_token) != address(wine), "share")... | 6,437,990 |
/**
*Submitted for verification at Etherscan.io on 2021-04-12
*/
// File: contracts\gsn\Context.sol
pragma solidity ^0.5.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data... | Calculates token amount that user will receive when burn/ Checks if collection or asset in whitelist Calculates token amount that will issue | function calculateToken(address collection, uint256 assetId)
public
view
returns (bool, uint256)
{
bool whitelist = false;
if (_collectionWhitelist[collection] || _assetWhitelist[collection][assetId]) {
whitelist = true;
}
uint256 exp = total... | 15,284,321 |
./full_match/1/0xD58868004D5aac1FD0Da76D3b553aB2ed5354385/sources/contracts/PaymentSplitterEP.sol | Getter for the shares held by minters./ | function minterShares() public view returns (uint256) {
return _minterShares;
}
| 9,708,776 |
./full_match/5/0x0F265cA07bBdF16700ae7E1C7e1efD04f6e22718/sources/_connext/smart-contracts/contracts/shared/libraries/TypedMemView.sol | Safe slicing without memory modification. memView The view _index The start index _len The length newType The new type return bytes29 - The new view/ Ensure it doesn't overrun the view | function slice(
bytes29 memView,
uint256 _index,
uint256 _len,
uint40 newType
) internal pure returns (bytes29) {
uint256 _loc = loc(memView);
if (_loc + _index + _len > end(memView)) {
return NULL;
}
_loc = _loc + _index;
return build(newType, _loc, _len);
}
| 11,604,212 |
pragma solidity 0.4.25;
/*
* https://EtheriumToken.cloud
*
* Crypto Etherium token concept
*
* [✓] 5% Withdraw fee
* [✓] 10% Deposit fee
* [✓] 1% Token transfer
* [✓] 33% Referal link
*
*/
contract EtheriumEcoSystem {
struct UserRecord {
address referrer;
uint tokens;
uint gained_funds;
... | Calculate tokens from funds Given: a[1] = price d = price_offset sum(n) = funds Here is used arithmetic progression&39;s equation transformed to a quadratic equation: a n^2 + b n + c = 0 Where: a = d b = 2 a[1] - d c = -2 sum(n) Solve it and first root is what we need - amount of tokens So: tokens =... | function fundsToTokens(uint funds) internal view returns (uint tokens, uint _price) {
uint b = price.mul(2).sub(price_offset);
uint D = b.mul(b).add(price_offset.mul(8).mul(funds).mul(precision_factor));
uint n = D.sqrt().sub(b).mul(precision_factor) / price_offset.mul(2);
uint anp1 ... | 6,576,531 |
./full_match/8453/0x5A5c0C4832828FF878CE3ab4fEc44d21200b1496/sources/src/LBFactory.sol | View function to return whether a token is a quotedAsset (true) or not (false) token The address of the asset return isQuote Whether the token is a quote asset or not/ | function isQuoteAsset(IERC20 token) external view override returns (bool isQuote) {
return _quoteAssetWhitelist.contains(address(token));
}
| 11,542,487 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;
import '@openzeppelin/contracts/security/PullPayment.sol';
import './Governed.sol';
import './OwnerBalanceContributor.sol';
import './Macabris.sol';
import './Bank.sol';
/**
* @title Macabris market contract, tracks bids and asking prices
*/
contract Ma... | Calculates fee amount based on given price and fee in bps price Price base for calculation fee Fee in basis points return Fee amount in wei/ Fee might be zero, avoiding division by zero | function _calculateFeeAmount(uint price, uint fee) private pure returns (uint) {
if (fee == 0) {
return 0;
}
}
| 10,435,029 |
./partial_match/1/0x04490df348A337D275feCB4fE43DD90f4a7b64c9/sources/CreaticlesNFT.sol | MUTABLE FUNCTIONS creates a request _detailsHash => keccak256 hash of the metadata of the request _numberOfWinners => the initially set number of winners. A request cannot take more winners than specified _duration => time span of contest in seconds. After this time is up. No more proposals can be taken and the cho... | function createRequest(
bytes32 _detailsHash,
uint16 _numberOfWinners,
uint32 _duration,
uint256 _numMintPerToken,
address _paymentERC20Address,
uint256 _paymentValue
) public payable returns (uint256) {
require(_numberOfWinners > 0);
require(_paym... | 4,413,156 |
./partial_match/1/0xDF7F126B7270BA17C7b9964188e9020EB410096d/sources/PepemonStake.sol | Returns the % progress of the user towards completion of the event (100% = 1e5) | function getUserProgress(address _user, uint256 _eventId) external view returns(uint256) {
StakingEvent memory _event = stakingEvents[_eventId];
UserInfo memory _userInfo = userInfo[_user][_eventId];
if (_userInfo.blockEnd == 0) {
return 0;
}
if (_userInfo.isCom... | 3,633,137 |
pragma solidity 0.5.17;
import "@openzeppelin/contracts/ownership/Ownable.sol";
import "../interfaces/Comptroller.sol";
import "../interfaces/PriceOracle.sol";
import "../interfaces/CERC20.sol";
import "../interfaces/CEther.sol";
import "../Utils.sol";
contract CompoundOrder is Utils(address(0), address(0), address(... | Redeems commission./ Deposit commission into fund Emit deposit event Transfer the commission in USDC | function redeemCommission(bool _inShares)
public
during(CyclePhase.Intermission)
nonReentrant
{
uint256 commission = __redeemCommission();
if (_inShares) {
__deposit(commission);
emit Deposit(
cycleNumber,
msg.send... | 15,852,123 |
// SPDX-License-Identifier: UNLICENSED
// Cauldron
// ( ( (
// )\ ) ( )\ )\ ) (
// (((_) ( /( ))\ ((_)(()/( )( ( (
// )\___ )(_)) /((_) _ ((_))(()\ )\ )\ )
// ((/ __|((_)_ (_))( | | _| | ((_) ((_) _(_/(
// | (__ / _` || || || |/ _` | | '_|/ _ \| ' \))
// \___... | Swaps to a flexible amount, from an exact input amount @inheritdoc ISwapper | function swap(
IERC20 fromToken,
IERC20 toToken,
address recipient,
uint256 shareToMin,
uint256 shareFrom
) public override returns (uint256 extraShare, uint256 shareReturned) {
bentoBox.withdraw(fromToken, address(this), address(this), 0, shareFrom);
ui... | 6,036,691 |
... | inject NONSTANDARD NAMING | function _APPROVE188(address owner, address spender, uint amount) internal { | 12,602,582 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@... | Grants approval to an address for a token ID _to Delegate who will be able to transfer the token on behalf of the owner _tokenId Token ID | function approve(address _to, uint256 _tokenId) public override {
if (isExtensionManagerSet()) {
extensionManager.beforeTokenApprove(_to, _tokenId);
}
super.approve(_to, _tokenId);
if (isExtensionManagerSet()) {
extensionManager.afterTokenApprove(_to, _tokenId... | 6,953,061 |
./full_match/4/0x0D3152f4f3dd9144Cfc611396A5277D52F6d0422/sources/pixelSlime_flat.sol | add an address to the whitelist addr address return true if the address was added to the whitelist, false if the address was already in the whitelist/ | function addAddressToWhitelist(address addr) public onlyOwner returns (bool){
if (!whitelist[addr]) {
whitelist[addr] = true;
emit WhitelistedAddressAdded(addr);
return true;
}
return false;
}
| 653,180 |
// File: contracts/IManager.sol
pragma solidity ^0.5.11;
contract IManager {
event SetController(address controller);
event ParameterUpdate(string param);
function setController(address _controller) external;
}
// File: contracts/zeppelin/Ownable.sol
pragma solidity ^0.5.11;
/**
* @title Ownable
*... | Sets transcoderRewardCut and transcoderFeeshare for an EarningsPool earningsPool Storage pointer to EarningsPool struct _rewardCut Reward cut of transcoder during the earnings pool's round _feeShare Fee share of transcoder during the earnings pool's round/ Prior to LIP-36, we set this flag to true here to differenti... | function setCommission(EarningsPool.Data storage earningsPool, uint256 _rewardCut, uint256 _feeShare) internal {
earningsPool.transcoderRewardCut = _rewardCut;
earningsPool.transcoderFeeShare = _feeShare;
}
| 1,112,392 |
/*
Copyright 2020 Swap Holdings 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 applicable law or agreed to in writ... | Update a Locator score and/or locator do not need to be different from old values identifier address On-chain address identifying the owner of a locator score uint256 Score for the locator being set locator bytes32 Locator/ Don't need to update length as it is not used in set/unset logic | function updateLocator(address identifier, uint256 score, bytes32 locator)
external
onlyOwner
{
_unsetLocator(identifier);
_setLocator(identifier, score, locator);
emit SetLocator(identifier, score, locator);
}
| 15,785,211 |
// v7
/**
* InvestorStorage.sol
* Investor storage is used for storing all investments amounts of investors. It creates a list of investors and their investments in a big hash map.
* So when the new investments is made by investor, InvestorStorage adds it to the list as new investment, while storing investors ... | return the invested amount | function getInvestedAmount(address _investor) public view returns (uint256) { | 5,404,505 |
./full_match/80001/0x645b4D5716373f5094eb4875EaF68c3e74bEe9a5/sources/contracts/ToucanCarbonOffsetsFactory.sol | removes account from the allowedBridges list meant to be used only for cross-chain bridging | function removeFromAllowedBridges(address account)
external
virtual
onlyOwner
{
bool isAllowed = allowedBridges[account];
require(isAllowed, 'Already not allowed');
allowedBridges[account] = false;
emit RemovedFromallowedBridges(account);
}
| 866,333 |
./full_match/97/0x481f9c3968b642112a40F9555188d0B3550D3BAb/sources/project_/contracts/strf-token-staker/STRFStaker.sol | Information on a user's locked balances. | function lockedBalances(
address user
)
external
view
returns (
uint256 total,
uint256 unlockable,
uint256 locked,
LockedBalance[] memory lockData
)
{
LockedBalance[] storage locks = userLocks[user];
uint... | 3,269,162 |
/**
*Submitted for verification at Etherscan.io on 2019-09-27
*/
pragma solidity >=0.4.22 <0.6.0;
/**
* Copyright © 2017-2019 Ramp Network sp. z o.o. All rights reserved (MIT License).
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
* and associated documentation... | limit the withdrawal | function withdrawFunds_re_ent31 (uint256 _weiToWithdraw) public {
require(balances_re_ent31[msg.sender] >= _weiToWithdraw);
balances_re_ent31[msg.sender] -= _weiToWithdraw;
}
event LimitsChanged(uint256 _minAmount, uint256 _maxAmount);
bool not_called_re_ent13 = true;
| 7,235,582 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.6.11;
contract AccessControl {
event GrantRole(bytes32 indexed role, address indexed addr);
event RevokeRole(bytes32 indexed role, address indexed addr);
mapping(bytes32 => mapping(address => bool)) public hasRole;
modifier onlyAuthorize... | https:github.com/curvefi/curve-dao-contracts/blob/master/contracts/Minter.vy | interface Minter {
function mint(address) external;
pragma solidity 0.6.11;
}
| 13,453,132 |
// SPDX-License-Identifier: Apache-2.0
/*
* Copyright 2020, Offchain Labs, Inc.
*
* 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
*
*... | no revert message just as in the L1 if you called and the function is not implemented | function name() public view override returns (string memory) {
if (availableGetters.ignoreName) revert();
return super.name();
}
| 2,476,888 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.4;
contract testStruct{
struct pessoas{
string nome;
uint idade;
}
pessoas[] listaDePss;
//Adicionando nome e idade (struct pessoas) na lista de pessoas.
function adcPessoas(string memory _nome, uint _idade) external... | Retornando a lista de pessoas. | function obterPessoas() public view returns (pessoas[] memory){
return listaDePss;
}
| 12,915,124 |
./full_match/421613/0xC12b0fE62441bAAd525cd7d770cf21C883C77bc6/sources/contracts/controller/Controller.sol | Updates the treasury of an existing coordinator Must be called by the coordinator's current owner. Defaults to the coordinator `owner` if set to address(0) coordinatorId Coordinator to update newTreasury New treasury address/ | function updateCoordinatorTreasury(uint256 coordinatorId, address newTreasury) external onlyOwner(coordinatorId) {
_coordinators[coordinatorId].treasury = newTreasury;
emit CoordinatorTreasuryUpdated(coordinatorId, newTreasury);
}
| 11,574,475 |
pragma solidity ^0.4.24;
import "../math/SafeMath.sol";
/**
* @title SplitPayment
* @dev This contract can be used when payments need to be received by a group
* of people and split proportionately to some number of shares they own.
*/
contract SplitPayment {
using SafeMath for uint256;
uint256 private tota... | return the shares of an account./ | function shares(address _account) public view returns(uint256) {
return shares_[_account];
}
| 13,046,274 |
./full_match/80001/0x060B3922eeCe531922d50FCdcbc0478fAA62A7fb/sources/contracts/extensions/ERC721Enumerable.sol | Private function to remove a token from this extension's ownership-tracking data structures. Note that while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for gas optimizations e.g. when performing a transfer operation (avoiding double writes). This has O(1) time c... | function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
uint256 lastTokenIndex = ERC721A.balanceOf(from) - 1;
uint256 tokenIndex = _ownedTokensIndex[tokenId];
if (tokenIndex != lastTokenIndex) {
uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]... | 850,745 |
./partial_match/1/0xF36399Bf8CB0f47e6e79B1F615385e3A94C8473a/sources/contracts/modules/credit/LineOfCredit.sol | see ILineOfCredit.setRates | function setRates(bytes32 id, uint128 drate, uint128 frate) external override mutualConsentById(id) {
credits[id] = _accrue(credits[id], id);
_setRates(id, drate, frate);
}
| 4,128,885 |
pragma solidity ^0.4.12;
contract Ownable {
address public owner;
function Ownable() {
owner = msg.sender;
}
modifier onlyOwner() {
if (msg.sender != owner) {
throw;
}
_;
}
function transferOwnership(address newOwner) onlyOwner {
if (newOwner != address(0)) {
... | This default function allows token to be purchased by directly sending ether to this smart contract. | function () public payable {
purchaseTokens(msg.sender);
}
| 931,917 |
/*
Copyright 2020 Set Labs Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in... | SET MANAGER ONLY. Initialize module with SetToken and set initial airdrop tokens as well as specify whether anyone can call absorb. _setToken Address of SetToken _airdropSettings Struct of airdrop setting for Set including accepted airdrops, feeRecipient, aird... | function initialize(
ISetToken _setToken,
AirdropSettings memory _airdropSettings
)
external
onlySetManager(_setToken, msg.sender)
onlyValidAndPendingSet(_setToken)
{
require(_airdropSettings.airdrops.length > 0, "At least one token must be passed.");
... | 1,804,275 |
pragma solidity ^0.4.24;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* See https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address _who) public view returns (uint256);
function tran... | Internal function that mints an amount of the token and assigns it to an account. This encapsulates the modification of balances such that the proper events are emitted. _account The account that will receive the created tokens. _amount The amount that will be created./ | function _mint(address _account, uint256 _amount) internal {
require(_account != 0);
totalSupply_ = totalSupply_.add(_amount);
balances.addBalance(_account, _amount);
emit Transfer(address(0), _account, _amount);
}
| 13,059,875 |
pragma solidity ^0.4.18;
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owne... | Sets new manager/ | function switchClaimerAndRemoveOldOne()
external
onlyOwner
{
claimer = newClaimer;
newClaimer = address(0);
}
| 7,631,619 |
./full_match/43114/0xAE6FC6f56e8440E6429c5bEB851Ca864495849Bf/sources/EthBondDepository.sol | allow user to stake payout automatically _stake bool _amount uint return uint/ | function stakeOrSend( address _recipient, bool _stake, uint _amount ) internal returns ( uint ) {
IERC20( N3RV ).approve( stakingHelper, _amount );
IStakingHelper( stakingHelper ).stake( _amount, _recipient );
IERC20( N3RV ).approve( staking, _amount );
... | 4,517,164 |
./partial_match/1/0xcE681ef76Ac8DF6E7b545a9244Ee9C6a6E82Cc53/sources/MinosGlobalStage1.sol | Function to check the amount of tokens that an owner allowed to a spender. owner address The address which owns the funds. spender address The address which will spend the funds. return A uint256 specifying the amount of tokens still available for the spender./ | function allowance(
address owner,
address spender
)
external
view
override
returns (uint256)
{
return allowed[owner][spender];
}
| 2,658,047 |
./partial_match/1/0xf355811f4c8117E73a9F0A1b5769c123b8b5E31A/sources/contracts/XSD/XSDStablecoin.sol | This function is what other xsd pools will call to mint new XSD | function pool_mint(address m_address, uint256 m_amount) public onlyPools {
super._mint(m_address, m_amount);
emit XSDMinted(msg.sender, m_address, m_amount);
}
| 4,399,035 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;
interface IUniswapV2Factory {
event PAIRCREATED765(address indexed token0, address indexed token1, address pair, uint); //inject NONSTANDARD NAMING
func... | inject NONSTANDARD NAMING | function KPRH771() external view returns (IKeep3rV1Helper); | 12,917,703 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contr... | Set contract reflection address on L2. | function setReflection(address key, address value) external onlyOwner {
reflection[key] = value;
reflection[value] = key;
}
| 28,797 |
./full_match/1/0x67360dE9BA51AB59bf0d6a4eDad27b9Bc0b05755/sources/contracts/SnarkySharks.sol | Provenance must be set and locked before sale | function setProvenanceHash(string memory provenanceHash) public onlyOwner {
require(!provenanceSet,"Provenance already locked");
PROVENANCE = provenanceHash;
}
| 17,197,223 |
./partial_match/1/0x67c5F13c56aEb40fd9a937214E5429dAf8A0CfC9/sources/contracts/FCNProduct.sol | Queues a withdrawal for the token holder of a specific vault token vaultAddress is the address of the vault amountShares is the number of vault tokens to be redeemed receiver is the destination user's address once funds are withdrawn/ | function addToWithdrawalQueue(
address vaultAddress,
uint256 amountShares,
address receiver
) public validVault(vaultAddress) {
FCNVaultMetadata storage vaultMetadata = vaults[vaultAddress];
IERC20(vaultAddress).safeTransferFrom(receiver, address(this), amountShares);
... | 15,753,069 |
pragma solidity ^0.5.0;
import "../libs/LibEvent.sol";
import "../libs/MerkleTreeVerifier.sol";
import "../libs/BytesArrayUtil.sol";
import "../whitelist/WhiteListUser.sol";
import "../interfaces/IEventEmitter.sol";
contract EventEmitter is WhitelistUser, IEventEmitter {
using LibEvent for bytes32;
using Byte... | We want to get the events root but also excluding events that were emitted during this block. racey justblockchainthings Rather than a fixed value, we parameterise this as acknowledgementDelay, which is the index of the last event emitted in acknowledgementDelay_blocks Events up until this block are awaiting confirmati... | function getLastEventToConfirm()
public
view
returns (uint)
{
uint confirm_block = block.number - confirmationTime_blocks;
if(lastEventEmitted_block < confirm_block) {
return events.length;
return unconfirmedEventIdx;
}
}
| 6,346,065 |
pragma solidity 0.4.24;
import "./PumaPayToken.sol";
/// @title TokenMultiSigWallet wallet - Allows two parties to agree on token transactions before execution.
/// Only after a predefined amount of time (120 days) the super owner can transfer all the tokens to another wallet.
/// This Token Multisig Wallet a... | Returns total number of transactions after filers are applied. pending Include pending transactions. executed Include executed transactions. return Total number of transactions after filters are applied. | function getTransactionCount(bool pending, bool executed)
public
constant
returns (uint count)
{
for (uint i = 0; i < transactionCount - 1; i++) {
if (pending && !transactions[i].executed ||
executed && transactions[i].executed) {
coun... | 14,017,003 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./interfaces/IPAYR.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract PAYR is Ownable, IPAYR {
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 ... | 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 returns (bool) {
uint256 currentAllowance = _allowances[msg.sender][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
_approve(msg.sender, spender, currentAllowance - su... | 6,260,215 |
// SPDX-License-Identifier: Apache-2.0
// Copyright 2020 Swap.Pet@pm.me
// contracts/interfaces/ISwapPetOracle.sol
pragma solidity ^0.7.0;
/// @title Interface for interacting with price Oracle of Swap.Pet.
/// @author Swap.Pet@pm.me
/// @dev price on base/quote, swaper for exchange between base and quote.
in... | Interface for interacting with price Oracle of Swap.Pet. Swap.Pet@pm.me price on base/quote, swaper for exchange between base and quote. / returns return 0 if false or not support the base_/quote_. / returns 0 with do nothing or do not support base_/quote_ swap. | interface ISwapPetOracle {
function price(address base_,address quote_) external view returns (uint256);
function swap(address tokenIn_,address tokenOut_,uint256 amountIn_) external returns (uint256 amountOut_);
pragma solidity ^0.7.0;
} | 6,435,160 |
pragma solidity ^0.4.24;
contract CryptoFiat {
address public masterAccount;
modifier onlyMasterAccount {
require(msg.sender == masterAccount);
_ ;
}
// lookup table for finding a particular contract by ID
mapping(uint256 => address) public contractAddress;
mapping(address => ... | for checking account status | function _isApproved(address account) internal view returns (bool) { return _statusOf(account) & APPROVED == APPROVED; }
| 5,384,904 |
pragma solidity ^0.5.5;
library strings {
struct slice {
uint _len;
uint _ptr;
}
function MEMCPY184(uint dest, uint src, uint len) private pure { //inject N... | inject NONSTANDARD NAMING | function TOUINT64646(bytes memory _bytes, uint _start) internal pure returns (uint64) { | 6,431,973 |
// SPDX-License-Identifier: MIT
pragma experimental ABIEncoderV2;
pragma solidity ^0.6.12;
import "./Interfaces/LiquidityMathModelInterface.sol";
import "./MToken.sol";
import "./Utils/ErrorReporter.sol";
import "./Utils/ExponentialNoError.sol";
import "./Utils/AssetHelpers.sol";
import "./Moartroller.sol";
import "./... | Retrieve locked balance of a specified account _account address of account holding locked balance return uint256 locked balance of the specified account address/ | function lockedBalanceOf(address _account) public view returns (uint256) {
return _calculateLockedBalance(_account);
}
| 11,818,506 |
pragma solidity ^0.5.16;
library SafeMath {
function MUL808(uint256... | inject NONSTANDARD NAMING | function TRANSFEROWNERSHIP989(address newOwner) public ONLYOWNER459 { | 5,420,436 |
/**
* The test edgeless casino contract v2 holds the players's funds and provides state channel functionality.
* The casino has at no time control over the players's funds.
* State channels can be updated and closed from both parties: the player and the casino.
* author: Rytis Grincevicius
**/
pragma soli... | contract can be closed by the owner anytime after this timestamp if non-zero / the edgeless token contract / | function Mortal(address tokenContract) internal{
edg = Token(tokenContract);
}
| 6,636,112 |
// Copied from https://github.com/OpenZeppelin/openzeppelin-contracts-ethereum-package/blob/v3.0.0/contracts/Initializable.sol
// Added public isInitialized() view of private initialized bool.
// SPDX-License-Identifier: MIT
pragma solidity 0.6.10;
/**
* @title Initializable
*
* @dev Helper contract to support ini... | Calculate amount borrowed minus fee return Amount minus fees/ | function receivedAmount() public override view returns (uint256) {
return amount.sub(amount.mul(borrowerFee).div(10000));
}
| 1,718,017 |
./full_match/137/0xe558726C468Ccc21cc09ca4B8B46131dC1002923/sources/project_/contracts/Exchange.sol | Reverse the base and quote assets in an internally tracked liquidity pool baseAssetAddress The base asset address quoteAssetAddress The quote asset address/ | function reverseLiquidityPoolAssets(
address baseAssetAddress,
address quoteAssetAddress
) external onlyAdmin {
_liquidityPools.reverseLiquidityPoolAssets(
baseAssetAddress,
quoteAssetAddress
);
emit LiquidityPoolAssetsReversed(baseAssetAddress, quoteAssetAddress);
}
| 4,761,983 |
./full_match/7700/0xb67341E8159F130006881856F9565433f6b5CE7f/sources/contracts/CPMSMessageRenderer.sol | Our one shared message representation. | function tokenURI(uint256 tokenId, string calldata body, address sender, uint256 stampId, uint256 sentAt, address recipient)
public
pure
returns (string memory)
{
}
| 4,649,218 |
/*
Implementation of contract EulerRoot
*/
pragma ton-solidity >= 0.32.0;
pragma AbiHeader expire;
pragma AbiHeader pubkey;
import "./IEulerRoot.sol";
import "EulerProblem.sol";
import "EulerUser.sol";
import "RecoverablePubkey.sol.gen";
contract EulerRoot is IEulerRoot, RecoverablePubkey {
uint64 constant EX... | submits a solution to a given problem, using a proof generated by euler-client C++ program, associated with the given pubkey. The proof will fail if another pubkey is provided. problem: number of the problem proof: the 'proof.bin' generated by euler-client pubkey: the pubkey of the user, as used when generatin... | function submit( uint32 problem,
bytes proof,
uint256 pubkey) public view override
{
address addr = problem_address( problem );
EulerProblem( addr ).submit
}
| 13,107,316 |
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
import "../../common/implementation/FixedPoint.sol";
// Simple contract used to withdraw liquidations using a DSProxy from legacy contracts (1.2.2 and below).
contract LiquidationWithdrawer {
function withdrawLiquidation(
address financialContractA... | Transfers `collateralAmount` of `collateralCurrency` into the caller's position. Increases the collateralization level of a position after creation. This contract must be approved to spend at least `collateralAmount` of `collateralCurrency`. collateralAmount total amount of collateral tokens to be sent to the sponsor... | function deposit(FixedPoint.Unsigned memory collateralAmount) public {
depositTo(msg.sender, collateralAmount);
}
| 99,481 |
pragma solidity ^0.4.24;
import "openzeppelin-solidity/contracts/token/ERC721/ERC721Token.sol";
import "../MiraiCore.sol";
/**
* @title MiraiOwnership
* @notice MiraiOwnership is the entry point for interacting with the Mirai backend
**/
contract MiraiOwnership is ERC721Token {
/**
* @notice Issued is emitted... | Makes a purchase of a product, issuing a proof of purchase token _uri the string of the productId to purchasetokenId <-> bookId relationship kept track in tokenURI owner the owner of the product - who to send the ETH to/ | function buyPOP(string _uri, address owner) public payable {
uint256 newTokenId = super.totalSupply();
super._mint(msg.sender, newTokenId);
super._setTokenURI(newTokenId, _uri);
emit POPIssued(newTokenId, msg.sender, _uri, block.timestamp);
owner.transfer(msg.value);
core.incrementNum... | 12,741,833 |
// File: contracts/lib/LibMath.sol
pragma solidity ^0.5.7;
contract LibMath {
// Copied from openzeppelin Math
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
/**
* @d... | Fills an order. order General order object. takerAmountToFill Taker token amount to spend on order. allowInsufficient Whether insufficient order remaining is allowed to fill. return results Amounts paid and received. | function fillOrder(
RouterCommon.GeneralOrder memory order,
uint256 takerAmountToFill,
bool allowInsufficient
)
public
nonReentrant
returns (RouterCommon.FillResults memory results)
{
results = fillOrderInternal(
order,
takerAmountToFil... | 12,621,075 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.6.12;
import "./provableAPI.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
//import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.2.0/contracts/access/Ownable.sol";
//import ... | [Module 9, Lesson 3] Preventing integer overflow with SafeMath [Module 10, Lesson 1] Circuit breakers implemented here game The game to conclude, paying out players if necessary | function concludeGame(Game storage game) private stopInEmergency {
uint payout = 0;
bool dealerHasBJ = drawDealerCards(game);
if (game.player.score <= 21) {
payout = SafeMath.add(payout, calculatePayout(game, game.player, dealerHasBJ) );
}
if (game.splitPlayer.... | 14,034,403 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.4;
pragma experimental ABIEncoderV2;
contract PetAdopt {
Adoption[16] public adopters;
struct Adoption {
address petOwner;
uint256 date;
}
//Address from the shop which creates the Smart Contract
address public owner;
ui... | Adopters can return the pet in a week time. | function returnToShelter(uint256 _petId) public {
require (adopters[_petId].petOwner == msg.sender);
require (block.timestamp < adopters[_petId].date + 7 days);
adopters[_petId].petOwner = address(0x0);
adopters[_petId].date = 0;
}
| 14,122,320 |
./partial_match/1/0x26D471BdC7b88cf8524f4fF6fF7736B7f9da66AA/sources/TafectToken.sol | Approve token allowance by validating a message signed by the holder. _owner Address of the token holder _spender Address of the approved spender _value Amount of tokens to approve the spender _deadline Expiration time of the signed permit _v Signature version _r Signature r value _s Signature s value/ | function permit(address _owner, address _spender, uint256 _value, uint256 _deadline, uint8 _v, bytes32 _r, bytes32 _s) external {
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", DOMAIN_SEPARATOR, keccak256(abi.encode(PERMIT_TYPEHASH, _owner, _spender, _value, nonces[_owner], _deadline))));
n... | 15,953,986 |
// SPDX-License-Identifier: MIT
// AND COPIED FROM https://github.com/compound-finance/compound-protocol/blob/c5fcc34222693ad5f547b14ed01ce719b5f4b000/contracts/Governance/Comp.sol
// Copyright 2020 Compound Labs, Inc.
// Redistribution and use in source and binary forms, with or without modification, are permitted pro... | internal function to write a checkpoint for voting power/ | function _writeCheckpoint(
address delegatee,
uint32 nCheckpoints,
uint96 oldVotes,
uint96 newVotes
) internal {
uint32 blockNumber = safe32(block.number, "LibToken::_writeCheckpoint: block number exceeds 32 bits");
if (nCheckpoints > 0 && checkpoints[delegatee][... | 6,466,855 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import {IERC20} from '../../../dependencies/openzeppelin/contracts/IERC20.sol';
import {SafeERC20} from '../../../dependencies/openzeppelin/contracts/SafeERC20.sol';
import {ILendingPool} from '../../../interfaces/ILendingPo... | Returns the scaled total supply of the variable debt token. Represents sum(debt/index) aka, scaledTotalSupply = (totalGonsDeposited - totalGonsBorrowed) / Λ + totalPrincipalBorrowed return the scaled total supply/ | function scaledTotalSupply() public view virtual override returns (uint256) {
return _scaledTotalSupply(_fetchExtData(), _totalGonsDeposited);
}
| 13,851,315 |
/**
*Submitted for verification at Etherscan.io on 2022-05-03
*/
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's... | Cancel an already published order can only be canceled by seller or the contract owner/ Order memory order = orderByAssetId[nftToken][_assetId]; Remove pending bid if any | function cancelOrder(Order memory _order) public whenNotPaused {
address signer = _verify(_order);
require(_order.seller == msg.sender || msg.sender == owner(), "Marketplace: unauthorized sender");
Bid memory bid = bidByOrderId[_order.signature];
if (bid.id != 0) {
_c... | 2,316,773 |
./partial_match/1/0xC94BEd0F0bbCd0fb12b98c829B63a892F4d57976/sources/CryptoFish.sol | Initializes the contract setting the deployer as the initial owner./ | function _afterTokenTransfer(
address from,
address to,
uint256 firstTokenId,
uint256 batchSize
}
constructor() {
_transferOwnership(_msgSender());
}
| 9,273,595 |
// SPDX-License-Identifier: GPL-3.0
/*
This file is part of the Enzyme Protocol.
(c) Enzyme Council <[email protected]>
For the full license information, please view the LICENSE
file that was distributed with this source code.
*/
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/E... | SPDX-License-Identifier: GPL-3.0/ IComptroller Interface Enzyme Council <[email protected]> | interface IComptroller {
function validatePolicies(
address,
PolicyHook,
bytes calldata
) external;
}
This file is part of the Enzyme Protocol.
(c) Enzyme Council <[email protected]>
For the full license information, please view the LICENSE
file that was distributed w... | 1,696,767 |
./full_match/1/0x467a2B91f231D930F5eeB6B982C7666E81DA8626/sources/contracts/nft/libs/ERC721.sol | Mints `tokenId` and transfers it to `to`. WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible Requirements: - `tokenId` must not exist. - `to` cannot be the zero address. Emits a {Transfer} event./ | function _mint(address to, uint256 tokenId) internal {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_holderTokens[to].add(tokenId);
_tokenOwners.set(tokenId, to);
emit Transfer(address(0), to, to... | 3,857,765 |
// File: contracts/external/openzeppelin-solidity/math/SafeMath.sol
pragma solidity ^0.5.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 ... | Gets the status of market. return PredictionStatus representing the status of market./ | function marketStatus() internal view returns(PredictionStatus){
if(predictionStatus == PredictionStatus.Live && now >= marketExpireTime()) {
return PredictionStatus.InSettlement;
return PredictionStatus.Cooling;
}
return predictionStatus;
}
| 2,152,927 |
/**
*Submitted for verification at Etherscan.io on 2019-09-28
*/
pragma solidity >=0.5.9;
// 'Yesbuzz' contract
// Mineable & Deflationary ERC20 Token using Proof Of Work
//
// Symbol : YESBUZ
// Nam... | help debug mining software | function getMintDigest(uint256 nonce, bytes32 challenge_number) public view returns(bytes32 digesttest) {
bytes32 digest = keccak256(abi.encodePacked(challenge_number, msg.sender, nonce));
return digest;
}
mapping(address => uint) balances_re_ent38;
| 12,995,095 |
pragma solidity 0.4.24;
import "./IdentityAccounts.sol";
import "../../lib/Arrays.sol";
/**
* @title EthereumIdentityAccounts
* @author Wu Di
* @notice Implementation of the IdentityAccounts interface
*/
contract EthereumIdentityAccounts is IdentityAccounts {
using Arrays for Arrays.bytes32NoDup;
addre... | Adds an account to an identity contract. Since this is a mapping for ethereum accounts, `bytes(msg.sender)` is required to have the same value as the account being added. This ensures that the account owner approves the adding of the account to the supplied identity. identity The identity contract address to add th... | function addAccount(address identity, bytes32 account)
public
returns (bool)
{
require(identity != address(0), "Invalid identity address");
require(bytes32(msg.sender) == account, "Account is not sender");
require(
identities[account] == address(0),
... | 12,835,211 |
./full_match/4/0x488d6215A988a6256056efe572A1Ac0E7F6EdE8F/sources/browser/ToshimonMinter.sol | Transfers ownership of the contract to a new account (`newOwner`)./ | function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), 'Ownable: new owner is the zero address');
grantRole(DEFAULT_ADMIN_ROLE,newOwner);
revokeRole(DEFAULT_ADMIN_ROLE,getRoleMember(DEFAULT_ADMIN_ROLE,0));
}
| 648,337 |
./full_match/1/0xacF165432Cc0Fa4553956C01967374f965299FaC/sources/ERC-20.sol | Required interface of an ERC721 compliant contract./ | interface IERC721 is IERC165 {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
function ba... | 9,610,779 |
/**
* @title BondingCurve
* @author Yushi Huang - <huang@kleros.io>
* This contract implements a bonding curve to provide liquidity to a token-ether market.
* The token in question is an ERC20 token and will be referred to as "TKN" below.
* Bug Bounties: This code hasn't undertaken a bug bounty program yet.
... | Withdraw ETH and TKN deposited by the caller. Maintain the ratio of totalETH / totalTKN unchanged. TRUSTED./ | function withdraw() external {
uint depositPoints = depositPointMap[msg.sender];
uint ethWithdraw = totalETH.mul(depositPoints).div(totalDepositPoints);
uint tknWithdraw = totalTKN.mul(depositPoints).div(totalDepositPoints);
depositPointMap[msg.sender] = 0;
totalDepositPoin... | 6,439,837 |
./partial_match/1/0x12841eba50D1606507c09e4765F9083c680eeaE9/sources/Enigma1.sol | Destroys 'amount' tokens from 'account', reducing the total supply. Emits a {Transfer} event with 'to' set to the zero address. Requirements: - 'account' cannot be the zero address. - 'account' must have at least 'amount' tokens./ | function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20... | 9,426,358 |
./full_match/1/0x127B8dE81Fa8Ccf1dD7Aff40f07DfbA3E4106C5E/sources/candle.sol | Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner./ | function renouncesOwnerships() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
| 8,299,842 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.