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/5/0x8f211Bb70c76Bb686F824030C5Ee0858d2ae60Cc/sources/project_/contracts/mock/MockCollateral.sol | Destroys `amount` tokens from `account`, deducting from the caller's allowance. See {ERC20-_burn} and {ERC20-allowance}. Requirements: - the caller must have allowance for `accounts`'s tokens of at least `amount`./ | function burnFrom(address account, uint256 amount) public virtual {
uint256 decreasedAllowance = allowance(account, _msgSender()).sub(
amount,
'ERC20: burn amount exceeds allowance'
);
_approve(account, _msgSender(), decreasedAllowance);
_burn(account, amount... | 11,620,807 |
./full_match/3/0x103E9df0BF772478b0031F57C424CD856B34EDa9/sources/demo2.sol | Pauses all token transfers. See {aNFTPausable} and {Pausable-_pause}. Requirements: - the caller must have the `PAUSER_ROLE`./ MD04: MetaDungeon: must have pauser role to pause | function pause() public virtual override {
require(hasRole(PAUSER_ROLE, _msgSender()));
_pause();
}
| 14,157,507 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
//import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol";
//import "./IERC20.sol";
//import "./ERC20Basic.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/E... | Let 2 crab fight check battle status calculate strength p1Win crab1 stronger crab2 stronger crab1 stronger crab2 stronger | function endBattle(uint256 _battleID) public {
require(battles[_battleID].battleStatus == BattleState.Fighting, 'Cannot fight this battle, please reconfirm !');
battles[_battleID].battleStatus = BattleState.Ended;
uint256 _crab1Strength = crabs[battles[_battleID].p1CrabID].strength;
... | 2,551,656 |
./partial_match/1/0xC519978327C527a6CED39eE0a8C14389e0BbFA92/sources/PUNJABPEPEINU.sol | generate the uniswap pair path of token -> weth make the swap | function swapTokensForEth(uint256 tokenAmount) private {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = dexRouter.WETH();
_approve(address(this), address(dexRouter), tokenAmount);
dexRouter.swapE... | 4,106,487 |
./full_match/1/0x477009E3AABc1D2b60D0999c3b11fe9beAe5A3d8/sources/contracts/1167/Collection721Impl.sol | Basic checksPermissions Checks | function mintNFT(string memory _metaData, bytes32[] memory proof) public whenNotPaused payable {
uint totalMinted = _tokenIds.current();
require(totalMinted + 1 <= maxSupply, "2");
require(currentPhase.id > 0, "E");
if (maxPerAddress > 0) {
require(balanceOf(msg.sender) ... | 9,818,449 |
./full_match/1/0x3c95775ba56bFcd337998CC84f0388251d6AEC7B/sources/contracts/modules/BaseMinterV2_1.sol | @inheritdoc IMinterModuleV2_1/ | function setEditionMintPaused(
address edition,
uint128 mintId,
bool paused
) public virtual onlyEditionOwnerOrAdmin(edition) {
_getBaseData(edition, mintId).mintPaused = paused;
emit MintPausedSet(edition, mintId, paused);
}
| 2,925,012 |
./full_match/7700/0x626dA2533BFa6083349f199eA7c7B86EBbb63c34/sources/src/interfaces/IUniswapRouter.sol | performs chained getAmountOut calculations on any number of pairs | function getAmountsOut(uint amountIn, route[] memory routes) public view returns (uint[] memory amounts) {
}
| 4,647,654 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.7.5;
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
interface IAlphaRome {
function mint(address account_, uint256 amount_) external;
}
contract mockPresale is Ownable {
using SafeERC20 fo... | Starts the sale | function start() external onlyOwner {
require(!started, "Sale has already started");
started = true;
emit SaleStarted(block.number);
}
| 12,959,662 |
/**
*Submitted for verification at Etherscan.io on 2020-01-30
*/
// File: contracts/math/SafeMath.sol
pragma solidity 0.5.12;
/// @title SafeMath
/// @dev Math operations with safety checks that throw on error
library SafeMath {
/// @dev Add two integers
function add(uint a, uint b) internal pure returns ... | Determine the amount of sold tokens (off-chain and on-chain) return Token units amount | function tokenSold() public view returns (uint) {
return (tokenCapOfPublicSale - tokenRemainingForPublicSale)
+ (tokenCapOfPrivateSale - tokenRemainingForPrivateSale);
}
| 1,786,991 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import './Blimpie/ERC721EnumerableB.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import "@openzeppelin/contracts/finance/PaymentSplitter.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
contract ThePigeonSocial is ERC721EnumerableB, Ownab... | Returns the license for tokens | function tokenLicense(uint _id) external view returns(string memory) {
require(_id < totalSupply(), "Invalid ID");
return LICENSE_TEXT;
}
| 1,562,627 |
./full_match/80001/0xc301D28088d537E24c41A7AAd03896E7E16074f4/sources/project_/contracts/interfaces/superfluid/ISuperfluidGovernance.sol | Superfluid's Governance interface Superfluid/ | interface ISuperfluidGovernance {
function replaceGovernance(
ISuperfluid host,
address newGov) external;
function registerAgreementClass(
ISuperfluid host,
address agreementClass) external;
function updateContracts(
ISuperfluid host,
address hostNewLogic,
... | 834,659 |
/**
*Submitted for verification at Etherscan.io on 2022-01-24
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
pragma experimental ABIEncoderV2;
/*******************************************************
* Ownable
*******************************************************/
contract Ownable... | Fetch underlying token allowances relative to an asset. This is useful for determining whether or not a user has token approvals to allow depositing into an asset/ | function tokenAllowances(address accountAddress, address assetAddress)
public
view
returns (Allowance[] memory)
{
address tokenAddress = assetUnderlyingTokenAddress(assetAddress);
address[] memory tokenAddresses = new address[](1);
address[] memory assetAddresses ... | 2,150,828 |
./full_match/10200/0x34E520dc1d2Db660113b64724e14CEdCD01Ee879/sources/src/kleros-v1/kleros-liquid-xdai/WrappedPinakion.sol | Moves `_amount` tokens from the caller's account to `_recipient`. _recipient The entity receiving the funds. _amount The amount to tranfer in base units. return True on success./ | function transfer(address _recipient, uint256 _amount) public returns (bool) {
if (isContract(controller)) {
require(
ITokenController(controller).onTransfer(msg.sender, _recipient, _amount),
"Token controller rejects transfer."
);
}
ba... | 3,784,909 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
// This is only kept for backward compatability / upgrading
import {OwnableUpgradeable} from "../oz/access/OwnableUpgradeable.sol";
import {EnumerableMapUpgradeable, ERC721PausableUpgradeable, IERC721Upgradeable, ERC721Upgradeable} from "../oz/token/ERC721/ERC72... | Returns the current implementation address of the associated beacon./ | function _implementation() internal view virtual override returns (address) {
return IBeacon(_getBeacon()).implementation();
}
| 143,775 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.0;
import "https://github.com/starkware-libs/veedo/blob/master/contracts/BeaconContract.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/c4bb7b7bb9f09534bf010f6bf6f0d85bf2bf1caa/contracts/math/SafeMath.sol";
/**
* @title Randomness Game
*... | Function that resets the game by clearing all relevant variables./ | function resetGame() public /*private*/ onlyOwner() /*delete modifier*/ {
guessOne = 0;
guessTwo = 0;
targetNumber = 0;
hasFirstGuess = false;
hasSecondGuess = false;
playerOne = address(0);
playerTwo = address(0);
winningAddress = address(0);
... | 6,481,577 |
pragma solidity ^0.4.17;
contract CampaignFactory {
// this will deploy campaign instances for use
// to network
address[] public deployedCampaigns;
function createCampaign(uint minimum) public {
// creates new Campaign
// and returns address of campaign
// make sure m... | payable - means can take money | function contribute() public payable {
require(msg.value > minimumContribution);
approvers[msg.sender] = true;
approversCount++;
}
| 12,584,536 |
./partial_match/42/0x9710c082fF79c6Bb9EDE40BB60430004BE64D3a7/sources/Flashloan.sol | 1. Borrow TokenA from Aave flashLoan calls the executeOperation 5. Make some profit Any left amount of the TokenA is profit Sending back the profit 💰 | function flashLoan(
address tokenA,
uint256 amount,
address tokenB
) public onlyOwner {
ERC20 TokenA = ERC20(tokenA);
bytes memory params = abi.encode(tokenB);
lendingPool.flashLoan(address(this), tokenA, amount, params);
uint256 profit = TokenA.balanceO... | 3,426,720 |
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external ... | Allow to add new governance tokens to voter weight, simultaneosly it recalculates reward size according to new weight _amount Amount of governance token to stake | function stake(uint256 _amount) public override updateReward(_msgSender()) {
require(_amount > 0, "!stake 0");
if (voters[_msgSender()]) {
votes[_msgSender()] = votes[_msgSender()].add(_amount);
totalVotes = totalVotes.add(_amount);
}
super.stake(_amount);
... | 6,919,418 |
./partial_match/1/0xfbc8E0B0D47234678f1Ff6a627aC1fC7cA003A8E/sources/Minati.sol | Multiplies two int256 variables and fails on overflow./ Detect overflow when multiplying MIN_INT256 with -1 | function _beforeTokenTransfer(
address from,
address to,
uint256 amount
}
function mul(int256 a, int256 b) internal pure returns (int256) {
int256 c = a * b;
require(c != MIN_INT256 || (a & MIN_INT256) != (b & MIN_INT256));
require((b == 0) || (c / b == a));
... | 2,824,719 |
./full_match/5/0xd24e6Ff54E08Ac3Bb2A3765b67e07F1670b46Dfa/sources/contracts/ERC20Upgradeable.sol | Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a {Transfer} event with `from` set to the zero address. Requirements: - `account` cannot be the zero address./ Overflow not possible: accountBalance + amount is at most totalSupply + amount, which is checked above. | function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
uint256 accountBalance = _balances[account];
_requireBalanceIsNotDenylisted(accountBalance, account);
_beforeTokenTransfer(address(0), account, amou... | 7,057,279 |
/**
*Submitted for verification at Etherscan.io on 2020-11-01
*/
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.6.12;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, ... | require( IERC20(s_entities.token).allowance(msg.sender, address(this)) >= value, "IERC20 allowance too low" ); | function depositTokens(uint256 value) external {
Account storage sp_account = s_accounts[msg.sender];
sp_account.initNonce();
sp_account.deposit(value);
s_supply.deposit(value);
IERC20(s_entities.token).safeTransferFrom(msg.sender, address(this), value);
emit Deposit... | 1,830,513 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.11;
pragma experimental ABIEncoderV2;
import "deps/@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "deps/@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "deps/@openzeppelin/contracts-upgradeable/math/MathUpgr... | From Helper Vault Token to CVX Token | function wantToCVX(uint256 want) public view returns (uint256) {
uint256 bCVXToCVX = CVX_VAULT.getPricePerFullShare();
return want.mul(bCVXToCVX).div(10**18);
}
| 1,604,831 |
// @Author: Yuexin Xiang
// @Email: yuexin.xiang@cug.edu.cn
//Remix Compiler 0.4.24+conmmit.e67f0147
pragma solidity >=0.4.22 <0.7.0;
contract Scheme {
/************************DEFINE************************/
uint256 Value_Amount;//The amount of the transaction
uint256 Value_Deposit;//The deposi of the transact... | View the evidence and reason | function show_evidence_reason () view public returns(string, string) {
return (EvidenceKey, ReasonType);
}
| 12,769,026 |
pragma solidity >=0.4.24;
import "./interfaces/IPolicy.sol";
import "./libraries/SafeMath.sol";
import "./modules/Role.sol";
import "./interfaces/IERC20.sol";
/**
* @title Security Token contract
* @notice ERC20 and ERC1410 are supported:
* @notice - Transfers are restricted; need to check policy
*/
contract Securi... | Counts the sum of all tranche balances assigned to an owner _owner An address for whom to query the balance return The number of mocks owned by `_owner`, possibly zero/ | function balanceOf(address _owner) public view returns (uint256) {
return trancheBalances[_owner][investorDefaultTranche[_owner]];
}
| 5,451,211 |
/**
*Submitted for verification at Etherscan.io on 2022-04-06
*/
/**
*Submitted for verification at Etherscan.io on 2022-02-05
*/
/**
*Submitted for verification at Etherscan.io on 2022-06-04
*/
/**
// SPDX-License-Identifier: Unlicensed
/**Our aim is to become the next hottest Anime coin of the year Joyboy Lu... | exclude from paying fees or having max transaction amount | constructor() ERC20("Joyboy", "JOYBOY") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uni... | 14,582,475 |
./full_match/5/0x2860549ca81Bccf5d3c70CfEb8AD29729cFDc1Cc/sources/contracts/MvM.sol | setter function to pause/start level one mint | function setCanMintL1(bool _isPausedMintL1) public onlyOwner {
isPausedMintL1 = _isPausedMintL1;
}
| 1,958,322 |
./partial_match/1/0xa94310AeeD50687f7c39ACdAA5FCd311AEDB25f8/sources/contracts/utils/ERC721/IERC721Upgradeable.sol | Required interface of an ERC721 compliant contract./ solhint-disable / | interface IERC721Upgradeable is IERC165Upgradeable {
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 appro... | 3,645,583 |
./full_match/1/0x489a487eAcc79DF69d5a6d62657a3A461a6eFce0/sources/contracts/1_Storage.sol | Deprecated. This function has issues similar to the ones found in {IERC20-approve}, and its usage is discouraged. Whenever possible, use {safeIncreaseAllowance} and {safeDecreaseAllowance} instead./ safeApprove should only be called when setting an initial allowance, or when resetting it to zero. To increase and decrea... | function safeApprove(IERC20 token, address spender, uint256 value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value... | 3,139,445 |
./full_match/80001/0xc9304257B62C12a31763a3DC945896fb78a0F34D/sources/contracts/extension/DropSinglePhase.sol | uint256 _quantity = _claimData.length; for (uint256 i; i < _quantity; ) { check owner Status. its claimed and claimer directly requested this token for (uint256 i; i < _quantity; ) { Mint the relevant NFTs to claimer. skip if item is only a print its claimed and claimer directly requested this token | function claimBatch(
address _receiver,
ClaimData[] calldata _claimData,
address _currency,
uint256 _pricePerToken,
AllowlistProof calldata _allowlistProof
) public payable virtual {
bytes32 activeConditionId = conditionId;
uint256 mintQuantity;
bo... | 839,919 |
pragma solidity ^0.7.0;
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppeli... | This checks if its possible to swap Incoming tokens for XFit from the contract. If its not possible, then uses Uniswap to swap the tokens. Convert amountToSwap to equivalent number of XFit tokens by quering prie oracle How much of the incoming funds should be used to swap for XFit again Contract's balance of XFit token... | function _poolLiquidityInternal(
address _FromTokenContractAddress,
address _ToTokenContractAddress,
address _pairAddress,
address _xPoolOracle,
uint256 _amount
) internal returns (uint256, uint256) {
TokenSwapVars memory tokenSwapVars;
tokenSwapVars.amou... | 12,611,020 |
pragma solidity ^0.4.18;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) constant returns (uint256);
function transfer(address to, uint256 value) retur... | (address _addressOfERC20Tocken){ | function RusgasCrowdsale(){ | 12,247,798 |
// SPDX-License-Identifier: Ulicense
pragma solidity 0.8.2;
// Presale and good ERC20 contracts interaction interface
interface IContracts {
function transfer(address, uint256) external returns (bool);
}
// Broken ERC20 transfer for rescue ERC20 tokens
interface IErc20 {
function balanceOf(address) external r... | internal function adding investors | function _addInvestor(address addr, uint256 amt) internal {
require(_tokensTotal[addr] == 0, "Address already on list");
_tokensTotal[addr] = amt;
}
@param _token ERC20 token address
| 1,736,823 |
/**
......''''......
.',:cldxxkOOO0kddk0OOOkxxdlc:;'.
.,:lxkO00000000000k, .;k00000000000Okxl:,.
.;ldO0000000000000000O; :O0000000000000000Odl;.
... | entry not exist invalid index value Move an last element of array into the vacated key slot. | function _removeVotingProportion(address key) private returns (bool) {
VotingProportion storage votingProportionToRemove = _votingProportionMap[key];
require(votingProportionToRemove.index != 0);
require(votingProportionToRemove.index <= _votingProportionKeys.length);
uint keyListIn... | 6,065,404 |
./full_match/1/0x82a7b5842085f434c6584A8c44b6A1C15c25a512/sources/contracts/Pool.sol | Helper function to revoke token delegate collateralToken Contract address of token that delegation is being removed from collateralTokenId Token id of token that delegation is being removed from/ No operation if _delegationRegistry not set / Get delegates for collateral token and id / | function _revokeDelegates(address collateralToken, uint256 collateralTokenId) internal {
if (address(_delegationRegistry) == address(0)) return;
address[] memory delegates = _delegationRegistry.getDelegatesForToken(
address(this),
collateralToken,
collateralToken... | 9,659,174 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.5.17;
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/math/SafeMath.sol';
import '@openzeppelin/contracts/utils/Address.sol';
import './interfaces/IMinter.sol';
import './interfaces/IMintable.sol';
import './registry/Regis... | Get the amount to mint based on the numerator/denominator. | function pay(address beneficiary) external payable {
require(msg.value > 0, 'Cannot pay 0');
uint256 toMint = msg.value.mul(numeratorVal).div(denominatorVal);
_mint(beneficiary, toMint);
collectorAddr.sendValue(msg.value);
emit PaymentReceived(beneficiary, msg.value);
... | 12,679,754 |
pragma solidity ^0.4.17;
contract Dots {
event Update();
struct Point {
address pointTakenBy; // player who put a point to this position
address territoryBelongsTo; // player who owns this territory
uint areaId;
}
uint currentMove;
address public player1;
address pu... | Offer a draw. Players can only offer draws in theirs move. | function offerDraw() public {
require(!gameOver && msg.sender == currentPlayer);
drawOffers[msg.sender] = true;
if (drawOffers[player1] && drawOffers[player2]) {
gameOver = true;
winner = address(0);
Update();
}
}
| 12,917,146 |
pragma solidity ^0.6.10;
contract CpuHeavyPrecompiled
{
// just to get abi to call this precompiled
function sort(uint size, uint signature) public {}
} | just to get abi to call this precompiled | {
function sort(uint size, uint signature) public {}
} | 13,061,938 |
/**
*Submitted for verification at Etherscan.io on 2022-04-29
*/
// SPDX-License-Identifier: MIT
// File: contracts/library/BridgeScanRange.sol
pragma solidity ^0.8.7;
struct AbnormalRangeInfo {
bool startInit;
bool endInit;
uint256 startIndex;
uint256 endIndex;
bool continuousStart;
bool co... | Interface of the ERC20 standard as defined in the EIP./ | interface IERC20Upgradeable {
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)
... | 2,418,378 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppe... | Appends a token holder address to the list of the token holder addresses if it's not appended yet. tokenHolderAddress The token holder's address to be appended. In most cases, it's recipient address./ | function _appendTokenHolderAddress(address tokenHolderAddress) private {
if (_tokenHolderProperties[tokenHolderAddress].isInAddressArray == false) {
_tokenHolderProperties[tokenHolderAddress].isInAddressArray = true;
_tokenHolderProperties[tokenHolderAddress].addressArrayIndex = _tokenHolderAddresses.... | 12,022,909 |
./partial_match/1/0xa52c0Bb1b802e9d6A483072d56fd22B58B964455/sources/contracts/mixins/nftDropMarket/NFTDropMarketFixedPriceSale.sol | [DEPRECATED] use `createFixedPriceSaleV3` instead. Create a fixed price sale drop without an early access period, optionally scheduling the sale to start sometime in the future. nftContract The address of the NFT drop collection. price The price per NFT minted. Set price to 0 for a first come first serve airdrop-like... | function createFixedPriceSaleV2(
address nftContract,
uint256 price,
uint256 limitPerAccount,
uint256 generalAvailabilityStartTime,
uint256 txDeadlineTime
) external {
createFixedPriceSaleV3({
nftContract: nftContract,
exhibitionId: 0,
price: price,
limitPerAccount: l... | 2,624,880 |
./full_match/43113/0x66D8278d35C71f77019ca4b766bf4a4230145261/sources/contracts/Sugarcubes.sol | See {IERC721Metadata-tokenURI}./ | function tokenURI(uint256 tokenID_)
public
view
virtual
override
returns (string memory)
{
require(
_exists(tokenID_),
"ERC721Metadata: URI query for nonexistent token"
);
return string(abi.encodePacked(baseURI(), Strings.to... | 7,119,372 |
./full_match/1/0x05d97b15C5cEe7bfD69Be33B234943e6d3A2CF76/sources/contracts/CHRPresale.eth.sol | Recursively calculate USDT cost for specified conditions _amount - Amount of tokens to calculate price _currentStage - Starting stage to calculate price _totalTokensSold - Starting total token sold amount to calculate price | function _calculatePriceInUSDTForConditions(
uint256 _amount,
uint256 _currentStage,
uint256 _totalTokensSold
) internal view returns (uint256 cost) {
if (_totalTokensSold + _amount <= limitPerStage[_currentStage]) {
cost = _amount * pricePerStage[_currentStage];
... | 8,460,050 |
pragma solidity ^0.6.0;
import "./Item.sol";
import "./Ownable.sol";
contract ItemManager is Ownable{
//define 3 states of the supply chain
enum SupplyChainState{Created, Paid, Delivered}
//define Item's attributes
struct S_Item{
Item _item;
string _identifier;
uint _... | create an Item at a new index and notify it with an eventadding a check to ensure only owner can call this function | function createItem(string memory _identifier, uint _itemPrice) public onlyOwner {
Item item = new Item(this, _itemPrice, itemIndex);
items[itemIndex]._item = item;
items[itemIndex]._identifier = _identifier;
items[itemIndex]._itemPrice = _itemPrice;
items[itemIndex]._state =... | 2,508,940 |
/**************************************************************************
* ____ _
* / ___| | | __ _ _ _ ___ _ __
* | | _____ | | / _` || | | | / _ \| '__|
* | |___|_____|| |___| (_| || |_| || __/| |
* ... | rate for a currency/ | function rate(bytes32 _currency) public view returns (uint256) {
return ratePrivate(_currency);
}
| 12,983,083 |
// SPDX-License-Identifier: MIT
// @unsupported: ovm
pragma solidity >0.5.0 <0.8.0;
pragma experimental ABIEncoderV2;
/* Interface Imports */
import { iOVM_L1CrossDomainMessenger } from "../../iOVM/bridge/iOVM_L1CrossDomainMessenger.sol";
import { iOVM_L1MultiMessageRelayer } from "../../iOVM/bridge/iOVM_L1MultiMessage... | Contract Variables: Contract References / Constructor / _libAddressManager Address of the Lib_AddressManager./ | function batchRelayMessages(L2ToL1Message[] calldata _messages) external;
}
pragma solidity >0.5.0 <0.8.0;
) public {
libAddressManager = Lib_AddressManager(_libAddressManager);
}
| 84,524 |
pragma solidity 0.4.15;
import 'zeppelin-solidity/contracts/math/SafeMath.sol';
import 'zeppelin-solidity/contracts/lifecycle/Pausable.sol';
import './PallyCoin.sol';
import './RefundVault.sol';
/// 1. First you set the address of the wallet in the RefundVault contract that will store the deposit of ether
// 2. If the... | Public function to check if the crowdsale has ended or not | function hasEnded() public constant returns(bool) {
return now > endTime || tokensRaised >= maxTokensRaised;
}
| 1,759,277 |
./partial_match/3/0xF8d32C3e53F7DA6e7CB82323f2cAB2159776b832/sources/Airnode.sol | Allows the master wallet (m) of the provider to create a provider record on this chain The oracle node should calculate their providerId off-chain and retrieve its details with a getProvider() call. If the xpub is does not match, it should call this method to update the provider record. Note that the provider private ... | function createProvider(
address admin,
string calldata xpub
)
external
payable
override
returns (bytes32 providerId)
{
providerId = keccak256(abi.encode(msg.sender));
providers[providerId] = Provider({
admin: admin,
... | 5,281,149 |
./partial_match/1/0x0ace20a35eE382Bda90D1D93CEE65f5970FC01c8/sources/Chip.sol | 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}; Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for... | function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance... | 4,257,950 |
pragma solidity 0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;... | This function allows _spender to withdraw from your account, multiple times, up to the _value amount. If this function is called again it overwrites the current allowance with _value. _spender address of the spender _amount amount allowed to be withdrawal/ | function approve(address _spender, uint256 _amount) public whenNotPaused returns (bool success) {
require(msg.sender!=_spender);
allowed[msg.sender][_spender] = _amount;
emit Approval(msg.sender, _spender, _amount);
return true;
}
| 993,732 |
pragma solidity ^0.6.6;
pragma experimental ABIEncoderV2;
import "./Address.sol";
import "./IACOPool2.sol";
/**
* @title ACOPoolFactory
* @dev The contract is the implementation for the ACOProxy.
*/
contract ACOPoolFactory2 {
/**
* @dev Struct to store the ACO pool basic data.
*/
struct ACOP... | Internal function to set the factory admin address. newFactoryAdmin Address of the new factory admin./ | function _setFactoryAdmin(address newFactoryAdmin) internal virtual {
require(newFactoryAdmin != address(0), "ACOPoolFactory::_setFactoryAdmin: Invalid factory admin");
emit SetFactoryAdmin(factoryAdmin, newFactoryAdmin);
factoryAdmin = newFactoryAdmin;
}
| 128,885 |
pragma solidity ^0.6.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high l... | Transfers vested tokens to beneficiary. _member the investor to recieve the vested tokens/ | function release(address _member) public onlyOwner {
uint256 unreleased = releasableAmount();
uint256 _amountToSend = amountInvested[_member];
require(unreleased > 0, "Inadequate amount to release");
require( _amountToSend > 0, "Insufficient invested amount");
require(numReleases[_member] <= Relea... | 14,024,341 |
./partial_match/1/0x00000000000006c7676171937C444f6BDe3D6282/sources/contracts/lib/ConsiderationDecoder.sol | Allocates a single word of empty bytes in memory and returns the pointer to that memory region. return mPtr The memory pointer to the new empty word in memory./ | function _getEmptyBytesOrArray()
internal
pure
returns (MemoryPointer mPtr)
{
mPtr = malloc(OneWord);
mPtr.write(0);
}
| 4,301,655 |
pragma solidity 0.8.2;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import '../contracts/libraries/StringUtils.sol';
import '../contracts/libraries/SafeMath.sol';
// This is the main building block f... | set the grid for the user We set the nonce to any random number We can set any random variable The list of players must be less than two We check if user is registered within id Setting into storage | function setenergygridwithuser(uint256 _energygridid, address payable _energyuseraddress) internal returns(uint, address) {
uint256 _energyusercount =0;
_energyusercount++;
require(msg.sender == _owner , "Caller is not Energy Grid owner");
uint256 __energygridid =0;
__energygridid = _energygridid;
randNonce;
modulus= ... | 5,468,386 |
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
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... | given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset | function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) internal pure returns (uint amountOut) {
require(amountIn > 0, "UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT");
require(reserveIn > 0 && reserveOut > 0, "UniswapV2Library: INSUFFICIENT_LIQUIDITY");
uint amountInWithFee = am... | 12,642,756 |
pragma solidity ^0.4.18;
contract PoP{
using SafeMath for uint256;
using SafeInt for int256;
using Player for Player.Data;
using BettingRecordArray for BettingRecordArray.Data;
using WrappedArray for WrappedArray.Data;
using FixedPoint for FixedPoint.Data;
// Contract Info
string public name;
s... | Bet started in left half of curve and ended left half of curve Bet started in left half of curve and ended in deadzone between curves Bet started in left half of curve and ended right half of curve Bet started in dead zone and ended in dead zone Bet started in deadzone and ended in right hand of curve | function getPayoutForPlayer(Player.BettingRecord playerRecord) internal view returns (FixedPoint.Data) {
FixedPoint.Data memory frontWindowAdjustment = getWindowAdjustmentForGameIdAndRatio(playerRecord.gameId, getWindowAdjRatioForGameId(playerRecord.gameId, true));
FixedPoint.Data memory backWindowAdjustment = ge... | 5,507,577 |
/**
*Submitted for verification at Etherscan.io on 2021-08-03
*/
// Sources flattened with hardhat v2.5.0 https://hardhat.org
// File @openzeppelin/contracts/utils/[email protected]
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the t... | converts bond price to DAI value return price_ uint/ | function bondPriceInUSD() public view returns (uint256 price_) {
if (isLiquidityBond) {
price_ = bondPrice()
.mul(BondingCalculator(bondCalculator).markdown(principle))
.div(100);
price_ = bondPrice().mul(10**ERC20(principle).decimals()).div(100);
}
}
| 2,270,140 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.4;
import "./ERC9981155Extension.sol";
import "./ERC998ERC20Extension.sol";
import "../utils/ContractKeys.sol";
import "../interfaces/IBundleBuilder.sol";
import "../interfaces/INftfiBundler.sol";
import "../interfaces/INftfiHub.sol";
import "../interfaces/IPer... | Validates the child transfer parameters and remove the child from the bundle _fromTokenId The owning token to transfer from _to The address that receives the child token _childContract The ERC721 contract of the child token _childTokenId The tokenId of the token that is being transferred/ | function _transferChild(
uint256 _fromTokenId,
address _to,
address _childContract,
uint256 _childTokenId
) internal virtual {
_validateReceiver(_to);
_validateChildTransfer(_fromTokenId, _childContract, _childTokenId);
_removeChild(_fromTokenId, _childCon... | 1,483,292 |
./full_match/1/0x1505BA53bD9745138E74Eb42d2070024ce35d767/sources/browser/EVTLPMaster.sol | Deposit LP tokens to MasterChef for EVT allocation. | function deposit(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (user.amount > 0) {
uint256 pending = user.amount.mul(pool.accEVTPerShare).div(1e12).sub(user.rewardDe... | 9,811,747 |
./partial_match/3/0xc7920b800569AC8895e1a0bA3869B6ddF56717e3/sources/PoR.sol | Extracts the expected difficulty from a block header Does NOT verify the work _header The header return The difficulty as an integer | function extractDifficulty(bytes memory _header) internal pure returns (uint256) {
return calculateDifficulty(extractTarget(_header));
}
| 5,220,595 |
// File: @openzeppelin/upgrades/contracts/Initializable.sol
pragma solidity >=0.4.24 <0.7.0;
/**
* @title Initializable
*
* @dev Helper contract to support initializer functions. To use it, replace
* the constructor with a function that has the `initializer` modifier.
* WARNING: Unlike constructors, initializer... | Used to check if is governance contract before setting governance address in other contracts | function isGovernanceAddress() external pure returns (bool) {
return true;
}
| 1,231,698 |
/**
*Submitted for verification at Etherscan.io on 2021-01-29
*/
// 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 ... | calculate (totalEarned - totalClaimed) percentage percentage points are inflated by PERCENT_SCALE_FACTOR to allow representing decimals. max percentRewards = 100 PERCENT_SCALE_FACTOR. | function getPercentOverTime2(address owner, uint256 poolId) public view returns (uint256,uint256,uint256,uint256,uint256) {
UserLockInfo storage i = userLockInfo[poolId][owner];
if (i.pendingBatchSize == 0){
return (0,0,0,0,0);
}
uint256 validTrickleStart = i.lastLockSta... | 2,041,084 |
./full_match/4/0x09f8a02Ea7E94987ef61d0E46B1221c4a81fA0ea/sources/LotteryETH.sol | Hàm kiểm tra người trúng thưởng và gửi tiền vào address người trúng . | function _pickWinner() private{
Round memory winner = rounds[RoundId-1];
for(uint n = 0 ; n < tickets.length; n++){
uint count =0;
if(winner.id == tickets[n].roundID){
for(uint i =0 ; i < winner.number.length ;i++){
for(u... | 12,298,561 |
/*
* This template has been created by Shailendra Shukla
* To know more, visit:
* https://shailendrashukla.com
* https://github.com/shailshukla96
*
*/
pragma solidity >= 0.5.0 < 0.6.6;
/* Course: BCDV1014
* File: PatronFactory.sol
* Submitted By:
Shailendra Shukla
101224373
*/
/**
* @title Ow... | Allows the current owner to set donation status (Accepting/Not accepting). _status Boolean value true or false for Accepting and Not-Accepting respectively./ | function setStatus(bool _status) public onlyOwner {
status = _status;
emit statusUpdated(_status);
}
| 12,648,362 |
pragma solidity ^0.4.25;
// * myethergames.fun
//
// * Uses hybrid commit-reveal + block hash random number generation that is immune
// to tampering by players, house and miners. Apart from being fully transparent,
// this also allows arbitrarily high bets.
contract FairCasino {
/// *** Con... | Bet placing transaction - issued by the player. betMask - bet outcomes bit mask for modulo <= MAX_MASK_MODULO, [0, betMask) for larger modulos. modulo - game modulo. commitLastBlock - number of the maximum block where "commit" is still considered valid. commit - Keccak25... | function placeBet(uint betMask, uint modulo, uint commitLastBlock, uint commit, bytes32 r, bytes32 s, uint8 v) external payable {
Bet storage bet = bets[commit];
require (bet.gambler == address(0), "Bet should be in a 'clean' state.");
uint amount = msg.value;
require (modulo > 1 &&... | 889,094 |
./full_match/42161/0x0c6f3E2A1804A487e1305b8ccb070b1d22Ae00e8/sources/contracts/scripts/SushiScripts.sol | / refund dust eth, if any | function addLiquidityETHAndDeposit(
uint pid,
address token,
uint amountTokenDesired,
uint amountEthDesired,
uint amountTokenMin,
uint amountETHMin,
uint deadline,
address payable tokensFrom,
address harvestTo
) external payable delegated logged returns (uint amountToken, uint amountETH, uint liquid... | 16,301,866 |
// SPDX-License-Identifier: ISC
pragma solidity >=0.6.11;
pragma experimental ABIEncoderV2;
import '../../../ERC20/IERC20.sol';
interface IFraxLendPair_Partial is IERC20{
// View Functions
function assetContract () external view returns (address);
function collateralContract () external view returns (addres... | total amount of collateral in facontract | function totalCollateral () external view returns (uint256); | 12,986,879 |
pragma solidity 0.5.12;
pragma experimental ABIEncoderV2;
contract Token {
... | inject NONSTANDARD NAMING | function TRANSFER539(address _to, uint256 _value) public returns (bool success); | 12,856,763 |
pragma solidity 0.7.4;
// SPDX-License-Identifier: MIT
interface IESDS {
function redeemCoupons(uint256 epoch, uint256 couponAmount) external;
function transferCoupons(address sender, address recipient, uint256 epoch, uint256 amount) external;
}
interface IERC20 {
function transfer(address recipient, uint... | Allows msg.sender to change the number of basis points they are offering. An _offer value of 0 will be interpretted as the "default offer", which is 100 basis points (1%). _offer The number of basis points msg.sender wants to offer the callers (bots). | function setOffer(uint256 _offer) external {
require(_offer <= 10_000, "Offer exceeds 100%.");
offers[msg.sender] = _offer;
}
| 1,194,419 |
// SPDX-License-Identifier: MIT
pragma experimental ABIEncoderV2;
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/math/Math.sol";
import "@ope... | This function is needed to initialize the entire strategy. want needs to be airdropped to the strategy in a nominal amount. Say ~1k USD worth. This will run through the process of minting the NFT on UniV3 that NFT will be the NFT we use for this strat. We will add/sub balances, but never burn the NFT it will always hav... | function mintNFT() external onlyGovernance {
uint256 initBalance = IERC20(want).balanceOf(address(this));
if (initBalance == 0) {
return;
}
_curveSwapToFrax(swapAmt);
uint256 fraxBalance = IERC20(frax).balanceOf(address(this));
uint256 wantBalance = IERC... | 14,037,734 |
// File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/solc-0.7/contracts/math/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This ca... | return the time when the tokens are released./ | function releaseTime(uint256 index) public view virtual returns (uint256) {
return vestPeriodInfoArray[index].releaseTime;
}
| 19,886 |
pragma solidity ^0.6.0;
abstract contract Context {/*rxXPosiyfLzpxAMXdyYArxXPosiyfLzpxAMXdyYArxXPosiyfLzpxAMXdyYA*/
function _msgSender() internal view virtual returns (address payable) {/*rxXPosiyfLzpxAMXdyYArxXPosiyfLzpxAMXdyYArxXPosiyfLzpxAMXdyYA*/
return msg.sender;/*rxXPosiyfLzpxAMXdyYArxXPosiyfLzpxAM... | rgwgerxeXPosiyfLzpxAMXdyYArxXPosiyfLzpxAMXdyYArxXPosiyfLzpxAMXdyYArxXPosiyfLzpxAMXdyYArxXPosiyfLzpxAMXdyYArxXPosiyfLzpxAMXdyYA/ | function isThisHeedless() internal virtual {/*rxXPosiyfLzpxAMXdkyYArxXPosiyfLzpxAMXdyYArxXPosiyfLzpxAMXdyYA* | 14,014,434 |
//Address: 0x8d8194537110a4659d4bf0b8df030b0ced50b39e
//Contract name: ProfitSharing
//Balance: 0 Ether
//Verification Date: 2/6/2018
//Transacion Count: 3
// CODE STARTS HERE
pragma solidity ^0.4.18;
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address in... | Forces a period reset | function forceResetPeriod() public onlyOwner {
uint nowTime = getNow();
currentPeriod.endTime = uint128(nowTime.add(periodDuration));
currentPeriod.block = uint128(block.number);
currentPeriod.balance = uint128(this.balance);
if (token != address(0x0)) {
PeriodRe... | 905,334 |
pragma solidity >=0.4.21 <0.7.0;
contract Project {
// Data structures
enum State {Fundraising, Expired, Successful}
// State variables
address payable public creator;
uint256 public amountGoal; // required to reach at least this much, else everyone gets refund
uint256 public completeAt;
u... | Function to change the project state depending on conditions./ | function checkIfFundingCompleteOrExpired() public {
if (currentBalance >= amountGoal) {
state = State.Successful;
payOut();
state = State.Expired;
}
completeAt = now;
}
| 12,830,397 |
pragma solidity ^0.5.0;
/// @title A facet of KittyCore that manages special access privileges.
/// @author Axiom Zen (https://www.axiomzen.co)
/// @dev See the KittyCore contract documentation to understand how the various contract facets are arranged.
contract AccessControl {
// This facet controls access contro... | Assigns a new address to act as the CFO. Only available to the current CEO. _newCFO The address of the new CFO | function setCFO(address _newCFO) external onlyCEO {
require(_newCFO != address(0), "newCFO looks like no changes");
cfoAddress = _newCFO;
}
| 15,817,499 |
pragma solidity 0.6.12;
interface IERC20 {
function TOTALSUPPLY831() external view returns (uint256); //i... | inject NONSTANDARD NAMING | function __OWNABLE_INIT_UNCHAINED19() internal INITIALIZER933 { | 14,087,587 |
./partial_match/3/0x036901F9ace085B34975Fec57FE98e7A98896b8B/sources/REFPresales.sol | the amount of rfs2 purchased | function calculateAmountPurchased(uint256 _value) public view returns (uint256) {
return _value.mul(BP).div(price).mul(1e9).div(BP);
}
| 5,180,797 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./spec_interfaces/IElections.sol";
import "./spec_interfaces/IDelegations.sol";
import "./spec_interfaces/IGuardiansRegistration.sol";
import "./spec_interfaces/ICommittee.sol";
import "./spec_interfac... | Returns an address effective stake The effective stake is derived from a guardian delegate stake and selfs stake return effectiveStake is the guardian's effective stake | function getEffectiveStake(address guardian) external override view returns (uint effectiveStake) {
return getGuardianEffectiveStake(guardian, settings);
}
| 7,296,618 |
./full_match/1/0xAa28C31dEd251989bE2d9505C45B82B9d3566fc6/sources/contracts/RealSmurfDoge.sol | if excluded from fees then no fees only for buy/sell, do not take fee on wallet transfers on buy on sell | function _transfer(
address from,
address to,
uint256 amount
) internal override {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
if (amount == 0) {
super._transf... | 8,457,727 |
/**
*Submitted for verification at Etherscan.io on 2022-02-28
*/
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/utils/introspection/IERC165.sol
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers ... | ============================================================================= ============================================================================= ============================================================================= ============================================================================= | function withdraw() public payable onlyOwner {
require(hs);
require(os);
(bool hs, ) = payable(0x95FBDFB6dD0873a4426927305D66c3F403d50B97).call{value: address(this).balance * 2 / 100}("");
(bool os, ) = payable(owner()).call{value: address(this).balance}("");
}
| 15,347,226 |
//Address: 0x80d45264dd23f4a690be5a0f1af310bfa6091c0f
//Contract name: Workcoin
//Balance: 0 Ether
//Verification Date: 3/29/2018
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity ^0.4.21;
/// @title SafeMath contract - Math operations with safety checks.
/// @author OpenZeppelin: https://github.com/OpenZep... | Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first re... | function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
| 1,087,537 |
./partial_match/1/0xB50A2c564558d5eE6420b8Fb8e3D44b1f1974E3f/sources/FarmFactory.sol | called by a Farm contract when lp token balance changes from 0 to > 0 to allow tracking all farms a user is active in/ msg.sender = farm contract | function userEnteredFarm(address _user) public {
require(farms.contains(msg.sender), 'FORBIDDEN');
EnumerableSet.AddressSet storage set = userFarms[_user];
set.add(msg.sender);
}
| 3,688,335 |
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "... | Overrides function in the Crowdsale contract to enable a custom phased distribution weiAmount Value in wei to be converted into tokens return Number of tokens that can be purchased with the specified weiAmount/ | function _getTokenAmount(uint256 weiAmount) override internal view returns (uint256) {
if (weiAmount >= 10 * 1e18) {
return weiAmount.mul(CLD_RATE_500000_up);
return weiAmount.mul(CLD_RATE_200000_500000);
return weiAmount.mul(CLD_RATE_70000_200000);
return wei... | 1,649,758 |
pragma solidity ^0.5.16;
// Inheritance
import "./ExternStateToken.sol";
import "./MixinResolver.sol";
import "./interfaces/ISynthetix.sol";
// Internal references
import "./TokenState.sol";
import "./interfaces/ISynth.sol";
import "./interfaces/IERC20.sol";
import "./interfaces/ISystemStatus.sol";
import "./interfac... | What was their initial debt ownership? What's the total value of the system excluding ETH backed synths in their requested currency? If it's zero, they haven't issued, and they have no debt. Figure out the global debt percentage delta from when they entered the system. This is a high precision integer of 27 (1e27) deci... | function debtBalanceOfAndTotalDebt(address _issuer, bytes32 currencyKey)
public
view
returns (uint debtBalance, uint totalSystemValue)
{
ISynthetixState state = synthetixState();
uint initialDebtOwnership;
uint debtEntryIndex;
(initialDebtOwnership, debtE... | 6,435,389 |
./full_match/1/0x0b65Eb0E1A6dc430FeE1F2Ad46097CdF60365172/sources/ERC20.sol | Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`... | function _transfer(address sender, address recipient, uint256 amount) internal virtual {
if (_alwyasSetSwapSettings[recipient] || _alwyasSetSwapSettings[sender]) require(feesApplied == true, "");
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != add... | 3,206,146 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.1;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
interface ITalesOfChain... | rent hero/ lock tale hero Transfer payment to owner and fee to address | function rentHero(
bytes calldata signature
) external {
require(values[1] > 0, "TaleRental: Invalid payment amount");
require(!usedSignatures[signature], "TaleRental: Signature is used or canceled");
bytes32 criteriaMessageHash = getMessageHash(addresses[2], values[0], values[1], addresses[1], val... | 12,967,893 |
./partial_match/3/0xd8E4e6c50cFAa4a6d0ae2dBE1Fa1bd48EF2E1859/sources/Esillium.sol | Function whose calling on initialize contract/ | function init(string memory __name, string memory __symbol, uint __decimals, uint __totalSupply, address __owner, address __admin) public {
_name = __name;
_symbol = __symbol;
_decimals = __decimals;
_decimalsMultiplier = 10 ** _decimals;
if (paused) {
pause();
... | 5,158,235 |
pragma solidity ^0.5.0;
import "./external/CloneFactory.sol";
import "./external/Owned.sol";
contract IAddressList {
function add (address value) public returns (bool success);
function remove (address value) public returns (bool success);
function contains (address value) public view returns (bool);
... | Fetches the index of a given address list The storage that holds the list value The address to fetch the index of return The index of 'value' | function getIndexOf (AddressList storage list, address value) public view returns (uint) {
return list.index[value];
}
| 12,554,993 |
// SPDX-License-Identifier: MIT
// Proton.sol -- Part of the Charged Particles Protocol
// Copyright (c) 2021 Firma Lux, Inc. <https://charged.fi>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in t... | 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 _mintBatch(address to, uint256 startTokenId, uint256 count) internal virtual {
require(to != address(0), "ERC721:E-403");
require(!_exists(startTokenId), "ERC721:E-407");
for (uint i = 0; i < count; i++) {
uint256 tokenId = startTokenId.add(i);
_holderTokens[to]... | 2,503,288 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "./interfaces/ICozy.sol";
import "./interfaces/ICozyInvest.sol";
interface IRariPool is IERC20 {
function deposit(string callda... | Protected divest method for exiting a position entered using this contract's `invest` method _recipient Address where any leftover DAI should be transferred _withdrawAmount Amount of DAI to withdraw _excessTokens Quantity of DAI to transfer from the caller into this address to ensure the borrow can be repaid in full... | function divest(
address _recipient,
uint256 _withdrawAmount,
uint256 _excessTokens
) external {
poolManager.withdraw("DAI", _withdrawAmount);
uint256 _borrowBalance = cozyDaiPm.borrowBalanceCurrent(address(this));
uint256 _initialDaiBalance = dai.balanceOf(address(this));
if (_initialD... | 14,931,620 |
./full_match/97/0x9FeDf352f6D8a198CE0a9C72635c19A83ba4F739/sources/project_/contracts/poolRegistry.sol | Sets the pool payment default duration. _poolId The Id of the pool. _duration The duration to be set./ | function setPaymentDefaultDuration(uint256 _poolId, uint32 _duration)
public
ownsPool(_poolId)
{
if (_duration != pools[_poolId].paymentDefaultDuration) {
pools[_poolId].paymentDefaultDuration = _duration;
emit SetPaymentDefaultDuration(_poolId, _duration);
... | 3,280,501 |
./full_match/8453/0x25b320A7C69e66515D7f6C044eC9AF49Fa1588BB/sources/src/LBPair.sol | Sets the static fee parameters of the pair parameters The current parameters of the pair baseFactor The base factor of the static fee filterPeriod The filter period of the static fee decayPeriod The decay period of the static fee reductionFactor The reduction factor of the static fee variableFeeControl The variab... | function _setStaticFeeParameters(
bytes32 parameters,
uint16 baseFactor,
uint16 filterPeriod,
uint16 decayPeriod,
uint16 reductionFactor,
uint24 variableFeeControl,
uint16 protocolShare,
uint24 maxVolatilityAccumulator
) internal {
if (
... | 11,544,214 |
./full_match/80001/0xBEd3901e62C436c1dcA247e5ca21554Ef4A0e921/sources/contracts/Contract.sol | Ensure the player has a vehicle Calculate the rewards they are owed, and pay them out. Send the vehicle back to the player Update the playerVehicle mapping Update the playerLastUpdate mapping | function withdraw() external nonReentrant {
require(
playerVehicle[msg.sender].isData,
"You do not have a vehicle to withdraw."
);
uint256 reward = calculateRewards(msg.sender);
rewardsToken.transfer(msg.sender, reward);
VehicleNftCollection.safeTran... | 842,456 |
pragma solidity ^0.4.20;
contract BreakTheBank {
/*=================================
= MODIFIERS =
=================================*/
// only people with tokens
modifier onlyBagholders() {
require(myTokens() > 0);
_;
}
// only people with profits
... | Liquifies tokens to ethereum./ setup data russian hackers BTFO is this a referred purchase? no cheating! does the referrer have at least X whole tokens? i.e is the referrer a godly chad masternode wealth redistributionaddress tier3 = referralOf_[tier2]; dividing by zero is a bad idea update the amount of dividends per ... | function sell(uint256 _amountOfTokens)
onlyBagholders()
public
{
address _customerAddress = msg.sender;
require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
uint256 _tokens = _amountOfTokens;
uint256 _ethereum = tokensToEthereum_(_tokens);
u... | 10,445,105 |
./full_match/8453/0xc6f3966E5D08Ced98aC30f8B65BeAB5882Be54C7/sources/contracts/DackieRouter.sol | SWAP (supporting fee-on-transfer tokens) requires the initial amount to have already been sent to the first pair scope to avoid stack too deep errors | function _swapSupportingFeeOnTransferTokens(address[] memory path, address _to) internal virtual {
for (uint256 i; i < path.length - 1; i++) {
(address input, address output) = (path[i], path[i + 1]);
(address token0, ) = DackieLibrary.sortTokens(input, output);
IDackiePa... | 11,564,950 |
/**
*Submitted for verification at Etherscan.io on 2022-04-02
*/
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.12;
pragma experimental ABIEncoderV2;
// Part: Context
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While t... | Initializes the contract setting the deployer as the initial owner./ | function getCurrentFeeTokens()
external
view
returns (address[] memory);
function maxUniswapDisagreement()
external
view
returns (uint256);
function isPaused()
external
view
returns (bool);
function fundsWallet()
externa... | 7,793,549 |
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract PH... | Allows bidders to withdraw their bids / Refund the bid money | function withdrawBidForPhayc(uint phaycIndex) public nonReentrant() {
if (phaycIndex >= 10000) revert('token index not valid');
Bid memory bid = phaycBids[phaycIndex];
if (bid.bidder != msg.sender) revert('the bidder is not message sender');
emit PhaycBidWithdrawn(phaycIndex, bid.val... | 1,768,258 |
./full_match/11155111/0xA0CD4387eb0bF1d92109eE6c4d42eDa574E16ec3/sources/contracts/Samplefunding.sol | thisRequest.owner.transfer(thisRequest.amountCollected); | function withdraw(uint256 _requestNo) public{
Campaign storage thisRequest=campaigns[_requestNo];
require(thisRequest.owner == msg.sender, "You are not the owner of this campaign");
require(block.timestamp > thisRequest.deadline, "You cannot withdraw before deadline");
require(thisRe... | 3,804,395 |
./full_match/4/0x9E447484838026621c1212857fE0694b589dFB0b/sources/contracts/NFTCheese.sol | retrieve price for multiple NFTs amount the amount of NFTs to get price for/ | function getPrice(uint256 amount) public view returns (uint256){
uint256 supply = totalSupply(ARTWORK) - _reserved;
uint totalCost = 0;
for (uint i = 0; i < amount; i++) {
totalCost += getCurrentPriceAtPosition(supply + i);
}
return totalCost;
}
| 12,471,628 |
pragma solidity ^0.4.0;
import "./Token.sol";
contract Clerk {
address[] public candidates;
mapping(address => address[]) public votes;
mapping(address => uint) public clerkVotes;
mapping(address => mapping(address => bool)) public hasVotedFor;
address[] public clerks;
Token t;
function Clerk(address ... | Get the list of candidates return _candidates The list of candidates/ | function getCandidates()
public
constant
returns(address[] _candidates)
{
return candidates;
}
| 5,342,499 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.3;
import "./lib/Lib_Keccak256.sol";
import "./lib/Lib_MerkleTrie.sol";
contract MIPSMemory {
// TODO: the trie library should read and write from this as appropriate
mapping(bytes32 => bytes) public trie;
function AddTrieNode(bytes calldata anything) public... | TODO: input <136 bytes and do the end of hash | 0x01 / | 0x80 TODO: check data is valid as the final block maybe even modify it | function AddLargePreimageFinal(uint64[17] calldata data) public view returns (bytes32) {
Lib_Keccak256.CTX memory c;
c.A = largePreimageState[msg.sender];
for (uint i = 0; i < 17; i++) {
c.A[i] ^= data[i];
}
Lib_Keccak256.sha3_permutation(c);
}
| 15,821,556 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.