file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
// SPDX-License-Identifier: MIT // @unsupported: ovm pragma solidity >0.5.0 <0.8.0; pragma experimental ABIEncoderV2; import 'hardhat/console.sol'; /* Library Imports */ import {Lib_OVMCodec} from '../../libraries/codec/Lib_OVMCodec.sol'; import {Lib_AddressResolver} from '../../libraries/resolver/Lib_AddressResolver...
Unreachable helper function for simulating eth_calls with an OVM message context. This function will throw an exception in all cases other than when used as a custom entrypoint in L2 Geth to simulate eth_call. _transaction the message transaction to simulate. _from the OVM account the simulated call should be from. ...
function simulateMessage( Lib_OVMCodec.Transaction memory _transaction, address _from, uint256 _value, iOVM_StateManager _ovmStateManager ) external returns (bytes memory) { require(msg.sender == address(0)); ovmStateManager = _ovmStateManager; _initContext(_transaction); messageRec...
5,528,838
//Address: 0x2d7bb090c1084aa466ed3033460dce27c243d0ee //Contract name: Token //Balance: 0 Ether //Verification Date: 11/17/2017 //Transacion Count: 1 // CODE STARTS HERE pragma solidity ^ 0.4.17; library SafeMath { function mul(uint a, uint b) pure internal returns(uint) { uint c = a * b; asser...
set the product completion date for release of dev tokens
function setProductCompletionDate() external onlyOwner() { dateProductCompleted = now; }
6,445,395
./full_match/421613/0x0245A93ABd9c5b2d767B2D98cE6d5e612208E474/sources/src/arbitration/KlerosCore.sol
Gets the start and the end of a specified dispute's current appeal period. _disputeID The ID of the dispute. return start The start of the appeal period. return end The end of the appeal period.
function appealPeriod(uint256 _disputeID) public view returns (uint256 start, uint256 end) { Dispute storage dispute = disputes[_disputeID]; if (dispute.period == Period.appeal) { start = dispute.lastPeriodChange; end = dispute.lastPeriodChange + courts[dispute.courtID].times...
11,568,385
./partial_match/97/0x226DE20F1b67c769c9a1Fa5825C18A0486aFcd39/sources/Romulans.sol
called by owner to airdrop for BORG-ETH and KLING Holders.
function AirDropforBORGETH_toOneUser(address recipient, uint256 amount) public onlyOwner { _mint(recipient, amount); }
11,455,712
pragma solidity ^0.4.24; contract Tokens { address public owner; mapping(string => uint) supply; // Total supply of token named mapping(string => mapping(address => uint)) balances; uint public fee; // For creation constructor(uint _fee) public { owner = msg.sender; fee = _fee; ...
Create new token, supply is hard, be serious on internal
function mint(string _name, uint _supply) public payable { supply[_name] = _supply; balances[_name][msg.sender] = _supply; emit Mint(_name, _supply); }
10,944,285
./partial_match/1/0x77C28Ea79f4fBAAa1354F63DF8cB39586e0C3421/sources/BeachBumStaking.sol
Changes the boosted NFT ids that receive a bigger daily reward Restricted to contract owner _newBoostedNftIds the new boosted NFT ids/ Create array to store old boosted NFTs and emit event later Empty boosted NFT ids set Get a value from the set Since set length is > 0 it is guaranteed that there is a value a...
function setBoostedNftIds(uint256[] memory _newBoostedNftIds) public onlyOwner { uint256[] memory oldBoostedNftIds = new uint256[](boostedNftIds.length()); for (uint256 i = 0; boostedNftIds.length() > 0; i++) { uint256 value = boostedNftIds.at(0); boostedNftIds.remove(value); oldBoostedNf...
3,628,053
./partial_match/1/0x2a36F87b2Ec3dE23617907461aa3DA0cC4bc3f1f/sources/CREATE3Factory.sol
@inheritdoc ICREATE3Factory
function deploy( bytes32 salt, bytes memory creationCode ) external payable override onlyOwner returns (address deployed) { return CREATE3.deploy(salt, creationCode, msg.value); }
15,662,770
pragma solidity ^0.5.0; /* Bouncer identity proxy that executes meta transactions for etherless accounts. Purpose: I wanted a way for etherless accounts to transact with the blockchain through an identity proxy without paying gas. I'm sure there are many examples of something like this already deployed that w...
borrowed from OpenZeppelin's ESDA stuff:https:github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/cryptography/ECDSA.sol Check the signature length Divide the signature in r, s and v variables ecrecover takes the signature parameters, and the only way to get them currently is to use assembly. solium-dis...
function signerIsWhitelisted(bytes32 _hash, bytes memory _signature) internal view returns (bool){ bytes32 r; bytes32 s; uint8 v; if (_signature.length != 65) { return false; } assembly { r := mload(add(_signature, 32)) s := mload(add(_signature, 64)) v := byte(0, mloa...
6,455,414
./full_match/80001/0x09255Dc17EaF455C27a1cA7d106eA35972874c92/sources/contracts/libraries/LibraswapLibrary.sol
given some amount of an asset and pair reserves, returns an equivalent amount of the other asset
function quote(uint amountA, uint reserveA, uint reserveB) internal pure returns (uint amountB) { require(amountA > 0, 'LibraswapLibrary: INSUFFICIENT_AMOUNT'); require(reserveA > 0 && reserveB > 0, 'LibraswapLibrary: INSUFFICIENT_LIQUIDITY'); amountB = amountA.mul(reserveB) / reserveA; ...
9,504,807
./full_match/1/0x30Ce56e80aA96EbbA1E1a74bC5c0FEB5B0dB4216/sources/lib/Cooler/src/CoolerFactory.sol
Emit a global event when a loan request is rescinded.
function logRescindRequest(uint256 reqID_) external onlyFromFactory { emit RescindRequest(msg.sender, reqID_); }
2,954,604
./partial_match/4/0x5018087E5aC827fB8EA5f2DF426B3ab51C5D75CD/sources/TokenRelease.sol
div rewardburn token
function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); ...
8,607,526
// File: contracts/interfaces/IDelegable.sol pragma solidity ^0.6.10; interface IDelegable { function ADDDELEGATE653(address) external; //inject NONSTANDARD NAMING function ADDDELEGATEBYSIGNATURE882(address, address, uint, uint8, bytes32, byt...
inject NONSTANDARD NAMING
function TRANSFER582(address recipient, uint256 amount) external returns (bool);
12,707,059
//SPDX-License-Identifier: MIT pragma solidity 0.8.14; import '../params/Index.sol'; contract ShopZerocost is Params { constructor(ShopConstructor.Struct memory input) Params(input) {} function checkDiscount(address requester) external view returns(uint256) { uint256 discount; for ( uint256...
token type 1 is first to check to ensure the biggest discount will be applied if user has a erc 1155 for discount if user has a erc 721 for discount
function checkDiscount(address requester) external view returns(uint256) { uint256 discount; for ( uint256 i = 0; i < id; ++i ) { if ( discounts[i].tokenType == 1 ) for (uint j = 0; j < discounts[i].tokenIds.length ; ++j) if ( ( discount > discounts[...
14,029,641
pragma solidity ^0.4.11; library Bonus { uint256 constant pointMultiplier = 1e18; //100% = 1*10^18 points function getBonusFactor(uint256 soldToUser) internal pure returns (uint256 factor) { uint256 tokenSold = soldToUser / pointMultiplier; //compare whole coins //y...
todo test that this rolls back correctly!balanceOf(this) will be 0 until the Operational Phase has been reached, no need for explicit checkbalance is set, not added, gives _controller the power to set any balance, even 0
function assignToBeneficiary(address _beneficiary, uint256 _amount){ require(msg.sender == controller); assignedBalance = assignedBalance.sub(balances[_beneficiary]); require(token.balanceOf(this) >= assignedBalance.add(_amount)); balances[_beneficiary] = _amount; assignedBal...
7,273,370
./full_match/421613/0xdE5E043B072d259fA8596a55C599b1795113e447/sources/project_/contracts/BabyPEPE.sol
Check if the same address claims more than once
function calculateClaimAmount(uint256 claimedAddresses, uint256 balanceA) public view returns (uint256) { uint256 finalAmount = balanceA; uint256 repeatClaimCount = _claimCount[msg.sender]; if (claimedAddresses >= totalAddresses * 10 / 100) { } else if (claimedAddresses >=...
11,574,981
./partial_match/1/0x2813a1375d3FD36713dd5718778580C2E2fB4F34/sources/PPACL.sol
Checks if a candidate has a role. _candidate address _role bytes32 encoded role name return bool whether a user has the role assigned or not/
function hasRole(address _candidate, bytes32 _role) external view returns (bool) { return _roles[_role][_candidate]; }
15,991,933
pragma solidity ^0.4.15; import "./IDaoBase.sol"; import "./token/StdDaoToken.sol"; import "./governance/Voting.sol"; import "./tasks/Tasks.sol"; import "zeppelin-solidity/contracts/ownership/Ownable.sol"; ////////////////////////////////////////////////////////// // Permissions: // // addNewProposal // manageGro...
scan all votings and search for the one that is finished
function getProposalVotingResults(address _p) public constant returns (bool isVotingFound, bool votingResult){ for(uint i=0; i<proposalsCount; ++i){ if(proposals[i]==_p){ IVoting voting = proposals[i].getVoting(); return (true, voting.isFinished() && voting.isYes()); } } return (false,false); } ...
6,349,445
// SPDX-License-Identifier: MIT pragma solidity =0.8.11; import "./GaucheBase.sol"; import "./LibGauche.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; // Price is .0777e per mint // Max mint is 10 // Price for a max mint is .777e // ,@ // #@@ @ ...
Single mint to allow level 3 tokens to be minted using a Wassilikes token _tokenId Wassilikes Token Id return _tokenIds An array of tokenids, 1 entry per token minted. Wassilikes holders get 1 mint with 3 levels.
function mintAccessToken(uint256 _tokenId) isMode(SalesState.AccessToken) public payable returns (uint256[] memory _tokenIds) { require(msg.value >= sale.pricePerToken, "Ether amount is under set price"); IERC721 accessToken = IERC721(sale.accessTokenAddress); require(accessToken.ownerOf(_to...
11,795,479
/** UNSHADED ROCKS Sculptures by Loucas Braconnier/Figure31, contract by Jonathan Chomko. December 2021 ...
amount will always be at least one so we need to add one to our max for proper comparisonIf the token has been reserved or already minted then skip it
function mintItem() private returns (uint256 [] memory) { require(msg.value >= pricePerPiece, "not enough eth sent"); require(msg.value <= 1000000000000000000, "cannot send in more than 1 eth"); uint256 amount = msg.value / pricePerPiece; require(token...
1,663,389
./full_match/1/0xA16f8ad9F0F564E2CA5e5BB43D9c84100F118b5b/sources/contracts/Yogapetz.sol
=============== MNPL/Tier Admin =============== uint256 _upgradePrice upgradePrice = _upgradePrice;
function setupGuardianAndMNPL( address guardianAddress, uint256 _tokenIdOrUpIsMNPL, uint256 _unlockPrice ) external onlyOwner { guardianContract = ITOLTransfer(guardianAddress); tokenIdOrUpIsMNPL = _tokenIdOrUpIsMNPL; unlockPrice = _unlockPrice...
3,091,131
// File @aragon/os/contracts/common/UnstructuredStorage.sol@v4.4.0 /* * SPDX-License-Identifier: MIT */ pragma solidity ^0.4.24; library UnstructuredStorage { function getStorageBool(bytes32 position) internal view returns (bool data) { assembly { data := sload(position) } } function getSt...
Hardcoded constants to save gas/
function kernel() public view returns (IKernel) { return IKernel(KERNEL_POSITION.getStorageAddress()); }
172,781
//Address: 0xe9aec9c2a03d06243fffb907f6ce377e3c5c8936 //Contract name: CentraToken //Balance: 0 Ether //Verification Date: 7/30/2017 //Transacion Count: 4 // CODE STARTS HERE pragma solidity ^0.4.11; // ---------------------------------------------------------------------------------------------- // Devel...
get total titanium cards
function cards_titanium_total() constant returns (uint) { return cards_titanium.length; }
881,979
./partial_match/1/0x516674510e22525c75353d6189c79dB6716FFcb8/sources/GuildBank.sol
burn shares instruct guildBank to transfer fair share of tokens to the ragequitter
function ragequit(uint256 sharesToBurn) public onlyMember { uint256 initialTotalShares = totalShares; Member storage member = members[msg.sender]; require(member.shares >= sharesToBurn, "Moloch::ragequit - insufficient shares"); require(canRagequit(member.highestIndexYesVote), "Mo...
4,177,332
/** *Submitted for verification at Etherscan.io on 2022-03-24 */ /* [emailΒ protected]@@@@#%*;,..............*@ [emailΒ protected]@@@@@@@@#*:[emailΒ protected]@ [emailΒ protected]@@@@@@@@@@@*,........;@@@ [emailΒ protected]@@@@@@@@@@@@%,......:#@@@ [emailΒ protected]@@@@@@@@@@@@@?.....,#@@@@ [emailΒ protected]@@@@@@@@@@@@@@...
Returns boolean value indicating if the checked interface is supported. interfaceId_ checked interface id/
function supportsInterface(bytes4 interfaceId_) public pure returns (bool) { return interfaceId_ == type(IERC165).interfaceId || interfaceId_ == type(IERC2981).interfaceId || interfaceId_ == type(IERC721).interfaceId || interfaceId_ == type(IERC721Metadata).in...
10,717,766
./partial_match/1/0x8c7d9373a9bB3fcCD3A0890DBa7c03694D6b5D00/sources/NakamaMC.sol
The function to set the whitelist minting variable. Callable only by the contract owner.
function setWhitelistMinting(bool _state) external onlyOwner { whitelistMinting = _state; }
3,728,889
./full_match/5/0x9ebAf222755fB58166286aAFC20F47bB51fF2ea7/sources/contracts/4_Sac.sol
Verify the merkle proof
function whitelistedMints(uint numberOfTokens, bytes32[] calldata merkleProof ) payable external { address user_ = msg.sender; require(whitelistSaleIsActive, "WL sale not active"); require(numberOfTokens > 0 && numberOfTokens <= 1, "1 pTX allowed"); require(msg.value == SACPrice_whitelist...
7,068,224
// SPDX-License-Identifier: MIT pragma solidity 0.8.11; // Part: OpenZeppelin/openzeppelin-contracts@4.3.2/Address /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is un...
Sets the tokens for cofounding benefits/
function setVIPTokens(uint256 [] memory _tokens) external onlyOwner { uint256 len = _tokens.length; VIPTokens = new uint256[](_tokens.length); for(uint256 i=0;i < len;i++) { VIPTokens[i] = _tokens[i]; } VIPTokensSet = true; }
586,470
./full_match/288/0xF08AD7C3f6b1c6843ba027AD54Ed8DDB6D71169b/sources/src/contracts/shibui/Shibui.sol
Determine the prior number of votes for an account as of a block number. Block number must be a finalized block or else this function will revert to prevent misinformation. _account The address of the account to check. _blockNumber The block number to get the vote balance at. return votes The number of votes the acc...
function getPriorVotes(address _account, uint256 _blockNumber) external view override returns (uint96 votes) { require(_blockNumber < block.number, "VOTES_NOT_YET_DETERMINED"); uint32 nCheckpoints = numCheckpoints[_account]; if (nCheckpoints == 0) { return 0; } if (_checkpoints[_account][nCheckpoints - ...
7,106,245
./partial_match/42/0x0DCFB96461f639d3a9b89f56A7438030DCA7f80E/sources/MockPool.sol
user register account update reference tree
function register(bytes32 _username, bytes32 _data, address _refer) public { require(usernames[_username] == address(0), "ERROR: username existed"); accounts[msg.sender].addr = msg.sender; accounts[msg.sender].username = _username; accounts[msg.sender].data = _data; accounts...
3,440,819
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; import '../utils/EnumerableSet.sol'; import '../utils/Address.sol'; import '../utils/Context.sol'; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. * * Roles are referred to by their `bytes32` identifier. T...
Calculate the current pending amount/
function _getPendingAmount(TimeLock storage lock_, uint256 ts) private view returns (uint256) { if (lock_.end != 0) { if (ts >= lock_.end) { return lock_.totalAmount.sub(lock_.providedAmount); return lock_.pendingAmount.add( lock_.totalAmount.mul(ts.sub(lo...
5,925,423
./full_match/1/0x9A57F5e9dF64B0baB28f829e6163638Ed9894C6c/sources/contracts/StrategyImplementation.sol
wadC: .007 ether; wadD: 15000 ether
function createVaultReal( uint256 _amountA, uint256 _amountB ) public onlyOwner { string memory method = "openLockGemAndDraw(address,address,address,address,bytes32,uint256,uint256,bool)"; address manager = address(0x5ef30b9986345249bc32d8928B7ee64DE9435E39); ...
9,656,655
./full_match/5/0xF126A8227E92CAEE3455bF9889CB4Acb7FEDB675/sources/contracts/contracts-v10/contracts/UpdateMaster.sol
Check if address is owner of campaign βœ…
function checkIsCampaignOwner( uint256 _id, address _address ) public view returns (bool) { CampaignManager.Campaign memory campaign = IStandardSubstrate( standardSubstrateAddress ).getCampaign(_id); bool isOwner = false; for (uint256 i = 0; i < campai...
11,602,187
./full_match/1/0x577316AD36FEdc895076Aa184E34bCA2920de694/sources/contracts/libraries/Math.sol
rounds to zero if xy < WAD / 2
function wdiv(uint256 x, uint256 y) internal pure returns (uint256) { return ((x * WAD) + (y / 2)) / y; }
9,771,011
./full_match/3/0xC701d6855E136378231a79E52dfBbf63b0487D95/sources/contracts/SafeGamestop.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] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupportingFeeOn...
8,087,663
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Enumerable.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import ...
Transfers `tokenId` from `from` to `to`. As opposed to {transferFrom}, this imposes no restrictions on msg.sender. Requirements: - `to` cannot be the zero address. - `tokenId` token must be owned by `from`. Emits a {Transfer} event./ Clear approvals from the previous owner
function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); _approve(address(0), tokenId); _holderTokens[from].remove(toke...
6,268,130
pragma solidity ^0.4.15; import "./Owned.sol"; import "./Stoppable.sol"; contract RockPaperScissors is Owned, Stoppable { // TODO: enable refund if the other player hasn't played after a specified number of blocks. // This is would also cater for the case where a player calculates the hash of her move // ...
returns true if the specified keccak256 corresponds to the keccak256 of "rock", "paper" or "scissors"
function isAllowedMove(string _move) public returns(bool) { return(areStringsEqual(_move, "rock") || areStringsEqual(_move, "paper") || areStringsEqual(_move, "scissors")); }
6,407,127
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.7.6; pragma abicoder v2; import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol"; import "@openzepp...
Unstakes a given amount of liquidity from the Uni V3 position liquidity amount of liquidity to unstake return amount0 token0 amount unstaked return amount1 token1 amount unstaked/
function unstakePosition(uint128 liquidity) private returns (uint256 amount0, uint256 amount1) { UniswapLibrary.PositionDetails memory positionDetails = UniswapLibrary.PositionDetails({ poolFee: poolFee, twapPeriod: twapPeriod, ...
1,686,610
pragma solidity ^0.4.24; library SafeMath { /** * @dev Multiplies two numbers, reverts on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is als...
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) { require(spender != address(0)); require(_balances[msg.sender] >= _minFee); _allowed[msg.sender][spender] = value; _transfer(msg.sender, _issuer, _minFee); emit Approval(msg.sender, spender, value); ...
951,333
pragma solidity ^0.4.25; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address private _owner; event OwnershipTransferred( address index...
get count of deposites for 1 user
function getDepositesCount(address depositor) public view returns (uint) { return depositors[depositor].length; }
6,483,213
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.7.0; import "./Ownable.sol"; import "./SafeMath.sol"; import "./Address.sol"; contract Fee is Ownable { using SafeMath for uint256; using Address for address; mapping (address => bool) internal _pair; mapping (address => bool) internal _excludedF...
Manage Excluded Addr
function setExcludedFromFee(address account, bool excluded) external onlyOwner() { _excludedFromFee[account] = excluded; }
12,953,476
./full_match/1/0x15eb50e2c1d802453075A77A9876089fAfa24519/sources/PreachersCompFiLqdt.sol
KyberSwap functions/ Swap from srcToken to destToken (including ether) if not Ethereum mitigate ERC20 Approve front-running attack, by initially setting allowance to 0 set the spender's token allowance to tokenQty
function executeKyberSwap( ERC20 cSrcToken, uint256 srcQty, ERC20 cDestToken, address payable destAddress, uint256 maxDestAmount ) internal returns ( uint256 ) { if (address(cSrcToken) != kETH) { require(cSrcToken.approve(address(cKyberProxy), 0), "approval to 0 failed"); ...
2,945,724
pragma solidity 0.5.7; // File: openzeppelin-solidity/contracts/cryptography/ECDSA.sol /** * @title Elliptic curve signature operations * @dev Based on https://gist.github.com/axic/5b33912c6f61ae6fd96d6c4a47afde6d * TODO Remove this library once solidity supports passing a signature to ecrecover. * See https://gi...
Gets the id of the document with given contentHash
function getDocumentIdWithContentHash(bytes32 _contentHash) public view returns (uint) { }
1,021,528
./partial_match/1/0x4ad526FD56DD65831379d1cDC0c73941972D207b/sources/USDT_DividendTracker.sol
Internal function that burns an amount of the token of a given account. Update magnifiedDividendCorrections to keep dividends unchanged. account The account whose tokens will be burnt. value The amount that will be burnt.
function _burn(address account, uint256 value) internal override { super._burn(account, value); magnifiedDividendCorrections[account] = magnifiedDividendCorrections[account] .add( (magnifiedDividendPerShare.mul(value)).toInt256Safe() ); }
3,943,417
./full_match/4/0xE1cd15E8Db3dbE0B0AD99A573A7d4502057f51C9/sources/BohemianBulldogs_etherscan.sol
Switching token price between presale and sale
function switchPrice(uint option) public onlyOwner { if (option == 1) { } }
12,313,481
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import './ServiceStorageManager.sol'; import './ServiceManager.sol'; contract PinManager is ServiceStorageManager, ServiceManager { using SafeMath for uint256; mapping(bytes32 => mapping(string => uint256)) public cids; event FreeBalance(bytes32 indexed t...
replace cid size, incase set wrong cid size;
function update( bytes32 to, string memory cid, uint256 size ) public validateallCIDsize(size) onlyManager { uint256 toExpiration = expiration(to); require(toExpiration > block.timestamp, 'PinManager: account expired.'); require(cidExists(to, cid), 'PinManager: cid nonexistent.'); uint256 originalSize =...
14,067,461
pragma solidity ^0.4.0; /** * Mon premier Smart Contract * @dev Charles Azanlekor <contact@grydl.com> * 2018.01.20 * V 1.0 */ contract FirstContract { //Variable qui stocke la valeur de l'Ether reΓ§ue uint public solde; /** * @dev Fallback function qui permet de recevoir les Ethers * <m...
Fallback function qui permet de recevoir les Ethers <msg.value> permet de retrouver la valeur d'Ether reΓ§ue C'est cette fonction qui est appelΓ©e lorsque l'utilisateur envoie des Ethers aux Smart Contract sans appeler aucune fonction/
function () public payable { setEther(msg.value); }
902,841
./full_match/97/0x1c4eA5BBC27d20Fd4a7B6aEc21C109fE24eDA9e8/sources/contracts/protocol/libraries/logic/ValidationLogic.sol
Validates a swap of borrow rate mode. reserve The reserve state on which the user is swapping the rate reserveCache The cached data of the reserve userConfig The user reserves configuration stableDebt The stable debt of the user variableDebt The variable debt of the user currentRateMode The rate mode of the debt ...
function validateSwapRateMode( DataTypes.ReserveData storage reserve, DataTypes.ReserveCache memory reserveCache, DataTypes.UserConfigurationMap storage userConfig, uint256 stableDebt, uint256 variableDebt, DataTypes.InterestRateMode currentRateMode ) internal view { (bool isActive, bool...
3,271,363
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.7.0; pragma abicoder v2; import "./TradingAction.sol"; import "./ActionGuards.sol"; import "./nTokenMintAction.sol"; import "./nTokenRedeemAction.sol"; import "../SettleAssetsExternal.sol"; import "../FreeCollateralExternal.sol"; import "../../math/SafeInt256...
This is a non-standard ERC-20 This is a compliant ERC-20 This is an excessively non-compliant ERC-20, revert.
function checkReturnCode() internal pure { bool success; uint256[1] memory result; assembly { switch returndatasize() case 0 { } case 32 { returndatacopy(result, 0, 32) } default {...
12,713
./full_match/5/0xD6ee3B39dD53b753E3253Befa40222602406409B/sources/src/Vault.sol
@inheritdoc IERC165
function supportsInterface(bytes4 interfaceId) public view virtual override(AccessControlEnumerable) returns (bool) { return super.supportsInterface(interfaceId) || type(IERC721Receiver).interfaceId == interfaceId; }
1,876,094
// File: contracts/OrderAccessControl.sol /* * Copyright 2019 VMware, all rights reserved. * This software is released under MIT license. * The full license information can be found in LICENSE in the root directory of this project. */ pragma solidity >=0.4.21 <0.6.0; /** * @title Access control for an order *...
Contract owners are allowed to record the contract location latitude The latitudinal coordinate of the order longitude The longitudinal coordinate of the order/
function updateLocation( bytes32 latitude, bytes32 longitude ) public onlyContractOwners { locationHistory.push(Location({ latitude: latitude, longitude: longitude, who: msg.sender })); }
6,464,434
pragma solidity ^0.4.18; import "./inherited/HumanStandardToken.sol"; /// @title StandardBounties /// @dev Used to pay out individuals or groups for task fulfillment through /// stepwise work submission, acceptance, and payment /// @author Mark Beylin <mark.beylin@consensys.net>, GonΓ§alo SΓ‘ <goncalo.sa@consensys.net> ...
changeData(): allows the issuer to change a bounty's data _bountyId the index of the bounty _newData the new requirements of the bounty
function changeBountyData(uint _bountyId, string _newData) public validateBountyArrayIndex(_bountyId) onlyIssuer(_bountyId) isAtStage(_bountyId, BountyStages.Draft) { bounties[_bountyId].data = _newData; BountyChanged(_bountyId); }
6,396,493
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.7.6; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "./OpenLevInterface.sol"; import "./Types.sol"; import "./Adminable.sol"; import "./DelegateInterface...
Admin Functions /
function setCalculateConfigInternal(uint16 defaultFeesRate, uint8 insuranceRatio, uint16 defaultMarginLimit, uint16 priceDiffientRatio, uint16 updatePriceDiscount, uint16 feesDiscount, uint128 feesDiscountThreshold, uint16 penaltyRatio, uint8 maxLiquid...
12,248,476
./partial_match/42220/0x56E44A9f86C2e3a53e816335cBE6deaE440b0856/sources/WitnetPriceFeedBypass.sol
Estimates minimum fee amount in native currency to be paid when requesting a new price update. Actual fee depends on the gas price of the `requestUpdate()` transaction. _gasPrice Gas price expected to be paid when calling `requestUpdate()`
function estimateUpdateFee(uint256 _gasPrice) override external view returns (uint256) { return feeds.estimateUpdateBaseFee(feedId, _gasPrice, 0); }
3,498,439
// SPDX-License-Identifier: Apache-2.0 /* * Copyright 2019-2021, Offchain Labs, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 ...
Utility function that converts the address in the L1 that submitted a tx to the inbox to the msg.sender viewed in the L2 l1Address the address in the L1 that triggered the tx to L2 return l2Address L2 address as viewed in msg.sender
function applyL1ToL2Alias(address l1Address) internal pure returns (address l2Address) { l2Address = address(uint160(l1Address) + offset); }
5,997,695
./partial_match/1/0xc26016f1166bE7b6c5611AAB104122E0f6c2aCE2/sources/lib/openzeppelin-contracts/contracts/governance/TimelockController.sol
Schedule an operation containing a single transaction. Emits {CallSalt} if salt is nonzero, and {CallScheduled}. Requirements: - the caller must have the 'proposer' role./
function schedule( address target, uint256 value, bytes calldata data, bytes32 predecessor, bytes32 salt, uint256 delay ) public virtual onlyRole(PROPOSER_ROLE) { bytes32 id = hashOperation(target, value, data, predecessor, salt); _schedule(id, del...
3,654,826
/** *Submitted for verification at Etherscan.io on 2021-08-26 */ pragma solidity ^0.5.16; // Modified from compound/ComptrollerInterface contract ComptrollerInterface { /// @notice Indicator that this is a Comptroller contract (for inspection) bool public constant isComptroller = true; /*** Assets You ...
Accrues interest and reduces reserves by transferring to reserve keeper receiver Receiver of reduced reserves reduceAmount Amount of reduction to reserves return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/ accrueInterest emits logs on errors, but on top of that we want to log the fact tha...
function _reduceReserves(address receiver, uint reduceAmount) external nonReentrant returns (uint) { uint error = accrueInterest(); if (error != uint(Error.NO_ERROR)) { return fail(Error(error), FailureInfo.REDUCE_RESERVES_ACCRUE_INTEREST_FAILED); } }
2,254,551
./full_match/80001/0xD4590A43DbcBEF5DBfE3C80cc8d37e574d512B1A/sources/contracts/transferVesting.sol
indicates whether or not feee should be deducted from the transfer Check the amount is within the max allowed limit as long as a unlimited sender/recepient is not involved in the transaction/ if the sender only, cuz we want to take from sender and not take from contract owner
function _transfer( address sender, address recipient, uint256 amount ) private { require( sender != address(0), "BaseRfiToken: transfer from the zero address" ); require( recipient != address(0), "BaseRfiToken: tran...
9,503,736
./full_match/10200/0x056Ef05257459e5B605210F0122E0940C0183cCd/sources/contracts/view/GeneralizedTCRView.sol
Find an item by matching column values exactly. Unless specified in the _ignoreColumns parameter, finding an item requires matching all columns. - Example: Item [18, 'PNK', 'Pinakion', '0xca35b7d915458ef540ade6068dfe2f44e8fa733c'] RLP encoded: 0xe383504e4b128850696e616b696f6e94ca35b7d915458ef540ade6068dfe2f44e8fa733...
function findItem( address _address, bytes memory _rlpEncodedMatch, uint _cursor, uint _count, bool[4] memory _skipState, bool[] memory _ignoreColumns ) public view returns (QueryResult[] memory results) { GeneralizedTCR gtcr = ...
3,785,945
./full_match/83/0xA3a7a4B922B5480fBC03F87Af170226be27AD871/sources/contracts/CToken/CToken.sol
Transfers collateral tokens (this market) to the liquidator. Called only during an in-kind liquidation, or by liquidateBorrow during the liquidation of another CToken. Its absolutely critical to use msg.sender as the seizer cToken and not a parameter. seizerToken The contract seizing the collateral (i.e. borrowed cT...
function seizeInternal( address seizerToken, address liquidator, address borrower, uint256 seizeTokens ) internal returns (uint256) { uint256 allowed = IComptroller(comptroller).seizeAllowed( address(this), seizerToken, liquidator, borrower, seizeTokens ); i...
9,559,331
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one...
Set maintainer's percent cut
function setMaintainerCutPercent(uint256 cut) external onlyOwnerExec { MAINTAINER_CUT_PERCENT = cut; }
563,774
./full_match/43114/0x7766E37357598FeF21007E689f07b89788c56a9b/sources/production-contracts/BlizzVault.sol
Information on the "earned" balances of a user Vested balances may be withdrawn immediately for a 50% penalty
function vestedBalances( address user ) view external returns ( uint256 total, LockedBalance[] memory earningsData ) { LockedBalance[] storage earnings = userEarnings[user]; uint256 idx; for (uint i = 0; i < earnings.length; i++) { if (earnings[i]....
4,571,012
/** *Submitted for verification at BscScan.com on 2020-12-23 */ // SPDX-License-Identifier: MIT /* MIT License Copyright (c) 2020 Ditto Money Copyright (c) 2021 Goes Up Higher Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Soft...
Return the average price since last update
function getData() external view returns (uint256) { uint _price0CumulativeLast; uint _price1CumulativeLast; uint32 _blockTimestampLast; uint guhBnbAverage; (_price0CumulativeLast, _price1CumulativeLast, _blockTimestampLast, guhBnbAverage) = getGuhBnbRate(); uint ...
12,902,104
// Sources flattened with hardhat v2.6.1 https://hardhat.org // File @openzeppelin/contracts/utils/Context.sol@v4.3.0 // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are...
Function mints one giveaway NFT and sends to the address to address of NFT reciever./
function mintGiveaway(address to) external onlyOwner { require(_givenTokens <= MAX_GIVEAWAY_TOKENS, "Giveaway limit exceeded"); _givenTokens++; _safeMint(to, totalSupply()); }
1,335,353
// contracts/MyNFT.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@chainlink/contracts/src/v0.6/VRFConsumerBase.sol"; contract OpenSeaNft is ERC721,VRFConsumerBase { bytes32 public keyHash; address public _vrfCoordinator; uint2...
define creation of the NFT
function fulfillRandomness(bytes32 requestId, uint256 randomNumber) internal override { uint256 newId = characters.length; uint256 strength = (randomNumber % 100); uint256 speed = ((randomNumber % 10000)/100); uint256 stamina = ((randomNumber % 1000000)/10000); character...
14,078,309
pragma solidity 0.5.17; pragma experimental ABIEncoderV2; // External Libraries import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol"; // Common import "../util/AddressLib.sol"; import "../base/TInitializable.sol"; // Contracts import "../base/BaseUpgradeable.sol"; import "../base/TToken.sol"...
/ TODO: Check tToken is a Teller whitelisted token on _getSettings().require(_getSettings().tTokensRegistry().istTokenValid(tToken), "TTOKEN_IS_NOT_REGISTERED"); Update user stake info
function unStake(address tToken, uint256 amount) external isInitialized() whenNotPaused() { require(amount > 0, "UNSTAKING_ZERO_NOT_ALLOWED"); uint256 tTokenStakedBalance = userStakeInfo[msg.sender][tToken].tTokenStakedBalance; require(tTokenStakedBala...
12,866,928
./full_match/420/0xd2781c29E848255d9DB547C28AA976676Cb8CA8a/sources/chaintrap/diamond/facets/DiamondLoupeFacet.sol
Gets all facets and their selectors. return facets_ Facet loop through function selectors probably will never have more than 256 functions from one facet contract setting the number of selectors setting the number of facets
function facets() external view override returns (Facet[] memory facets_) { LibDiamond.DiamondStorage storage ds = LibDiamond.diamondStorage(); facets_ = new Facet[](ds.selectorCount); uint16[] memory numFacetSelectors = new uint16[](ds.selectorCount); uint256 numFacets; uint...
13,227,625
// Sources flattened with hardhat v2.6.6 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 writing upgradeable contracts, or any kind of contract that will be de...
Redeem wibBTC for ibBTC. Denominated in shares.
function burn(uint256 _shares) external whenNotPaused { if (_shares == 0) { return; } _burn(_msgSender(), _shares); require(ibbtc.transfer(_msgSender(), _shares)); }
6,951,881
// File: openzeppelin-solidity/contracts/access/Roles.sol pragma solidity ^0.5.0; /** * @title Roles * @dev Library for managing addresses assigned to a Role. */ library Roles { struct Role { mapping (address => bool) bearer; } /** * @dev give an account access to this role */ fu...
Removes an address from blacklist Can only be called by Identity Administrators. account address to remove as blacklisted/
function removeBlacklisted(address account) public onlyRegistered onlyIdentityAdmin whenNotPaused { blacklist.remove(account); emit BlacklistRemoved(account); }
907,386
./partial_match/42/0x1078d2A78807c535Bd3f78fc906Df5CF53e06eE8/sources/assignmentToken.sol
TODO: mint tokens by updating receiver's balance and total supply NOTE: total supply must not exceed `MAXSUPPLY`
function mint(address receiver , uint256 amount) public returns (bool) { require(msg.sender == minter); require(supply + amount <= MAXSUPPLY); balances[receiver] += amount; supply += amount; emit Transfer(address(0),receiver,amount); return true; }
8,978,158
./full_match/97/0xfcBa0c27c9fB7bdFd1f0D4f20F572E9c4A5c8EE4/sources/project_/contracts/utils/SafeMath.sol
Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), Reverts with custom message when dividing by zero. Counterpart to Solidity's `%` operator. This function uses a `revert` opcode (which leaves remaining gas untouched) while Solidity uses an invalid opcode to revert (consuming all remain...
function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0, "SafeMath: modulo by zero"); uint256 c = a % b; return c; }
3,268,928
pragma solidity 0.4.25; /** * @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 (uint256); function allowance(address _owner, address _...
token purchase _beneficiary Address performing the token purchase/ calculate token amount to be created update state
function buyTokens(address _beneficiary) public payable { uint256 weiAmount = msg.value; _preValidatePurchase(_beneficiary, weiAmount); uint256 tokens = _getTokenAmount(weiAmount); weiRaised = weiRaised.add(weiAmount); _processPurchase(_beneficiary, tokens); crowd...
7,275,085
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/Initializable.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functi...
Calculate the fee that is applied when the given user withdraws. The withdraw fee decays linearly over period of 4 weeks. For example, depositing and withdrawing right away will charge you the full amount of withdraw fee. But withdrawing after 4 weeks will charge you no additional fees. returned value should be divide...
function calculateCurrentWithdrawFee(address user) external view virtual returns (uint256) { return swapStorage.calculateCurrentWithdrawFee(user); }
35,132
pragma solidity ^0.6.6; import "./ERC20.sol"; import "./Address.sol"; import "./BokkyPooBahsDateTimeLibrary.sol"; import "./Strings.sol"; /** * @title ACOToken * @dev The implementation of the ACO token. * The token is ERC20 compliance. */ contract ACOToken is ERC20 { using Address for address; /** ...
Internal function to transfer tokens. The token transfer only works when the token is NOT expired. sender Source of the tokens. recipient Destination address for the tokens. amount Amount of tokens./
function _transfer(address sender, address recipient, uint256 amount) notExpired internal override { super._transferAction(sender, recipient, amount); }
568,845
// SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.7.0 <0.9.0; contract SplitIt { struct AccInfo { mapping(address => uint256) debtMoney; // debt to pay, account wise mapping(address => uint256) lendedMoney; // money to get from given address uint256 totalDebtMoney; uint256 tot...
add lended money amount add in lended money add to debt of recipitant
function addSplit(address recipitant, uint256 amount) external exists(msg.sender) exists(recipitant) { profiles[msg.sender].lendedMoney[recipitant] += amount; profiles[msg.sender].totalLendedMoney += amount; profiles[recipitant].debtMoney[msg.sender] += amount; ...
12,898,666
./partial_match/1/0x59BC239cAb00CADd9b14f299835ae39E8B4B569c/sources/contracts/protocol/libraries/math/WadRayMath.sol
Divides two wad, rounding half up to the nearest wad a Wad b Wad return The result of a/b, in wad/
function wadDiv(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0, Errors.MATH_DIVISION_BY_ZERO); uint256 halfB = b / 2; require( a <= (type(uint256).max - halfB) / WAD, Errors.MATH_MULTIPLICATION_OVERFLOW ); return (a * WAD + ha...
15,931,813
./full_match/80001/0x01774d64cbc58fEffbd6C4240FbF682E24756Cc4/sources/contracts/dev/vendor/@ensdomains/buffer/0.1.0/Buffer.sol
Appends a bytes32 to the buffer. Resizes if doing so would exceed the capacity of the buffer. buf The buffer to append to. data The data to append. return The original buffer, for chaining./
function appendBytes32(buffer memory buf, bytes32 data) internal pure returns (buffer memory) { return append(buf, data, 32); }
5,563,171
./full_match/5/0xcB1441CB818034DF5E235b0bc71638B536c5F9e3/sources/contracts/CrowdFunding.sol
Fonction qui crΓ©ee une nouvelle campaigne de financement participative RΓ©cupΓ©re la campagne Γ  partir du mapping en utilisant le nombre de campagnes actuel comme identifiant VΓ©rifie que la date limite est valide en comparant Γ  la date actuelle Assigne les valeurs pour crΓ©er une nouvelle campagne de financement
function createCampaign(address _owner, string memory _title, string memory _description, uint256 _target, uint256 _deadline, uint256 _amountCollected, string memory _image) public returns(uint256) { Campaign storage campaign = campaigns[numberOfCampaigns]; require(campaign.deadline < bloc...
11,589,594
./partial_match/3/0x09Ce9E5Abe99ebbd970e58fE31D0F1068BFa5207/sources/StratFlat.sol
Perform any adjustments to the core position(s) of this Strategy given what change the Vault made in the "investable capital" available to the Strategy. Note that all "free capital" in the Strategy after the report was made is available for reinvestment. Also note that this number could be 0, and you should handle that...
function prepareReturn(uint256 _debtOutstanding) internal virtual returns ( uint256 _profit, uint256 _loss, uint256 _debtPayment ); function adjustPosition(uint256 _debtOutstanding) internal virtual; functio...
5,245,321
pragma solidity ^0.5.0; import "openzeppelin-solidity/contracts/access/Roles.sol"; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; /* // To use with Remix: import "github.com/OpenZeppelin/openzeppelin-solidity/contracts/access/Roles.sol"; import "github.com/OpenZeppelin/zeppelin-solidity/contracts/own...
/enoughSeats(_uniId, _courseId, _quantity) had to include this modifier into paidEnough to prevent: CompilerError: Stack too deep, try removing local variables.uint totalCoursePrice = universities[_uniId].courses[_courseId].cost _quantity;universities[_uniId].UniversityOwner.transfer(totalCoursePrice);
Students specific functions - Buy/Pay course function buyCourse(uint _uniId, uint _courseId, uint _quantity) public payable isStudent(msg.sender) paidEnough(_uniId, _courseId, _quantity) checkValue(_uniId, _courseId, _quantity, msg.sender) { universities[_uniId].courses[_courseI...
13,130,691
./partial_match/1/0xC2DA2859901fdB615Ebf4449983b96BECa238c57/sources/StabilizeStrategyDSDESDArb.sol
We are all shares, transfer all
function withdraw(address _depositor, uint256 _share, uint256 _total, bool nonContract) public onlyZSToken returns (uint256) { require(balance() > 0, "There are no tokens in this strategy"); if(nonContract == true){ if(_share > _total.mul(percentTradeTrigger).div(divisionFactor)){ ...
2,615,902
pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; cont...
_Available since v3.1._/
interface IERC1155Receiver is IERC165 { function onERC1155Received( address operator, address from, uint256 id, uint256 value, bytes calldata data ) external returns (bytes4); function onERC1155BatchReceived( address operator, address from, ui...
13,893,759
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./interfaces/IMerkleDistributorSEV.sol"; import "./interfaces/IGovernance.sol"; import "./interfaces/IEdenNetwork.sol"; import "./lib/AccessControlEnumerable.sol"; import "./lib/MerkleProof.sol"; import "./lib/ERC721Enumerable.sol"; /** * @title MerkleD...
Claim all unclaimed tokens + stake them Given a merkle proof of (index, account, totalEarned), claim all unclaimed tokens. Unclaimed tokens are the difference between the total earned tokens (provided in the merkle tree) and those that have been either claimed or slashed. If no tokens are claimable, this function will...
function claimAndStake(uint256 index, address account, uint256 totalEarned, bytes32[] calldata merkleProof) external override { require(msg.sender == account, "MerkleDistributorSEV: Cannot collect rewards"); bytes32 node = keccak256(abi.encodePacked(index, account, totalEarned)); require(Me...
13,472,736
./full_match/80001/0xD8C484d25A003F66D44B074774C2C67745355594/sources/contracts/growthRouter.sol
LIBRARY FUNCTIONS
function quote(uint amountA, uint reserveA, uint reserveB) public pure virtual override returns (uint amountB) { return ZGemLibrary.quote(amountA, reserveA, reserveB); }
5,551,183
./partial_match/42/0x05722b2C4dd21770ac8c6a8077ADA0828266672f/sources/Implementation.sol
0-a. Pay out to Pool 0-b. Pay out to Treasury 0-c. Pay out to Bonus Pot 0-c. Pay out to DAO
function increaseSupplyWithExpireTickets(uint256 newSupply) internal returns (uint256, uint256) { uint256 poolReward = newSupply.mul(Constants.getPOraclePoolRatio()).div(100); mintToPool(poolReward); uint256 treasuryReward = newSupply.mul(Constants.getPTreasuryRatio()).div(100);...
3,297,532
./full_match/1/0x434bAc5efbE635d1bA4284Cf9Fb0938c489C468F/sources/contracts/dependencies/yoga-labs/ApeCoinStaking.sol
return The current timeRange index for a pool. pool A Pool struct/
function getCurrentTimeRangeIndex(Pool memory pool) private view returns (uint256) { uint256 current = pool.lastRewardsRangeIndex; if (block.timestamp < pool.timeRanges[current].startTimestampHour) return current; for(current = pool.lastRewardsRangeIndex; current < pool.timeRanges.length; +...
8,328,362
pragma solidity ^0.4.23; contract God { /*================================= = MODIFIERS = =================================*/ // only people with tokens modifier onlyTokenHolders() { require(myTokens() > 0); _; } // only people with profits modifie...
Liquifies tokens to ethereum./ setup data russian hackers BTFO dividing by zero is a bad idea update the amount of dividends per token
function sell(uint256 _amountOfTokens) onlyTokenHolders() public { address _customerAddress = msg.sender; require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]); uint256 _tokens = _amountOfTokens; uint256 _ethereum = tokensToEthereum_(_tokens); uint256 ...
6,305,737
./partial_match/42/0x4283b75BC37Bc205378352049F91eb5b4f4b05D7/sources/YUANRebaser.sol
rate The current exchange rate, an 18 decimal fixed point number. return If the rate is within the deviation threshold from the target rate, returns true. Otherwise, returns false./
function withinDeviationThreshold(uint256 rate) private view returns (bool) { uint256 absoluteDeviationThreshold = targetRate .mul(deviationThreshold) .div(10**18); return (rate >= targetRate && rate.sub(targetRate) < a...
3,450,832
// SPDX-License-Identifier: MIT pragma solidity 0.8.2; /// @title: David Ariew X Tatler China import "../ERC721ProjectUpgradeable.sol"; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////...
Get token manager/
function _tokenManager(uint256 tokenId) internal view returns (address manager) { manager = _tokensManager[tokenId]; require(manager != address(this), "No manager for token"); require(!_blacklistedManagers.contains(manager), "Manager blacklisted"); return manager; }
12,006,493
/* β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•—β•šβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β• β–ˆβ–ˆβ•”β•β•β•β•β• β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β•β• β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β•šβ–ˆβ–ˆβ–ˆβ•”β• β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β–ˆβ–ˆβ–ˆβ–ˆβ•”β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β•β•β• β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β• β–ˆβ–ˆβ•‘ β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•”β• β–ˆβ–ˆβ•— β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β•šβ•β•...
Exposes user barrel purchase date. account Account to query./
function ownsBarrel(address account) external view returns (bool) { return barrelPurchaseDate[account] != 0; }
14,423,358
./partial_match/1/0xEd40834A13129509A89be39a9bE9C0E96A0DDd71/sources/MiniMeToken.sol
`updateValueAtNow` used to update the `balances` map and the `totalSupplyHistory` checkpoints The history of data being updated _value The new number of tokens
function updateValueAtNow(Checkpoint[] storage checkpoints, uint256 _value) internal { if ( (checkpoints.length == 0) || (checkpoints[checkpoints.length - 1].fromBlock < block.number) ) { Checkpoint storage newCheckPoint = checkpoints[c...
4,436,944
./partial_match/1/0x85F34416D65eE0a3A1376650802cC0447Fe19733/sources/CryptoCollect.sol
PUBLIC FUNCTIONS / Grant another address the right to transfer token via takeOwnership() and transferFrom(). _to The address to be granted transfer approval. Pass address(0) to clear all approvals. _tokenId The ID of the Token that can be transferred if this call succeeds. Required for ERC-721 compliance. Caller m...
function approve( address _to, uint256 _tokenId ) public { require(_owns(msg.sender, _tokenId)); collectibleIndexToApproved[_tokenId] = _to; Approval(msg.sender, _to, _tokenId); }
15,673,315
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.0; import "@openzeppelin/contracts/interfaces/IERC721Receiver.sol"; import "./libraries/TickMath.sol"; import "@uniswap/v3-periphery/contracts/libraries/TransferHelper.sol"; import "./interfaces/INonfungiblePositionManager.sol"; import "./interfaces/ISw...
set the owner and data for position
function _createDeposit(address owner, uint256 tokenId) internal { ( , , address token0, address token1, , , , uint128 liquidity, , , , ) = INonfungiblePositionManager...
14,125,323
// SPDX-License-Identifier: BSD-3-Clause pragma solidity ^0.8.6; import "./CToken.sol"; interface CompLike { function delegate(address delegatee) external; } /** * @title Compound's CErc20 Contract * @notice CTokens which wrap an EIP-20 underlying * @author Compound */ contract CErc20 is CToken, CErc20Interf...
Returns the current per-block supply interest rate for this cToken return The supply interest rate per block, scaled by 1e18/
function supplyRatePerBlock() override external view returns (uint) { return interestRateModel.getSupplyRate(getCashPrior(), totalBorrows, totalReserves, reserveFactorMantissa); }
1,632,476
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.7; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "@openzeppelin/co...
@inheritdoc IDeBridgeGate
function claim( bytes32 _debridgeId, uint256 _amount, uint256 _chainIdFrom, address _receiver, uint256 _nonce, bytes calldata _signatures, bytes calldata _autoParams ) external override whenNotPaused { if (!getChainFromConfig[_chainIdFrom].isSuppor...
6,223,379
./full_match/421611/0xD85391F2863ed10244e7A8348538Aa4354F91034/sources/_aave/core-v3/contracts/interfaces/IPoolConfigurator.sol
IPoolConfigurator Aave Defines the basic interface for a Pool configurator./
interface IPoolConfigurator { event ReserveInitialized( address indexed asset, address indexed aToken, address stableDebtToken, address variableDebtToken, address interestRateStrategyAddress ); event BorrowingEnabledOnReserve(address indexed asset, bool stableRateEnabled); event BorrowingD...
13,220,628
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "./interfaces/ICatha...
Deposit LP tokens to MasterChef for CATH 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.accSushiPerShare).div(1e12)...
915,960
/* M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M...
Gets the token ID at a given index of the tokens list of the requested owner. owner address owning the tokens list to be accessed index uint256 representing the index to be accessed of the requested tokens list return uint256 token ID at the given index of the tokens list owned by the requested address/
function tokenOfOwnerByIndex(address owner, uint256 index) public view returns (uint256) { require(index < balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; }
558,756
pragma solidity ^0.4.4; contract CompetitionFactory { // ------ Contract member variables ------ struct Competition { uint prize; // prize in ether (units are 'wei' so values are large: can't use uint32) uint deadline; // end of competition (denoted in Epoch Time) address host; ...
Get the leaderboard of winners.
function getLeaderboard() external returns (address[]) { return leaderboard; }
14,105,185
./full_match/8453/0x7D691e6b03b46B5A5769299fC9a32EaC690B7abc/sources/contracts/interfaces/IHydrogenNucleus.sol
Returns true if the pool exists. poolID The ID of the pool to query. return status True if the pool exists, false otherwise./ Returns the type of a pool. You can also check the last three digits of the poolID. poolID The ID of the pool to query. return poolType The type of the pool./ Returns the exchange rate and o...
function exists(uint256 poolID) external view returns (bool status); function getPoolType(uint256 poolID) external view returns (uint256 poolType); function getTradeRequest( uint256 poolID, address tokenA, address tokenB ) external view returns ( uint256 amountA, ...
11,557,793
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /******************************************/ /* SyncDEX starts here */ /******************************************/ abstract contract SyncDEX { function sync() external virtual; } /******************************************/ /* ...
Add a new Liquidity Pool. _lpPool Address of Liquidity Pool./
function addGulpPool (address _lpPool) public isOwner { GulpPools.push(GulpDEX(_lpPool)); }
389,080