file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
// File: @openzeppelin/contracts/math/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.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... | computes "scale a / (a + b)" and "scale b / (a + b)"./ | function normalizedRatio(
uint256 _a,
uint256 _b,
uint256 _scale
) internal pure returns (uint256, uint256) {
if (_a <= _b) {
return accurateRatio(_a, _b, _scale);
}
(uint256 y, uint256 x) = accurateRatio(_b, _a, _scale);
return (x, y);
}
| 1,735,906 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
import "hardhat/console.sol";
import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
/// @title A simulator for Berghain club entrance system
/// @author Bianca Buzea
/// @notice Uses Chainlink VR... | Callback function used by VRF Coordinator to get a random number between 0-1/ | function fulfillRandomness(bytes32 requestId, uint256 randomness) internal override{
uint256 randomResult = (randomness % 2);
if (randomResult == 1) {
totalPeopleIn += 1;
console.log("%s has got in!", reqIdToAddrMapping[requestId]);
hasJoined[reqIdToAddrMapping[r... | 12,549,012 |
/**
*Submitted for verification at Etherscan.io on 2020-03-19
*/
pragma solidity ^0.6.4;
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint... | 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
)
override
public
view
returns (uint256)
{
return _allowed[owner][spender];
}
| 12,700,531 |
pragma solidity ^0.4.15;
import "./BlockRPGlib.sol";
/**
Standard Ownable contract
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the... | Returns the currently spawned mobs/ | function mobList() constant returns(Mob[]) {
return mobs;
}
| 12,955,414 |
// SPDX-License-Identifier: MIT
// @title Main contract for the Lenia collection
/**********************************************
* . *
* ,, *
* ......*#* *
* ....... ..*%%, ... | Get the velocity/ | function getVelocity(uint16 index)
private
pure
returns (string memory)
{
string[5] memory velocitys = [
"Immovable", "Unrushed", "Swift", "Turbo", "Flash"
];
return velocitys[index];
}
| 10,264,507 |
pragma solidity 0.5.17;
import "./TreasuryBase.sol";
/**
* @author Quant Network
* @title This contract holds a specific treasury's information
*/
contract Treasury is TreasuryBase {
// The addresses variables in the speed bump
bytes constant private speedBumpAddresses1 = '1.speedBump.addresses';
... | Updates the treasury's QNT address, operator and circuitBreaker, as detailed in speedBump[2] param: speedBump[2].addresses[0] - the treasury's new QNT Address param: speedBump[2].addresses[1] - the treasury's new operator address param: speedBump[2].circuitBreaker - if this treasury circuitBreaker has been activated pa... | function updateTreasuryMainVariables() external onlyOperator() {
uint8 sb = 2;
uint256 sBTimeCreated = speedBumpTimeCreated(sb);
require(sBTimeCreated > 0, "Time created must be >0 (to stop replays of the speed bump)");
require(now > sBTimeCreated + (speedBumpCurr... | 12,557,718 |
./full_match/3/0x57763B44f9fD2B5Dc5a7e131721b8569630F3A95/sources/browser/TokenERC721.sol | Mints more tokens, can only be called by contract creator and all newly minted tokens will belong to creator. This function is optional, it isn't required by the ERC721 spec, and is not needed if the initial supply of NFTs is all that is needed. Throws if msg.sender isn't creator, or if added tokens overflows maxId (... | function issueTokens(uint256 _extraTokens) public{
require(msg.sender == creator);
balances[msg.sender] = balances[msg.sender].add(_extraTokens);
for(uint i = maxId.add(1); i <= maxId.add(_extraTokens); i++){
emit Transfer(address(0x0), creator, i);
}
}
| 8,266,088 |
./partial_match/1/0x4B44e4305B42405382b7BeC717F64D0552a9D9Fe/sources/InboxValidatorManager.sol | Marks a message as processed and calls handle on the recipient Internal function that can be called by contracts like TestInbox _message Formatted message (refer to Mailbox.sol Message library) _messageHash keccak256 hash of the message/ ensure message was meant for this domain update message status as processed | function _process(bytes calldata _message, bytes32 _messageHash) internal {
(
uint32 origin,
bytes32 sender,
uint32 destination,
bytes32 recipient,
bytes calldata body
) = _message.destructure();
require(destination == localDomain,... | 15,460,208 |
/**
*Submitted for verification at Etherscan.io on 2021-08-02
*/
// Sources flattened with hardhat v2.4.1 https://hardhat.org
// File deps/@openzeppelin/contracts-upgradeable/proxy/Initializable.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.24 <0.7.0;
/**
* @dev This is a base contract to aid in wri... | Burn tokens from governance | function burn(uint256 amount) external onlyOwner {
require(minime.destroyTokens(owner(), amount), "burn failed");
}
| 10,859,193 |
./partial_match/1/0xEceec31C940e49C7557C530305DA1Ac3C3556569/sources/ZUSDImplementation.sol | Allows the current owner or proposed owner to cancel transferring control of the contract to a proposedOwner/ | function disregardProposeOwner() external {
require(
msg.sender == proposedOwner || msg.sender == owner,
"only proposedOwner or owner"
);
require(
proposedOwner != address(0),
"can only disregard a proposed owner that was previously set"
... | 2,809,957 |
./full_match/137/0x602f47c53fbd3D6F6783F26E01623cCfd53268D0/sources/main-contract/main-contract/XUSDPrime.sol | Function for the public to call the results of the latest security audit | function getLatestSecurityAudit() public view returns (bool auditStatus, uint256 blockNum, uint256 time) {
auditStatus = latestSecurityAudit.status;
blockNum = latestSecurityAudit.blockNumber;
time = latestSecurityAudit.timestamp;
return (auditStatus, blockNum, time);
}
| 4,787,695 |
pragma solidity ^0.5.0;
/**
* @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 optimiz... | Get spendable balance of a tokenholder./ | function _spendableBalanceOf(address token, address account) internal view returns (uint256) {
return IERC20(token).balanceOf(account) - _heldBalance[token][account];
}
| 1,722,096 |
./full_match/11155111/0x298F37fFd4B31d216B8954968cEe7EC5273CB891/sources/src/Streams.sol | Applies the effects of the change of the streams on the receivers' streams state. states The streams states for the used ERC-20 token. currReceivers The list of the streams receivers set in the last streams update of the account. If this is the first update, pass an empty array. lastUpdate the last time the sender u... | function _updateReceiverStates(
mapping(uint256 accountId => StreamsState) storage states,
StreamReceiver[] memory currReceivers,
uint32 lastUpdate,
uint32 currMaxEnd,
StreamReceiver[] memory newReceivers,
uint32 newMaxEnd
) private {
uint256 currIdx = 0;
... | 3,819,504 |
// Sources flattened with hardhat v2.4.3 https://hardhat.org
// File @openzeppelin/contracts/utils/introspection/IERC165.sol@v4.2.0
// 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].
*
* Implemente... | This is to support Native meta transactions never use msg.sender directly, use _msgSender() instead | function _msgSender()
internal
override
view
returns (address)
{
return ContextMixin.msgSender();
}
| 1,707,525 |
pragma solidity ^0.4.23;
/*
* NamiMultiSigWallet smart contract-------------------------------
*/
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
contract NamiMultiSigWallet {
uint constant public MAX_OWNER_COUNT = 50;
event Confirmation(address indexed ... | Available at any phase. | function withdrawEther(uint _amount) public
onlyEscrow
{
require(namiMultiSigWallet != 0x0);
if (address(this).balance > 0) {
namiMultiSigWallet.transfer(_amount);
}
}
| 2,024,839 |
pragma solidity ^0.4.23;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256)... | / Generate and destroy tokens/ Generates `_amount` tokens that are assigned to `_owner` _owner The address that will be assigned the new tokens _amount The quantity of tokens generated return True if the tokens are generated correctly | function generateTokens(address _owner, uint _amount
) public onlyControllerorOwner whenNotPaused returns (bool) {
uint curTotalSupply = totalSupply();
uint previousBalanceTo = balanceOf(_owner);
updateValueAtNow(totalSupplyHistory, curTotalSuppl... | 170,828 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.2 <0.8.0;
pragma experimental ABIEncoderV2;
import "./utils/Address.sol";
import "./utils/SafeMath.sol";
import "./access/Ownable.sol";
import "./interfaces/IERC20.sol";
contract HagoromoV1 is Ownable {
using Address for address;
using SafeMath for uint;... | funding interface Transfer funds ERC20 tokens from the funding rights to the proposal Assure that the proposal has not ended and sender has enough funding rights _propNonce Integer of the target proposal that has been ended _funding Integer of the funding that the sender wants to transfer/ Revert the call if the ra... | function fundRaising(uint _propNonce, uint _funding) external returns (bool) {
proposal storage p = _propMap[_propNonce];
require(p.status != true, "funding has reached the goal already");
require(!isExpired(p.endDate), "fundraising has ended already");
require(p.beneficiary != ms... | 12,651,052 |
pragma solidity ^0.4.24;
/**
* This utility library was forked from https://github.com/o0ragman0o/LibCLL
*/
library LinkedListLib {
uint256 constant NULL = 0;
uint256 constant HEAD = 0;
bool constant PREV = false;
bool constant NEXT = true;
struct LinkedList {
mapping (uint256 => mappin... | Generate room night token _vendorId The vendor id _rpid The rate plan id _date The date desc (20180723) _token The token id _price The token price _ipfs The rate plan IPFS address/ Give the token to `_customer` | function generateRoomNightToken(uint256 _vendorId, uint256 _rpid, uint256 _date, uint256 _token, uint256 _price, bytes32 _ipfs)
public
onlyOwnerOrAuthorizedContract
returns(uint256) {
roomnights.push(RoomNight(_vendorId, _rpid, _token, _price, now, _date, _ipfs));
uint256 ... | 1,978,848 |
./full_match/80001/0xE01e011CE6365792318179Ffc8DA0d01463Ca59A/sources/project_/contracts/src/property/Property.sol | Returns the name of the token. return The name of the token./ | function name() public view override returns (string memory) {
return __name;
}
| 9,502,630 |
pragma solidity 0.5.17;
import "./XIERC20.sol";
import "./XSafeERC20.sol";
import "./XSafeMath.sol";
import "./ReentrancyGuard.sol";
import "./XERC20.sol";
import "./ERC20Detailed.sol";
interface IXStream {
function createStream(
address token,
address recipient,
uint256 depositAmo... | Update the given lpToken's lpFactor in the given pool. Can only be called by the owner. `_lpFactor` is 0, means the LpToken is soft deleted from pool. | function setLpFactor(
uint256 _pid,
IERC20 _lpToken,
uint256 _lpFactor,
bool _withUpdate
) public onlyCore poolExists(_pid) {
if (_withUpdate) {
massUpdatePools();
}
PoolInfo storage pool = poolInfo[_pid];
.poolFactor
.... | 13,029,814 |
pragma solidity ^0.4.0;
contract ItemTracking {
struct Item {
uint id;
address owner;
uint[] components;
bool exists;
bool created;
}
mapping(uint => Item) items;
modifier itemCreated(uint id) {
if (items[id].created == false) {
thro... | Split a combined item into its components | function split(uint srcId)
itemExists(srcId)
itemOwnedBySender(srcId)
itemIsCombined(srcId) {
items[srcId].exists = false;
for (uint i = 0; i < items[srcId].components.length; i++) {
uint componentId = items[srcId].components[i];
items[componentId].exists = true;
... | 7,320,413 |
pragma solidity 0.6.12;
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import '@openzeppelin/contracts/math/SafeMath.sol';
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import "./II... | It allows users to harvest from pool _pid: pool id/ Checks whether it is too early to harvest Checks whether pool id is valid Checks whether the user has participated Checks whether the user has already harvested Updates the harvest status Initialize the variables for offering, refunding user amounts, and tax amount I... | function harvestPool(uint8 _pid) external override nonReentrant notContract {
require(block.number > endBlock, "Too early to harvest");
require(_pid < numberPools, "Non valid pool id");
require(_userInfo[msg.sender][_pid].amountPool > 0, "Did not participate");
require(!_userInfo[... | 6,474,907 |
pragma solidity ^0.6.4;
pragma experimental ABIEncoderV2;
import "../curation/ICuration.sol";
import "../epochs/IEpochManager.sol";
import "../governance/Governed.sol";
import "../token/IGraphToken.sol";
import "../upgrades/GraphProxy.sol";
import "../upgrades/GraphUpgradeable.sol";
import "./IStaking.sol";
import ".... | Set the period in epochs that need to pass before fees in rebate pool can be claimed. _channelDisputeEpochs Period in epochs/ | function setChannelDisputeEpochs(uint32 _channelDisputeEpochs) external override onlyGovernor {
channelDisputeEpochs = _channelDisputeEpochs;
emit ParameterUpdated("channelDisputeEpochs");
}
| 5,377,291 |
/**
*Submitted for verification at Etherscan.io on 2021-03-02
*/
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/utils/Context.sol
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While t... | Destroys `amount` tokens from the caller. NOTE: restricting access to owner only. See {ERC20-_burn}./ | function _burn(address account, uint256 amount) internal override onlyOwner {
super._burn(account, amount);
}
| 10,616,384 |
./full_match/420/0x429D24232DBeF44c39e1D67C2E870a9EAf730ABa/sources/src/contracts/external/Coin.sol | Burn coins from an address usr The address that will have its coins burned amount The amount of coins to burn/ | function burn(address usr, uint256 amount) external {
require(balanceOf[usr] >= amount, "Coin/insufficient-balance");
if (
usr != msg.sender && allowance[usr][msg.sender] != type(uint128).max
) {
require(
allowance[usr][msg.sender] >= amount,
... | 13,226,199 |
pragma solidity ^0.4.18; // solhint-disable-line
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) inte... | PRIVATE / If we have a referrer, no referrer is set yet, and address is not referring itself | function _setReferrer(address sender, address ref) private {
if (_addressNotNull(ref) && !_addressNotNull(referrers[sender]) && sender != ref) {
referrers[sender] = ref;
}
}
| 2,021,840 |
./full_match/11155111/0x5AF04cE1D7590070A7304D6691B708D81449fEe9/sources/src/contracts/Neo.sol | Internal Transfer / Zero Address Check Amounts Check Track old price and sender volume Update Sender balance and volume Does Fee apply Transfer Fee Update actual transfer amount caculate devFee and liquidityFee Make sure price is updated since totalSupply changed Here were simply reusing the fee variable | function _transferFrom(
address sender,
address recipient,
uint256 amount
) internal returns (bool) {
require(
sender != address(0) && recipient != address(0),
"Tx to/from Zero"
);
require(
amount > 0 && _balances[sender] >= amo... | 3,789,557 |
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// OpenZeppelin Contracts v4.4.0 (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 tota... | rainCheck=========================================require(to != address(0), "RainCheck: transfer to the zero address");checkFeetransfer | function rainCheckStakeEth(address to, uint256 limitTime, uint256 fee, string memory memo) public payable whenNotPaused {
uint256 total = msg.value;
require(total > fee, "RainCheck: amount must be greater than 0");
uint256 amount = total - fee;
uint256 tempFee = amount/500;
... | 12,090,894 |
./partial_match/42/0x31dd4B1Abea38252D12F2E4aBD7C80914f875E84/sources/ExampleContract.sol | require(msg.sender != provable_cbAddress(), "Failed"); | function __callback(bytes32 myid, string result) {
ETHUSD = parseInt(result, 2);
emit LogPriceUpdated(result);
}
| 9,070,142 |
./partial_match/8453/0x3AD45858a983D193D98BD4e6C14852a4cADcDBeA/sources/contracts/metadata/EditionsMetadataRenderer.sol | Maps collection to list of edition infos for each edition on collection, edition-indexed/ Emitted when edition's metadata is initialized contractAddress Collection address of edition editionId Edition id data Edition metadata/ Emitted when edition's name is updated contractAddress Collection address of edition e... | function initialize(address _owner) external initializer nonReentrant {
__Ownable_init();
__ReentrancyGuard_init();
_transferOwnership(_owner);
}
| 16,695,990 |
/*
https://powerpool.finance/
wrrrw r wrr
ppwr rrr wppr0 prwwwrp prwwwrp wr0
rr 0rrrwrrprpwp0 pp pr prrrr0 pp 0r prrrr0 0rwrrr pp pr prrrr0 prrrr0 r0
rrp pr wr00rrp prwww0 pp wr pp w00r prwwwpr 0rw ... | The owner sets the new slashing percent values slasherSlashingRewardPct_ The slasher share will be accrued on the slasher's deposit protocolSlashingRewardPct_ The protocol share will immediately be transferred to reservoir/ | function setSlashingPct(uint256 slasherSlashingRewardPct_, uint256 protocolSlashingRewardPct_)
external
override
onlyOwner
{
require(slasherSlashingRewardPct_.add(protocolSlashingRewardPct_) <= HUNDRED_PCT, "INVALID_SUM");
slasherSlashingRewardPct = slasherSlashingRewardPct_;
protocolSlashi... | 1,169,386 |
pragma solidity >=0.6.0 <0.9.0;
pragma experimental ABIEncoderV2;
//SPDX-License-Identifier: MIT
//import "@openzeppelin/contracts/access/Ownable.sol"; //https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@open... | Grant owner will send money to this contract manually Grant owner need to put a bounty for curators | function makeJudgeable() public onlyOwner {
require(gtc.balanceOf(address(this)) >= bountyAmount);
status = Statuses.TO_BE_JUDGED;
}
| 12,760,615 |
./partial_match/42/0xafA059c7D4d1edf05dc2E16db8A61B1903e71De9/sources/NBCESDPool.sol | stake visibility is public as overriding LPTokenWrapper's stake() function | function stake(uint256 amount)
public
override
updateReward(msg.sender)
checkStart
{
require(amount > 0, 'NBCESDPool: Cannot stake 0');
require(amount <= 20000 * 10**18, 'NBCESDPool: Cannot stake more 20000');
uint256 newDeposit = deposits[msg.sender].ad... | 3,374,622 |
pragma solidity ^0.4.23;
// * dice2.win - fair games that pay Ether.
// * Ethereum smart contract, deployed at 0xD1CEeee3ecFff60d9532C37c9d24f68cA0E96453
// * Uses hybrid commit-reveal + block hash random number generation that is immune
// to tampering by players, house and miners. Apart from being fully transparen... | This function is used to bump up the jackpot fund. Cannot be used to lower it. | function increaseJackpot(uint increaseAmount) external onlyOwner {
require (increaseAmount <= address(this).balance);
require (jackpotSize + lockedInBets + increaseAmount <= address(this).balance);
jackpotSize += uint128(increaseAmount);
}
| 14,556,594 |
pragma solidity >=0.8.4;
import "./ENS.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "../root/Controllable.sol";
// function _claimWithResolver
// 1. reverse nodeκ° records_list μ΄λκ°μ μλ€.
// 1)ν΄λΉ recordμ resolverκ°μ΄ μλ κ²½μ°
// currentResolverκ° ν΄λΉ resolverλ₯Ό λ°μμ΄.
// μ§κΈ μΈμλ‘ λ°μμ¨ re... | Internal functions / addrμ reverse nodeλ₯Ό μ°Ύμ ownerμ resolverλ₯Ό setνλ ν¨μ reverse nodeκ° records_listμ΄λκ°μ resolverμ μ΄λ―Έ μλμ§ μλμ§ νμΈνκ³ μμΌλ©΄ μλ‘μ΄ resolverλ₯Ό κ°±μ ν΄μ recordμ λ³ν©νμ¬ setSubnodeRecordμ€ν. | function _claimWithResolver(
address addr,
address owner,
address resolver
) internal returns (bytes32) {
address currentResolver = ens.resolver(node);
bool shouldUpdateResolver = (resolver != address(0x0) &&
resolver != currentResolver);
address ne... | 1,031,089 |
./full_match/1/0x9c9247A959B3eA52aBB5BCAABFD2A2F9842fd837/sources/contracts/interfaces/EIP3009.sol | EIP-3009: Transfer With Authorization A contract interface that enables transferring of fungible assets via a signed authorization./ | interface EIP3009 {
event AuthorizationUsed(address indexed authorizer, bytes32 indexed nonce);
event AuthorizationCanceled(address indexed authorizer, bytes32 indexed nonce);
function authorizationState(
address authorizer,
bytes32 nonce
) external view returns (bool);
function transferWithAuthorization(
... | 16,483,431 |
pragma solidity ^0.5.0;
//import "@openzeppelin/upgrades/contracts/Initializable.sol";
import "./Ownable.sol";
import "./ExternalStorage.sol";
import "./LandRegistry.sol";
/**
* @dev Contract module which provides a basic storage system.
*
* This module is used through inheritance. It will make available the contr... | adding administrators | function addSuperAdmin(
address _superAdmin,
string memory _registrar
) public onlyOwner {
superAdmin[_registrar] = _superAdmin;
}
| 15,864,599 |
pragma solidity ^0.5.7;
interface RegistryInterface {
function proxies(address) external view returns (address);
}
interface UserWalletInterface {
function owner() external view returns (address);
}
interface ERC20Interface {
function allowance(address, address) external view returns (uint);
function... | user's address => CToken Address => CToken Amount Deposited/ Deposit CToken for liquidity/ | function depositCTkn(address ctknAddr, uint amt) public {
require(CTokenInterface(ctknAddr).transferFrom(msg.sender, address(this), amt), "Nothing to deposit");
deposits[msg.sender][ctknAddr] += amt;
emit LogDepositCToken(msg.sender, ctknAddr, amt);
}
| 14,104,701 |
/*
Copyright 2019 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... | Asserts that vault is not in catastrophic failure mode. | function _assertNotInCatastrophicFailure()
private
view
{
if (isInCatastrophicFailure) {
revert();
}
}
| 12,751,006 |
./full_match/1/0x668434279A7380E4Da683897BB02D8a77B6caE0A/sources/Users/shengdading/git/acSaving/contracts/strategies/curve/StrategyCurveBase.sol | Deposits the want token into Curve in exchange for lp token. _want Amount of want token to deposit. _minAmount Minimum LP token to receive./ | function _depositToCurve(uint256 _want, uint256 _minAmount) internal virtual {}
| 8,386,729 |
./full_match/80001/0x0ac3e8c7641214FD3A9538C07fdFD7D3AEE4cF64/sources/contracts/mynft.sol | Enables or disables an operator to manage all of msg.senders assets. | function setApprovalForAll(address operator, bool approved) public {
_operatorApprovals[msg.sender][operator] = approved;
emit ApprovalForAll(msg.sender, operator, approved);
}
| 9,519,770 |
./partial_match/1/0xB52Edb5Cf2d88E78191F21B027F53D07F4AB7e5d/sources/DogPadStake.sol | View function to see pending Reward on frontend. | function pendingReward(address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[0];
UserInfo storage user = userInfo[_user];
if(pool.lastRewardTimestamp == 99999999999){
return 0;
}
uint256 accTokensPerShare = pool.accTokensPerShare;
... | 4,155,030 |
./partial_match/1/0xF6aA48431C6B2392a20155651Cf255D1798fFAd9/sources/VRFv2Consumer.sol | Assumes the subscription is funded sufficiently. Will revert if subscription is not set and funded. | function requestRandomWords(
uint32 numWords,
string memory campaignId,
string memory rewardItemId
) external onlyOwner returns (uint256 requestId) {
requestId = COORDINATOR.requestRandomWords(
keyHash,
s_subscriptionId,
requestConfirmations,
... | 9,243,219 |
pragma solidity ^0.4.16;
// ----------------------------------------------------------------------------
//
// IDH indaHash token public sale contract
//
// For details, please visit: https://indahash.com/ico
//
// ----------------------------------------------------------------------------
// -----------... | balance checks update balances and allowed amount log event | function transferFrom(address _from, address _to, uint _amount) returns (bool success) {
require( balances[_from] >= _amount );
require( allowed[_from][msg.sender] >= _amount );
balances[_from] = balances[_from].sub(_amount);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amo... | 12,943,015 |
// SPDX-License-Identifier: GPL-3.0
// File: @openzeppelin/contracts/utils/Strings.sol
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
... | to see if a person has minted a NFT | function isMinter() public view returns(bool) {
if (mintsPerAddress[msg.sender] != 0) {
return true;
}
else {
return false;
}
}
| 275,223 |
pragma solidity ^0.5.6;
import "openzeppelin-solidity/contracts/token/ERC721/IERC721.sol";
import "../interfaces/ILinkdropERC721.sol";
import "./LinkdropCommon.sol";
contract LinkdropERC721 is ILinkdropERC721, LinkdropCommon {
/**
* @dev Function to verify linkdrop signer's signature
* @param _weiAmount ... | Function to claim ETH and/or ERC721 token. Can only be called when contract is not paused _weiAmount Amount of wei to be claimed _nftAddress NFT address _tokenId Token id to be claimed _expiration Unix timestamp of link expiration time _linkId Address corresponding to link key _linkdropSignerSignature ECDSA signa... | function claimERC721
(
uint _weiAmount,
address _nftAddress,
uint _tokenId,
uint _expiration,
address _linkId,
bytes calldata _linkdropSignerSignature,
address payable _receiver,
bytes calldata _receiverSignature
)
external
whenNotPause... | 12,672,048 |
pragma solidity 0.4.24;
import "../interfaces/TokenInterface.sol";
import "../interfaces/ERC20.sol";
import "./AdminInteractor.sol";
/**
* @title For tokenization operations such as minting and burning of tokens.
*
* @notice Operations flow: Request -> Approval by first admin -> Finalize by second admin
*/
contra... | Approve mint, fires off a MintOperationApproved event. Can only be approved by Admin 1. _requestor Requestor of MintRequestOperation. _index Index of MintRequestOperation by _requestor./ | function approveMint(
address _requestor,
uint256 _index
)
public
onlyAdmin1
operationsNotPaused
whitelistedForMint(_requestor)
notBlacklistedForRequest(_requestor)
{
MintRequestOperation storage mintRequestOperation = mintRequestOperations[_re... | 13,140,334 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.6 <0.8.0;
import {ERC1155InventoryIdentifiersLib} from "./ERC1155InventoryIdentifiersLib.sol";
import {IERC165} from "@animoca/ethereum-contracts-core/contracts/introspection/IERC165.sol";
import {IERC1155} from "./interfaces/IERC1155.sol";
import {IERC1155Invento... | @inheritdoc IERC1155InventoryTotalSupply | function totalSupply(uint256 id) external view virtual override returns (uint256) {
if (id.isNonFungibleToken(_collectionMaskLength)) {
return address(uint160(_owners[id])) == address(0) ? 0 : 1;
return _supplies[id];
}
}
| 12,939,429 |
./partial_match/42/0x45acf832db0002CcE90411321dbD9059BDE2C412/sources/compoundFarmer.sol | Total deposit: 35% initial amount, 65% flash loan loan is 65% of total deposit Use flash loan to payback borrowed amount Handle repayment inside handleWithdraw() function Claim COMP tokens Withdraw COMP tokens Calculate how much WETH we got left after repaying the loan unwrap it reset accInvest Send it to investor | function withdrawEth() external returns (bool){
address payable investor = msg.sender;
updateUserBalance(investor);
UserInfo storage user = userInfo[investor];
uint256 totalAmount = (user.borrowBalance * 100) / 35;
uint256 flashLoanAmount = user.borrowBala... | 3,411,350 |
// 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, s... | Claim for Ghost HoldersCheck if Claims are still active...Check how many Ghost are in the holders balance | function claim(address _wallet, uint256 _mintAmount) public {
require(mintPhase == 1 || mintPhase == 2, "Claiming is no longer open.");
uint256 supply = totalSupply();
require(claimMinted + _mintAmount <= claimSize, "Max supply has been claimed!");
uint256 amountCanMint = holder... | 14,782,017 |
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
interface IUniswap {
// To convert DAI to ETH
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts);
// To convert ETH to YELD and burn it
function s... | To convert DAI to ETH To convert ETH to YELD and burn it | interface IUniswap {
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts);
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) external payable returns (uint[] m... | 187,069 |
./full_match/1/0x3a32BecC41115b4Aa8bD8614301AeBB9bB11258b/sources/@lyrafinance/protocol/contracts/periphery/LyraAdapter.sol | the resultant volatility =`skew` 'baseIv' for a given `strikeId` with GWAV interval `secondsAgo` | function _volGWAV(uint strikeId, uint secondsAgo) internal view returns (uint) {
return gwavOracle.volGWAV(strikeId, secondsAgo);
}
| 9,671,963 |
./full_match/1/0xD4d8a1aC7b54e5af7b8Ffc0BcCB6A4d4DDCcE046/sources/contracts/blindBackrun.sol | Executes an arbitrage transaction between two Uniswap V2 pairs. Pair addresses need to be computed off-chain. Only the contract owner can call this function. Decode the parameters from the params field | function executeOperation(
address asset,
uint256 amount,
uint256 premium,
address initiator,
bytes calldata params
) external override returns (bool) {
require(initiator == address(this), "Unauthorized initiator");
ExecuteOperationData memory data;
(data... | 8,366,141 |
./partial_match/1/0x222AB78c8a06dB5BD109204d96D53801Fde0aa14/sources/Icarus.sol | -------------------------------------------------------------- TRANSACTION CONTROL | function _beforeTokenTransfer(address from, address to, uint256 amount) internal whenNotPaused override {
require(!blacklists[to] && !blacklists[from], "Address Blacklisted");
if (uniswapPool == address(0)) {
require(from == mainWallet || to == mainWallet || to == cexWallet || to == crea... | 3,905,885 |
./full_match/5/0xc8109B44Ac17f45B6A68F5563Aa814aFDfDCB74A/sources/contracts/Hyperi0n_Startup.sol | if every thing is okay. | function createCompaign(
address _owner,
string memory _title,
string memory _description,
uint256 _target,
uint256 _deadline,
string memory _image) public returns (uint256) {
Campaign storage campaign = campaigns[numOfCompaigns];
require(c... | 11,602,607 |
./full_match/4/0x7Bd6062a2056Ba6b9775EfF89fdAa507Ba4B9E14/sources/baal.sol | Baal-only function to change periods. | function setPeriods(bytes memory _periodData) external baalOnly {
(
uint32 min,
uint32 max,
uint32 grace,
bool pauseLoot,
bool pauseShares
) = abi.decode(_periodData, (uint32, uint32, uint32, bool, bool));
if (min != 0) minVotingPer... | 12,297,304 |
./full_match/10/0xC7c29E0bD443AFf2c5AE18e7a54B95487F09A1d8/sources/project:/contracts/UxuyProtocol.sol | changes the fee recipients | function setFeeRecipient(address main, address alt) external onlyAdmin {
_setFeeRecipient(main, alt);
}
| 3,782,542 |
/**
*Submitted for verification at Etherscan.io on 2021-06-01
*/
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens... | Throws if any of `_spender`, `_from` or `_to` is blocklisted./ | function canTransferFrom(
address _spender,
address _from,
address _to
) external view override onlyToken {
require(!_isBlocked(_spender), "blocklisted");
require(!_isBlocked(_from), "blocklisted");
require(!_isBlocked(_to), "blocklisted");
}
| 2,134,868 |
// SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "redstone-evm-connector/lib/contracts/message-based/PriceAware.sol";
// You can find more details about RedStone oracles here: https://tinyurl.com/redstone-celo-docs
/**
* @title Oracle
* @dev Read data from RedStone oracle protocol
*/
contract... | You can check check evm addresses for providers at: https:api.redstone.finance/providers | function isSignerAuthorized(address _receviedSigner)
public
override
virtual
view
returns (bool)
{
}
| 5,460,208 |
./full_match/80001/0xdBAf7190865A37E0E92e1554807CeA075eec3174/sources/contracts/utils/LibString.sol | Packs two strings with their lengths into a single word. Returns `bytes32(0)` if combined length is zero or greater than 30. | {
function packTwo(string memory a, string memory b)
internal
pure
returns (bytes32 result)
assembly {
let aLength := mload(a)
result := mul(
or(
shl(shl(3, sub(0x1f, aLength)), mload(add(a, aLength))),
... | 873,829 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/// @title Referral fee collector interface
interface IReferralFeeReceiver {
function updateReward(address referral, uint256 referralShare) external;
}
| Referral fee collector interface | interface IReferralFeeReceiver {
function updateReward(address referral, uint256 referralShare) external;
}
| 12,892,984 |
./full_match/43113/0x19dc831e7586475d83650Ad11d757eA2058133F7/sources/LdpCommissions.sol | Retrieves the organizations count return count of organizations/ | function getOrganizationCount() public view override returns(uint count) {
return organizationIndex.length;
}
| 13,175,478 |
/**
*Submitted for verification at Etherscan.io on 2021-02-23
*/
// File: contracts/interfaces/interestModelInterface.sol
pragma solidity 0.6.12;
interface interestModelInterface {
function getInterestAmount(address handlerDataStorageAddr, address payable userAddr, bool isView) external view returns (bool, uint256... | Calculates interest amount for a user (before user action) handlerDataStorageAddr The address of handlerDataStorage contract userAddr The address of user return (bool, uint256, uint256, bool, uint256, uint256)/ | function _viewInterestAmount(address handlerDataStorageAddr, address payable userAddr) internal view returns (bool, uint256, uint256, bool, uint256, uint256)
{
marketHandlerDataStorageInterface handlerDataStorage = marketHandlerDataStorageInterface(handlerDataStorageAddr);
uint256 blockDelta = block.number.sub(ha... | 2,263,630 |
pragma solidity ^0.4.20;
// TODO
//
//
// auction??
contract CryptoMe {
struct identity {
address addr;
string name;
string email;
string ipfs;
string[] aliases;
string[] connections;
}
uint basePrice;
address admin;
//mapping(string => a... | thanks tkeber https:ethereum.stackexchange.com/questions/8346/convert-address-to-string | function ascii(address x) pure internal returns (string) {
bytes memory s = new bytes(40);
for (uint i = 0; i < 20; i++) {
byte b = byte(uint8(uint(x) / (2**(8*(19 - i)))));
byte hi = byte(uint8(b) / 16);
byte lo = byte(uint8(b) - 16 * uint8(hi));
s[2*i] = char(hi);
s... | 13,135,216 |
./full_match/80001/0x627403FCca3e49161e03fd30554942284DdCA6F6/sources/contracts/Contract.sol | External interface of AccessControlEnumerable declared to support ERC165 detection./ | interface IPermissionsEnumerable is IPermissions {
function getRoleMember(bytes32 role, uint256 index) external view returns (address);
function getRoleMemberCount(bytes32 role) external view returns (uint256);
}
| 9,474,118 |
// File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/80d8da05644ceef3cd8e81860882571f037f8667/contracts/utils/Context.sol
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the ... | See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. NOTE: Does not update the allowance if the current allowance is the maximum `uint256`. Requirements: - `sender` and `recipient` cannot be the zero address. - ... | function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
uint256 currentAllowance = _allowances[sender][_msgSender()];
if (currentAllowance != type(uint256).max) {
require(currentAllowance >= amount, "... | 321,662 |
./full_match/42/0xB7698b86b3DF067E7F5Bb0076b3B86bd27b1279c/sources/AutoLiquidity.sol | callback function when receiving NFT only Univ3 NFT transfer in is allowed return default value | function onERC721Received(address, address, uint256 tokenId, bytes calldata) external returns (bytes4){
require(
msg.sender == address(UniV3PMExtends.PM),
'UniV3Liquidity::onERC721Received: not a univ3 nft'
);
if (stakers.contains(tokenId)) {
stakers.remov... | 16,247,153 |
./full_match/1001/0xF2AffaFa966780988f7FBdf06B6A807a1687b2c8/sources/_klaytn/contracts/KIP/token/KIP17/IKIP17.sol | Required interface of an ERC721 compliant contract./ | interface IKIP17 is IKIP13 {
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 bala... | 16,364,178 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/ClonesUpgradeable.sol";
import "contracts/... | Getter decription of the state of a token _tokenId the token id return the state of the token/ | function getTokenStateDescriptionRef(uint256 _tokenId)
public
view
returns (string memory)
{
require(_exists(_tokenId), "ERR_TOKEN_ID");
return stateDescription[_tokenId];
}
| 5,972,395 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
/// @notice Interface of the `SmartWalletChecker` contracts of the protocol
interface SmartWalletChecker {
function check(address) external view returns (bool);
}
/// @title SmartWalletWhitelist
/// @author Curve Finance and adapted by Stake DAO Core Team (http... | Interface of the `SmartWalletChecker` contracts of the protocol | interface SmartWalletChecker {
function check(address) external view returns (bool);
}
| 10,513,011 |
./full_match/11155111/0xe302e42153793088cbE5174a574BEcA7db27d213/sources/project_/contracts/MasterChef.sol | Update the given pool's EQUAL allocation point. Can only be called by the owner. | function set(uint256 _pid, uint256 _allocPoint) external onlyOwner {
require(_allocPoint <= MAX_ALLOC_POINT, "add: too many alloc points!!");
massUpdatePools();
totalAllocPoint = totalAllocPoint - poolInfo[_pid].allocPoint + _allocPoint;
poolInfo[_pid].allocPoint = _allocPoint;
... | 3,840,477 |
// SPDX-License-Identifier: GPL-3.0
// File: contracts/interfaces/ILayerZeroUserApplicationConfig.sol
pragma solidity >=0.5.0;
interface ILayerZeroUserApplicationConfig {
// @notice set the configuration of the LayerZero messaging library of the specified version
// @param _version - messaging library versi... | assert there is message to retry clear the stored message execute the message. revert if it fails again | function retryMessage(
uint16 _srcChainId,
bytes memory _srcAddress,
uint64 _nonce,
bytes calldata _payload
) external payable {
FailedMessages storage failedMsg = failedMessages[_srcChainId][
_srcAddress
][_nonce];
require(
failedM... | 97,255 |
pragma solidity ^0.4.8;
import "./Exchange.sol";
import "./tokens/EtherToken.sol";
import "./base/Token.sol";
import "./base/Ownable.sol";
import "./base/SafeMath.sol";
contract SimpleCrowdsale is Ownable, SafeMath {
address public PROXY_ADDRESS;
address public EXCHANGE_ADDRESS;
address public PROTOCOL_T... | Verifies that an order signature is valid. pubKey Public address of signer. hash Signed Keccak-256 hash. v ECDSA signature parameter v. r ECDSA signature parameters r. s ECDSA signature parameters s. return Validity of order signature. | function isValidSignature(
address pubKey,
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s)
constant
returns (bool isValid)
{
return pubKey == ecrecover(
sha3("\x19Ethereum Signed Message:\n32", hash),
v,
r,
... | 5,540,129 |
/**
*Submitted for verification at polygonscan.com on 2021-11-28
*/
/**
*Submitted for verification at polygonscan.com on 2021-10-18
*/
// File: @openzeppelin/contracts/utils/cryptography/ECDSA.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECD... | ------------ UTILS ------------ | function getCreate2Address(bytes32 _salt, bytes32 _code) internal view returns (address) {
return address(uint160(uint256(keccak256(abi.encodePacked(
bytes1(0xff),
address(this),
bytes32(_salt),
bytes32(_code)
)))));
}
| 13,423,113 |
./partial_match/1/0xD320a898DDFb5e4D057acfc0D8c89fb5e4b7698E/sources/BabySanicCoin.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 _beforeTokenTransfer(
address from,
address to,
uint256 amount
function approve(address spender, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_approve(owner, spender, amount);
return true;
}
| 9,150,349 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.7.0 <0.9.0;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Receiver.sol";
import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";
import "@openzeppelin/contracts/token/ERC2... | Convinence function to get the number of shares left to fund for a loan (ie still owned by the contract)/ | function sharesLeft(uint256 loanId) public view returns (uint256) {
return this.balanceOf(address(this), loanId);
}
| 15,883,307 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
/* Library Imports */
import {AddressAliasHelper} from '../../standards/AddressAliasHelper.sol';
import {Lib_OVMCodec} from '../../libraries/codec/Lib_OVMCodec.sol';
import {Lib_AddressResolver} from '../../libraries/resolver/Lib_AddressResolver.sol';
/* Interfa... | Converts a boolean to a bytes32 value. _in Input boolean value. return Boolean as a bytes32./ | function fromBool(bool _in) internal pure returns (bytes32) {
return bytes32(uint256(_in ? 1 : 0));
}
| 1,596,452 |
/**
* @title: Idle BarnBridge wrapper
* @summary: Used for interacting with BarnBridge. Has
* a common interface with all other protocol wrappers.
* This contract holds assets only during a tx, after tx it should be empty
* @author: Idle Labs Inc., idle.finance
*/
pragma solidity 0.5.16;
pragm... | return apr : current yearly net rate/ | function getAPR()
external view
returns (uint256) {
return ICErc20(cErc20).exchangeRateStored();
}
| 12,673,907 |
//Address: 0x3aaa175924a77ee4b40606f714b727331e430ece
//Contract name: MonsterCreatorInterface
//Balance: 0 Ether
//Verification Date: 1/19/2018
//Transacion Count: 3
// CODE STARTS HERE
pragma solidity ^0.4.11;
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original... | Checks if a given address currently has transferApproval for a particular monster. _claimant the address we are confirming monster is approved for. _tokenId monster id, only valid when > 0 | function _approvedFor(address _claimant, uint256 _tokenId) internal view returns (bool) {
return monsterIndexToApproved[_tokenId] == _claimant;
}
| 932,279 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.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,... | Send any deposited ETH back to the vault | function withdrawBalance() external override {
address vaultProxy = getParentVault();
require(
msg.sender == IVault(vaultProxy).getOwner() ||
msg.sender == __getComptrollerForVault(vaultProxy),
"withdrawBalance: Only owner or comptroller is authorized"
... | 355,540 |
./full_match/5/0xAF872e2383C217C0278DC77D9baaa1c859CC567B/sources/contracts/NokkoCollection.sol | New function to send payment to the contract address | function sendPayment() public payable {
require(msg.value > 0, "Invalid amount");
address payable owner = payable(owner());
owner.transfer(msg.value);
Transaction memory newTransaction = Transaction({
sender: msg.sender,
recipient: owner,
amount: ... | 1,860,035 |
pragma solidity ^0.4.18;
contract Theater{
address public organizer;
uint constant rows=3;
uint constant columns=6;
address [6][3] public tickets; //[columns][rows]
mapping (address=>uint[]) public userTickets;
mapping (address=>uint) public userTicketsLength;
uint price=5.99 ether;
uint public totalTic... | delete(userTickets[msg.sender][i]); | function sendTo(address adr, uint row, uint column) public returns (bool){
if (tickets[row][column]!=msg.sender && tickets[row][column]!=adr)
return false;
for (uint i=0; i<userTicketsLength[msg.sender]; i++){
if (userTickets[msg.sender][i]==row*columns+column){
userTi... | 12,995,802 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity =0.7.6;
pragma abicoder v2;
import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol";
import "@uniswap/v3-core/contracts/libraries/TickMath.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@uniswap/v3-periphery/contra... | A function that decreases the current liquidity by half. An example to show how to call the `decreaseLiquidity` function defined in periphery. tokenId The id of the erc721 token return amount0 The amount received back in token0 return amount1 The amount returned back in token1 caller must be the owner of the NFT get l... | function decreaseLiquidityInHalf(uint256 tokenId)
external
returns (uint256 amount0, uint256 amount1)
{
require(msg.sender == deposits[tokenId].owner, "Not the owner");
uint128 liquidity = deposits[tokenId].liquidity;
uint128 halfLiquidity = liquidity / 2;
INonfu... | 12,748,443 |
/**
*Submitted for verification at Etherscan.io on 2022-02-02
*/
/**
ββββββ βββββ ββββββ ββββββββ ββ ββ ββββββββ ββββββ ββ ββ βββββββ βββ ββ
ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ ββββ ββ
ββββββ βββββββ ββββββ ββ ββ ββ ββ ββ ββ βββββ βββ... | Interface of the ERC20 standard as defined in the EIP. Does not include the optional functions; to access them see {ERC20Detailed}./ | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint2... | 15,111,180 |
./full_match/1/0xA441CF75BCFb5833cB1ba7c93A0721ae9B292789/sources/contracts/SafeguardPool.sol | for gas optimization purposes we store (1 - max tolerance) the lower maxPerfDev value is, the less strict the performance check is (more permitted deviation) | function _setMaxPerfDev(uint256 maxPerfDev) internal {
_srequire(maxPerfDev <= FixedPoint.ONE, SwaapV2Errors.MAX_PERFORMANCE_DEV_TOO_LOW);
_srequire(maxPerfDev >= _MAX_PERFORMANCE_DEVIATION, SwaapV2Errors.MAX_PERFORMANCE_DEV_TOO_HIGH);
_packedPoolParams = _packedPoolParams.... | 3,012,382 |
./partial_match/8453/0x19A4f00039Cde3ffbe29b23417FcfB9101Ae174b/sources/NFT.sol | Update the mapping every time a new token is minted | function mint(string memory tokenURI) public payable {
require(msg.value >= cost, "Payment less than cost");
_tokenIds.increment();
uint256 newItemId = _tokenIds.current();
_mint(msg.sender, newItemId);
_setTokenURI(newItemId, tokenURI);
_tokensOfOwner[msg.se... | 16,690,105 |
./full_match/1/0xDf5e9f529679c74Ba86449bA7258c7679E103206/sources/browser/Contract_Code_v2_Base.sol | countBonus AwardData user user storage bonusAmount Bonus Amount _type countBonus type (0 static, 1 share, 2 team, 3 elite, 4 signIn)/ | function countBonus_AwardData(User storage user, uint bonusAmount, uint8 _type)
internal
{
AwardData storage awData = user.rewardData[_type][user.rewardIndex[_type]];
awData.amount += bonusAmount;
}
| 16,392,075 |
./partial_match/56/0xF2A2D4071BC1F69EADb6763b13AFc2E406918bEE/sources/Exchange.sol | Fills the input order. order Order struct containing order specifications. takerAssetFillAmount Desired amount of takerAsset to sell. signature Proof that order has been created by maker. return Amounts filled and fees paid by maker and taker. | function fillOrder(
Order memory order,
uint256 takerAssetFillAmount,
bytes memory signature
)
public
nonReentrant
returns (FillResults memory fillResults)
{
fillResults = fillOrderInternal(
order,
takerAssetFillAmount,
... | 11,280,088 |
/**
* Do you have any questions or suggestions? Emails us @ <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="3e4d4b4e4e514c4a7e5d4c474e4a5c51505a10505b4a">[email protected]</a>
*
* ===================== CRYPTBOND NETWORK =======================*
oooooooo8 oooooooooo ooooo oooo oooooo... | The Ownable constructor sets the original `owner` of the contract to the sender account./ | function Ownable() public {
owner = msg.sender;
}
| 7,693,258 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppel... | The IA uses this function to check if a borrower is allowed to use him. _tokenId The id of the token return borrowDatas An array of {BorrowData} of the {_tokenId}/ | function borrowOf(uint256 _tokenId) external view existToken(_tokenId) returns (BorrowData[] memory) {
uint256 ln = _borrowerArray.length;
if (ln == 0) return new BorrowData[](ln);
uint256 cbsIndex;
uint256 i;
BorrowData[] memory cbs = new BorrowData[](ln);
for (i = 0... | 15,811,862 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.17;
... | inject NONSTANDARD NAMING | function GETNAME315() external pure returns (string memory) { | 12,870,965 |
./partial_match/6119/0x0CBDcecC301f55196950b990dDC5DE948C7CA23D/sources/contracts/temp/Multicall2.sol | Backwards-compatible with Multicall2 Aggregate calls without requiring success requireSuccess If true, require all calls to succeed calls An array of Call structs return returnData An array of Result structs | function tryAggregate(bool requireSuccess, Call[] calldata calls) public payable returns (Result[] memory returnData) {
uint256 length = calls.length;
returnData = new Result[](length);
Call calldata call;
for (uint256 i = 0; i < length;) {
Result memory result = returnDa... | 3,492,616 |
./full_match/1/0x6334Ee29002E350a4f451aeA2C38C4B1537c1CF1/sources/contracts/CryptoDuckz_NFT.sol | Interface of the ERC165 standard, as defined in the Implementers can declare support of contract interfaces, which can then be queried by others ({ERC165Checker}). For an implementation, see {ERC165}./ | interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
CRYPTODUCKZ
pragma solidity ^0.8.0;
}
| 9,604,870 |
./partial_match/288/0xfBd2541e316948B259264c02f370eD088E04c3Db/sources/contracts/LP/interfaces/iL1LiquidityPool.sol | iL1LiquidityPool/ | interface iL1LiquidityPool {
event AddLiquidity(
address sender,
uint256 amount,
address tokenAddress
);
event OwnerRecoverFee(
address sender,
address receiver,
uint256 amount,
address tokenAddress
);
event ClientDepositL1(
address... | 16,905,436 |
pragma solidity 0.6.12;
import "@chainlink/contracts/src/v0.6/ChainlinkClient.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./IMedianOracle.sol";
/**
* @title ChainlinkToOracleBridge requests data from the Chainlink network and feeds it to xBTCs
* Dominance Oracle
* @dev This contract is desi... | Call this method if no response is received within 5 minutes _requestId The ID that was generated for the request to cancel _payment The payment specified for the request to cancel _callbackFunctionId The bytes4 callback function ID specified for the request to cancel _expiration The expiration generated for the re... | function cancelRequest(
bytes32 _requestId,
uint256 _payment,
bytes4 _callbackFunctionId,
uint256 _expiration
)
public
onlyOwner
{
cancelChainlinkRequest(_requestId, _payment, _callbackFunctionId, _expiration);
}
| 1,063,228 |
pragma solidity ^0.5.12;
interface IHarbergerTaxManager {
function initialize(address _unicoinRegistry) external;
function createTaxObject(
uint256 _licence_Id,
// uint256 _ratePerBlock,
uint256 _currentAssignedValue
) external returns (uint256);
function calculateOutstandingT... | uint256 _ratePerBlock, | interface IHarbergerTaxManager {
function initialize(address _unicoinRegistry) external;
function createTaxObject(
uint256 _licence_Id,
uint256 _currentAssignedValue
) external returns (uint256);
function calculateOutstandingTax(uint256 _taxObject_Id)
external
view
... | 15,836,627 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
// 0.6.12+commit.27d51765
import "./@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "./@openzeppelin/contracts/utils/EnumerableSet.sol";
import "./@openzeppelin/contracts/math/SafeMath.sol";
... | NOTE: in the last changes we made 4 real days into one "contract" day | function updateDailyTotalLptAmount() private {
uint256 currentStakingDayNumber = getCurrentStakingDayNumber();
for (uint256 i = currentStakingDayNumber; i <= 92; i++) {
dailyTotalLptAmount[i] = currentTotalLptAmount;
}
}
Withdraw variants:
1) withdrawLp... | 917,563 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.25 <0.8.0;
import { IAlphaWhiteList } from "./IAlphaWhiteList.sol";
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import { SafeMath } from "@openzeppelin/contracts/math/SafeMath.sol";
import { IFujiERC1155 } from "./FujiERC1155/IFujiERC1155.... | Modifies the limitUsers _newUserLimit: New User Limit number/ | function updateLimitUser(uint256 _newUserLimit) public onlyOwner {
limitUsers = _newUserLimit;
emit UserLimitUpdated(_newUserLimit);
}
| 13,505,933 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
pragma abicoder v2;
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
imp... | Update the recipient | function updatePlatform(address _platform) external onlyOwner {
require(_platform != address(0), "AladdinConvexVault: zero platform address");
platform = _platform;
emit UpdatePlatform(_platform);
}
| 12,045,946 |
./full_match/43113/0x984b9b8f350ed8eAA8F8aC05f72Cec7C9707Bd40/sources/tests/Fingers/Fingers.sol | NOK code -3emit FingerChange(_tokenId); | function _changeDna(uint256 _tokenId) internal {
Finger storage myFinger = fingers[_tokenId];
myFinger.thumbDna = _generateFingerDna();
myFinger.indexDna = _generateFingerDna();
myFinger.middleDna = _generateFingerDna();
myFinger.ringDna = _generateFingerDna();
myFinge... | 7,153,281 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.